[gtk+/wip/gdk-gl: 11/31] x11: Update GL viewport on ConfigureNotify
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/gdk-gl: 11/31] x11: Update GL viewport on ConfigureNotify
- Date: Thu, 14 Aug 2014 11:13:14 +0000 (UTC)
commit 686f9b46070cd8fd257bd367f2a1e0595ddc50dd
Author: Emmanuele Bassi <ebassi gnome org>
Date: Mon Aug 11 21:29:00 2014 +0100
x11: Update GL viewport on ConfigureNotify
On X11, by virtue of the asynchronous nature of the protocol, we have to
wait until the ConfigureNotify event to resize the GL viewport. If the
GdkWindow is a top-level one, then we'll get a GDK_CONFIGURE event, but
if we're using a GDK_WINDOW_CHILD the event will be dropped on the
floor.
gdk/x11/gdkdisplay-x11.c | 24 ++++++++++++++++++++----
1 files changed, 20 insertions(+), 4 deletions(-)
---
diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c
index 1837347..f6ba01a 100644
--- a/gdk/x11/gdkdisplay-x11.c
+++ b/gdk/x11/gdkdisplay-x11.c
@@ -782,11 +782,27 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
}
#endif
- if (!window ||
- xevent->xconfigure.event != xevent->xconfigure.window ||
- GDK_WINDOW_TYPE (window) == GDK_WINDOW_CHILD ||
+ if (!window ||
+ xevent->xconfigure.event != xevent->xconfigure.window ||
GDK_WINDOW_TYPE (window) == GDK_WINDOW_ROOT)
- return_val = FALSE;
+ {
+ return_val = FALSE;
+ }
+ else if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_CHILD)
+ {
+ /* on X11 we need to wait until a ConfigureNotify before
+ * updating the GL viewport, otherwise the GLX drawable
+ * and the X drawable will go out of sync.
+ */
+ if (gdk_window_has_gl_context (window))
+ {
+ GdkGLContext *context = gdk_window_get_gl_context (window);
+
+ gdk_gl_context_update (context);
+ }
+
+ return_val = FALSE;
+ }
else
{
event->configure.type = GDK_CONFIGURE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]