mirror of
https://github.com/labwc/labwc.git
synced 2026-06-13 14:33:18 -04:00
cursor: add scroll wheel support for window cycle
When cycle mode is active (Alt+Tab held), scrolling the mouse wheel cycles through windows. Scroll down advances to the next window, scroll up goes to the previous window. This uses the same LAB_CYCLE_DIR_FORWARD/BACKWARD constants as the keyboard handler, ensuring consistent navigation behavior. No configuration needed - always active during cycle mode.
This commit is contained in:
parent
2135fb0d35
commit
856da84f08
2 changed files with 40 additions and 0 deletions
29
docs/scroll-cycle.md
Normal file
29
docs/scroll-cycle.md
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
# Scroll Wheel Support for Window Cycle (Alt+Tab)
|
||||||
|
|
||||||
|
## Summary
|
||||||
|
|
||||||
|
Add mouse scroll wheel support to the Alt+Tab window switcher. When cycle mode is active (Alt+Tab held), scrolling the mouse wheel cycles through windows — scroll down for next, scroll up for previous.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
1. Press and hold **Alt+Tab** to enter cycle mode
|
||||||
|
2. **Scroll wheel down** → cycle to the next window
|
||||||
|
3. **Scroll wheel up** → cycle to the previous window
|
||||||
|
4. Release **Alt** to focus the selected window
|
||||||
|
|
||||||
|
No configuration needed — this behavior is always active during cycle mode.
|
||||||
|
|
||||||
|
## Technical Details
|
||||||
|
|
||||||
|
The patch intercepts `WL_POINTER_AXIS_VERTICAL_SCROLL` events in `handle_axis()` when `server.input_mode == LAB_INPUT_STATE_CYCLE`. It maps:
|
||||||
|
|
||||||
|
- Negative delta (scroll up) → `LAB_CYCLE_DIR_BACKWARD`
|
||||||
|
- Positive delta (scroll down) → `LAB_CYCLE_DIR_FORWARD`
|
||||||
|
|
||||||
|
These are the same direction constants used by the keyboard handler (`handle_cycle_view_key()` in `keyboard.c`), ensuring consistent behavior between keyboard and mouse navigation.
|
||||||
|
|
||||||
|
The event is consumed (not forwarded to clients or processed as mouse bindings) when cycle mode is active.
|
||||||
|
|
||||||
|
## Files Changed
|
||||||
|
|
||||||
|
- `src/input/cursor.c` — Added scroll wheel interception in `handle_axis()`
|
||||||
|
|
@ -1441,6 +1441,17 @@ handle_axis(struct wl_listener *listener, void *data)
|
||||||
idle_manager_notify_activity(seat->wlr_seat);
|
idle_manager_notify_activity(seat->wlr_seat);
|
||||||
cursor_set_visible(seat, /* visible */ true);
|
cursor_set_visible(seat, /* visible */ true);
|
||||||
|
|
||||||
|
/* Cycle mode: scroll wheel cycles through windows */
|
||||||
|
if (server.input_mode == LAB_INPUT_STATE_CYCLE) {
|
||||||
|
if (event->orientation == WL_POINTER_AXIS_VERTICAL_SCROLL
|
||||||
|
&& event->delta != 0) {
|
||||||
|
cycle_step(event->delta < 0
|
||||||
|
? LAB_CYCLE_DIR_FORWARD
|
||||||
|
: LAB_CYCLE_DIR_BACKWARD);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* input->scroll_factor is set for pointer/touch devices */
|
/* input->scroll_factor is set for pointer/touch devices */
|
||||||
assert(event->pointer->base.type == WLR_INPUT_DEVICE_POINTER
|
assert(event->pointer->base.type == WLR_INPUT_DEVICE_POINTER
|
||||||
|| event->pointer->base.type == WLR_INPUT_DEVICE_TOUCH);
|
|| event->pointer->base.type == WLR_INPUT_DEVICE_TOUCH);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue