@@ -44,47 +44,51 @@ static gboolean
4444device_has_property (XDevice * device ,
4545 const char * property_name )
4646{
47+ GdkDisplay * display ;
4748 Atom realtype , prop ;
4849 int realformat ;
4950 unsigned long nitems , bytes_after ;
5051 unsigned char * data ;
5152
52- prop = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), property_name , True );
53+ display = gdk_display_get_default ();
54+ prop = XInternAtom (GDK_DISPLAY_XDISPLAY (display ), property_name , True );
5355 if (!prop )
5456 return FALSE;
5557
56- gdk_error_trap_push ( );
57- if ((XGetDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default () ), device , prop , 0 , 1 , False ,
58+ gdk_x11_display_error_trap_push ( display );
59+ if ((XGetDeviceProperty (GDK_DISPLAY_XDISPLAY (display ), device , prop , 0 , 1 , False ,
5860 XA_INTEGER , & realtype , & realformat , & nitems ,
5961 & bytes_after , & data ) == Success ) && (realtype != None )) {
60- gdk_error_trap_pop_ignored ( );
62+ gdk_x11_display_error_trap_pop_ignored ( display );
6163 XFree (data );
6264 return TRUE;
6365 }
6466
65- gdk_error_trap_pop_ignored ( );
67+ gdk_x11_display_error_trap_pop_ignored ( display );
6668 return FALSE;
6769}
6870
6971XDevice *
7072device_is_touchpad (XDeviceInfo * deviceinfo )
7173{
74+ GdkDisplay * display ;
7275 XDevice * device ;
7376
74- if (deviceinfo -> type != XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), XI_TOUCHPAD , True ))
77+ display = gdk_display_get_default ();
78+ if (deviceinfo -> type != XInternAtom (GDK_DISPLAY_XDISPLAY (display ), XI_TOUCHPAD , True ))
7579 return NULL ;
7680
77- gdk_error_trap_push ( );
78- device = XOpenDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default () ), deviceinfo -> id );
79- if (gdk_error_trap_pop ( ) || (device == NULL ))
81+ gdk_x11_display_error_trap_push ( display );
82+ device = XOpenDevice (GDK_DISPLAY_XDISPLAY (display ), deviceinfo -> id );
83+ if (gdk_x11_display_error_trap_pop ( display ) || (device == NULL ))
8084 return NULL ;
8185
8286 if (device_has_property (device , "libinput Tapping Enabled" ) ||
8387 device_has_property (device , "Synaptics Off" )) {
8488 return device ;
8589 }
8690
87- XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default () ), device );
91+ XCloseDevice (GDK_DISPLAY_XDISPLAY (display ), device );
8892 return NULL ;
8993}
9094
0 commit comments