summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2014-11-28 14:12:49 -0500
committerMatthias Clasen <mclasen@redhat.com>2014-11-28 14:28:50 -0500
commit426d6e8241ce44823d21267526eb83a6d0609908 (patch)
tree1496ac6718e757d332f7830c0fe51b068f108a5f
parent7359a9daec2cf99826b0d19cd65d195e9fd8249e (diff)
downloadgtk+-overlay-heuristics.tar.gz
Track only motionoverlay-heuristics
The fact that the buttons right above the touchpad actually report events for the trackpoint puts a wrench into the current device tracking idea. I always use those buttons together with the touchpad, so I constantly change the current device between touchpad and trackpoint, which ruins the experience. To overcome this problem, use only motion events for the current tracking, eliminating the problem, but making this tracking less generally useful. It is really tailored towards overlay scrolling now.
-rw-r--r--gdk/gdkdevice.c12
-rw-r--r--gdk/gdkdevice.h2
-rw-r--r--gdk/gdkdevicemanager.c9
-rw-r--r--gdk/gdkdeviceprivate.h4
-rw-r--r--gdk/gdkevents.c5
5 files changed, 20 insertions, 12 deletions
diff --git a/gdk/gdkdevice.c b/gdk/gdkdevice.c
index d8b66f1a83..6c3832262b 100644
--- a/gdk/gdkdevice.c
+++ b/gdk/gdkdevice.c
@@ -1760,18 +1760,18 @@ gdk_device_get_last_event_window (GdkDevice *device)
}
/**
- * gdk_device_get_time:
+ * gdk_device_get_motion_time:
* @device: a #GdkDevice
*
- * Returns the timestamp of the last event involving this device that GDK has
- * received.
+ * Returns the timestamp of the last motion event involving this device
+ * that GDK has received.
*
* Returns: the timestamp of the last event for this device
*
* Since: 3.16
*/
guint32
-gdk_device_get_time (GdkDevice *device)
+gdk_device_get_motion_time (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), 0);
@@ -1779,8 +1779,8 @@ gdk_device_get_time (GdkDevice *device)
}
void
-_gdk_device_set_time (GdkDevice *device,
- guint32 time)
+_gdk_device_set_motion_time (GdkDevice *device,
+ guint32 time)
{
if (time > device->time)
{
diff --git a/gdk/gdkdevice.h b/gdk/gdkdevice.h
index 8e238ed8be..b46cc55be9 100644
--- a/gdk/gdkdevice.h
+++ b/gdk/gdkdevice.h
@@ -275,7 +275,7 @@ GDK_AVAILABLE_IN_3_12
GdkWindow *gdk_device_get_last_event_window (GdkDevice *device);
GDK_AVAILABLE_IN_3_16
-guint32 gdk_device_get_time (GdkDevice *device);
+guint32 gdk_device_get_motion_time (GdkDevice *device);
G_END_DECLS
diff --git a/gdk/gdkdevicemanager.c b/gdk/gdkdevicemanager.c
index e7e16b546e..02a6396461 100644
--- a/gdk/gdkdevicemanager.c
+++ b/gdk/gdkdevicemanager.c
@@ -186,6 +186,13 @@ gdk_device_manager_class_init (GdkDeviceManagerClass *klass)
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
+ /**
+ * GdkDeviceManager:current-device:
+ *
+ * The device that we have most recently seen a motion event for.
+ *
+ * Since: 3.16
+ */
g_object_class_install_property (object_class,
PROP_CURRENT_DEVICE,
g_param_spec_object ("current-device",
@@ -383,7 +390,7 @@ _gdk_device_manager_update_current_device (GdkDeviceManager *device_manager,
if (device_manager->current_device == NULL ||
device == NULL ||
- gdk_device_get_time (device) >= gdk_device_get_time (device_manager->current_device))
+ gdk_device_get_motion_time (device) >= gdk_device_get_motion_time (device_manager->current_device))
{
device_manager->current_device = device;
g_object_notify (G_OBJECT (device_manager), "current-device");
diff --git a/gdk/gdkdeviceprivate.h b/gdk/gdkdeviceprivate.h
index 53a9cbb2cb..53dc16142a 100644
--- a/gdk/gdkdeviceprivate.h
+++ b/gdk/gdkdeviceprivate.h
@@ -174,8 +174,8 @@ GdkWindow * _gdk_device_window_at_position (GdkDevice *device,
GdkModifierType *mask,
gboolean get_toplevel);
-void _gdk_device_set_time (GdkDevice *device,
- guint32 time);
+void _gdk_device_set_motion_time (GdkDevice *device,
+ guint32 time);
G_END_DECLS
diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c
index 00ca18a7a7..0430f376e8 100644
--- a/gdk/gdkevents.c
+++ b/gdk/gdkevents.c
@@ -1482,6 +1482,7 @@ gdk_event_set_device (GdkEvent *event,
{
case GDK_MOTION_NOTIFY:
event->motion.device = device;
+ _gdk_device_set_motion_time (device, gdk_event_get_time (event));
break;
case GDK_BUTTON_PRESS:
case GDK_2BUTTON_PRESS:
@@ -1505,7 +1506,6 @@ gdk_event_set_device (GdkEvent *event,
default:
break;
}
- _gdk_device_set_time (device, gdk_event_get_time (event));
}
/**
@@ -1631,7 +1631,8 @@ gdk_event_set_source_device (GdkEvent *event,
private = (GdkEventPrivate *) event;
private->source_device = device;
- _gdk_device_set_time (device, gdk_event_get_time (event));
+ if (event->type == GDK_MOTION_NOTIFY)
+ _gdk_device_set_motion_time (device, gdk_event_get_time (event));
}
/**