From 111512a2a05243a7fc6f999f18805eae9bd6bfce Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Mon, 5 Oct 2009 12:24:19 +0100 Subject: [PATCH] [x11] Fix Stage user-initiated resize The user-initiated resize is conflicting with the allocated size. This happens because we change the size of the stage's X Window behind the back of the size allocation machinery. Instead, we should change the size of the actor whenever we receive a ConfigureNotify event to reflect the new size of the actor. --- clutter/x11/clutter-event-x11.c | 7 +++---- clutter/x11/clutter-stage-x11.c | 6 +++++- tests/interactive/test-actors.c | 1 + 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/clutter/x11/clutter-event-x11.c b/clutter/x11/clutter-event-x11.c index 176fd2e72..b40c5b5a4 100644 --- a/clutter/x11/clutter-event-x11.c +++ b/clutter/x11/clutter-event-x11.c @@ -479,8 +479,9 @@ event_translate (ClutterBackend *backend, xevent->xconfigure.width, xevent->xconfigure.height); - stage_x11->xwin_width = xevent->xconfigure.width; - stage_x11->xwin_height = xevent->xconfigure.height; + clutter_actor_set_size (CLUTTER_ACTOR (stage), + xevent->xconfigure.width, + xevent->xconfigure.height); CLUTTER_UNSET_PRIVATE_FLAGS (stage_x11->wrapper, CLUTTER_STAGE_IN_RESIZE); @@ -489,8 +490,6 @@ event_translate (ClutterBackend *backend, * to set up the GL viewport with the new size */ clutter_stage_ensure_viewport (stage); - - clutter_actor_queue_relayout (CLUTTER_ACTOR (stage_x11->wrapper)); } res = FALSE; break; diff --git a/clutter/x11/clutter-stage-x11.c b/clutter/x11/clutter-stage-x11.c index 2231bfc02..02aec37f8 100644 --- a/clutter/x11/clutter-stage-x11.c +++ b/clutter/x11/clutter-stage-x11.c @@ -194,6 +194,9 @@ clutter_stage_x11_resize (ClutterStageWindow *stage_window, gint height) { ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window); + gboolean resize; + + resize = clutter_stage_get_user_resizable (stage_x11->wrapper); if (width == 0 || height == 0) { @@ -230,7 +233,8 @@ clutter_stage_x11_resize (ClutterStageWindow *stage_window, stage_x11->xwin_height); } - clutter_stage_x11_fix_window_size (stage_x11, width, height); + if (!resize) + clutter_stage_x11_fix_window_size (stage_x11, width, height); if (stage_x11->xpixmap != None) { diff --git a/tests/interactive/test-actors.c b/tests/interactive/test-actors.c index ef2c56fd9..aba8be43d 100644 --- a/tests/interactive/test-actors.c +++ b/tests/interactive/test-actors.c @@ -159,6 +159,7 @@ test_actors_main (int argc, char *argv[]) clutter_stage_set_title (CLUTTER_STAGE (stage), "Clone Test"); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); + clutter_stage_set_user_resizable (CLUTTER_STAGE (stage), TRUE); oh = g_new (SuperOH, 1); oh->stage = stage;