[clutter-gtk] Make GtkClutterEmbed redraw resizes nicer



commit c4c06aae2e294cb247cb5421670f279c960087f8
Author: Alexander Larsson <alexl redhat com>
Date:   Tue Jun 5 19:08:22 2012 +0200

    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

 clutter-gtk/gtk-clutter-embed.c |   15 +++++++++++++++
 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
     }
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]