From 0bf6d57ab128f301588695d011a9ab5d1b1dce1a Mon Sep 17 00:00:00 2001 From: Chris Lord Date: Wed, 17 Feb 2010 16:56:30 +0000 Subject: [PATCH] [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. --- clutter/x11/clutter-event-x11.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/clutter/x11/clutter-event-x11.c b/clutter/x11/clutter-event-x11.c index 7be186984..5155ad91e 100644 --- a/clutter/x11/clutter-event-x11.c +++ b/clutter/x11/clutter-event-x11.c @@ -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;