~ubuntu-branches/ubuntu/trusty/gnome-shell/trusty-proposed

« back to all changes in this revision

Viewing changes to js/ui/altTab.js

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2012-03-14 13:47:20 UTC
  • mfrom: (1.1.36) (18.1.8 sid)
  • Revision ID: package-import@ubuntu.com-20120314134720-202sbjbu4a3z1fru
Tags: 3.3.90-0ubuntu1
* Sync with Debian experimental svn packaging (LP: #941755, #937709).
  Remaining changes:
  - debian/gnome-shell.gsettings-override: Update for Ubuntu defaults
  - debian/control.in: Recommend cups-pk-helper
  - debian/patches/10-make-NetworkManager-optional.patch: Disabled
  - Don't run dh-autoreconf

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
    return primary;
44
44
}
45
45
 
46
 
function AltTabPopup() {
47
 
    this._init();
48
 
}
 
46
const AltTabPopup = new Lang.Class({
 
47
    Name: 'AltTabPopup',
49
48
 
50
 
AltTabPopup.prototype = {
51
49
    _init : function() {
52
50
        this.actor = new Shell.GenericContainer({ name: 'altTabPopup',
53
51
                                                  reactive: true,
170
168
        if (localApps.length == 0 && otherApps.length == 0)
171
169
            return false;
172
170
 
173
 
        if (!Main.pushModal(this.actor))
174
 
            return false;
 
171
        if (!Main.pushModal(this.actor)) {
 
172
            // Probably someone else has a pointer grab, try again with keyboard only
 
173
            if (!Main.pushModal(this.actor, global.get_current_time(), Meta.ModalOptions.POINTER_ALREADY_GRABBED)) {
 
174
                return false;
 
175
            }
 
176
        }
175
177
        this._haveModal = true;
176
178
        this._modifierMask = primaryModifier(mask);
177
179
 
195
197
        this.actor.get_allocation_box();
196
198
 
197
199
        // Make the initial selection
198
 
        if (binding == 'switch_group') {
 
200
        if (binding == 'switch-group') {
199
201
            if (backward) {
200
202
                this._select(0, this._appIcons[0].cachedWindows.length - 1);
201
203
            } else {
204
206
                else
205
207
                    this._select(0, 0);
206
208
            }
207
 
        } else if (binding == 'switch_group_backward') {
 
209
        } else if (binding == 'switch-group-backward') {
208
210
            this._select(0, this._appIcons[0].cachedWindows.length - 1);
209
 
        } else if (binding == 'switch_windows_backward') {
 
211
        } else if (binding == 'switch-windows-backward') {
210
212
            this._select(this._appIcons.length - 1);
211
213
        } else if (this._appIcons.length == 1) {
212
214
            this._select(0);
536
538
                           onComplete: Lang.bind(this, function () { this.thumbnailsVisible = true; })
537
539
                         });
538
540
    }
539
 
};
540
 
 
541
 
function SwitcherList(squareItems) {
542
 
    this._init(squareItems);
543
 
}
544
 
 
545
 
SwitcherList.prototype = {
 
541
});
 
542
 
 
543
const SwitcherList = new Lang.Class({
 
544
    Name: 'SwitcherList',
 
545
 
546
546
    _init : function(squareItems) {
547
547
        this.actor = new Shell.GenericContainer({ style_class: 'switcher-list' });
548
548
        this.actor.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth));
847
847
        // Clip the area for scrolling
848
848
        this._clipBin.set_clip(0, -topPadding, (this.actor.allocation.x2 - this.actor.allocation.x1) - leftPadding - rightPadding, this.actor.height + bottomPadding);
849
849
    }
850
 
};
 
850
});
851
851
 
852
852
Signals.addSignalMethods(SwitcherList.prototype);
853
853
 
854
 
function AppIcon(app) {
855
 
    this._init(app);
856
 
}
 
854
const AppIcon = new Lang.Class({
 
855
    Name: 'AppIcon',
857
856
 
858
 
AppIcon.prototype = {
859
857
    _init: function(app) {
860
858
        this.app = app;
861
859
        this.actor = new St.BoxLayout({ style_class: 'alt-tab-app',
873
871
        this._iconBin.set_size(size, size);
874
872
        this._iconBin.child = this.icon;
875
873
    }
876
 
};
877
 
 
878
 
function AppSwitcher() {
879
 
    this._init.apply(this, arguments);
880
 
}
881
 
 
882
 
AppSwitcher.prototype = {
883
 
    __proto__ : SwitcherList.prototype,
 
874
});
 
875
 
 
876
const AppSwitcher = new Lang.Class({
 
877
    Name: 'AppSwitcher',
 
878
    Extends: SwitcherList,
884
879
 
885
880
    _init : function(localApps, otherApps, altTabPopup) {
886
 
        SwitcherList.prototype._init.call(this, true);
 
881
        this.parent(true);
887
882
 
888
883
        // Construct the AppIcons, add to the popup
889
884
        let activeWorkspace = global.screen.get_active_workspace();
962
957
 
963
958
    _allocate: function (actor, box, flags) {
964
959
        // Allocate the main list items
965
 
        SwitcherList.prototype._allocate.call(this, actor, box, flags);
 
960
        this.parent(actor, box, flags);
966
961
 
967
962
        let arrowHeight = Math.floor(this.actor.get_theme_node().get_padding(St.Side.BOTTOM) / 3);
968
963
        let arrowWidth = arrowHeight * 2;
1017
1012
                this._arrows[this._curApp].remove_style_pseudo_class('highlighted');
1018
1013
        }
1019
1014
 
1020
 
        SwitcherList.prototype.highlight.call(this, n, justOutline);
 
1015
        this.parent(n, justOutline);
1021
1016
        this._curApp = n;
1022
1017
 
1023
1018
        if (this._curApp != -1) {
1041
1036
        if (appIcon.cachedWindows.length == 1)
1042
1037
            arrow.hide();
1043
1038
    }
1044
 
};
1045
 
 
1046
 
function ThumbnailList(windows) {
1047
 
    this._init(windows);
1048
 
}
1049
 
 
1050
 
ThumbnailList.prototype = {
1051
 
    __proto__ : SwitcherList.prototype,
 
1039
});
 
1040
 
 
1041
const ThumbnailList = new Lang.Class({
 
1042
    Name: 'ThumbnailList',
 
1043
    Extends: SwitcherList,
1052
1044
 
1053
1045
    _init : function(windows) {
1054
 
        SwitcherList.prototype._init.call(this);
 
1046
        this.parent(false);
1055
1047
 
1056
1048
        let activeWorkspace = global.screen.get_active_workspace();
1057
1049
 
1129
1121
        // Make sure we only do this once
1130
1122
        this._thumbnailBins = new Array();
1131
1123
    }
1132
 
};
 
1124
});
1133
1125
 
1134
1126
function _drawArrow(area, side) {
1135
1127
    let themeNode = area.get_theme_node();