/usr/share/cinnamon/js/misc/pointerTracker.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 | // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const Gdk = imports.gi.Gdk;
function PointerTracker(){
this._init();
}
PointerTracker.prototype = {
_init: function() {
let display = Gdk.Display.get_default();
let deviceManager = display.get_device_manager();
let pointer = deviceManager.get_client_pointer();
let [lastScreen, lastPointerX, lastPointerY] = pointer.get_position();
this.hasMoved = function() {
let [screen, pointerX, pointerY] = pointer.get_position();
try {
return !(screen == lastScreen && pointerX == lastPointerX && pointerY == lastPointerY);
} finally {
[lastScreen, lastPointerX, lastPointerY] = [screen, pointerX, pointerY];
}
};
this.getPosition = function() {
[lastScreen, lastPointerX, lastPointerY] = pointer.get_position();
return [lastPointerX, lastPointerY, lastScreen];
};
this.setPosition = function(x, y, screenOpt) {
let [screen, pointerX, pointerY] = pointer.get_position();
pointer.warp(screenOpt || screen, Math.round(x), Math.round(y));
[lastScreen, lastPointerX, lastPointerY] = pointer.get_position();
};
}
};
|