diff --git a/clutter/clutter-main.c b/clutter/clutter-main.c index 84602f1b2..c07a2492d 100644 --- a/clutter/clutter-main.c +++ b/clutter/clutter-main.c @@ -153,12 +153,15 @@ _clutter_stage_maybe_relayout (ClutterActor *stage) void _clutter_stage_maybe_setup_viewport (ClutterStage *stage) { - if (CLUTTER_PRIVATE_FLAGS (stage) & CLUTTER_ACTOR_SYNC_MATRICES) + if ((CLUTTER_PRIVATE_FLAGS (stage) & CLUTTER_ACTOR_SYNC_MATRICES) && + !(CLUTTER_PRIVATE_FLAGS (stage) & CLUTTER_STAGE_IN_RESIZE)) { ClutterPerspective perspective; gfloat width, height; - clutter_actor_get_size (CLUTTER_ACTOR (stage), &width, &height); + clutter_actor_get_preferred_size (CLUTTER_ACTOR (stage), + NULL, NULL, + &width, &height); clutter_stage_get_perspective (stage, &perspective); CLUTTER_NOTE (PAINT, diff --git a/clutter/clutter-private.h b/clutter/clutter-private.h index 2a6e651b6..a50b9f0db 100644 --- a/clutter/clutter-private.h +++ b/clutter/clutter-private.h @@ -64,7 +64,8 @@ typedef enum { */ CLUTTER_ACTOR_IN_PAINT = 1 << 4, /* Used to avoid recursion */ CLUTTER_ACTOR_IN_RELAYOUT = 1 << 5, /* Used to avoid recursion */ - CLUTTER_TEXTURE_IN_CLONE_PAINT = 1 << 6 /* Used for safety in clones */ + CLUTTER_TEXTURE_IN_CLONE_PAINT = 1 << 6, /* Used for safety in clones */ + CLUTTER_STAGE_IN_RESIZE = 1 << 7 } ClutterPrivateFlags; struct _ClutterInputDevice diff --git a/clutter/x11/clutter-event-x11.c b/clutter/x11/clutter-event-x11.c index 5cfe628dc..176fd2e72 100644 --- a/clutter/x11/clutter-event-x11.c +++ b/clutter/x11/clutter-event-x11.c @@ -482,11 +482,13 @@ event_translate (ClutterBackend *backend, stage_x11->xwin_width = xevent->xconfigure.width; stage_x11->xwin_height = xevent->xconfigure.height; + CLUTTER_UNSET_PRIVATE_FLAGS (stage_x11->wrapper, + CLUTTER_STAGE_IN_RESIZE); + /* the resize process is complete, so we can ask the stage * to set up the GL viewport with the new size */ - CLUTTER_SET_PRIVATE_FLAGS (CLUTTER_ACTOR (stage_x11->wrapper), - CLUTTER_ACTOR_SYNC_MATRICES); + clutter_stage_ensure_viewport (stage); clutter_actor_queue_relayout (CLUTTER_ACTOR (stage_x11->wrapper)); } diff --git a/clutter/x11/clutter-stage-x11.c b/clutter/x11/clutter-stage-x11.c index a1d083da8..ee011fc2b 100644 --- a/clutter/x11/clutter-stage-x11.c +++ b/clutter/x11/clutter-stage-x11.c @@ -280,6 +280,9 @@ clutter_stage_x11_allocate (ClutterActor *self, stage_x11->xwin_width, stage_x11->xwin_height); + CLUTTER_SET_PRIVATE_FLAGS (stage_x11->wrapper, + CLUTTER_STAGE_IN_RESIZE); + XResizeWindow (stage_x11->xdpy, stage_x11->xwin, stage_x11->xwin_width, @@ -472,7 +475,8 @@ clutter_stage_x11_set_fullscreen (ClutterStageWindow *stage_window, } } - clutter_actor_queue_relayout (CLUTTER_ACTOR (stage)); + clutter_stage_ensure_viewport (CLUTTER_STAGE (stage_x11->wrapper)); + clutter_actor_queue_relayout (CLUTTER_ACTOR (stage_x11->wrapper)); } static void @@ -547,14 +551,31 @@ clutter_stage_x11_show (ClutterStageWindow *stage_window, if (stage_x11->xwin != None) { if (do_raise) - XRaiseWindow (stage_x11->xdpy, stage_x11->xwin); + { + CLUTTER_NOTE (BACKEND, "Raising stage[%lu]", + (unsigned long) stage_x11->xwin); + XRaiseWindow (stage_x11->xdpy, stage_x11->xwin); + } if (!STAGE_X11_IS_MAPPED (stage_x11)) { - CLUTTER_NOTE (BACKEND, "Mapping stage[%lu] (%d, %d)", - (unsigned long) stage_x11->xwin, - stage_x11->xwin_width, - stage_x11->xwin_height); + CLUTTER_NOTE (BACKEND, "Mapping stage[%lu]", + (unsigned long) stage_x11->xwin); + + if (!stage_x11->is_foreign_xwin) + { + CLUTTER_NOTE (BACKEND, "Resizing stage[%lu] (%d, %d)", + (unsigned long) stage_x11->xwin, + stage_x11->xwin_width, + stage_x11->xwin_height); + + CLUTTER_SET_PRIVATE_FLAGS (stage_x11->wrapper, + CLUTTER_STAGE_IN_RESIZE); + + XResizeWindow (stage_x11->xdpy, stage_x11->xwin, + stage_x11->xwin_width, + stage_x11->xwin_height); + } update_wm_hints (stage_x11); @@ -564,8 +585,6 @@ clutter_stage_x11_show (ClutterStageWindow *stage_window, clutter_stage_x11_set_fullscreen (stage_window, FALSE); set_stage_state (stage_x11, STAGE_X11_WITHDRAWN, 0); - - clutter_stage_ensure_viewport (CLUTTER_STAGE (stage_x11->wrapper)); } g_assert (STAGE_X11_IS_MAPPED (stage_x11));