summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2012-06-05 19:08:22 +0200
committerAlexander Larsson <alexl@redhat.com>2012-06-05 19:13:05 +0200
commitc4c06aae2e294cb247cb5421670f279c960087f8 (patch)
treede5136c9a7c4a672a796bbb358b64f438782bfb1
parentc98d0593d6d382028637dd3dcf285016f84fad72 (diff)
downloadclutter-gtk-c4c06aae2e294cb247cb5421670f279c960087f8.tar.gz
Make GtkClutterEmbed redraw resizes nicer
Currently when you vertically resize a GtkClutterEmbed we draw twice, once with the old window size and once again when the ConfigureNotify gets back with the right size. The first draw is at the wrong position due to the wrong window height used to calculate the viewport position. We fix this by immediately telling cogl about the new size by faking a ConfigureNotify event. https://bugzilla.gnome.org/show_bug.cgi?id=677493
-rw-r--r--clutter-gtk/gtk-clutter-embed.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/clutter-gtk/gtk-clutter-embed.c b/clutter-gtk/gtk-clutter-embed.c
index add1078..2ab08d8 100644
--- a/clutter-gtk/gtk-clutter-embed.c
+++ b/clutter-gtk/gtk-clutter-embed.c
@@ -503,6 +503,21 @@ gtk_clutter_embed_size_allocate (GtkWidget *widget,
clutter_stage_ensure_viewport (CLUTTER_STAGE (priv->stage));
gtk_clutter_embed_send_configure (GTK_CLUTTER_EMBED (widget));
+
+#if defined(GDK_WINDOWING_X11) && defined(CLUTTER_WINDOWING_X11)
+ if (clutter_check_windowing_backend (CLUTTER_WINDOWING_X11) &&
+ GDK_IS_X11_WINDOW (gtk_widget_get_window (widget)))
+ {
+ XConfigureEvent xevent = { ConfigureNotify };
+ xevent.window = GDK_WINDOW_XID (gtk_widget_get_window (widget));
+ xevent.width = allocation->width;
+ xevent.height = allocation->height;
+
+ /* Ensure cogl knows about the new size immediately, as we will
+ draw before we get the ConfigureNotify response. */
+ clutter_x11_handle_event ((XEvent *)&xevent);
+ }
+#endif
}
}