2
* Copyright (C) 2008 Canonical Ltd
4
* This program is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU General Public
6
* License as published by the Free Software Foundation; either
7
* version 2 of the License, or (at your option) any later version.
9
* This library is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
* Lesser General Public License for more details.
14
* You should have received a copy of the GNU General Public
15
* License along with this library; if not, write to the
16
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17
* Boston, MA 02111-1307, USA.
19
* Authored by Neil Jagdish Patel <neil.patel@canonical.com>
33
#include <clutter/clutter.h>
34
#include <clutter/clutter-x11.h>
36
#include "launcher-app.h"
37
#include "launcher-defines.h"
40
static void set_window_hints (ClutterStage *stage);
42
static gboolean windowed = FALSE;
44
static GOptionEntry entries[] =
51
"Launch in windowed mode (for testing, 800x640)",
60
main (gint argc, gchar *argv[])
63
ClutterColor black = { 0x00, 0x00, 0x00, 0xff };
68
g_set_application_name ("Belmont Launcher");
70
gtk_init (&argc, &argv);
71
clutter_init_with_args (&argc, &argv,
72
" - Belmont Launcher", entries,
77
g_print ("Unable to run Desktop Launcher: %s", error->message);
82
stage = clutter_stage_get_default ();
83
clutter_actor_set_size (stage, 1024, 600);
87
clutter_stage_fullscreen (CLUTTER_STAGE (stage));
88
set_window_hints (CLUTTER_STAGE (stage));
90
clutter_stage_set_color (CLUTTER_STAGE (stage), &black);
92
/* Init() the main application */
93
app = launcher_app_get_default ();
95
clutter_actor_show (stage);
105
* Set a fake hint to the WM telling it there is a 'panel' beneath the
106
* gnome-panel, so it won't set maximised windows to the full height, this
107
* lets us draw the 'window-decorations' in clutter.
108
* Functions taken from xutils.c (part of gnome-panel)
115
STRUT_LEFT_START = 4,
117
STRUT_RIGHT_START = 6,
121
STRUT_BOTTOM_START = 10,
122
STRUT_BOTTOM_END = 11
126
set_panel_strut (Display *display,
132
gulong struts[12] = {0, };
133
static Atom net_wm_strut = 0;
134
static Atom net_wm_strut_partial = 0;
136
if (net_wm_strut == 0)
137
net_wm_strut = XInternAtom (display, "_NET_WM_STRUT", False);
138
if (net_wm_strut_partial == 0)
139
net_wm_strut_partial = XInternAtom (display, "_NET_WM_STRUT_PARTIAL",
142
struts [STRUT_TOP] = offset;
143
struts [STRUT_TOP_START] = x_start;
144
struts [STRUT_TOP_END] = x_end;
146
gdk_error_trap_push ();
147
XChangeProperty (display, window, net_wm_strut,
148
XA_CARDINAL, 32, PropModeReplace,
149
(guchar *) &struts, 4);
150
XChangeProperty (display, window, net_wm_strut_partial,
151
XA_CARDINAL, 32, PropModeReplace,
152
(guchar *) &struts, 12);
153
gdk_error_trap_pop ();
158
* Apply the 'desktop' window type to the clutter-stage window. Also, set the
159
* 'panel' hints, to stop the windows from maximising the entire way.
162
set_window_hints (ClutterStage *stage)
164
/*GdkScreen *screen = gdk_screen_get_default ();*/
165
GdkDisplay *display = gdk_display_get_default ();
170
xdisplay = GDK_DISPLAY_XDISPLAY (display);
171
stage_win = clutter_x11_get_stage_window (stage);
174
* Make the clutter window a 'desktop' window, i.e maximised, but behind
177
atom = gdk_x11_get_xatom_by_name_for_display (display,
178
"_NET_WM_WINDOW_TYPE_DESKTOP");
179
XChangeProperty (xdisplay, stage_win,
180
gdk_x11_get_xatom_by_name_for_display (display,
181
"_NET_WM_WINDOW_TYPE"),
182
XA_ATOM , 32, PropModeReplace,
185
/*set_panel_strut (xdisplay, stage_win, TOP_OFFSET,
186
0, gdk_screen_get_width (screen));*/