mirror of
https://github.com/labwc/labwc.git
synced 2025-11-04 13:30:07 -05:00
osd: make window switcher more Openbox-like in terms of key precessing
Before this commit, keystrokes were interpreted based on following
hard-coded rules while the window switcher is active:
1. Up/Left arrow keys cycle the window forward.
2. Down/Right arrow keys cycle the window backward.
3. Other keystrokes cycle the window in the initial direction specified
by NextWindow/PreviousWindow actions. But while Shift key is pressed,
the direction is inverted.
...and keybind actions were never executed.
However, this lead to a counter-intuitive behavior for new, especially
pre-Openbox users. For example, in the following keybinds, after the user
activates the window switcher with Super+n, Super+p cycles the window
_forward_:
<keybind key="W-n">
<action name="NextWindow" />
</keybind>
<keybind key="W-p">
<action name="PreviousWindow" />
</keybind>
This is because the key 'n' is recognized just as a normal key in the
third hard-coded rule.
So this commit changes the rules to be more Openbox-like:
1. Up/Left arrow keys cycles the window forward.
2. Down/Right arrow keys cycles the window backward.
3. Other keystrokes are matched against keybinds and execute their
actions. If they include NextWindow/PreviousWindow action, it cycles
the selected window forward/backward even while the window switcher
is active.
This commit is contained in:
parent
1043cbcca9
commit
713b1d8a13
5 changed files with 35 additions and 65 deletions
12
src/osd.c
12
src/osd.c
|
|
@ -160,14 +160,6 @@ restore_preview_node(struct server *server)
|
|||
}
|
||||
}
|
||||
|
||||
static bool
|
||||
shift_is_pressed(struct server *server)
|
||||
{
|
||||
uint32_t modifiers = wlr_keyboard_get_modifiers(
|
||||
&server->seat.keyboard_group->keyboard);
|
||||
return modifiers & WLR_MODIFIER_SHIFT;
|
||||
}
|
||||
|
||||
void
|
||||
osd_begin(struct server *server, enum lab_cycle_dir direction)
|
||||
{
|
||||
|
|
@ -175,10 +167,6 @@ osd_begin(struct server *server, enum lab_cycle_dir direction)
|
|||
return;
|
||||
}
|
||||
|
||||
/* Remember direction so it can be followed by subsequent key presses */
|
||||
server->osd_state.initial_direction = direction;
|
||||
server->osd_state.initial_keybind_contained_shift =
|
||||
shift_is_pressed(server);
|
||||
server->osd_state.cycle_view = get_next_cycle_view(server,
|
||||
server->osd_state.cycle_view, direction);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue