From 10a3ddf6ccee2365874b0fd10043541fa20fd283 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Fri, 1 Aug 2003 20:37:56 +0000 Subject: [PATCH] If the check for missing depths, try actually creating pixmaps of the Fri Aug 1 16:30:13 2003 Owen Taylor * gdk/x11/gdkdrawable-x11.c (_gdk_x11_have_render): If the check for missing depths, try actually creating pixmaps of the depths to deal with Xinerama not reporting all the depths it should. (#115822) --- ChangeLog | 7 +++++++ ChangeLog.pre-2-10 | 7 +++++++ ChangeLog.pre-2-4 | 7 +++++++ ChangeLog.pre-2-6 | 7 +++++++ ChangeLog.pre-2-8 | 7 +++++++ gdk/x11/gdkdrawable-x11.c | 31 +++++++++++++++++++++++++++++++ 6 files changed, 66 insertions(+) diff --git a/ChangeLog b/ChangeLog index 3b89409db3..e79b36dc3d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Fri Aug 1 16:30:13 2003 Owen Taylor + + * gdk/x11/gdkdrawable-x11.c (_gdk_x11_have_render): + If the check for missing depths, try actually creating pixmaps + of the depths to deal with Xinerama not reporting + all the depths it should. (#115822) + Fri Aug 1 15:33:59 2003 Owen Taylor * gtk/gtksocket.c: Patch from Denis Mikhalkin to diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 3b89409db3..e79b36dc3d 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,10 @@ +Fri Aug 1 16:30:13 2003 Owen Taylor + + * gdk/x11/gdkdrawable-x11.c (_gdk_x11_have_render): + If the check for missing depths, try actually creating pixmaps + of the depths to deal with Xinerama not reporting + all the depths it should. (#115822) + Fri Aug 1 15:33:59 2003 Owen Taylor * gtk/gtksocket.c: Patch from Denis Mikhalkin to diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 3b89409db3..e79b36dc3d 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,10 @@ +Fri Aug 1 16:30:13 2003 Owen Taylor + + * gdk/x11/gdkdrawable-x11.c (_gdk_x11_have_render): + If the check for missing depths, try actually creating pixmaps + of the depths to deal with Xinerama not reporting + all the depths it should. (#115822) + Fri Aug 1 15:33:59 2003 Owen Taylor * gtk/gtksocket.c: Patch from Denis Mikhalkin to diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 3b89409db3..e79b36dc3d 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,10 @@ +Fri Aug 1 16:30:13 2003 Owen Taylor + + * gdk/x11/gdkdrawable-x11.c (_gdk_x11_have_render): + If the check for missing depths, try actually creating pixmaps + of the depths to deal with Xinerama not reporting + all the depths it should. (#115822) + Fri Aug 1 15:33:59 2003 Owen Taylor * gtk/gtksocket.c: Patch from Denis Mikhalkin to diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 3b89409db3..e79b36dc3d 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,10 @@ +Fri Aug 1 16:30:13 2003 Owen Taylor + + * gdk/x11/gdkdrawable-x11.c (_gdk_x11_have_render): + If the check for missing depths, try actually creating pixmaps + of the depths to deal with Xinerama not reporting + all the depths it should. (#115822) + Fri Aug 1 15:33:59 2003 Owen Taylor * gtk/gtksocket.c: Patch from Denis Mikhalkin to diff --git a/gdk/x11/gdkdrawable-x11.c b/gdk/x11/gdkdrawable-x11.c index 70d563281e..306504c2b3 100644 --- a/gdk/x11/gdkdrawable-x11.c +++ b/gdk/x11/gdkdrawable-x11.c @@ -224,6 +224,17 @@ gdk_drawable_impl_x11_finalize (GObject *object) } #ifdef HAVE_XFT +static void +try_pixmap (Display *xdisplay, + int screen, + int depth) +{ + Pixmap pixmap = XCreatePixmap (xdisplay, + RootWindow (xdisplay, screen), + 1, 1, depth); + XFreePixmap (xdisplay, pixmap); +} + gboolean _gdk_x11_have_render (GdkDisplay *display) { @@ -266,6 +277,26 @@ _gdk_x11_have_render (GdkDisplay *display) XFree (depths); } + /* At this point, we might have a false positive; + * buggy versions of Xinerama only report depths for + * which there is an associated visual; so we actually + * go ahead and try create pixmaps. + */ + if (!(has_8 && has_32)) + { + gdk_error_trap_push (); + if (!has_8) + try_pixmap (xdisplay, screen, 8); + if (!has_32) + try_pixmap (xdisplay, screen, 32); + XSync (xdisplay, False); + if (gdk_error_trap_pop () == 0) + { + has_8 = TRUE; + has_32 = TRUE; + } + } + if (!(has_8 && has_32)) { g_warning ("The X server advertises that RENDER support is present,\n"