x11: Clean up NET_WM_STATE modifiers

Use a separate function to avoid code duplication.
This commit is contained in:
Emmanuele Bassi 2010-07-07 14:49:28 +01:00
parent eca398f113
commit 608a5a8ae6

View File

@ -92,6 +92,30 @@ send_wmspec_change_state (ClutterBackendX11 *backend_x11,
(XEvent *)&xclient); (XEvent *)&xclient);
} }
static void
update_state (ClutterStageX11 *stage_x11,
ClutterBackendX11 *backend_x11,
Atom *state,
gboolean add)
{
if (add)
{
/* FIXME: This wont work if we support more states */
XChangeProperty (backend_x11->xdpy,
stage_x11->xwin,
backend_x11->atom_NET_WM_STATE, XA_ATOM, 32,
PropModeReplace,
(unsigned char *) state, 1);
}
else
{
/* FIXME: This wont work if we support more states */
XDeleteProperty (backend_x11->xdpy,
stage_x11->xwin,
backend_x11->atom_NET_WM_STATE);
}
}
void void
clutter_stage_x11_fix_window_size (ClutterStageX11 *stage_x11, clutter_stage_x11_fix_window_size (ClutterStageX11 *stage_x11,
gint new_width, gint new_width,
@ -436,16 +460,13 @@ clutter_stage_x11_set_fullscreen (ClutterStageWindow *stage_window,
* a resize when calling clutter_stage_fullscreen() before showing * a resize when calling clutter_stage_fullscreen() before showing
* the stage * the stage
*/ */
if (!/*CLUTTER_ACTOR_IS_MAPPED (stage_x11->wrapper)*/ STAGE_X11_IS_MAPPED (stage_x11)) if (!STAGE_X11_IS_MAPPED (stage_x11))
{ {
CLUTTER_NOTE (BACKEND, "Fullscreening unmapped stage"); CLUTTER_NOTE (BACKEND, "Fullscreening unmapped stage");
/* FIXME: This wont work if we support more states */ update_state (stage_x11, backend_x11,
XChangeProperty (backend_x11->xdpy, &backend_x11->atom_NET_WM_STATE_FULLSCREEN,
stage_x11->xwin, TRUE);
backend_x11->atom_NET_WM_STATE, XA_ATOM, 32,
PropModeReplace,
(unsigned char *) &backend_x11->atom_NET_WM_STATE_FULLSCREEN, 1);
} }
else else
{ {
@ -469,14 +490,13 @@ clutter_stage_x11_set_fullscreen (ClutterStageWindow *stage_window,
if (stage_x11->xwin != None) if (stage_x11->xwin != None)
{ {
if (!/*CLUTTER_ACTOR_IS_MAPPED (stage_x11->wrapper)*/ STAGE_X11_IS_MAPPED (stage_x11)) if (!STAGE_X11_IS_MAPPED (stage_x11))
{ {
CLUTTER_NOTE (BACKEND, "Un-fullscreening unmapped stage"); CLUTTER_NOTE (BACKEND, "Un-fullscreening unmapped stage");
/* FIXME: This wont work if we support more states */ update_state (stage_x11, backend_x11,
XDeleteProperty (backend_x11->xdpy, &backend_x11->atom_NET_WM_STATE_FULLSCREEN,
stage_x11->xwin, FALSE);
backend_x11->atom_NET_WM_STATE);
} }
else else
{ {