[gtk+/overlay-heuristics: 5/8] overlay scrolling: Use device timestamps in heuristics
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/overlay-heuristics: 5/8] overlay scrolling: Use device timestamps in heuristics
- Date: Fri, 28 Nov 2014 19:30:07 +0000 (UTC)
commit 0851e8d47e067ab34a7f8480fd8427d8ea79eab2
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Nov 28 12:31:11 2014 -0500
overlay scrolling: Use device timestamps in heuristics
Use the device timestamps when determining whether to show overlay
scrollbars or not. This lets us treat trackpoints like mice, without
enforcing traditional scrollbars for thinkpad users who never use
the trackpoint.
gtk/gtkscrolledwindow.c | 22 ++++++++++------------
1 files changed, 10 insertions(+), 12 deletions(-)
---
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index 86a53d7..be74fda 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -3649,9 +3649,11 @@ device_manager_has_mouse (GdkDeviceManager *dm)
GdkDevice *cp;
GList *slaves, *s;
GdkDevice *device;
- gboolean found;
+ guint32 mouse_time;
+ guint32 other_time;
- found = FALSE;
+ mouse_time = 0;
+ other_time = 0;
cp = gdk_device_manager_get_client_pointer (dm);
slaves = gdk_device_list_slave_devices (cp);
@@ -3659,24 +3661,20 @@ device_manager_has_mouse (GdkDeviceManager *dm)
{
device = s->data;
- if (gdk_device_get_source (device) != GDK_SOURCE_MOUSE)
+ if (g_object_get_data (G_OBJECT (device), "removed"))
continue;
if (strstr (gdk_device_get_name (device), "XTEST"))
continue;
- if (strstr (gdk_device_get_name (device), "TrackPoint"))
- continue;
-
- if (g_object_get_data (G_OBJECT (device), "removed"))
- continue;
-
- found = TRUE;
- break;
+ if (gdk_device_get_source (device) == GDK_SOURCE_MOUSE)
+ mouse_time = MAX (mouse_time, gdk_device_get_time (device));
+ else
+ other_time = MAX (other_time, gdk_device_get_time (device));
}
g_list_free (slaves);
- return found;
+ return mouse_time > other_time;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]