[gnome-shell] messageTray: Disable the tray dwell when the user is interacting
- From: Owen Taylor <otaylor src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] messageTray: Disable the tray dwell when the user is interacting
- Date: Fri, 14 Sep 2012 14:42:50 +0000 (UTC)
commit b1451523ca60153b50859b26f32a4a5599cb10b4
Author: Owen W. Taylor <otaylor fishsoup net>
Date: Thu Sep 6 12:02:26 2012 -0400
messageTray: Disable the tray dwell when the user is interacting
Look at the focus window's interaction timestamp to catch the case
where the user is typing and knocks the pointer into the tray or
mouses down to the bottom of the screen and clicks on something.
If the focus window's interaction time differs at the start and
end of the tray dwell then we don't activate the tray.
https://bugzilla.gnome.org/show_bug.cgi?id=683811
js/ui/messageTray.js | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index c563b8f..1b64098 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -1510,6 +1510,7 @@ const MessageTray = new Lang.Class({
pointerWatcher.addWatch(TRAY_DWELL_CHECK_INTERVAL, Lang.bind(this, this._checkTrayDwell));
this._trayDwellTimeoutId = 0;
this._trayDwelling = false;
+ this._trayDwellUserTime = 0;
},
_checkTrayDwell: function(x, y) {
@@ -1523,9 +1524,14 @@ const MessageTray = new Lang.Class({
// of the monitor. The _trayDwelling variable is used so that we only try to
// fire off one tray dwell - if it fails (because, say, the user has the mouse down),
// we don't try again until the user moves the mouse up and down again.
- if (!this._trayDwelling && !this.actor.hover && this._trayDwellTimeoutId == 0)
+ if (!this._trayDwelling && !this.actor.hover && this._trayDwellTimeoutId == 0) {
+ // Save the interaction timestamp so we can detect user input
+ let focusWindow = global.display.focus_window;
+ this._trayDwellUserTime = focusWindow ? focusWindow.user_time : 0;
+
this._trayDwellTimeoutId = Mainloop.timeout_add(TRAY_DWELL_TIME,
Lang.bind(this, this._trayDwellTimeout));
+ }
this._trayDwelling = true;
} else {
this._cancelTrayDwell();
@@ -1541,6 +1547,13 @@ const MessageTray = new Lang.Class({
},
_trayDwellTimeout: function() {
+ // If the user interacted with the focus window since we started the tray
+ // dwell (by clicking or typing), don't activate the message tray
+ let focusWindow = global.display.focus_window;
+ let currentUserTime = focusWindow ? focusWindow.user_time : 0;
+ if (currentUserTime != this._trayDwellUserTime)
+ return false;
+
this._trayDwellTimeoutId = 0;
this._traySummoned = true;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]