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-.patch589
1 files changed, 589 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..3c9b3dad9
--- /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,589 @@
1From 78353322ce1070ee1fd7bb5367e2c4dd43928f42 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 | 342 ++++++++++++++++++++++++++++++++-----------------
21 1 file changed, 225 insertions(+), 117 deletions(-)
22
23diff --git a/xfsettingsd/pointers.c b/xfsettingsd/pointers.c
24index cfa56e2..41c8bba 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@@ -299,17 +327,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@@ -319,8 +346,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@@ -847,24 +872,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@@ -874,86 +931,110 @@ xfce_pointers_helper_restore_devices (XfcePointersHelper *helper,
271 return;
272 }
273
274+ device_data = NULL;
275 for (n = 0; n < ndevices; n++)
276 {
277- /* filter the pointer devices */
278+ /* filter the physical pointer devices */
279 device_info = &device_list[n];
280 if (device_info->use != IsXExtensionPointer
281- || device_info->name == NULL)
282+ || device_info->name == NULL
283+ || g_str_has_prefix (device_info->name, "Virtual core XTEST"))
284 continue;
285
286 /* filter out the device if one is set */
287 if (xid != NULL && device_info->id != *xid)
288 continue;
289
290- /* open the device */
291- gdk_error_trap_push ();
292- device = XOpenDevice (xdisplay, device_info->id);
293- if (gdk_error_trap_pop () != 0 || device == NULL)
294+ device_data = g_hash_table_lookup (helper->pointer_devices, &device_info->id);
295+ if (device_data == NULL)
296 {
297- g_critical ("Unable to open device %s", device_info->name);
298- continue;
299- }
300+ /* open the device and insert to hash */
301+ gdk_error_trap_push ();
302+ device = XOpenDevice (xdisplay, device_info->id);
303+ if (G_UNLIKELY(gdk_error_trap_pop () != 0 || device == NULL))
304+ {
305+ g_critical ("Unable to open device %s / ID: %i", device_info->name, device_info->id);
306+ continue;
307+ }
308
309- /* create a valid xfconf property name for the device */
310- device_name = xfce_pointers_helper_device_xfconf_name (device_info->name);
311+ /* create a valid xfconf property name for the device */
312+ device_name = xfce_pointers_helper_device_xfconf_name (device_info->name);
313
314- /* read buttonmap properties */
315- g_snprintf (prop, sizeof (prop), "/%s/RightHanded", device_name);
316- right_handed = xfconf_channel_get_bool (helper->channel, prop, -1);
317+ /* add device to our list */
318+ device_data = g_new (XfcePointerDeviceData, 1);
319+ device_data->device = device;
320+ device_data->name = device_name;
321+ g_hash_table_insert (helper->pointer_devices, g_memdup (&device_info->id, sizeof(device_info->id)), device_data);
322
323- g_snprintf (prop, sizeof (prop), "/%s/ReverseScrolling", device_name);
324- reverse_scrolling = xfconf_channel_get_bool (helper->channel, prop, -1);
325+ /* catch motion event / button-press for new device */
326+ gdk_error_trap_push ();
327+ DeviceMotionNotify (device, helper->device_motion_event_type, event_classes[0]);
328+ DeviceButtonPress (device, helper->device_button_press_event_type, event_classes[1]);
329+ XSelectExtensionEvent (xdisplay, RootWindow (xdisplay, DefaultScreen (xdisplay)), event_classes, 2);
330+ if (G_UNLIKELY (gdk_error_trap_pop () != 0))
331+ g_critical ("Unable to register DeviceButtonPress/DeviceMotionNotify for %i", device_info->id);
332
333- if (right_handed != -1 || reverse_scrolling != -1)
334- {
335- xfce_pointers_helper_change_button_mapping (device_info, device, xdisplay,
336+
337+ /* read buttonmap properties */
338+ g_snprintf (prop, sizeof (prop), "/%s/RightHanded", device_name);
339+ right_handed = xfconf_channel_get_bool (helper->channel, prop, -1);
340+
341+ g_snprintf (prop, sizeof (prop), "/%s/ReverseScrolling", device_name);
342+ reverse_scrolling = xfconf_channel_get_bool (helper->channel, prop, -1);
343+
344+ if (right_handed != -1 || reverse_scrolling != -1)
345+ {
346+ xfce_pointers_helper_change_button_mapping (device_info, device, xdisplay,
347 right_handed, reverse_scrolling);
348- }
349+ }
350
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+ /* read feedback settings */
355+ g_snprintf (prop, sizeof (prop), "/%s/Threshold", device_name);
356+ threshold = xfconf_channel_get_int (helper->channel, prop, -1);
357
358- g_snprintf (prop, sizeof (prop), "/%s/Acceleration", device_name);
359- acceleration = xfconf_channel_get_double (helper->channel, prop, -1.00);
360+ g_snprintf (prop, sizeof (prop), "/%s/Acceleration", device_name);
361+ acceleration = xfconf_channel_get_double (helper->channel, prop, -1.00);
362
363- if (threshold != -1 || acceleration != -1.00)
364- {
365- xfce_pointers_helper_change_feedback (device_info, device, xdisplay,
366- threshold, acceleration);
367- }
368+ if (threshold != -1 || acceleration != -1.00)
369+ {
370+ xfce_pointers_helper_change_feedback (device_info, device, xdisplay,
371+ threshold, acceleration);
372+ }
373
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+ /* read mode settings */
378+ g_snprintf (prop, sizeof (prop), "/%s/Mode", device_name);
379+ mode = xfconf_channel_get_string (helper->channel, prop, NULL);
380
381- if (mode != NULL)
382- xfce_pointers_helper_change_mode (device_info, device, xdisplay, mode);
383+ if (mode != NULL)
384+ xfce_pointers_helper_change_mode (device_info, device, xdisplay, mode);
385
386 #ifdef DEVICE_PROPERTIES
387- /* set device properties */
388- g_snprintf (prop, sizeof (prop), "/%s/Properties", device_name);
389- props = xfconf_channel_get_properties (helper->channel, prop);
390+ /* set device properties */
391+ g_snprintf (prop, sizeof (prop), "/%s/Properties", device_name);
392+ props = xfconf_channel_get_properties (helper->channel, prop);
393
394- if (props != NULL)
395- {
396- pointer_data.xdisplay = xdisplay;
397- pointer_data.device = device;
398- pointer_data.device_info = device_info;
399- pointer_data.prop_name_len = strlen (prop) + 1;
400+ if (props != NULL)
401+ {
402+ pointer_data.xdisplay = xdisplay;
403+ pointer_data.device = device;
404+ pointer_data.device_info = device_info;
405+ pointer_data.prop_name_len = strlen (prop) + 1;
406
407- g_hash_table_foreach (props, xfce_pointers_helper_change_properties, &pointer_data);
408+ g_hash_table_foreach (props, xfce_pointers_helper_change_properties, &pointer_data);
409
410- g_hash_table_destroy (props);
411- }
412+ g_hash_table_destroy (props);
413+ }
414 #endif
415-
416- g_free (device_name);
417- XCloseDevice (xdisplay, device);
418+ }
419 }
420-
421 XFreeDeviceList (device_list);
422+ if (G_LIKELY (device_data != NULL))
423+ {
424+ if (helper->last_pointer_active != device_data->device->device_id)
425+ xfce_pointers_helper_change_current_device (helper, &device_data->device->device_id);
426+ }
427+ else
428+ g_critical("no device selected in xfce_pointers_helper_restore_devices");
429 }
430
431
432@@ -964,12 +1045,12 @@ xfce_pointers_helper_channel_property_changed (XfconfChannel *channel,
433 const GValue *value,
434 XfcePointersHelper *helper)
435 {
436- Display *xdisplay = GDK_DISPLAY ();
437- XDeviceInfo *device_list, *device_info;
438- XDevice *device;
439- gint n, ndevices;
440- gchar **names;
441- gchar *device_name;
442+ Display *xdisplay = GDK_DISPLAY ();
443+ XDeviceInfo *device_list, *device_info;
444+ XfcePointerDeviceData *device_data;
445+ gint n, ndevices;
446+ gchar **names;
447+ gchar *device_name;
448
449 if (G_UNLIKELY (property_name == NULL))
450 return;
451@@ -1000,63 +1081,72 @@ xfce_pointers_helper_channel_property_changed (XfconfChannel *channel,
452 /* filter the pointer devices */
453 device_info = &device_list[n];
454 if (device_info->use != IsXExtensionPointer
455- || device_info->name == NULL)
456+ || device_info->name == NULL
457+ || g_str_has_prefix (device_info->name, "Virtual core XTEST"))
458 continue;
459
460 /* search the device name */
461 device_name = xfce_pointers_helper_device_xfconf_name (device_info->name);
462 if (strcmp (names[0], device_name) == 0)
463 {
464- /* open the device */
465- gdk_error_trap_push ();
466- device = XOpenDevice (xdisplay, device_info->id);
467- if (gdk_error_trap_pop () != 0 || device == NULL)
468+ /* find the device */
469+ device_data = g_hash_table_lookup (helper->pointer_devices, &device_info->id);
470+ if (device_data == NULL)
471 {
472- g_critical ("Unable to open device %s", device_info->name);
473+ g_critical ("xfce_pointers_helper_channel_property_changed: Unable to find device %s / ID %i in hash table", device_info->name, device_info->id);
474 continue;
475 }
476
477 /* check the property that requires updating */
478 if (strcmp (names[1], "RightHanded") == 0)
479 {
480- xfce_pointers_helper_change_button_mapping (device_info, device, xdisplay,
481+ xfce_pointers_helper_change_button_mapping (device_info, device_data->device, xdisplay,
482 g_value_get_boolean (value), -1);
483 }
484 else if (strcmp (names[1], "ReverseScrolling") == 0)
485 {
486- xfce_pointers_helper_change_button_mapping (device_info, device, xdisplay,
487+ xfce_pointers_helper_change_button_mapping (device_info, device_data->device, xdisplay,
488 -1, g_value_get_boolean (value));
489 }
490 else if (strcmp (names[1], "Threshold") == 0)
491 {
492- xfce_pointers_helper_change_feedback (device_info, device, xdisplay,
493+ xfce_pointers_helper_change_feedback (device_info, device_data->device, xdisplay,
494 g_value_get_int (value), -2.00);
495 }
496 else if (strcmp (names[1], "Acceleration") == 0)
497 {
498- xfce_pointers_helper_change_feedback (device_info, device, xdisplay,
499+ xfce_pointers_helper_change_feedback (device_info, device_data->device, xdisplay,
500 -2, g_value_get_double (value));
501 }
502 #ifdef DEVICE_PROPERTIES
503 else if (strcmp (names[1], "Properties") == 0)
504 {
505- xfce_pointers_helper_change_property (device_info, device, xdisplay,
506+ xfce_pointers_helper_change_property (device_info, device_data->device, xdisplay,
507 names[2], value);
508 }
509 #endif
510 else if (strcmp (names[1], "Mode") == 0)
511 {
512- xfce_pointers_helper_change_mode (device_info, device, xdisplay,
513+ xfce_pointers_helper_change_mode (device_info, device_data->device, xdisplay,
514 g_value_get_string (value));
515 }
516+ else if (strcmp (names[1], "TouchscreenPointer") == 0)
517+ {
518+ /* only hide if the current device's property was changed */
519+ if (device_info->id == helper->last_pointer_active)
520+ {
521+ if (G_LIKELY (G_IS_OBJECT (helper->xsettings_helper)))
522+ g_object_set_property (helper->xsettings_helper, "touchscreen-pointer", value);
523+ else
524+ g_critical ("xsettings_helper was not properly set");
525+ }
526+ }
527 else
528 {
529 g_warning ("Unknown property %s set for device %s",
530 property_name, device_info->name);
531 }
532
533- XCloseDevice (xdisplay, device);
534-
535 /* stop searching */
536 n = ndevices;
537 }
538@@ -1072,26 +1162,44 @@ xfce_pointers_helper_channel_property_changed (XfconfChannel *channel,
539
540
541
542-#ifdef DEVICE_HOTPLUGGING
543 static GdkFilterReturn
544 xfce_pointers_helper_event_filter (GdkXEvent *xevent,
545 GdkEvent *gdk_event,
546 gpointer user_data)
547 {
548+ XDevicePresenceNotifyEvent *dpn_event;
549 XEvent *event = xevent;
550- XDevicePresenceNotifyEvent *dpn_event = xevent;
551 XfcePointersHelper *helper = XFCE_POINTERS_HELPER (user_data);
552
553- if (event->type == helper->device_presence_event_type)
554+ /* Comparison for device changed is done here redundantly to prevent call
555+ * on every mouse move.
556+ */
557+ if (event->type == helper->device_motion_event_type
558+ && helper->last_pointer_active != ((XDeviceMotionEvent*)xevent)->deviceid)
559+ xfce_pointers_helper_change_current_device (helper, &((XDeviceMotionEvent*)xevent)->deviceid);
560+ else if (event->type == helper->device_button_press_event_type
561+ && helper->last_pointer_active != ((XDeviceButtonEvent*)xevent)->deviceid)
562+ xfce_pointers_helper_change_current_device (helper, &((XDeviceButtonEvent*)xevent)->deviceid);
563+
564+#ifdef DEVICE_HOTPLUGGING
565+ /* handle device add/remove */
566+ else if (event->type == helper->device_presence_event_type)
567 {
568+ dpn_event = xevent;
569 /* restore device settings */
570 if (dpn_event->devchange == DeviceAdded)
571 xfce_pointers_helper_restore_devices (helper, &dpn_event->deviceid);
572+ else if(dpn_event->devchange == DeviceRemoved)
573+ /* we could try to find a remaining pointer to set that as active
574+ * one but that might not fit and as soon as the user works with
575+ * another pointer we are changing to correct one.
576+ */
577+ g_hash_table_remove (helper->pointer_devices, &dpn_event->deviceid);
578
579 /* check if we need to launch syndaemon */
580 xfce_pointers_helper_syndaemon_check (helper);
581 }
582+#endif
583
584 return GDK_FILTER_CONTINUE;
585 }
586-#endif
587--
5881.8.3.1
589