mirror of
https://github.com/brl/mutter.git
synced 2024-12-27 13:22:15 +00:00
[x11] Fix the race between resize and glViewport calls
The race we were experiencing in the X11 backends is apparently
back after the fix in commit 00a3c698
.
This time, just delaying the setting of the SYNC_MATRICES flag
is not enough, so we can resume the use of a STAGE_IN_RESIZE
private flag.
This should also fix bug:
http://bugzilla.openedhand.com/show_bug.cgi?id=1668
This commit is contained in:
parent
3726213291
commit
250b775926
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user