magnifier: Use PointerWatcher to poll the mouse pointer
This gives us a more efficient method to watch the mouse pointer. https://bugzilla.gnome.org/show_bug.cgi?id=683073
This commit is contained in:
parent
e616877fd2
commit
8aed51180f
@ -12,7 +12,7 @@ const Signals = imports.signals;
|
|||||||
const Main = imports.ui.main;
|
const Main = imports.ui.main;
|
||||||
const MagnifierDBus = imports.ui.magnifierDBus;
|
const MagnifierDBus = imports.ui.magnifierDBus;
|
||||||
const Params = imports.misc.params;
|
const Params = imports.misc.params;
|
||||||
|
const PointerWatcher = imports.ui.pointerWatcher;
|
||||||
|
|
||||||
const MOUSE_POLL_FREQUENCY = 50;
|
const MOUSE_POLL_FREQUENCY = 50;
|
||||||
const CROSSHAIRS_CLIP_SIZE = [100, 100];
|
const CROSSHAIRS_CLIP_SIZE = [100, 100];
|
||||||
@ -136,11 +136,8 @@ const Magnifier = new Lang.Class({
|
|||||||
* Turn on mouse tracking, if not already doing so.
|
* Turn on mouse tracking, if not already doing so.
|
||||||
*/
|
*/
|
||||||
startTrackingMouse: function() {
|
startTrackingMouse: function() {
|
||||||
if (!this._mouseTrackingId)
|
if (!this._pointerWatch)
|
||||||
this._mouseTrackingId = Mainloop.timeout_add(
|
this._pointerWatch = PointerWatcher.getPointerWatcher().addWatch(MOUSE_POLL_FREQUENCY, Lang.bind(this, this.scrollToMousePos));
|
||||||
MOUSE_POLL_FREQUENCY,
|
|
||||||
Lang.bind(this, this.scrollToMousePos)
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -148,10 +145,10 @@ const Magnifier = new Lang.Class({
|
|||||||
* Turn off mouse tracking, if not already doing so.
|
* Turn off mouse tracking, if not already doing so.
|
||||||
*/
|
*/
|
||||||
stopTrackingMouse: function() {
|
stopTrackingMouse: function() {
|
||||||
if (this._mouseTrackingId)
|
if (this._pointerWatch)
|
||||||
Mainloop.source_remove(this._mouseTrackingId);
|
this._pointerWatch.remove();
|
||||||
|
|
||||||
this._mouseTrackingId = null;
|
this._pointerWatch = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user