js: Avoid Clutter.get_current_event() in Clutter.Actor event vfuncs

We sometimes obtained the current event through the general machinery
just so we could pass it along as a ClutterEvent instead of a specialized
subtype.

We now get that out of the box, so may avoid getting the current event
which is just a cast of the same current event we already have.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2872>
This commit is contained in:
Carlos Garnacho
2023-08-08 18:22:11 +02:00
parent 8423ba44fe
commit d56b05b5c3
3 changed files with 11 additions and 12 deletions

View File

@ -61,8 +61,8 @@ export const Slider = GObject.registerClass({
cr.$dispose();
}
vfunc_button_press_event() {
return this.startDragging(Clutter.get_current_event());
vfunc_button_press_event(event) {
return this.startDragging(event);
}
startDragging(event) {
@ -117,8 +117,7 @@ export const Slider = GObject.registerClass({
return Clutter.EVENT_PROPAGATE;
}
vfunc_touch_event() {
let event = Clutter.get_current_event();
vfunc_touch_event(event) {
let sequence = event.get_event_sequence();
if (!this._dragging &&
@ -159,13 +158,13 @@ export const Slider = GObject.registerClass({
return Clutter.EVENT_STOP;
}
vfunc_scroll_event() {
return this.scroll(Clutter.get_current_event());
vfunc_scroll_event(event) {
return this.scroll(event);
}
vfunc_motion_event() {
vfunc_motion_event(event) {
if (this._dragging && !this._grabbedSequence)
return this._motionEvent(this, Clutter.get_current_event());
return this._motionEvent(this, event);
return Clutter.EVENT_PROPAGATE;
}