summaryrefslogtreecommitdiff
path: root/libslab
diff options
context:
space:
mode:
authorrbuj <[email protected]>2020-03-03 11:52:46 +0100
committerraveit65 <[email protected]>2020-03-11 13:16:41 +0100
commit8660392f4f4f94094ab68ca7920d940b51b2acc4 (patch)
tree6ca30b9e8d895de7830fd52ccc3636eebe48b17f /libslab
parentb43972d86c8dee68c5511a1b4abb2013f4d69176 (diff)
downloadmate-control-center-8660392f4f4f94094ab68ca7920d940b51b2acc4.tar.bz2
mate-control-center-8660392f4f4f94094ab68ca7920d940b51b2acc4.tar.xz
libslab: Remove libslab_get_current_time_millis
Diffstat (limited to 'libslab')
-rw-r--r--libslab/double-click-detector.c16
-rw-r--r--libslab/double-click-detector.h4
-rw-r--r--libslab/libslab-utils.c10
-rw-r--r--libslab/libslab-utils.h1
4 files changed, 10 insertions, 21 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;
}
diff --git a/libslab/double-click-detector.h b/libslab/double-click-detector.h
index 06217b1c..57a0a7a2 100644
--- a/libslab/double-click-detector.h
+++ b/libslab/double-click-detector.h
@@ -38,7 +38,7 @@ typedef struct
{
GObject parent_placeholder;
- guint32 double_click_time;
+ gint32 double_click_time;
guint32 last_click_time;
} DoubleClickDetector;
@@ -54,8 +54,6 @@ DoubleClickDetector *double_click_detector_new (void);
gboolean double_click_detector_is_double_click (DoubleClickDetector * detector, guint32 event_time,
gboolean auto_update);
-void double_click_detector_update_click_time (DoubleClickDetector * detector, guint32 event_time);
-
#ifdef __cplusplus
}
#endif
diff --git a/libslab/libslab-utils.c b/libslab/libslab-utils.c
index fc380719..67a47d31 100644
--- a/libslab/libslab-utils.c
+++ b/libslab/libslab-utils.c
@@ -93,16 +93,6 @@ libslab_get_current_screen (void)
return screen;
}
-guint32
-libslab_get_current_time_millis ()
-{
- GTimeVal t_curr;
-
- g_get_current_time (& t_curr);
-
- return 1000L * t_curr.tv_sec + t_curr.tv_usec / 1000L;
-}
-
gint
libslab_strcmp (const gchar *a, const gchar *b)
{
diff --git a/libslab/libslab-utils.h b/libslab/libslab-utils.h
index ce2138ec..ecb2ff6d 100644
--- a/libslab/libslab-utils.h
+++ b/libslab/libslab-utils.h
@@ -10,7 +10,6 @@ extern "C" {
#endif
MateDesktopItem *libslab_mate_desktop_item_new_from_unknown_id (const gchar *id);
-guint32 libslab_get_current_time_millis (void);
gint libslab_strcmp (const gchar *a, const gchar *b);
void libslab_handle_g_error (GError **error, const gchar *msg_format, ...);