[gnome-shell] [AppSwitcher] Implement pointer selection
- From: Dan Winship <danw src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-shell] [AppSwitcher] Implement pointer selection
- Date: Thu, 24 Sep 2009 20:14:32 +0000 (UTC)
commit eb025901c8e826a30a0353dca0e304c06e67d014
Author: Dan Winship <danw gnome org>
Date: Mon Sep 21 13:44:42 2009 -0400
[AppSwitcher] Implement pointer selection
js/ui/altTab.js | 31 +++++++++++++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/altTab.js b/js/ui/altTab.js
index 9818d0a..333937c 100644
--- a/js/ui/altTab.js
+++ b/js/ui/altTab.js
@@ -20,6 +20,8 @@ const POPUP_GRID_SPACING = 8;
const POPUP_ICON_SIZE = 48;
const POPUP_NUM_COLUMNS = 5;
+const POPUP_POINTER_SELECTION_THRESHOLD = 3;
+
function AltTabPopup() {
this._init();
}
@@ -59,6 +61,8 @@ AltTabPopup.prototype = {
appIcon.connect('menu-popped-up', Lang.bind(this, this._menuPoppedUp));
appIcon.connect('menu-popped-down', Lang.bind(this, this._menuPoppedDown));
+ appIcon.actor.connect('enter-event', Lang.bind(this, this._iconEntered));
+
// FIXME?
appIcon.actor.border = 2;
@@ -87,6 +91,10 @@ AltTabPopup.prototype = {
this._keyPressEventId = global.stage.connect('key-press-event', Lang.bind(this, this._keyPressEvent));
this._keyReleaseEventId = global.stage.connect('key-release-event', Lang.bind(this, this._keyReleaseEvent));
+ this._motionEventId = this.actor.connect('motion-event', Lang.bind(this, this._mouseMoved));
+ this._mouseActive = false;
+ this._mouseMovement = 0;
+
// Contruct the AppIcons, sort by time, add to the popup
let icons = [];
for (let i = 0; i < apps.length; i++)
@@ -156,6 +164,29 @@ AltTabPopup.prototype = {
this._highlightWindow(window);
},
+ _mouseMoved : function(actor, event) {
+ if (++this._mouseMovement < POPUP_POINTER_SELECTION_THRESHOLD)
+ return;
+
+ this.actor.disconnect(this._motionEventId);
+ this._mouseActive = true;
+
+ actor = event.get_source();
+ while (actor) {
+ if (actor._delegate instanceof AppIcon.AppIcon) {
+ this._iconEntered(actor, event);
+ return;
+ }
+ actor = actor.get_parent();
+ }
+ },
+
+ _iconEntered : function(actor, event) {
+ let index = this._icons.indexOf(actor._delegate);
+ if (this._mouseActive)
+ this._updateSelection(index - this._selected);
+ },
+
destroy : function() {
this.actor.destroy();
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]