[gnome-shell/wip/fmuellner/delorian-overview: 40/40] overview: Use monotonic time to check for consecutive activations
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/fmuellner/delorian-overview: 40/40] overview: Use monotonic time to check for consecutive activations
- Date: Fri, 13 Apr 2018 09:14:30 +0000 (UTC)
commit e00f22ebe642d07bd1ab003f9b68105d8da25ed8
Author: Florian Müllner <fmuellner gnome org>
Date: Mon Jan 15 15:36:44 2018 +0100
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.
https://bugzilla.gnome.org/show_bug.cgi?id=763886
js/ui/overview.js | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/overview.js b/js/ui/overview.js
index 3d8d76b57..224057640 100644
--- a/js/ui/overview.js
+++ b/js/ui/overview.js
@@ -488,7 +488,8 @@ var Overview = new Lang.Class({
return false;
if (this._inItemDrag || this._inWindowDrag)
return false;
- if (this._activationTime == 0 || Date.now() / 1000 - this._activationTime >
OVERVIEW_ACTIVATION_TIMEOUT)
+ if (this._activationTime == 0 ||
+ GLib.get_monotonic_time() / GLib.USEC_PER_SEC - this._activationTime >
OVERVIEW_ACTIVATION_TIMEOUT)
return true;
return false;
},
@@ -547,7 +548,7 @@ var Overview = new Lang.Class({
this.visible = true;
this.animationInProgress = true;
this.visibleTarget = true;
- this._activationTime = Date.now() / 1000;
+ this._activationTime = GLib.get_monotonic_time() / GLib.USEC_PER_SEC;
Meta.disable_unredirect_for_screen(global.screen);
this.viewSelector.show();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]