[gnome-shell] [AppSwitcher] deal with the user releasing Alt before we get the grab
- From: Dan Winship <danw src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-shell] [AppSwitcher] deal with the user releasing Alt before we get the grab
- Date: Tue, 29 Sep 2009 14:07:48 +0000 (UTC)
commit 373fa3c3250f4309ebee9e384200c14211edbf6c
Author: Dan Winship <danw gnome org>
Date: Mon Sep 28 23:31:54 2009 -0400
[AppSwitcher] deal with the user releasing Alt before we get the grab
Previously mutter was doing this for us, but now we need to do it
ourselves.
https://bugzilla.gnome.org/show_bug.cgi?id=596695
js/ui/altTab.js | 26 +++++++++++++++++++++-----
1 files changed, 21 insertions(+), 5 deletions(-)
---
diff --git a/js/ui/altTab.js b/js/ui/altTab.js
index c49d470..beba052 100644
--- a/js/ui/altTab.js
+++ b/js/ui/altTab.js
@@ -2,6 +2,7 @@
const Big = imports.gi.Big;
const Clutter = imports.gi.Clutter;
+const Gdk = imports.gi.Gdk;
const Lang = imports.lang;
const Meta = imports.gi.Meta;
const Pango = imports.gi.Pango;
@@ -117,6 +118,18 @@ AltTabPopup.prototype = {
this.actor.y = Math.floor((global.screen_height - this.actor.height) / 2);
this._updateSelection(initialSelection);
+
+ // There's a race condition; if the user released Alt before
+ // we got the grab, then we won't be notified. (See
+ // https://bugzilla.gnome.org/show_bug.cgi?id=596695 for
+ // details.) So we check now. (Have to do this after calling
+ // _updateSelection.)
+ let [screen, x, y, mods] = Gdk.Display.get_default().get_pointer();
+ if (!(mods & Gdk.ModifierType.MOD1_MASK)) {
+ this._finish();
+ return false;
+ }
+
return true;
},
@@ -161,11 +174,8 @@ AltTabPopup.prototype = {
_keyReleaseEvent : function(actor, event) {
let keysym = event.get_key_symbol();
- if (keysym == Clutter.Alt_L || keysym == Clutter.Alt_R) {
- if (this._highlightedWindow)
- Main.activateWindow(this._highlightedWindow, event.get_time());
- this.destroy();
- }
+ if (keysym == Clutter.Alt_L || keysym == Clutter.Alt_R)
+ this._finish();
return true;
},
@@ -209,6 +219,12 @@ AltTabPopup.prototype = {
this._updateSelection(index - this._selected);
},
+ _finish : function() {
+ if (this._highlightedWindow)
+ Main.activateWindow(this._highlightedWindow);
+ this.destroy();
+ },
+
destroy : function() {
this.actor.destroy();
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]