locatePointer: Add implementation in gnome-shell

The "locate pointer" functionality was implemented in gnome settings
daemon using X11 protocols and would fail when run under Wayland.

With Wayland, there is no global coordinate space exposed to the clients
so this functionality cannot be implemented as a separate program.

Instead, add the "locate pointer" functionality in gnome-shell so that
it works in both X11 and Wayland.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/981
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/413
https://gitlab.gnome.org/GNOME/mutter/merge_requests/453
https://gitlab.gnome.org/GNOME/gsettings-desktop-schemas/merge_requests/19
https://gitlab.gnome.org/GNOME/gnome-settings-daemon/merge_requests/86
This commit is contained in:
Olivier Fourdan
2019-02-20 10:12:36 +01:00
parent ee3f52c097
commit 443c8347ea
7 changed files with 69 additions and 0 deletions

24
js/ui/locatePointer.js Normal file
View File

@ -0,0 +1,24 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const { Clutter, Gio, GLib, St } = imports.gi;
const Ripples = imports.ui.ripples;
const Main = imports.ui.main;
const LOCATE_POINTER_KEY = "locate-pointer";
const LOCATE_POINTER_SCHEMA = "org.gnome.desktop.interface"
var locatePointer = class {
constructor() {
this._settings = new Gio.Settings({schema_id: LOCATE_POINTER_SCHEMA});
this._ripples = new Ripples.Ripples(0.5, 0.5, 'ripple-pointer-location');
this._ripples.addTo(Main.uiGroup);
}
show() {
if (!this._settings.get_boolean("locate-pointer"))
return;
let [x, y, mods] = global.get_pointer();
this._ripples.playAnimation(x, y);
}
};