Commit graph

9 commits

Author SHA1 Message Date
Consolatis
67a8ae8561 Move input related source files into src/input/ 2023-10-30 21:14:04 +00:00
Johan Malm
2e8820cf6a key-state: rename function for consistency
...with the equivalent function that returns the number of pressed keys.

s/key_state_nr_keys/key_state_nr_bound_keys/
2023-09-30 15:43:59 +02:00
Johan Malm
e77330bc3f keyboard: make keybind match stricter
...and avoid failing to send release events to clients for any keys that were
not absorbed by a keybind.

Do not match keybinds if there are other non-modifier keys (not part of any
defined bind) pressed at the same time.

Only store non-modifier keycodes in the key-state.c 'pressed' array.
This makes the call to wlr_seat_keyboard_notify_enter() in seat_focus()
consistent with the equivalent in sway (in seat_keyboard_notify_enter()).

Fixes: issue #1091
2023-09-27 21:34:28 +01:00
Tomi Ollila
7ad5200f2e includes: identifier consistency in include guards
Made all header files to have LABWC_ prefix in include guard identifers.

Converted from __LABWC_ in 35 include/ files.
Converted from __LAB_ in 5 include/ files.
Added LABWC prefix to 3 include/ files.
Added include guards to 3 include/ files.

The double underscores were removed since according to C standard
those "are always reserved for any use".
2023-05-13 22:29:21 +01:00
Johan Malm
de99a8ba33 seat: only pass on sent keys on surface-focus
Key events associated with keybindings (both pressed and released) are not
sent to clients. When using wlr_seat_keyboard_notify_enter() it it
therefore important not to send the keycodes of _all_ pressed keys, but
only those that were actually _sent_ to clients (that is, those that were
not bound).

This approach is consistent with sway's implementation in input/seat.c
cffb006feb/sway/input/seat.c (L173-L175)

Fixes issue #510
2022-09-21 21:25:13 +01:00
Johan Malm
20c4ffa539 src/keyboard.c: do not end window-cycling on modifier release only
If a user lets go of the modifier (e.g. alt) before the 'normal' key (e.g.
tab) when window-cycling, we do not end the cycling until both keys have
been released.  If we end the window-cycling on release of the modifier
only, some XWayland clients such as hexchat realise that tab is pressed
(even though we did not forward the event) and because we absorb the
equivalent release event it gets stuck on repeat.

Just to clarify the position here: Issue #176 describes a behaviour
whereby dmenu gets stuck on repeat after being launched with a keybind.
This patch does not resolve that issue but reflects that in Wayland, the
client is responsible for implementing "key repeat".

Changing the key repeat rate/delay in (labwc/labwc@e62bb51) was dirty fix
that need should never have been made.
2022-09-21 21:25:13 +01:00
Johan Malm
a363f73e02 Revert "keyboard: cancel repeat when handling key-bind"
This reverts commit e62bb51bfb.

Fixes #510
2022-09-20 20:52:48 +01:00
Johan Malm
e62bb51bfb keyboard: cancel repeat when handling key-bind
<keybind key="W-d">
  <action name="Execute">
    <command>dmenu_run</command>
  </action>
</keybind>

When using the keybind above (in rc.xml), on the first execution of W-d
all is okay, but the second time, a "d" pressed event is sent to dmenu
resulting in a continuous "ddddddd...") which has to be stopped pressing a
key.

This behaviour started in commit 7e57b7f because release events associated
with keybinds are no longer sent to clients (before that commit, the
release event for the “d” would have been passed to dmenu, thus cancelling
the repeat).

Solves issue #176

Helped-by: @spectrum70
2022-01-02 15:28:35 +00:00
Johan Malm
7e57b7fcf5 keyboard: absolve release event if press was bound
When key press events are handled by compositor keybindings, do not
forward the corresponding release events to clients.
2021-12-22 10:37:25 -05:00