[event-x11] Don't relayout on window move

ConfigureNotify is delivered on window movements too, but there is no
need to queue a relayout on these as the viewport hasn't changed size.
Check for the window actually changing size on ConfigureNotify before
queueing a relayout.

This fixes laggy window movement when moving a window in response to
Clutter mouse motion events.
This commit is contained in:
Chris Lord 2010-02-17 16:56:30 +00:00
parent 05054bed87
commit 0bf6d57ab1

View File

@ -482,6 +482,22 @@ event_translate (ClutterBackend *backend,
xevent->xconfigure.width,
xevent->xconfigure.height);
/* Queue a relayout - we want glViewport to be called
* with the correct values, and this is done in ClutterStage
* via _cogl_onscreen_clutter_backend_set_size ().
*
* We queue a relayout, because if this ConfigureNotify is
* in response to a size we set in the application, the
* set_size above is essentially a null-op.
*
* Make sure we do this only when the size has changed,
* otherwise we end up relayouting on window moves.
*/
if ((stage_x11->state & CLUTTER_STAGE_STATE_FULLSCREEN) ||
(stage_x11->xwin_width != xevent->xconfigure.width) ||
(stage_x11->xwin_height != xevent->xconfigure.height))
clutter_actor_queue_relayout (CLUTTER_ACTOR (stage));
/* If we're fullscreened, we want these variables to
* represent the size of the window before it was set
* to fullscreen.
@ -503,16 +519,6 @@ event_translate (ClutterBackend *backend,
* to set up the GL viewport with the new size
*/
clutter_stage_ensure_viewport (stage);
/* Also queue a relayout - we want glViewport to be called
* with the correct values, and this is done in ClutterStage
* via _cogl_onscreen_clutter_backend_set_size ().
*
* We queue a relayout, because if this ConfigureNotify is
* in response to a size we set in the application, the
* set_size above is essentially a null-op.
*/
clutter_actor_queue_relayout (CLUTTER_ACTOR (stage));
}
res = FALSE;
break;