/usr/share/cinnamon/js/ui/edgeFlip.js is in cinnamon-common 2.8.6-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const Main = imports.ui.main;
const Clutter = imports.gi.Clutter;
const St = imports.gi.St;
const Mainloop = imports.mainloop;
const Lang = imports.lang;
const Cinnamon = imports.gi.Cinnamon;
function EdgeFlipper(side, func){
this._init(side, func);
}
EdgeFlipper.prototype = {
_init: function(side, func){
this.side = side;
this.func = func;
this.enabled = true;
this.delay = 1000;
this.entered = false;
this.activated = false;
this._checkOver();
},
_checkOver: function(){
if (this.enabled) {
let mask;
[this.xMouse, this.yMouse, mask] = global.get_pointer();
if (!(mask & Clutter.ModifierType.BUTTON1_MASK)) {
if (this.side == St.Side.RIGHT){
if (this.xMouse + 2 > global.screen_width){
this._onMouseEnter();
} else {
this._onMouseLeave();
}
} else if (this.side == St.Side.LEFT){
if (this.xMouse < 2 ){
this._onMouseEnter();
} else {
this._onMouseLeave();
}
} else if (this.side == St.Side.BOTTOM){
if (this.yMouse + 2 > global.screen_height) {
this._onMouseEnter();
} else {
this._onMouseLeave();
}
} else if (this.side == St.Side.TOP){
if (this.yMouse < 2){
this._onMouseEnter();
} else {
this._onMouseLeave();
}
}
}
Mainloop.timeout_add(Math.max(this.delay, 200), Lang.bind(this, this._checkOver));
}
},
_onMouseEnter: function(){
this.entered = true;
Mainloop.timeout_add(this.delay, Lang.bind(this, this._check));
},
_check: function(){
if (this.entered && this.enabled && !this.activated){
this.func();
this.activated = true;
}
},
_onMouseLeave: function(){
this.entered = false;
this.activated = false;
}
};
|