summaryrefslogtreecommitdiffstats
path: root/meta-xfce/recipes-xfce/xfce4-settings/xfce4-settings/touchscreen/0005-pointers-detect-a-change-of-pointer-device-used-and-.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-xfce/recipes-xfce/xfce4-settings/xfce4-settings/touchscreen/0005-pointers-detect-a-change-of-pointer-device-used-and-.patch')
-rw-r--r--meta-xfce/recipes-xfce/xfce4-settings/xfce4-settings/touchscreen/0005-pointers-detect-a-change-of-pointer-device-used-and-.patch586
1 files changed, 586 insertions, 0 deletions
diff --git a/meta-xfce/recipes-xfce/xfce4-settings/xfce4-settings/touchscreen/0005-pointers-detect-a-change-of-pointer-device-used-and-.patch b/meta-xfce/recipes-xfce/xfce4-settings/xfce4-settings/touchscreen/0005-pointers-detect-a-change-of-pointer-device-used-and-.patch
new file mode 100644
index 000000000..f4c28397d
--- /dev/null
+++ b/meta-xfce/recipes-xfce/xfce4-settings/xfce4-settings/touchscreen/0005-pointers-detect-a-change-of-pointer-device-used-and-.patch
@@ -0,0 +1,586 @@
1From 37f5e33511499d320c3035c5377425004657faa5 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@googlemail.com>
3Date: Thu, 20 Dec 2012 16:58:19 +0100
4Subject: [PATCH 5/5] pointers: detect a change of pointer-device used and set
5 "touchscreen-pointer" as found in xfconf
6MIME-Version: 1.0
7Content-Type: text/plain; charset=UTF-8
8Content-Transfer-Encoding: 8bit
9
10To detect pointer device in use the DevicePresence-, DeviceMotionNotify- and
11DeviceButtonPress-events are handled. Tests showed that by repopenning and
12closing the pointer devices (e.g when another setting was modified), the events
13stopped working. Therefore all pointer devices are opened only once and managed
14in a hash table.
15
16Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
17Upstream-Status: Submitted [1]
18[1] https://bugzilla.xfce.org/show_bug.cgi?id=9474
19---
20 xfsettingsd/pointers.c | 337 +++++++++++++++++++++++++++++++----------------
21 1 files changed, 222 insertions(+), 115 deletions(-)
22
23diff --git a/xfsettingsd/pointers.c b/xfsettingsd/pointers.c
24index 62ebc60..32662cc 100644
25--- a/xfsettingsd/pointers.c
26+++ b/xfsettingsd/pointers.c
27@@ -66,11 +66,9 @@ static void xfce_pointers_helper_channel_property_changed (XfconfCha
28 const gchar *property_name,
29 const GValue *value,
30 XfcePointersHelper *helper);
31-#ifdef DEVICE_HOTPLUGGING
32 static GdkFilterReturn xfce_pointers_helper_event_filter (GdkXEvent *xevent,
33 GdkEvent *gdk_event,
34 gpointer user_data);
35-#endif
36 static void xfce_pointers_helper_set_property (GObject *object,
37 guint prop_id,
38 const GValue *value,
39@@ -96,8 +94,11 @@ struct _XfcePointersHelper
40 GPid syndaemon_pid;
41 #endif
42
43+ GHashTable *pointer_devices;
44+ XID last_pointer_active;
45+ gint device_motion_event_type;
46+ gint device_button_press_event_type;
47 #ifdef DEVICE_HOTPLUGGING
48- /* device presence event type */
49 gint device_presence_event_type;
50 #endif
51 };
52@@ -117,6 +118,15 @@ G_DEFINE_TYPE (XfcePointersHelper, xfce_pointers_helper, G_TYPE_OBJECT);
53
54
55
56+typedef struct
57+{
58+ XDevice *device;
59+ gchar* name;
60+}
61+XfcePointerDeviceData;
62+
63+
64+
65 static void
66 xfce_pointers_helper_class_init (XfcePointersHelperClass *klass)
67 {
68@@ -147,6 +157,18 @@ xfce_pointers_helper_init (XfcePointersHelper *helper)
69
70
71 static void
72+xfce_pointers_device_close (gpointer data)
73+{
74+ XfcePointerDeviceData *device_data = data;
75+
76+ XCloseDevice (GDK_DISPLAY (), device_data->device);
77+ g_free (device_data->name);
78+ g_free (device_data);
79+}
80+
81+
82+
83+static void
84 xfce_pointers_helper_constructed (GObject *object)
85 {
86 XfcePointersHelper *helper = XFCE_POINTERS_HELPER (object);
87@@ -185,6 +207,10 @@ xfce_pointers_helper_constructed (GObject *object)
88 helper->channel = xfconf_channel_get ("pointers");
89
90 /* restore the pointer devices */
91+ helper->pointer_devices = g_hash_table_new_full (g_int_hash,
92+ g_int_equal,
93+ g_free,
94+ xfce_pointers_device_close);
95 xfce_pointers_helper_restore_devices (helper, NULL);
96
97 /* monitor the channel */
98@@ -194,21 +220,20 @@ xfce_pointers_helper_constructed (GObject *object)
99 /* launch syndaemon if required */
100 xfce_pointers_helper_syndaemon_check (helper);
101
102-#ifdef DEVICE_HOTPLUGGING
103 if (G_LIKELY (xdisplay != NULL))
104 {
105+#ifdef DEVICE_HOTPLUGGING
106 /* monitor device changes */
107 gdk_error_trap_push ();
108 DevicePresence (xdisplay, helper->device_presence_event_type, event_class);
109 XSelectExtensionEvent (xdisplay, RootWindow (xdisplay, DefaultScreen (xdisplay)), &event_class, 1);
110
111 /* add an event filter */
112- if (gdk_error_trap_pop () == 0)
113- gdk_window_add_filter (NULL, xfce_pointers_helper_event_filter, helper);
114- else
115+ if (gdk_error_trap_pop () != 0)
116 g_warning ("Failed to create device filter");
117- }
118 #endif
119+ gdk_window_add_filter (NULL, xfce_pointers_helper_event_filter, helper);
120+ }
121 }
122 }
123
124@@ -238,7 +263,10 @@ xfce_pointers_helper_set_property (GObject *object,
125 static void
126 xfce_pointers_helper_finalize (GObject *object)
127 {
128- xfce_pointers_helper_syndaemon_stop (XFCE_POINTERS_HELPER (object));
129+ XfcePointersHelper* helper = XFCE_POINTERS_HELPER (object);
130+
131+ xfce_pointers_helper_syndaemon_stop (helper);
132+ g_hash_table_destroy (helper->pointer_devices);
133
134 (*G_OBJECT_CLASS (xfce_pointers_helper_parent_class)->finalize) (object);
135 }
136@@ -267,19 +295,19 @@ static void
137 xfce_pointers_helper_syndaemon_check (XfcePointersHelper *helper)
138 {
139 #ifdef DEVICE_PROPERTIES
140- Display *xdisplay = GDK_DISPLAY ();
141- XDeviceInfo *device_list;
142- XDevice *device;
143- gint n, ndevices;
144- Atom touchpad_type;
145- Atom touchpad_off_prop;
146- Atom *props;
147- gint i, nprops;
148- gboolean have_synaptics = FALSE;
149- gdouble disable_duration;
150- gchar disable_duration_string[64];
151- gchar *args[] = { "syndaemon", "-i", disable_duration_string, "-K", "-R", NULL };
152- GError *error = NULL;
153+ Display *xdisplay = GDK_DISPLAY ();
154+ XDeviceInfo *device_list;
155+ XfcePointerDeviceData *device_data;
156+ gint n, ndevices;
157+ Atom touchpad_type;
158+ Atom touchpad_off_prop;
159+ Atom *props;
160+ gint i, nprops;
161+ gboolean have_synaptics = FALSE;
162+ gdouble disable_duration;
163+ gchar disable_duration_string[64];
164+ gchar *args[] = { "syndaemon", "-i", disable_duration_string, "-K", "-R", NULL };
165+ GError *error = NULL;
166
167 /* only stop a running daemon */
168 if (!xfconf_channel_get_bool (helper->channel, "/DisableTouchpadWhileTyping", FALSE))
169@@ -297,17 +325,16 @@ xfce_pointers_helper_syndaemon_check (XfcePointersHelper *helper)
170 if (device_list[n].type != touchpad_type)
171 continue;
172
173- gdk_error_trap_push ();
174- device = XOpenDevice (xdisplay, device_list[n].id);
175- if (gdk_error_trap_pop () != 0 || device == NULL)
176+ device_data = g_hash_table_lookup (helper->pointer_devices, &device_list[n].id);
177+ if (device_data == NULL)
178 {
179- g_critical ("Unable to open device %s", device_list[n].name);
180+ g_critical ("xfce_pointers_helper_syndaemon_check: Unable to find device %s / ID %i in hash table", device_list[n].name, device_list[n].id);
181 break;
182 }
183
184 /* look for the Synaptics Off property */
185 gdk_error_trap_push ();
186- props = XListDeviceProperties (xdisplay, device, &nprops);
187+ props = XListDeviceProperties (xdisplay, device_data->device, &nprops);
188 if (gdk_error_trap_pop () == 0
189 && props != NULL)
190 {
191@@ -317,8 +344,6 @@ xfce_pointers_helper_syndaemon_check (XfcePointersHelper *helper)
192 XFree (props);
193 }
194
195- XCloseDevice (xdisplay, device);
196-
197 if (have_synaptics)
198 break;
199 }
200@@ -844,24 +869,56 @@ xfce_pointers_helper_change_properties (gpointer key,
201
202
203 static void
204+xfce_pointers_helper_change_current_device (XfcePointersHelper *helper,
205+ XID *xid)
206+{
207+ XfcePointerDeviceData *device_data;
208+ gchar* prop;
209+ GValue bool_val = { 0, };
210+
211+ helper->last_pointer_active = *xid;
212+ device_data = g_hash_table_lookup (helper->pointer_devices, xid);
213+ if (device_data == NULL)
214+ {
215+ g_critical ("Unable to find device ID %i in hash table", *xid);
216+ return;
217+ }
218+ if (G_LIKELY (G_IS_OBJECT (helper->xsettings_helper)))
219+ {
220+ prop = g_strconcat ("/", device_data->name, "/TouchscreenPointer", NULL);
221+ g_value_init (&bool_val, G_TYPE_BOOLEAN);
222+ g_value_set_boolean (&bool_val,
223+ xfconf_channel_get_bool (helper->channel, prop, FALSE));
224+ g_object_set_property (helper->xsettings_helper, "touchscreen-pointer", &bool_val);
225+ g_value_unset (&bool_val);
226+ g_free (prop);
227+ }
228+ else
229+ g_critical ("xsettings_helper was not properly set");
230+}
231+
232+
233+static void
234 xfce_pointers_helper_restore_devices (XfcePointersHelper *helper,
235 XID *xid)
236 {
237- Display *xdisplay = GDK_DISPLAY ();
238- XDeviceInfo *device_list, *device_info;
239- gint n, ndevices;
240- XDevice *device;
241- gchar *device_name;
242- gchar prop[256];
243- gboolean right_handed;
244- gboolean reverse_scrolling;
245- gint threshold;
246- gdouble acceleration;
247+ Display *xdisplay = GDK_DISPLAY ();
248+ XDeviceInfo *device_list, *device_info;
249+ gint n, ndevices;
250+ XDevice *device;
251+ XfcePointerDeviceData *device_data;
252+ gchar *device_name;
253+ gchar prop[256];
254+ gboolean right_handed;
255+ gboolean reverse_scrolling;
256+ gint threshold;
257+ gdouble acceleration;
258+ XEventClass event_classes[2];
259 #ifdef DEVICE_PROPERTIES
260- GHashTable *props;
261- XfcePointerData pointer_data;
262+ GHashTable *props;
263+ XfcePointerData pointer_data;
264 #endif
265- const gchar *mode;
266+ const gchar *mode;
267
268 gdk_error_trap_push ();
269 device_list = XListInputDevices (xdisplay, &ndevices);
270@@ -873,84 +930,107 @@ xfce_pointers_helper_restore_devices (XfcePointersHelper *helper,
271
272 for (n = 0; n < ndevices; n++)
273 {
274- /* filter the pointer devices */
275+ /* filter the physical pointer devices */
276 device_info = &device_list[n];
277 if (device_info->use != IsXExtensionPointer
278- || device_info->name == NULL)
279+ || device_info->name == NULL
280+ || g_str_has_prefix (device_info->name, "Virtual core XTEST"))
281 continue;
282
283 /* filter out the device if one is set */
284 if (xid != NULL && device_info->id != *xid)
285 continue;
286
287- /* open the device */
288- gdk_error_trap_push ();
289- device = XOpenDevice (xdisplay, device_info->id);
290- if (gdk_error_trap_pop () != 0 || device == NULL)
291+ device_data = g_hash_table_lookup (helper->pointer_devices, &device_info->id);
292+ if (device_data == NULL)
293 {
294- g_critical ("Unable to open device %s", device_info->name);
295- continue;
296- }
297+ /* open the device and insert to hash */
298+ gdk_error_trap_push ();
299+ device = XOpenDevice (xdisplay, device_info->id);
300+ if (G_UNLIKELY(gdk_error_trap_pop () != 0 || device == NULL))
301+ {
302+ g_critical ("Unable to open device %s / ID: %i", device_info->name, device_info->id);
303+ continue;
304+ }
305
306- /* create a valid xfconf property name for the device */
307- device_name = xfce_pointers_helper_device_xfconf_name (device_info->name);
308+ /* create a valid xfconf property name for the device */
309+ device_name = xfce_pointers_helper_device_xfconf_name (device_info->name);
310
311- /* read buttonmap properties */
312- g_snprintf (prop, sizeof (prop), "/%s/RightHanded", device_name);
313- right_handed = xfconf_channel_get_bool (helper->channel, prop, -1);
314+ /* add device to our list */
315+ device_data = g_new (XfcePointerDeviceData, 1);
316+ device_data->device = device;
317+ device_data->name = device_name;
318+ g_hash_table_insert (helper->pointer_devices, g_memdup (&device_info->id, sizeof(device_info->id)), device_data);
319
320- g_snprintf (prop, sizeof (prop), "/%s/ReverseScrolling", device_name);
321- reverse_scrolling = xfconf_channel_get_bool (helper->channel, prop, -1);
322+ /* catch motion event / button-press for new device */
323+ gdk_error_trap_push ();
324+ DeviceMotionNotify (device, helper->device_motion_event_type, event_classes[0]);
325+ DeviceButtonPress (device, helper->device_button_press_event_type, event_classes[1]);
326+ XSelectExtensionEvent (xdisplay, RootWindow (xdisplay, DefaultScreen (xdisplay)), event_classes, 2);
327+ if (G_UNLIKELY (gdk_error_trap_pop () != 0))
328+ g_critical ("Unable to register DeviceButtonPress/DeviceMotionNotify for %i", device_info->id);
329
330- if (right_handed != -1 || reverse_scrolling != -1)
331- {
332- xfce_pointers_helper_change_button_mapping (device_info, device, xdisplay,
333+
334+ /* read buttonmap properties */
335+ g_snprintf (prop, sizeof (prop), "/%s/RightHanded", device_name);
336+ right_handed = xfconf_channel_get_bool (helper->channel, prop, -1);
337+
338+ g_snprintf (prop, sizeof (prop), "/%s/ReverseScrolling", device_name);
339+ reverse_scrolling = xfconf_channel_get_bool (helper->channel, prop, -1);
340+
341+ if (right_handed != -1 || reverse_scrolling != -1)
342+ {
343+ xfce_pointers_helper_change_button_mapping (device_info, device, xdisplay,
344 right_handed, reverse_scrolling);
345- }
346+ }
347
348- /* read feedback settings */
349- g_snprintf (prop, sizeof (prop), "/%s/Threshold", device_name);
350- threshold = xfconf_channel_get_int (helper->channel, prop, -1);
351+ /* read feedback settings */
352+ g_snprintf (prop, sizeof (prop), "/%s/Threshold", device_name);
353+ threshold = xfconf_channel_get_int (helper->channel, prop, -1);
354
355- g_snprintf (prop, sizeof (prop), "/%s/Acceleration", device_name);
356- acceleration = xfconf_channel_get_double (helper->channel, prop, -1.00);
357+ g_snprintf (prop, sizeof (prop), "/%s/Acceleration", device_name);
358+ acceleration = xfconf_channel_get_double (helper->channel, prop, -1.00);
359
360- if (threshold != -1 || acceleration != -1.00)
361- {
362- xfce_pointers_helper_change_feedback (device_info, device, xdisplay,
363- threshold, acceleration);
364- }
365+ if (threshold != -1 || acceleration != -1.00)
366+ {
367+ xfce_pointers_helper_change_feedback (device_info, device, xdisplay,
368+ threshold, acceleration);
369+ }
370
371- /* read mode settings */
372- g_snprintf (prop, sizeof (prop), "/%s/Mode", device_name);
373- mode = xfconf_channel_get_string (helper->channel, prop, NULL);
374+ /* read mode settings */
375+ g_snprintf (prop, sizeof (prop), "/%s/Mode", device_name);
376+ mode = xfconf_channel_get_string (helper->channel, prop, NULL);
377
378- if (mode != NULL)
379- xfce_pointers_helper_change_mode (device_info, device, xdisplay, mode);
380+ if (mode != NULL)
381+ xfce_pointers_helper_change_mode (device_info, device, xdisplay, mode);
382
383 #ifdef DEVICE_PROPERTIES
384- /* set device properties */
385- g_snprintf (prop, sizeof (prop), "/%s/Properties", device_name);
386- props = xfconf_channel_get_properties (helper->channel, prop);
387+ /* set device properties */
388+ g_snprintf (prop, sizeof (prop), "/%s/Properties", device_name);
389+ props = xfconf_channel_get_properties (helper->channel, prop);
390
391- if (props != NULL)
392- {
393- pointer_data.xdisplay = xdisplay;
394- pointer_data.device = device;
395- pointer_data.device_info = device_info;
396- pointer_data.prop_name_len = strlen (prop) + 1;
397+ if (props != NULL)
398+ {
399+ pointer_data.xdisplay = xdisplay;
400+ pointer_data.device = device;
401+ pointer_data.device_info = device_info;
402+ pointer_data.prop_name_len = strlen (prop) + 1;
403
404- g_hash_table_foreach (props, xfce_pointers_helper_change_properties, &pointer_data);
405+ g_hash_table_foreach (props, xfce_pointers_helper_change_properties, &pointer_data);
406
407- g_hash_table_destroy (props);
408- }
409+ g_hash_table_destroy (props);
410+ }
411 #endif
412-
413- g_free (device_name);
414- XCloseDevice (xdisplay, device);
415+ }
416 }
417-
418 XFreeDeviceList (device_list);
419+ if (G_LIKELY (device_data != NULL))
420+ {
421+ if (helper->last_pointer_active != device_data->device->device_id)
422+ xfce_pointers_helper_change_current_device (helper, &device_data->device->device_id);
423+ }
424+ else
425+ g_critical("no device selected in xfce_pointers_helper_restore_devices");
426 }
427
428
429@@ -961,12 +1041,12 @@ xfce_pointers_helper_channel_property_changed (XfconfChannel *channel,
430 const GValue *value,
431 XfcePointersHelper *helper)
432 {
433- Display *xdisplay = GDK_DISPLAY ();
434- XDeviceInfo *device_list, *device_info;
435- XDevice *device;
436- gint n, ndevices;
437- gchar **names;
438- gchar *device_name;
439+ Display *xdisplay = GDK_DISPLAY ();
440+ XDeviceInfo *device_list, *device_info;
441+ XfcePointerDeviceData *device_data;
442+ gint n, ndevices;
443+ gchar **names;
444+ gchar *device_name;
445
446 if (G_UNLIKELY (property_name == NULL))
447 return;
448@@ -996,63 +1076,72 @@ xfce_pointers_helper_channel_property_changed (XfconfChannel *channel,
449 /* filter the pointer devices */
450 device_info = &device_list[n];
451 if (device_info->use != IsXExtensionPointer
452- || device_info->name == NULL)
453+ || device_info->name == NULL
454+ || g_str_has_prefix (device_info->name, "Virtual core XTEST"))
455 continue;
456
457 /* search the device name */
458 device_name = xfce_pointers_helper_device_xfconf_name (device_info->name);
459 if (strcmp (names[0], device_name) == 0)
460 {
461- /* open the device */
462- gdk_error_trap_push ();
463- device = XOpenDevice (xdisplay, device_info->id);
464- if (gdk_error_trap_pop () != 0 || device == NULL)
465+ /* find the device */
466+ device_data = g_hash_table_lookup (helper->pointer_devices, &device_info->id);
467+ if (device_data == NULL)
468 {
469- g_critical ("Unable to open device %s", device_info->name);
470+ g_critical ("xfce_pointers_helper_channel_property_changed: Unable to find device %s / ID %i in hash table", device_info->name, device_info->id);
471 continue;
472 }
473
474 /* check the property that requires updating */
475 if (strcmp (names[1], "RightHanded") == 0)
476 {
477- xfce_pointers_helper_change_button_mapping (device_info, device, xdisplay,
478+ xfce_pointers_helper_change_button_mapping (device_info, device_data->device, xdisplay,
479 g_value_get_boolean (value), -1);
480 }
481 else if (strcmp (names[1], "ReverseScrolling") == 0)
482 {
483- xfce_pointers_helper_change_button_mapping (device_info, device, xdisplay,
484+ xfce_pointers_helper_change_button_mapping (device_info, device_data->device, xdisplay,
485 -1, g_value_get_boolean (value));
486 }
487 else if (strcmp (names[1], "Threshold") == 0)
488 {
489- xfce_pointers_helper_change_feedback (device_info, device, xdisplay,
490+ xfce_pointers_helper_change_feedback (device_info, device_data->device, xdisplay,
491 g_value_get_int (value), -2.00);
492 }
493 else if (strcmp (names[1], "Acceleration") == 0)
494 {
495- xfce_pointers_helper_change_feedback (device_info, device, xdisplay,
496+ xfce_pointers_helper_change_feedback (device_info, device_data->device, xdisplay,
497 -2, g_value_get_double (value));
498 }
499 #ifdef DEVICE_PROPERTIES
500 else if (strcmp (names[1], "Properties") == 0)
501 {
502- xfce_pointers_helper_change_property (device_info, device, xdisplay,
503+ xfce_pointers_helper_change_property (device_info, device_data->device, xdisplay,
504 names[2], value);
505 }
506 #endif
507 else if (strcmp (names[1], "Mode") == 0)
508 {
509- xfce_pointers_helper_change_mode (device_info, device, xdisplay,
510+ xfce_pointers_helper_change_mode (device_info, device_data->device, xdisplay,
511 g_value_get_string (value));
512 }
513+ else if (strcmp (names[1], "TouchscreenPointer") == 0)
514+ {
515+ /* only hide if the current device's property was changed */
516+ if (device_info->id == helper->last_pointer_active)
517+ {
518+ if (G_LIKELY (G_IS_OBJECT (helper->xsettings_helper)))
519+ g_object_set_property (helper->xsettings_helper, "touchscreen-pointer", value);
520+ else
521+ g_critical ("xsettings_helper was not properly set");
522+ }
523+ }
524 else
525 {
526 g_warning ("Unknown property %s set for device %s",
527 property_name, device_info->name);
528 }
529
530- XCloseDevice (xdisplay, device);
531-
532 /* stop searching */
533 n = ndevices;
534 }
535@@ -1068,26 +1157,44 @@ xfce_pointers_helper_channel_property_changed (XfconfChannel *channel,
536
537
538
539-#ifdef DEVICE_HOTPLUGGING
540 static GdkFilterReturn
541 xfce_pointers_helper_event_filter (GdkXEvent *xevent,
542 GdkEvent *gdk_event,
543 gpointer user_data)
544 {
545+ XDevicePresenceNotifyEvent *dpn_event;
546 XEvent *event = xevent;
547- XDevicePresenceNotifyEvent *dpn_event = xevent;
548 XfcePointersHelper *helper = XFCE_POINTERS_HELPER (user_data);
549
550- if (event->type == helper->device_presence_event_type)
551+ /* Comparison for device changed is done here redundantly to prevent call
552+ * on every mouse move.
553+ */
554+ if (event->type == helper->device_motion_event_type
555+ && helper->last_pointer_active != ((XDeviceMotionEvent*)xevent)->deviceid)
556+ xfce_pointers_helper_change_current_device (helper, &((XDeviceMotionEvent*)xevent)->deviceid);
557+ else if (event->type == helper->device_button_press_event_type
558+ && helper->last_pointer_active != ((XDeviceButtonEvent*)xevent)->deviceid)
559+ xfce_pointers_helper_change_current_device (helper, &((XDeviceButtonEvent*)xevent)->deviceid);
560+
561+#ifdef DEVICE_HOTPLUGGING
562+ /* handle device add/remove */
563+ else if (event->type == helper->device_presence_event_type)
564 {
565+ dpn_event = xevent;
566 /* restore device settings */
567 if (dpn_event->devchange == DeviceAdded)
568 xfce_pointers_helper_restore_devices (helper, &dpn_event->deviceid);
569+ else if(dpn_event->devchange == DeviceRemoved)
570+ /* we could try to find a remaining pointer to set that as active
571+ * one but that might not fit and as soon as the user works with
572+ * another pointer we are changing to correct one.
573+ */
574+ g_hash_table_remove (helper->pointer_devices, &dpn_event->deviceid);
575
576 /* check if we need to launch syndaemon */
577 xfce_pointers_helper_syndaemon_check (helper);
578 }
579+#endif
580
581 return GDK_FILTER_CONTINUE;
582 }
583-#endif
584--
5851.7.6.5
586