[x11] Proper fix for the ClutterStage resize race
Continuation of the fix in commit 00a3c698686f25e193d0311ad25c903f0ad71e8b. Instead of using a separate flag for the resize process, just delay the setting of the CLUTTER_ACTOR_SYNC_MATRICES flag on the stage to the point when we receive a ConfigureNotify event from X11. This commit will break the stage embedding into other toolkits.
This commit is contained in:
parent
2693ea3ddc
commit
4f6cc0b25f
@ -251,9 +251,6 @@ _clutter_backend_ensure_context (ClutterBackend *backend,
|
|||||||
* potential issue of GL calls with no context)
|
* potential issue of GL calls with no context)
|
||||||
*/
|
*/
|
||||||
current_context_stage = stage;
|
current_context_stage = stage;
|
||||||
|
|
||||||
if (stage)
|
|
||||||
CLUTTER_SET_PRIVATE_FLAGS (stage, CLUTTER_ACTOR_SYNC_MATRICES);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
CLUTTER_NOTE (MULTISTAGE, "Stage is the same");
|
CLUTTER_NOTE (MULTISTAGE, "Stage is the same");
|
||||||
|
@ -147,8 +147,7 @@ _clutter_stage_maybe_relayout (ClutterActor *stage)
|
|||||||
void
|
void
|
||||||
_clutter_stage_maybe_setup_viewport (ClutterStage *stage)
|
_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;
|
ClutterPerspective perspective;
|
||||||
guint width, height;
|
guint width, height;
|
||||||
|
@ -62,8 +62,7 @@ typedef enum {
|
|||||||
*/
|
*/
|
||||||
CLUTTER_ACTOR_IN_PAINT = 1 << 4, /* Used to avoid recursion */
|
CLUTTER_ACTOR_IN_PAINT = 1 << 4, /* Used to avoid recursion */
|
||||||
CLUTTER_ACTOR_IN_RELAYOUT = 1 << 5, /* 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 /* Used to mark stage resizes */
|
|
||||||
} ClutterPrivateFlags;
|
} ClutterPrivateFlags;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -433,17 +433,23 @@ event_translate (ClutterBackend *backend,
|
|||||||
it from trying to resize the window again */
|
it from trying to resize the window again */
|
||||||
stage_x11->handling_configure = TRUE;
|
stage_x11->handling_configure = TRUE;
|
||||||
|
|
||||||
|
CLUTTER_NOTE (BACKEND, "%s: ConfigureNotify[%x] (%d, %d)",
|
||||||
|
G_STRLOC,
|
||||||
|
(unsigned int) stage_x11->xwin,
|
||||||
|
xevent->xconfigure.width,
|
||||||
|
xevent->xconfigure.height);
|
||||||
|
|
||||||
clutter_actor_set_size (CLUTTER_ACTOR (stage),
|
clutter_actor_set_size (CLUTTER_ACTOR (stage),
|
||||||
xevent->xconfigure.width,
|
xevent->xconfigure.width,
|
||||||
xevent->xconfigure.height);
|
xevent->xconfigure.height);
|
||||||
|
|
||||||
stage_x11->handling_configure = FALSE;
|
stage_x11->handling_configure = FALSE;
|
||||||
|
|
||||||
/* the resize process is complete, so we can remove the
|
/* the resize process is complete, so we can ask the stage
|
||||||
* in-resize flag and allow the viewport to be resized
|
* to set up the GL viewport with the new size
|
||||||
*/
|
*/
|
||||||
CLUTTER_UNSET_PRIVATE_FLAGS (CLUTTER_ACTOR (stage_x11->wrapper),
|
CLUTTER_SET_PRIVATE_FLAGS (CLUTTER_ACTOR (stage_x11->wrapper),
|
||||||
CLUTTER_STAGE_IN_RESIZE);
|
CLUTTER_ACTOR_SYNC_MATRICES);
|
||||||
}
|
}
|
||||||
res = FALSE;
|
res = FALSE;
|
||||||
break;
|
break;
|
||||||
|
@ -286,27 +286,18 @@ clutter_stage_x11_allocate (ClutterActor *self,
|
|||||||
!stage_x11->is_foreign_xwin &&
|
!stage_x11->is_foreign_xwin &&
|
||||||
!stage_x11->handling_configure)
|
!stage_x11->handling_configure)
|
||||||
{
|
{
|
||||||
|
CLUTTER_NOTE (BACKEND, "%s: XResizeWindow[%x] (%d, %d)",
|
||||||
|
G_STRLOC,
|
||||||
|
(unsigned int) stage_x11->xwin,
|
||||||
|
stage_x11->xwin_width,
|
||||||
|
stage_x11->xwin_height);
|
||||||
|
|
||||||
XResizeWindow (stage_x11->xdpy,
|
XResizeWindow (stage_x11->xdpy,
|
||||||
stage_x11->xwin,
|
stage_x11->xwin,
|
||||||
stage_x11->xwin_width,
|
stage_x11->xwin_width,
|
||||||
stage_x11->xwin_height);
|
stage_x11->xwin_height);
|
||||||
|
|
||||||
/* resizing is an asynchronous process; to avoid races
|
|
||||||
* with the window manager, we flag the wrapper as being
|
|
||||||
* "in resize", so that the SYNC_MATRICES flag will not
|
|
||||||
* cause a call to cogl_get_viewport().
|
|
||||||
*
|
|
||||||
* the flag is unset inside clutter-event-x11.c, after
|
|
||||||
* we receive a ConfigureNotify event. XXX - need to
|
|
||||||
* check what happens when running without a window manager
|
|
||||||
*/
|
|
||||||
CLUTTER_SET_PRIVATE_FLAGS (CLUTTER_ACTOR (stage_x11->wrapper),
|
|
||||||
CLUTTER_STAGE_IN_RESIZE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CLUTTER_SET_PRIVATE_FLAGS (CLUTTER_ACTOR (stage_x11->wrapper),
|
|
||||||
CLUTTER_ACTOR_SYNC_MATRICES);
|
|
||||||
|
|
||||||
clutter_stage_x11_fix_window_size (stage_x11);
|
clutter_stage_x11_fix_window_size (stage_x11);
|
||||||
|
|
||||||
if (stage_x11->xpixmap != None)
|
if (stage_x11->xpixmap != None)
|
||||||
@ -411,6 +402,8 @@ clutter_stage_x11_set_fullscreen (ClutterStageWindow *stage_window,
|
|||||||
if (!stage)
|
if (!stage)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
CLUTTER_SET_PRIVATE_FLAGS (stage, CLUTTER_ACTOR_SYNC_MATRICES);
|
||||||
|
|
||||||
if (is_fullscreen)
|
if (is_fullscreen)
|
||||||
{
|
{
|
||||||
int width, height;
|
int width, height;
|
||||||
@ -493,8 +486,6 @@ clutter_stage_x11_set_fullscreen (ClutterStageWindow *stage_window,
|
|||||||
stage_x11->fullscreen_on_map = FALSE;
|
stage_x11->fullscreen_on_map = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CLUTTER_SET_PRIVATE_FLAGS (stage, CLUTTER_ACTOR_SYNC_MATRICES);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -754,6 +745,8 @@ clutter_x11_set_stage_foreign (ClutterStage *stage,
|
|||||||
clutter_actor_set_geometry (actor, &geom);
|
clutter_actor_set_geometry (actor, &geom);
|
||||||
clutter_actor_realize (actor);
|
clutter_actor_realize (actor);
|
||||||
|
|
||||||
|
CLUTTER_SET_PRIVATE_FLAGS (actor, CLUTTER_ACTOR_SYNC_MATRICES);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user