x11: Trap possible X error

XIGetClientPointer can generate X errors (e.g. when the X server
does not support XI2. Trap them and carry on.

https://bugzilla.gnome.org/show_bug.cgi?id=766233
This commit is contained in:
Matthias Clasen 2016-05-10 21:29:10 -04:00
parent f8bc35b9a6
commit 7e7d7991cc

View File

@ -2881,10 +2881,14 @@ gdk_x11_display_get_default_seat (GdkDisplay *display)
{
GList *seats, *l;
int device_id;
gboolean result = FALSE;
seats = gdk_display_list_seats (display);
XIGetClientPointer (GDK_DISPLAY_XDISPLAY (display),
None, &device_id);
gdk_x11_display_error_trap_push (display);
result = XIGetClientPointer (GDK_DISPLAY_XDISPLAY (display),
None, &device_id);
gdk_x11_display_error_trap_pop_ignored (display);
for (l = seats; l; l = l->next)
{
@ -2892,7 +2896,7 @@ gdk_x11_display_get_default_seat (GdkDisplay *display)
pointer = gdk_seat_get_pointer (l->data);
if (gdk_x11_device_get_id (pointer) == device_id)
if (gdk_x11_device_get_id (pointer) == device_id || !result)
{
GdkSeat *seat = l->data;
g_list_free (seats);