[gnome-shell] modalDialog: Fix auto-completion of prompts immediately upon display
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] modalDialog: Fix auto-completion of prompts immediately upon display
- Date: Mon, 4 Mar 2013 08:38:40 +0000 (UTC)
commit 7b705dd6703973880472c741ad127c5684b1b036
Author: Stef Walter <stefw gnome org>
Date: Wed Feb 13 21:57:02 2013 +0100
modalDialog: Fix auto-completion of prompts immediately upon display
Shell modal dialogs can take their action on a certain key's
key-release-event. For example on <enter> the affirmative action is
usually run.
Make sure that the key was also pressed on the dialog and we're not
seeing a spurious key-release-event from a key that was pressed before
the dialog was displayed.
https://bugzilla.gnome.org/show_bug.cgi?id=692937
js/ui/modalDialog.js | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/modalDialog.js b/js/ui/modalDialog.js
index 5c20b08..304733e 100644
--- a/js/ui/modalDialog.js
+++ b/js/ui/modalDialog.js
@@ -58,7 +58,9 @@ const ModalDialog = new Lang.Class({
this._group.connect('destroy', Lang.bind(this, this._onGroupDestroy));
+ this._pressedKey = null;
this._buttonKeys = {};
+ this._group.connect('key-press-event', Lang.bind(this, this._onKeyPressEvent));
this._group.connect('key-release-event', Lang.bind(this, this._onKeyReleaseEvent));
this._backgroundBin = new St.Bin();
@@ -179,10 +181,19 @@ const ModalDialog = new Lang.Class({
return button;
},
+ _onKeyPressEvent: function(object, event) {
+ this._pressedKey = event.get_key_symbol();
+ },
+
_onKeyReleaseEvent: function(object, event) {
+ let pressedKey = this._pressedKey;
+ this._pressedKey = null;
+
let symbol = event.get_key_symbol();
- let buttonInfo = this._buttonKeys[symbol];
+ if (symbol != pressedKey)
+ return false;
+ let buttonInfo = this._buttonKeys[symbol];
if (!buttonInfo)
return false;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]