Skip to content

Instantly share code, notes, and snippets.

@pclouds
Created July 3, 2011 23:57
Show Gist options
  • Save pclouds/1062725 to your computer and use it in GitHub Desktop.
Save pclouds/1062725 to your computer and use it in GitHub Desktop.
From ca71ec8926ab5b640fcb566c324c17b2639680a4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= <pclouds@gmail.com>
Date: Sun, 3 Jul 2011 17:52:25 +0700
Subject: [PATCH] dash: grab keyboard after Super is pressed
---
js/ui/overview.js | 43 ++++++++++++++++++++++++++++++++++++++-----
1 files changed, 38 insertions(+), 5 deletions(-)
diff --git a/js/ui/overview.js b/js/ui/overview.js
index 71aa7b5..dd14d1f 100644
--- a/js/ui/overview.js
+++ b/js/ui/overview.js
@@ -131,6 +131,7 @@ Overview.prototype = {
this._scrollAdjustment = null;
this._capturedEventId = 0;
this._buttonPressId = 0;
+ this._keyReleaseEventId = 0;
this._workspacesDisplay = null;
@@ -139,6 +140,7 @@ Overview.prototype = {
this._shownTemporarily = false; // showTemporarily() and not hideTemporarily()
this._dashShown = false;
this._modal = false; // have a modal grab
+ this._dashModal = false; // have a modal grab by dash
this.animationInProgress = false;
this._hideInProgress = false;
@@ -522,7 +524,9 @@ Overview.prototype = {
if (this._dashShown)
return;
- this._dashShown = true;
+ if (!Main.pushModal(this.dash.actor))
+ return;
+ this._dashModal = true;
this.dash.actor.show();
this.dash.actor.opacity = 0;
Tweener.addTween(this.dash.actor,
@@ -530,6 +534,9 @@ Overview.prototype = {
transition: 'easeOutQuad',
time: ANIMATION_TIME
});
+ this._dashShown = true;
+ this._keyReleaseEventId = this.dash.actor.connect('key-release-event',
+ Lang.bind(this, this._keyReleaseEvent));
},
_animateVisible: function() {
@@ -603,12 +610,22 @@ Overview.prototype = {
//
// Reverses the effect of show()
hide: function() {
- if (!this._shown)
+ if (!this._shown && !this._dashShown)
return;
if (!this._shownTemporarily)
this._animateNotVisible();
+ if (this._dashShown) {
+ Tweener.addTween(this.dash.actor,
+ { opacity: 0,
+ transition: 'easeOutQuad',
+ time: ANIMATION_TIME
+ });
+ this.dash.actor.disconnect(this._keyReleaseEventId);
+ this._keyReleaseEventId = 0;
+ }
+
this._shown = false;
this._dashShown = false;
this._syncInputMode();
@@ -662,9 +679,15 @@ Overview.prototype = {
}
global.stage_input_mode = Shell.StageInputMode.FULLSCREEN;
} else {
- if (this._modal) {
- Main.popModal(this._group);
- this._modal = false;
+ if (this._modal || this._dashModal) {
+ if (this._modal) {
+ Main.popModal(this._group);
+ this._modal = false;
+ }
+ if (this._dashModal) {
+ Main.popModal(this.dash.actor);
+ this._dashModal = false;
+ }
}
else if (global.stage_input_mode == Shell.StageInputMode.FULLSCREEN)
global.stage_input_mode = Shell.StageInputMode.NORMAL;
@@ -754,6 +777,16 @@ Overview.prototype = {
this._fakePointerEvent();
this._needsFakePointerEvent = false;
}
+ },
+
+ _keyReleaseEvent: function(actor, event) {
+ let keysym = event.get_key_symbol();
+ if (keysym == Clutter.Super_L || keysym == Clutter.Super_R) {
+ log("a");
+ this.show();
+ return true;
+ }
+ return false;
}
};
Signals.addSignalMethods(Overview.prototype);
--
1.7.4.74.g639db
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment