[gnome-shell] appDisplay: Use GrabHelper for folder popups
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] appDisplay: Use GrabHelper for folder popups
- Date: Wed, 11 Jun 2014 21:28:20 +0000 (UTC)
commit 5d00c1a5ee4e3fc3a7a3aef2d1439dd83c4a7bd6
Author: Florian Müllner <fmuellner gnome org>
Date: Wed Jun 11 13:13:12 2014 +0200
appDisplay: Use GrabHelper for folder popups
As clicks outside the app picker should still be handled normally
while clicks inside should dismiss the popup, we cannot make full
use of GrabHelper. However using it at least for focus handling
fixes some minor details we are getting wrong, for instance not
restoring the previous focus after dismissing a folder popup.
js/ui/appDisplay.js | 23 ++++++++++-------------
1 files changed, 10 insertions(+), 13 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index e43a679..854acd1 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -16,6 +16,7 @@ const Atk = imports.gi.Atk;
const AppFavorites = imports.ui.appFavorites;
const BoxPointer = imports.ui.boxpointer;
const DND = imports.ui.dnd;
+const GrabHelper = imports.ui.grabHelper;
const IconGrid = imports.ui.iconGrid;
const Main = imports.ui.main;
const Overview = imports.ui.overview;
@@ -1249,18 +1250,7 @@ const AppFolderPopup = new Lang.Class({
function() {
this.actor.destroy();
}));
- this.actor.connect('key-press-event', Lang.bind(this, this._onKeyPress));
- },
-
- _onKeyPress: function(actor, event) {
- if (!this._isOpen)
- return Clutter.EVENT_PROPAGATE;
-
- if (event.get_key_symbol() != Clutter.KEY_Escape)
- return Clutter.EVENT_PROPAGATE;
-
- this.popdown();
- return Clutter.EVENT_STOP;
+ this._grabHelper = new GrabHelper.GrabHelper(this.actor);
},
toggle: function() {
@@ -1274,6 +1264,12 @@ const AppFolderPopup = new Lang.Class({
if (this._isOpen)
return;
+ this._isOpen = this._grabHelper.grab({ actor: this.actor,
+ onUngrab: Lang.bind(this, this.popdown) });
+
+ if (!this._isOpen)
+ return;
+
this.actor.show();
this._boxPointer.setArrowActor(this._source.actor);
@@ -1282,7 +1278,6 @@ const AppFolderPopup = new Lang.Class({
this.actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
- this._isOpen = true;
this.emit('open-state-changed', true);
},
@@ -1290,6 +1285,8 @@ const AppFolderPopup = new Lang.Class({
if (!this._isOpen)
return;
+ this._grabHelper.ungrab({ actor: this.actor });
+
this._boxPointer.hide(BoxPointer.PopupAnimation.FADE |
BoxPointer.PopupAnimation.SLIDE);
this._isOpen = false;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]