diff options
author | Joakim Tjernlund <[email protected]> | 2022-12-19 16:59:06 +0100 |
---|---|---|
committer | lukefromdc <[email protected]> | 2023-01-14 15:32:33 -0500 |
commit | 2c0d3843a9e77f849f5f02a8b0ca9253a467e13e (patch) | |
tree | ab955b8711caee4554d358d14d8db78a7e5a9687 /src/core/display.c | |
parent | 318621e5c8ed760f97c180c34990d1560ac7fc05 (diff) | |
download | marco-2c0d3843a9e77f849f5f02a8b0ca9253a467e13e.tar.bz2 marco-2c0d3843a9e77f849f5f02a8b0ca9253a467e13e.tar.xz |
Test Xres 1.2 is present
Before using any Xres extension one must call XResQueryExtension()
Also make sure Xres 1.2 is available as marco need XResQueryClientIds()
Diffstat (limited to 'src/core/display.c')
-rw-r--r-- | src/core/display.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/core/display.c b/src/core/display.c index 7edf41b8..b3552cc9 100644 --- a/src/core/display.c +++ b/src/core/display.c @@ -50,6 +50,7 @@ #include "compositor.h" #include <X11/Xatom.h> #include <X11/cursorfont.h> +#include <X11/extensions/XRes.h> #ifdef HAVE_SOLARIS_XINERAMA #include <X11/extensions/xinerama.h> @@ -329,7 +330,8 @@ meta_display_open (void) Display *xdisplay; GSList *screens; GSList *tmp; - int i; + int i, event_base, error_base, major, minor; + gboolean have_xres = FALSE; guint32 timestamp; /* A list of all atom names, so that we can intern them in one go. */ @@ -343,6 +345,7 @@ meta_display_open (void) meta_verbose ("Opening display '%s'\n", XDisplayName (NULL)); xdisplay = meta_ui_get_display (); + event_base = error_base = major = minor = 0; if (xdisplay == NULL) { @@ -350,7 +353,13 @@ meta_display_open (void) XDisplayName (NULL)); return FALSE; } - + /* Make sure to init Xres any extensions */ + if (XResQueryExtension(xdisplay, &event_base, &error_base) && + XResQueryVersion (xdisplay, &major, &minor) == 1) + { + if (major > 1 || (major == 1 && minor >= 2)) + have_xres = TRUE; + } if (meta_is_syncing ()) XSynchronize (xdisplay, True); @@ -365,6 +374,7 @@ meta_display_open (void) */ the_display->name = g_strdup (XDisplayName (NULL)); the_display->xdisplay = xdisplay; + the_display->have_xres = have_xres; the_display->error_trap_synced_at_last_pop = TRUE; the_display->error_traps = 0; the_display->error_trap_handler = NULL; |