diff options
author | Joakim Tjernlund <[email protected]> | 2022-12-19 16:59:06 +0100 |
---|---|---|
committer | Luke from DC <[email protected]> | 2023-01-14 19:04:54 +0000 |
commit | 81ca7129c159bdae1d9ae9a0cd4e196a8354e7ce (patch) | |
tree | 711156c3a3e2032dc498be6dda4614c717988702 /src/core | |
parent | 0f7a8c6d19874336040a11cf62a7ecb3c1dd9849 (diff) | |
download | marco-81ca7129c159bdae1d9ae9a0cd4e196a8354e7ce.tar.bz2 marco-81ca7129c159bdae1d9ae9a0cd4e196a8354e7ce.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')
-rw-r--r-- | src/core/display-private.h | 1 | ||||
-rw-r--r-- | src/core/display.c | 14 |
2 files changed, 13 insertions, 2 deletions
diff --git a/src/core/display-private.h b/src/core/display-private.h index 0fd040c5..70e3ce0d 100644 --- a/src/core/display-private.h +++ b/src/core/display-private.h @@ -80,6 +80,7 @@ typedef enum { struct _MetaDisplay { char* name; Display* xdisplay; + gboolean have_xres; /* Got XRES >= 1.2 */ Window leader_window; Window timestamp_pinging_window; diff --git a/src/core/display.c b/src/core/display.c index f470ca5a..88b7e907 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; |