Skip to content

Commit

Permalink
Rework insensitive messageTray using injectionsHandler.
Browse files Browse the repository at this point in the history
Also cleanup code and add comments.
  • Loading branch information
micheleg committed Jan 21, 2015
1 parent 868ce00 commit b06b9c0
Showing 1 changed file with 25 additions and 17 deletions.
42 changes: 25 additions & 17 deletions dockedDash.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ const MyDash = Me.imports.myDash;

const PRESSURE_TIMEOUT = 1000;

let _myDwell = 0;

/* Return the actual position reverseing left and right in rtl */
function getPosition(settings) {
let position = settings.get_enum('dock-position');
Expand Down Expand Up @@ -308,6 +306,8 @@ const dockedDash = new Lang.Class({
]
);

this._injectionsHandler = new Convenience.InjectionsHandler();

//Hide the dock whilst setting positions
//this.actor.hide(); but I need to access its width, so I use opacity
this.actor.set_opacity(0);
Expand Down Expand Up @@ -432,6 +432,8 @@ const dockedDash = new Lang.Class({
// The dash has global signals as well internally
this.dash.destroy();

this._injectionsHandler.destroy();

// Destroy main clutter actor: this should be sufficient removing it and
// destroying all its children
this.actor.destroy();
Expand Down Expand Up @@ -1204,26 +1206,32 @@ const dockedDash = new Lang.Class({
}
},

// Makes the message not show. SOURCE: insensitive-tray extension.
// Makes the message not being triggered by mouse. SOURCE: insensitive-tray extension.
_updateInsensitiveTray: function() {
if (this._settings.get_boolean('insensitive-message-tray')) {
if("_trayPressure" in LayoutManager) {

let insensitive = this._settings.get_boolean('insensitive-message-tray');

if("_trayPressure" in LayoutManager) {
// Systems supporting pressure
if (insensitive) {
LayoutManager._trayPressure._keybindingMode = null;
//Shell.KeyBindingMode.OVERVIEW;
} else {
LayoutManager._trayPressure._keybindingMode = Shell.KeyBindingMode.NORMAL
| Shell.KeyBindingMode.OVERVIEW;
}

_myDwell = MessageTray._trayDwellTimeout;
MessageTray._trayDwellTimeout = function() { return false; };
} else {
if("_trayPressure" in LayoutManager) {
LayoutManager._trayPressure._keybindingMode =
Shell.KeyBindingMode.NORMAL | Shell.KeyBindingMode.OVERVIEW;
//systems using the old dwell mechanism
if (insensitive) {
this._injectionsHandler.addWithLabel('insensitive-message-tray',
[
Main.messageTray,
'_trayDwellTimeout',
function() { return false; }
]
);
} else {
this._injectionsHandler.removeWithLabel('insensitive-message-tray')
}

if(_myDwell) {
MessageTray._trayDwellTimeout = _myDwell;
_myDwell = 0;
}
}
}
});
Expand Down

0 comments on commit b06b9c0

Please sign in to comment.