fepitre / rpms / gtk3

Forked from rpms/gtk3 4 years ago
Clone
Blob Blame History Raw
From 4b1c02560f0d8097bf5a11932e52fb72f3e9e94b Mon Sep 17 00:00:00 2001
From: Benjamin Otte <otte@redhat.com>
Date: Mon, 12 Feb 2018 21:09:50 +0100
Subject: [PATCH] x11: Don't call XInput API for core events

Fixes emacs crashing with XMing.

https://bugzilla.redhat.com/show_bug.cgi?id=1483942
---
 gdk/x11/gdkdisplay-x11.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c
index 3e843d6..75bd34c 100644
--- a/gdk/x11/gdkdisplay-x11.c
+++ b/gdk/x11/gdkdisplay-x11.c
@@ -3072,6 +3072,16 @@ gdk_x11_display_get_default_seat (GdkDisplay *display)
 
   seats = gdk_display_list_seats (display);
 
+  /* Shortcut only one seat being available.
+   * This path always triggers for core events, so we can freely use XInput below. */
+  if (g_list_length (seats) == 1)
+    {
+      GdkSeat *seat = seats->data;
+
+      g_list_free (seats);
+      return seat;
+    }
+
   gdk_x11_display_error_trap_push (display);
   result = XIGetClientPointer (GDK_DISPLAY_XDISPLAY (display),
                                None, &device_id);
--
libgit2 0.26.0