[mutter/wip/carlosg/startup-notification-fixes: 1/4] core: Fix differing sequence timestamp precision expectations



commit ab7ef5f8bf2376402dd0bfc0db26eaa656811ab8
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Apr 15 20:03:16 2019 +0200

    core: Fix differing sequence timestamp precision expectations
    
    Calculations were being done at places accounting on usec precision,
    however those are still treated as having msec precision at places. Let's
    consolidate for the latter since it requires less changes across the board
    and usec precision doesn't buy us anything here.
    
    Closes: https://gitlab.gnome.org/GNOME/mutter/issues/541

 src/core/startup-notification.c         | 8 ++++----
 src/x11/meta-startup-notification-x11.c | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/src/core/startup-notification.c b/src/core/startup-notification.c
index d2d0d1362..956238b10 100644
--- a/src/core/startup-notification.c
+++ b/src/core/startup-notification.c
@@ -37,7 +37,7 @@
  * OpenOffice or whatever seems to stop launching - people
  * might decide they need to launch it again.
  */
-#define STARTUP_TIMEOUT 15000000
+#define STARTUP_TIMEOUT_MS 15000
 
 enum
 {
@@ -425,10 +425,10 @@ collect_timed_out_foreach (void *element,
 
   meta_topic (META_DEBUG_STARTUP,
               "Sequence used %" G_GINT64_FORMAT " ms vs. %d max: %s\n",
-              elapsed, STARTUP_TIMEOUT,
+              elapsed, STARTUP_TIMEOUT_MS,
               meta_startup_sequence_get_id (sequence));
 
-  if (elapsed > STARTUP_TIMEOUT)
+  if (elapsed > STARTUP_TIMEOUT_MS)
     ctod->list = g_slist_prepend (ctod->list, sequence);
 }
 
@@ -440,7 +440,7 @@ startup_sequence_timeout (void *data)
   GSList *l;
 
   ctod.list = NULL;
-  ctod.now = g_get_monotonic_time ();
+  ctod.now = g_get_monotonic_time () / 1000;
   g_slist_foreach (sn->startup_sequences,
                    collect_timed_out_foreach,
                    &ctod);
diff --git a/src/x11/meta-startup-notification-x11.c b/src/x11/meta-startup-notification-x11.c
index d6814926a..99fcf4561 100644
--- a/src/x11/meta-startup-notification-x11.c
+++ b/src/x11/meta-startup-notification-x11.c
@@ -151,7 +151,7 @@ meta_startup_sequence_x11_new (SnStartupSequence *seq)
 {
   gint64 timestamp;
 
-  timestamp = sn_startup_sequence_get_timestamp (seq) * 1000;
+  timestamp = sn_startup_sequence_get_timestamp (seq);
   return g_object_new (META_TYPE_STARTUP_SEQUENCE_X11,
                        "id", sn_startup_sequence_get_id (seq),
                        "icon-name", sn_startup_sequence_get_icon_name (seq),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]