mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 18:11:05 -05:00
[stage-x11] Ensure viewport is initialized before first stage paint
This ensures that glViewport is called before the first stage paint. Previously _clutter_stage_maybe_setup_viewport (which is done before we start painting) was bailing out without calling cogl_setup_viewport because the CLUTTER_STAGE_IN_RESIZE flag may be set if the stage was resized before the first paint. (NB: The CLUTTER_STAGE_IN_RESIZE flag isn't removed until we get an explicit event back from the X server since the window manager may choose to deny/alter the resize.) We now special case the first resize - where the viewport hasn't previously been initialized and use the requested geometry to initialize the glViewport without waiting for a reply from the server.
This commit is contained in:
parent
ad98e96d97
commit
f8f8873714
@ -210,6 +210,7 @@ clutter_stage_x11_resize (ClutterStageWindow *stage_window,
|
||||
ClutterBackend *backend = clutter_get_default_backend ();
|
||||
ClutterBackendX11 *backend_x11;
|
||||
ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window);
|
||||
ClutterStage *stage = stage_x11->wrapper;
|
||||
gboolean resize;
|
||||
|
||||
resize = clutter_stage_get_user_resizable (stage_x11->wrapper);
|
||||
@ -250,6 +251,22 @@ clutter_stage_x11_resize (ClutterStageWindow *stage_window,
|
||||
stage_x11->xwin,
|
||||
stage_x11->xwin_width,
|
||||
stage_x11->xwin_height);
|
||||
|
||||
/* If the viewport hasn't previously been initialized then even
|
||||
* though we can't guarantee that the server will honour our request
|
||||
* we need to ensure a valid viewport is set before our first paint.
|
||||
*/
|
||||
if (G_UNLIKELY (!stage_x11->viewport_initialized))
|
||||
{
|
||||
ClutterPerspective perspective;
|
||||
clutter_stage_get_perspective (stage, &perspective);
|
||||
_cogl_setup_viewport (stage_x11->xwin_width,
|
||||
stage_x11->xwin_height,
|
||||
perspective.fovy,
|
||||
perspective.aspect,
|
||||
perspective.z_near,
|
||||
perspective.z_far);
|
||||
}
|
||||
}
|
||||
|
||||
if (!resize)
|
||||
@ -654,6 +671,7 @@ clutter_stage_x11_init (ClutterStageX11 *stage)
|
||||
stage->is_foreign_xwin = FALSE;
|
||||
stage->fullscreen_on_map = FALSE;
|
||||
stage->is_cursor_visible = TRUE;
|
||||
stage->viewport_initialized = FALSE;
|
||||
|
||||
stage->title = NULL;
|
||||
|
||||
|
@ -53,6 +53,7 @@ struct _ClutterStageX11
|
||||
guint is_foreign_xwin : 1;
|
||||
guint fullscreen_on_map : 1;
|
||||
guint is_cursor_visible : 1;
|
||||
guint viewport_initialized : 1;
|
||||
|
||||
Window xwin;
|
||||
gint xwin_width;
|
||||
|
Loading…
Reference in New Issue
Block a user