js: Mass move to Clutter.Event getter methods in Clutter.Actor vfuncs
These traditionally got the various ClutterEvent subtype structs as their argument, so it was not allowed to use ClutterEvent generic getter methods in these vfuncs. These methods used direct access to struct fields instead. This got spoiled with the move to make ClutterEvent opaque types, since these are no longer public structs so GNOME Shell most silently failed to fetch the expected values from event fields. But since they are not ClutterEvents either, the getters could not be used on them. Mutter is changing so that these vmethods all contain an alias to the one and only Clutter.Event type, thus lifting those barriers, and making it possible to use the ClutterEvent methods in these vfuncs. Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2950 Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2872>
This commit is contained in:
@ -177,14 +177,14 @@ export const Slider = GObject.registerClass({
|
||||
return Clutter.EVENT_STOP;
|
||||
}
|
||||
|
||||
vfunc_key_press_event(keyPressEvent) {
|
||||
let key = keyPressEvent.keyval;
|
||||
vfunc_key_press_event(event) {
|
||||
let key = event.get_key_symbol();
|
||||
if (key == Clutter.KEY_Right || key == Clutter.KEY_Left) {
|
||||
let delta = key == Clutter.KEY_Right ? 0.1 : -0.1;
|
||||
this.value = Math.max(0, Math.min(this._value + delta, this._maxValue));
|
||||
return Clutter.EVENT_STOP;
|
||||
}
|
||||
return super.vfunc_key_press_event(keyPressEvent);
|
||||
return super.vfunc_key_press_event(event);
|
||||
}
|
||||
|
||||
_moveHandle(absX, _absY) {
|
||||
|
Reference in New Issue
Block a user