[clutter] x11/stage: Allow setting fullscreen hint before realize
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter] x11/stage: Allow setting fullscreen hint before realize
- Date: Wed, 15 Feb 2012 14:27:06 +0000 (UTC)
commit b8e5603a8585f6a4429263e6110a94132a7ad93d
Author: Emmanuele Bassi <ebassi linux intel com>
Date: Wed Feb 15 14:20:59 2012 +0000
x11/stage: Allow setting fullscreen hint before realize
It should be possible to do:
clutter_stage_set_fullscreen (stage, TRUE);
clutter_actor_show (stage);
and have the stage be full screen as soon as it is shown.
Currently, we need to call clutter_actor_realize() prior to calling
set_fullscreen(), otherwise the backing X window will not be set,
and ClutterStageX11 will silently discard the change.
If set_fullscreen() was called prior to realization, ClutterStageX11
should delay setting the fullscreen hint until the realize() chain
has been successfully executed.
http://bugzilla.clutter-project.org/show_bug.cgi?id=2515
clutter/x11/clutter-stage-x11.c | 205 ++++++++++++++++++++------------------
clutter/x11/clutter-stage-x11.h | 11 +-
2 files changed, 114 insertions(+), 102 deletions(-)
---
diff --git a/clutter/x11/clutter-stage-x11.c b/clutter/x11/clutter-stage-x11.c
index cb07c16..69536fe 100644
--- a/clutter/x11/clutter-stage-x11.c
+++ b/clutter/x11/clutter-stage-x11.c
@@ -418,103 +418,6 @@ _clutter_stage_x11_update_foreign_event_mask (CoglOnscreen *onscreen,
&attrs);
}
-static gboolean
-clutter_stage_x11_realize (ClutterStageWindow *stage_window)
-{
- ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window);
- ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
- ClutterBackend *backend = CLUTTER_BACKEND (stage_cogl->backend);
- ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (backend);
- ClutterDeviceManager *device_manager;
- int event_flags;
- gfloat width, height;
-
- clutter_actor_get_size (CLUTTER_ACTOR (stage_cogl->wrapper),
- &width, &height);
-
- stage_cogl->onscreen = cogl_onscreen_new (backend->cogl_context,
- width, height);
-
- /* We just created a window of the size of the actor. No need to fix
- the size of the stage, just update it. */
- stage_x11->xwin_width = width;
- stage_x11->xwin_height = height;
-
- if (stage_x11->xwin != None)
- {
- cogl_x11_onscreen_set_foreign_window_xid (stage_cogl->onscreen,
- stage_x11->xwin,
- _clutter_stage_x11_update_foreign_event_mask,
- stage_x11);
-
- }
-
- /* Chain to the parent class now. ClutterStageCogl will call cogl_framebuffer_allocate,
- which will create the X Window we need */
-
- if (!(clutter_stage_window_parent_iface->realize (stage_window)))
- return FALSE;
-
- if (stage_x11->xwin == None)
- stage_x11->xwin = cogl_x11_onscreen_get_window_xid (stage_cogl->onscreen);
-
- if (clutter_stages_by_xid == NULL)
- clutter_stages_by_xid = g_hash_table_new (NULL, NULL);
-
- g_hash_table_insert (clutter_stages_by_xid,
- GINT_TO_POINTER (stage_x11->xwin),
- stage_x11);
-
- set_wm_pid (stage_x11);
- set_wm_title (stage_x11);
- set_cursor_visible (stage_x11);
-
-
- /* the masks for the events we want to select on a stage window;
- * KeyPressMask and KeyReleaseMask are necessary even with XI1
- * because key events are broken with that extension, and will
- * be fixed by XI2
- */
- event_flags = CLUTTER_STAGE_X11_EVENT_MASK;
-
- /* we unconditionally select input events even with event retrieval
- * disabled because we need to guarantee that the Clutter internal
- * state is maintained when calling clutter_x11_handle_event() without
- * requiring applications or embedding toolkits to select events
- * themselves. if we did that, we'd have to document the events to be
- * selected, and also update applications and embedding toolkits each
- * time we added a new mask, or a new class of events.
- *
- * see: http://bugzilla.clutter-project.org/show_bug.cgi?id=998
- * for the rationale of why we did conditional selection. it is now
- * clear that a compositor should clear out the input region, since
- * it cannot assume a perfectly clean slate coming from us.
- *
- * see: http://bugzilla.clutter-project.org/show_bug.cgi?id=2228
- * for an example of things that break if we do conditional event
- * selection.
- */
- XSelectInput (backend_x11->xdpy, stage_x11->xwin, event_flags);
-
- /* input events also depent on the actual device, so we need to
- * use the device manager to let every device select them, using
- * the event mask we passed to XSelectInput as the template
- */
- device_manager = clutter_device_manager_get_default ();
- _clutter_device_manager_select_stage_events (device_manager,
- stage_cogl->wrapper,
- event_flags);
-
- clutter_stage_x11_fix_window_size (stage_x11,
- stage_x11->xwin_width,
- stage_x11->xwin_height);
- clutter_stage_x11_set_wm_protocols (stage_x11);
-
- CLUTTER_NOTE (BACKEND, "Successfully realized stage");
-
- return TRUE;
-}
-
static void
clutter_stage_x11_set_fullscreen (ClutterStageWindow *stage_window,
gboolean is_fullscreen)
@@ -583,6 +486,8 @@ clutter_stage_x11_set_fullscreen (ClutterStageWindow *stage_window,
TRUE);
}
}
+ else
+ stage_x11->fullscreen_on_realize = TRUE;
}
else
{
@@ -614,6 +519,8 @@ clutter_stage_x11_set_fullscreen (ClutterStageWindow *stage_window,
stage_x11->xwin_height);
}
}
+ else
+ stage_x11->fullscreen_on_realize = FALSE;
}
/* XXX: Note we rely on the ConfigureNotify mechanism as the common
@@ -622,6 +529,110 @@ clutter_stage_x11_set_fullscreen (ClutterStageWindow *stage_window,
* queue a relayout etc. */
}
+static gboolean
+clutter_stage_x11_realize (ClutterStageWindow *stage_window)
+{
+ ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window);
+ ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
+ ClutterBackend *backend = CLUTTER_BACKEND (stage_cogl->backend);
+ ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (backend);
+ ClutterDeviceManager *device_manager;
+ int event_flags;
+ gfloat width, height;
+
+ clutter_actor_get_size (CLUTTER_ACTOR (stage_cogl->wrapper),
+ &width, &height);
+
+ stage_cogl->onscreen = cogl_onscreen_new (backend->cogl_context,
+ width, height);
+
+ /* We just created a window of the size of the actor. No need to fix
+ the size of the stage, just update it. */
+ stage_x11->xwin_width = width;
+ stage_x11->xwin_height = height;
+
+ if (stage_x11->xwin != None)
+ {
+ cogl_x11_onscreen_set_foreign_window_xid (stage_cogl->onscreen,
+ stage_x11->xwin,
+ _clutter_stage_x11_update_foreign_event_mask,
+ stage_x11);
+
+ }
+
+ /* Chain to the parent class now. ClutterStageCogl will call cogl_framebuffer_allocate,
+ which will create the X Window we need */
+
+ if (!(clutter_stage_window_parent_iface->realize (stage_window)))
+ return FALSE;
+
+ if (stage_x11->xwin == None)
+ stage_x11->xwin = cogl_x11_onscreen_get_window_xid (stage_cogl->onscreen);
+
+ if (clutter_stages_by_xid == NULL)
+ clutter_stages_by_xid = g_hash_table_new (NULL, NULL);
+
+ g_hash_table_insert (clutter_stages_by_xid,
+ GINT_TO_POINTER (stage_x11->xwin),
+ stage_x11);
+
+ set_wm_pid (stage_x11);
+ set_wm_title (stage_x11);
+ set_cursor_visible (stage_x11);
+
+
+ /* the masks for the events we want to select on a stage window;
+ * KeyPressMask and KeyReleaseMask are necessary even with XI1
+ * because key events are broken with that extension, and will
+ * be fixed by XI2
+ */
+ event_flags = CLUTTER_STAGE_X11_EVENT_MASK;
+
+ /* we unconditionally select input events even with event retrieval
+ * disabled because we need to guarantee that the Clutter internal
+ * state is maintained when calling clutter_x11_handle_event() without
+ * requiring applications or embedding toolkits to select events
+ * themselves. if we did that, we'd have to document the events to be
+ * selected, and also update applications and embedding toolkits each
+ * time we added a new mask, or a new class of events.
+ *
+ * see: http://bugzilla.clutter-project.org/show_bug.cgi?id=998
+ * for the rationale of why we did conditional selection. it is now
+ * clear that a compositor should clear out the input region, since
+ * it cannot assume a perfectly clean slate coming from us.
+ *
+ * see: http://bugzilla.clutter-project.org/show_bug.cgi?id=2228
+ * for an example of things that break if we do conditional event
+ * selection.
+ */
+ XSelectInput (backend_x11->xdpy, stage_x11->xwin, event_flags);
+
+ /* input events also depent on the actual device, so we need to
+ * use the device manager to let every device select them, using
+ * the event mask we passed to XSelectInput as the template
+ */
+ device_manager = clutter_device_manager_get_default ();
+ _clutter_device_manager_select_stage_events (device_manager,
+ stage_cogl->wrapper,
+ event_flags);
+
+ clutter_stage_x11_fix_window_size (stage_x11,
+ stage_x11->xwin_width,
+ stage_x11->xwin_height);
+ clutter_stage_x11_set_wm_protocols (stage_x11);
+
+ if (stage_x11->fullscreen_on_realize)
+ {
+ stage_x11->fullscreen_on_realize = FALSE;
+
+ clutter_stage_x11_set_fullscreen (stage_window, TRUE);
+ }
+
+ CLUTTER_NOTE (BACKEND, "Successfully realized stage");
+
+ return TRUE;
+}
+
static void
clutter_stage_x11_set_cursor_visible (ClutterStageWindow *stage_window,
gboolean cursor_visible)
diff --git a/clutter/x11/clutter-stage-x11.h b/clutter/x11/clutter-stage-x11.h
index a605eec..61ff15f 100644
--- a/clutter/x11/clutter-stage-x11.h
+++ b/clutter/x11/clutter-stage-x11.h
@@ -61,11 +61,12 @@ struct _ClutterStageX11
ClutterStageX11State wm_state;
- guint is_foreign_xwin : 1;
- guint fullscreening : 1;
- guint is_cursor_visible : 1;
- guint viewport_initialized : 1;
- guint accept_focus : 1;
+ guint is_foreign_xwin : 1;
+ guint fullscreening : 1;
+ guint is_cursor_visible : 1;
+ guint viewport_initialized : 1;
+ guint accept_focus : 1;
+ guint fullscreen_on_realize : 1;
};
struct _ClutterStageX11Class
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]