[gimp/gtk3-port: 177/226] app: when checking for a device change, check the event's source device
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gtk3-port: 177/226] app: when checking for a device change, check the event's source device
- Date: Mon, 21 Jul 2014 00:59:23 +0000 (UTC)
commit 077797858b25e90c58b4c90009b1d52fe103b3a6
Author: Michael Natterer <mitch gimp org>
Date: Sun Feb 6 13:34:53 2011 +0100
app: when checking for a device change, check the event's source device
because the events we receive always come from either master or
floating devices, but never from a slave source device.
app/widgets/gimpdevices.c | 42 +++++++++++++++---------------------------
1 files changed, 15 insertions(+), 27 deletions(-)
---
diff --git a/app/widgets/gimpdevices.c b/app/widgets/gimpdevices.c
index 8699c18..61f5a0a 100644
--- a/app/widgets/gimpdevices.c
+++ b/app/widgets/gimpdevices.c
@@ -267,36 +267,24 @@ gimp_devices_check_change (Gimp *gimp,
g_return_val_if_fail (GIMP_IS_DEVICE_MANAGER (manager), FALSE);
- switch (event->type)
- {
- case GDK_MOTION_NOTIFY:
- device = ((GdkEventMotion *) event)->device;
- break;
-
- case GDK_BUTTON_PRESS:
- case GDK_2BUTTON_PRESS:
- case GDK_3BUTTON_PRESS:
- case GDK_BUTTON_RELEASE:
- device = ((GdkEventButton *) event)->device;
- break;
-
- case GDK_PROXIMITY_IN:
- case GDK_PROXIMITY_OUT:
- device = ((GdkEventProximity *) event)->device;
- break;
-
- case GDK_SCROLL:
- device = ((GdkEventScroll *) event)->device;
- break;
-
- default:
- device = gimp_device_manager_get_current_device (manager)->device;
- break;
- }
+ device = gdk_event_get_source_device (event);
+
+ if (! device)
+ device = gimp_device_manager_get_current_device (manager)->device;
device_info = gimp_device_info_get_by_device (device);
- if (device_info != gimp_device_manager_get_current_device (manager))
+ if (! device_info)
+ {
+ device = gdk_event_get_device (event);
+
+ if (! device)
+ device = gimp_device_manager_get_current_device (manager)->device;
+
+ device_info = gimp_device_info_get_by_device (device);
+ }
+
+ if (device_info && device_info != gimp_device_manager_get_current_device (manager))
{
gimp_device_manager_set_current_device (manager, device_info);
return TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]