diff options
author | rbuj <[email protected]> | 2020-03-03 11:52:46 +0100 |
---|---|---|
committer | raveit65 <[email protected]> | 2020-03-11 13:16:41 +0100 |
commit | 8660392f4f4f94094ab68ca7920d940b51b2acc4 (patch) | |
tree | 6ca30b9e8d895de7830fd52ccc3636eebe48b17f /libslab/double-click-detector.c | |
parent | b43972d86c8dee68c5511a1b4abb2013f4d69176 (diff) | |
download | mate-control-center-8660392f4f4f94094ab68ca7920d940b51b2acc4.tar.bz2 mate-control-center-8660392f4f4f94094ab68ca7920d940b51b2acc4.tar.xz |
libslab: Remove libslab_get_current_time_millis
Diffstat (limited to 'libslab/double-click-detector.c')
-rw-r--r-- | libslab/double-click-detector.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/libslab/double-click-detector.c b/libslab/double-click-detector.c index 64ed58e8..e6874d11 100644 --- a/libslab/double-click-detector.c +++ b/libslab/double-click-detector.c @@ -26,6 +26,8 @@ G_DEFINE_TYPE (DoubleClickDetector, double_click_detector, G_TYPE_OBJECT); +void double_click_detector_update_click_time (DoubleClickDetector * detector, guint32 event_time); + static void double_click_detector_class_init (DoubleClickDetectorClass * detector_class) { @@ -41,7 +43,7 @@ double_click_detector_init (DoubleClickDetector * detector) g_object_get (G_OBJECT (settings), "gtk-double-click-time", &click_interval, NULL); - detector->double_click_time = (guint32) click_interval; + detector->double_click_time = (gint32) click_interval; detector->last_click_time = 0; } @@ -57,17 +59,17 @@ double_click_detector_is_double_click (DoubleClickDetector *this, guint32 event_ { gint32 delta; - if (event_time <= 0) - event_time = libslab_get_current_time_millis (); + if (event_time == 0) + event_time = (guint32) (g_get_monotonic_time () / 1000); /* milliseconds */ - if (this->last_click_time <= 0) { + if (this->last_click_time == 0) { if (auto_update) double_click_detector_update_click_time (this, event_time); return FALSE; } - delta = event_time - this->last_click_time; + delta = (gint32) event_time - (gint32) this->last_click_time; if (auto_update) double_click_detector_update_click_time (this, event_time); @@ -78,8 +80,8 @@ double_click_detector_is_double_click (DoubleClickDetector *this, guint32 event_ void double_click_detector_update_click_time (DoubleClickDetector *this, guint32 event_time) { - if (event_time <= 0) - event_time = libslab_get_current_time_millis (); + if (event_time == 0) + event_time = (guint32) (g_get_monotonic_time () / 1000); /* milliseconds */ this->last_click_time = event_time; } |