- Fix dock and alternate-tab extensions

- Fix GNOME Shell version to work with GS 3.2.1
This commit is contained in:
Mohamed El Morabity 2011-11-10 10:08:26 +01:00
parent 30cdc2884b
commit 3de9f28a6d
3 changed files with 203 additions and 2 deletions

View File

@ -0,0 +1,146 @@
diff -up gnome-shell-extensions-3.2.0/extensions/alternate-tab/extension.js.orig gnome-shell-extensions-3.2.0/extensions/alternate-tab/extension.js
--- gnome-shell-extensions-3.2.0/extensions/alternate-tab/extension.js.orig 2011-10-03 18:16:09.000000000 +0200
+++ gnome-shell-extensions-3.2.0/extensions/alternate-tab/extension.js 2011-11-10 08:50:18.919449151 +0100
@@ -23,21 +23,26 @@ const Gettext = imports.gettext.domain('
const _ = Gettext.gettext;
const N_ = function(e) { return e };
-const POPUP_FADE_TIME = 0.1; // seconds
+const POPUP_DELAY_TIMEOUT = 150; // milliseconds
const SETTINGS_SCHEMA = 'org.gnome.shell.extensions.alternate-tab';
const SETTINGS_BEHAVIOUR_KEY = 'behaviour';
const SETTINGS_FIRST_TIME_KEY = 'first-time';
const MODES = {
- native: function() {
- Main.wm._startAppSwitcher();
+ native: function(shellwm, binding, mask, window, backwards) {
+ shellwm._startAppSwitcher(shellwm, binding, mask, window, backwards);
},
all_thumbnails: function() {
new AltTabPopup2();
},
- workspace_icons: function() {
- new AltTabPopupW().show();
+ workspace_icons: function(shellwm, binding, mask, window, backwards) {
+ if (shellwm._workspaceSwitcherPopup != null)
+ shellwm._workspaceSwitcherPopup.actor.hide();
+
+ let tabPopup = new AltTabPopupW();
+ if (!tabPopup.show(backwards, binding, mask))
+ tabPopup.destroy();
}
};
@@ -68,7 +73,9 @@ function AltTabPopupW() {
AltTabPopupW.prototype = {
__proto__ : AltTab.AltTabPopup.prototype,
- show : function(backward, switch_group) {
+ _windowActivated : function(thumbnailList, n) { },
+
+ show : function(backward, binding, mask) {
let appSys = Shell.AppSystem.get_default();
let apps = appSys.get_running ();
@@ -78,6 +85,7 @@ AltTabPopupW.prototype = {
if (!Main.pushModal(this.actor))
return false;
this._haveModal = true;
+ this._modifierMask = AltTab.primaryModifier(mask);
this.actor.connect('key-press-event', Lang.bind(this, this._keyPressEvent));
this.actor.connect('key-release-event', Lang.bind(this, this._keyReleaseEvent));
@@ -92,16 +100,22 @@ AltTabPopupW.prototype = {
this._appIcons = this._appSwitcher.icons;
+ // Need to force an allocation so we can figure out whether we
+ // need to scroll when selecting
+ this.actor.opacity = 0;
+ this.actor.show();
+ this.actor.get_allocation_box();
+
// Make the initial selection
- if (switch_group) {
- if (backward) {
- this._select(0, this._appIcons[0].cachedWindows.length - 1);
- } else {
- if (this._appIcons[0].cachedWindows.length > 1)
- this._select(0, 1);
- else
- this._select(0, 0);
- }
+ if (binding == 'switch_group') {
+ //see AltTab.AltTabPopup.show function
+ //cached windows are always of length one, so select first app and the window
+ //the direction doesn't matter, so ignore backward
+ this._select(0, 0);
+ } else if (binding == 'switch_group_backward') {
+ this._select(0, 0);
+ } else if (binding == 'switch_windows_backward') {
+ this._select(this._appIcons.length - 1);
} else if (this._appIcons.length == 1) {
this._select(0);
} else if (backward) {
@@ -110,24 +124,25 @@ AltTabPopupW.prototype = {
this._select(1);
}
+
// 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 updating
// selection.)
let [x, y, mods] = global.get_pointer();
- if (!(mods & Gdk.ModifierType.MOD1_MASK)) {
+ if (!(mods & this._modifierMask)) {
this._finish();
return false;
}
- this.actor.opacity = 0;
- this.actor.show();
- Tweener.addTween(this.actor,
- { opacity: 255,
- time: POPUP_FADE_TIME,
- transition: 'easeOutQuad'
- });
+ // We delay showing the popup so that fast Alt+Tab users aren't
+ // disturbed by the popup briefly flashing.
+ this._initialDelayTimeoutId = Mainloop.timeout_add(POPUP_DELAY_TIMEOUT,
+ Lang.bind(this, function () {
+ this.actor.opacity = 255;
+ this._initialDelayTimeoutId = 0;
+ }));
return true;
},
@@ -545,15 +560,16 @@ function init(metadata) {
imports.gettext.bindtextdomain('gnome-shell-extensions', metadata.localedir);
}
-function doAltTab(shellwm, binding, window, backwards) {
+function doAltTab(shellwm, binding, mask, window, backwards) {
let settings = new Gio.Settings({ schema: SETTINGS_SCHEMA });
+
if(settings.get_boolean(SETTINGS_FIRST_TIME_KEY)) {
new AltTabSettingsDialog().open();
} else {
let behaviour = settings.get_string(SETTINGS_BEHAVIOUR_KEY);
if(behaviour in MODES) {
- MODES[behaviour](binding, backwards);
+ MODES[behaviour](shellwm, binding, mask, window, backwards);
}
}
}
@@ -570,4 +586,4 @@ function disable() {
Main.wm.setKeybindingHandler('switch_group', Lang.bind(Main.wm, Main.wm._startAppSwitcher));
Main.wm.setKeybindingHandler('switch_windows_backward', Lang.bind(Main.wm, Main.wm._startAppSwitcher));
Main.wm.setKeybindingHandler('switch_group_backward', Lang.bind(Main.wm, Main.wm._startAppSwitcher));
-}
\ Pas de fin de ligne à la fin du fichier
+}

View File

@ -0,0 +1,41 @@
From e8531f773a8c9a6d74a386f16a5e414a0262f58f Mon Sep 17 00:00:00 2001
From: Vasily Khoruzhick <anarsoul@gmail.com>
Date: Sat, 8 Oct 2011 23:06:49 +0300
Subject: [PATCH] Make dock extension actually work with gnome-3.2
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
---
extensions/dock/extension.js | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/extensions/dock/extension.js b/extensions/dock/extension.js
index 47cd76f..ac42744 100644
--- a/extensions/dock/extension.js
+++ b/extensions/dock/extension.js
@@ -304,7 +304,6 @@ Dock.prototype = {
this.actor.show();
}));
Main.layoutManager.addChrome(this.actor);
- this.actor.lower_bottom();
//hidden
this._settings.connect('changed::'+DOCK_POSITION_KEY, Lang.bind(this, function (){
@@ -372,6 +371,8 @@ Dock.prototype = {
this.actor.connect('leave-event', Lang.bind(this, this._hideDock));
this.actor.connect('enter-event', Lang.bind(this, this._showDock));
+
+ this._hideDock();
},
destroy: function() {
@@ -862,4 +863,4 @@ function enable() {
function disable() {
dock.destroy();
dock = null;
-}
\ No newline at end of file
+}
--
1.7.7

View File

@ -2,19 +2,25 @@
Name: gnome-shell-extensions
Version: 3.2.0
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Modify and extend GNOME Shell functionality and behavior
Group: User Interface/Desktops
License: GPLv2+
URL: http://live.gnome.org/GnomeShell/Extensions
Source0: http://ftp.gnome.org/pub/GNOME/sources/gnome-shell-extensions/3.2/%{name}-%{version}.tar.xz
# Make alternate tab extension with GNOME Shell 3.2.x (patch taken from
# http://bugzilla.gnome.org/show_bug.cgi?id=661281)
Patch0: %{name}-3.2.0-fix_alternate_tab_3.2.patch
# Make dock extension with GNOME Shell 3.2.x (patch taken from
# http://bugzilla-attachments.gnome.org/attachment.cgi?id=198832)
Patch1: %{name}-3.2.0-fix_dock_3.2.patch
BuildRequires: glib2-devel
BuildRequires: intltool
BuildRequires: pkgconfig(gnome-desktop-3.0)
BuildRequires: pkgconfig(libgtop-2.0)
Requires: gnome-shell >= 3.2.0
Requires: gnome-shell >= 3.2.1
BuildArch: noarch
%description
@ -235,6 +241,10 @@ This extension adds a systems status menu for rotating monitors
%prep
%setup -q
%patch0 -p1 -b .fix_alternate_tab
%patch1 -p1 -b .fix_dock
sed -i 's/$(PACKAGE_VERSION)/3.2.1/' extension.mk
%build
@ -370,6 +380,10 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
%changelog
* Wed Nov 09 2011 Mohamed El Morabity <melmorabity@fedoraproject.org> - 3.2.0-2
- Fix dock and alternate-tab extensions
- Fix GNOME Shell version to work with GS 3.2.1
* Mon Oct 03 2011 Mohamed El Morabity <melmorabity@fedoraproject.org> - 3.2.0-1
- Update to 3.2.0