windowManager: Discard workspace scroll smooth events
Since touchpad smooth scroll events with source finger are handled by the swipeTracker, the workspace scroll handler can focus on discrete events. Thanks to Mutter emulating discrete scroll events, see meta_seat_impl_notify_scroll_continuous_in_impl in meta-seat-impl.c, it is safe to ignore smooth scroll in the workspace scroll handler and handle exclusively discrete events. In addition, once high-resolution scroll events land in Mutter [1], a mouse will be able generate non emulated smooth scroll events that should be ignored in favour of the discrete scroll events. Otherwise, a single mouse wheel click will scroll through multiple workspaces at once. [1] https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1962 Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1959>
This commit is contained in:
parent
cd1102ff30
commit
757e766a11
@ -1871,25 +1871,10 @@ var WindowManager = class {
|
|||||||
if (event.type() !== Clutter.EventType.SCROLL)
|
if (event.type() !== Clutter.EventType.SCROLL)
|
||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
|
|
||||||
if (event.is_pointer_emulated())
|
const direction = event.get_scroll_direction();
|
||||||
|
if (direction === Clutter.ScrollDirection.SMOOTH)
|
||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
|
|
||||||
let direction = event.get_scroll_direction();
|
|
||||||
if (direction === Clutter.ScrollDirection.SMOOTH) {
|
|
||||||
const [dx, dy] = event.get_scroll_delta();
|
|
||||||
if (Math.abs(dx) > Math.abs(dy)) {
|
|
||||||
direction = dx < 0
|
|
||||||
? Clutter.ScrollDirection.LEFT
|
|
||||||
: Clutter.ScrollDirection.RIGHT;
|
|
||||||
} else if (Math.abs(dy) > Math.abs(dx)) {
|
|
||||||
direction = dy < 0
|
|
||||||
? Clutter.ScrollDirection.UP
|
|
||||||
: Clutter.ScrollDirection.DOWN;
|
|
||||||
} else {
|
|
||||||
return Clutter.EVENT_PROPAGATE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const workspaceManager = global.workspace_manager;
|
const workspaceManager = global.workspace_manager;
|
||||||
const vertical = workspaceManager.layout_rows === -1;
|
const vertical = workspaceManager.layout_rows === -1;
|
||||||
const rtl = Clutter.get_default_text_direction() === Clutter.TextDirection.RTL;
|
const rtl = Clutter.get_default_text_direction() === Clutter.TextDirection.RTL;
|
||||||
|
Loading…
Reference in New Issue
Block a user