From 11a6c1b3336c11a83aaba938396d5013888cc4e5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
Date: Mon, 15 Jan 2018 15:36:44 +0100
Subject: [PATCH] overview: Use monotonic time to check for consecutive
 activations

We don't toggle the overview if the request happens too close to the
last activation, to filter out double-clicks or activation by both
the hot corner and a click. However as the check is based on the
real time, the check breaks if the system clock moves backwards and
the last activations appears to be in the future. Fix this by using
monotonic time which is guaranteed to only move forward.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=763886
Bug-Tails: https://labs.riseup.net/code/issues/14250
---
 js/ui/overview.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/js/ui/overview.js
+++ b/js/ui/overview.js
@@ -483,7 +483,7 @@
             return false;
         if (this._inDrag)
             return false;
-        if (this._activationTime == 0 || Date.now() / 1000 - this._activationTime > OVERVIEW_ACTIVATION_TIMEOUT)
+        if (this._activationTime == 0 || GLib.get_monotonic_time() - this._activationTime > OVERVIEW_ACTIVATION_TIMEOUT)
             return true;
         return false;
     },
@@ -542,7 +542,7 @@
         this.visible = true;
         this.animationInProgress = true;
         this.visibleTarget = true;
-        this._activationTime = Date.now() / 1000;
+        this._activationTime = GLib.get_monotonic_time();
 
         Meta.disable_unredirect_for_screen(global.screen);
         this.viewSelector.show();
