From ae8a06cdca5ca6635add94465473f85eb7e46ec1 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 31 Aug 2024 11:28:10 -0400 Subject: [PATCH 1/2] x11: Cosmetics Don't return FALSE from a function returning a pointer. --- gdk/x11/gdkdisplay-x11.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c index dae85b2bd9..0be4a24e62 100644 --- a/gdk/x11/gdkdisplay-x11.c +++ b/gdk/x11/gdkdisplay-x11.c @@ -1472,7 +1472,7 @@ gdk_x11_display_open (const char *display_name) } #endif - /* initialize the display's screens */ + /* initialize the display's screens */ display_x11->screen = _gdk_x11_screen_new (display, DefaultScreen (display_x11->xdisplay)); /* If GL is available we want to pick better default/rgba visuals, @@ -3021,7 +3021,7 @@ gdk_x11_display_init_gl (GdkDisplay *display, GdkX11Display *self = GDK_X11_DISPLAY (display); if (!gdk_x11_display_init_gl_backend (self, &self->window_visual, &self->window_depth, error)) - return FALSE; + return NULL; gdk_x11_display_init_leader_surface (self); From 5b6b42b5a91b1176ad8ecd1111ce9c99f7d9b472 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 31 Aug 2024 11:26:11 -0400 Subject: [PATCH 2/2] x11: Fix initialization mess When prepare_gl fails in the right way (or the wrong way?), we end up creating the leader window twice, and as a side effect, creating two instances of the "Virtual core pointer" device, which is bad news for grabs. Fixes: #6840 --- gdk/x11/gdkdisplay-x11.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c index 0be4a24e62..a875137037 100644 --- a/gdk/x11/gdkdisplay-x11.c +++ b/gdk/x11/gdkdisplay-x11.c @@ -1484,8 +1484,11 @@ gdk_x11_display_open (const char *display_name) */ if (!gdk_display_prepare_gl (display, NULL)) { - gdk_x11_display_query_default_visual (display_x11, &display_x11->window_visual, &display_x11->window_depth); - gdk_x11_display_init_leader_surface (display_x11); + if (!display_x11->leader_gdk_surface) + { + gdk_x11_display_query_default_visual (display_x11, &display_x11->window_visual, &display_x11->window_depth); + gdk_x11_display_init_leader_surface (display_x11); + } } #ifdef HAVE_XFIXES