Commit graph

87 commits

Author SHA1 Message Date
Consolatis
235a8ad9bc ToggleKeybinds per window 2023-07-06 06:02:28 +01:00
Johan Malm
d4288415c9 Support ext-session-lock protocol 2023-04-02 23:09:38 +01:00
John Lindgren
d7dd366bad view: Add view_move_to_front/back().
This avoids calling view->impl functions from cursor.c and desktop.c.

v2: Add an explicit recursion guard in cursor_update_focus().
2023-04-01 22:50:01 +02:00
Consolatis
43fb969b19 src/keyboard.c: Fix wrong argument parsing
The `wlr_keyboard.events.modifiers` signal does not use
a `wlr_keyboard_key_event` as argument, instead it is a
pointer to the `wlr_keyboard` instance which caused the
signal.
2023-03-07 20:55:35 +00:00
Consolatis
a4fb5b093b Prevent cursor based region-snapping when starting a move with A-Left
When wanting to snap to a region when starting the move
operation with A-Left (or a similar mousebind which includes a
modifier), the modifier - or another one - must be pressed again.

Fixes #761
2023-03-07 20:55:35 +00:00
Consolatis
c33a404dc1 Add ToggleKeybinds action
This can be used to better control Virtual Machines, VNC clients, nested
compositors or similar. All keybinds other than ToggleKeybinds itself are
disabled when first called, a 2nd call will restore handling of all keybinds.

Fixes #738
Fixes #810
2023-03-04 13:24:59 +00:00
Johan Malm
b8ec5a3e2e view: add move_to_front to struct view_impl
...to increase xwayland and xdg-shell encapsulation and to avoid passing a
function pointer as an argument in `xwayland_move_sub_views_to_front()`
which is inconsistent with labwc design patterns.

Rename view-impl.c to view-impl-common.c

Move function declarations that are common to view-implementations from
view.h into view-impl-common.h
2023-02-24 20:42:01 +00:00
Consolatis
4a8b50603e src/config/rcxml.c: allow clearing key/mouse bindings
Fixes #567
2023-02-03 03:30:10 +01:00
Consolatis
1995a33df9 CodeStyle: prevent space in code indents 2023-01-31 21:22:40 +00:00
Consolatis
eb5c8cfdad SnapToRegion: Add dynamic overlay
Either uses a half transparent single rect if running
hardware accelerated or uses a solid struct multirect
outline if not.
2023-01-11 18:52:24 +01:00
Consolatis
7e99d8ba08 SnapToRegion: Add overlay while moving and pressing a modifier 2023-01-11 18:52:24 +01:00
bi4k8
9ed800c5a1 keyboard: use 1000/rate msecs for keybind repeat event source delay 2022-11-11 22:19:34 +01:00
Johan Malm
e45e2c7e60 Fix coding style 2022-11-03 23:01:52 +01:00
John Lindgren
3b55b31070 keyboard: Implement key repeat for keybindings
It seems that every Wayland client is expected to implement its own
key-repeat logic, rather than doing it server-side as in X11.  This
means that labwc also has to implement its own key-repeat logic for
compositor keybindings.

This is a very simplistic timer-based implementation.  It doesn't
attempt to synthesize accurate timestamps, and may lag depending
on system load, but it appears to get the job done.

v2: Use server->wl_event_loop
v3: Comments and formatting
2022-11-02 21:52:33 +00:00
Johan Malm
f2277c37c3 keyboard: put modifier/key listeners in keyboard struct
...so that it can be determined what wlr_keyboard events come from.

This is required to manage virtual keyboards alongside the keyboard_group
of physical keyboards.
2022-09-27 17:31:00 +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
4108313f96 src/keyboard.c: register keys before inhibit check
Call key_state_set_pressed() before checking
seat->active_client_while_inhibited to avoid missing release events for
clients using the inhibit protocol (for example swaylock).
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
ffb2efe733 src/keyboard.c: reflow comment to shorten line 2022-09-20 20:52:48 +01:00
Johan Malm
e1467b9aac src/keyboard.c: stored handled keys as bound when window-cycling
...and changing TTY
2022-09-20 20:52:48 +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
John Lindgren
898a583522 keyboard: Fix SIGSEGV that showed up in out-of-memory fuzzing
Stack trace:

    #0  xkb_keymap_ref (keymap=keymap@entry=0x0) at ../libxkbcommon/src/keymap.c:61
    #1  0x00007f53a344ab99 in wlr_keyboard_set_keymap (kb=kb@entry=0x5571af8cb9a0, keymap=keymap@entry=0x0)
        at ../types/wlr_keyboard.c:174
    #2  0x00005571ade057e0 in keyboard_init (seat=0x7ffca0389680) at ../src/keyboard.c:229
    #3  seat_init (server=0x7ffca0389570) at ../src/seat.c:307
    #4  server_init (server=0x7ffca0389570) at ../src/server.c:308
2022-09-18 06:05:16 +02:00
John Lindgren
086a887058 keyboard: Fix use-after-free in keyboard_finish() 2022-09-16 21:41:38 +02:00
Consolatis
15a5b710db alt-tab preview: restore functionality after move to scene-graph 2022-08-28 20:40:36 +02:00
Consolatis
296e58079f Prepare OSD for reimplementation of the preview feature 2022-08-28 20:40:29 +02:00
John Lindgren
33bc37e7d0 keyboard: Hide Alt-Tab switcher when canceling via Escape 2022-08-21 21:47:45 +01:00
Consolatis
8c5157a098 workspaces: Wire up workspaces 2022-06-15 22:26:21 +02:00
Consolatis
a0d1003f28 src/keyboard.c: Make any_modifier_pressed() global 2022-06-15 16:14:02 +01:00
Johan Malm
5b34c81768 Fix trivial coding style breaches 2022-04-04 20:53:36 +01:00
Johan Malm
bca2e9be60 Chase wlroots wlr_seat_keyboard() refactoring
wlr_seat_keyboard() now takes wlr_keyboard
2022-03-28 20:41:53 +01:00
Johan Malm
d844f6798b Chase wlroots wlr-device-input refactoring
Rename wlroots input device events, for example
's/wlr_event_pointer_motion/wlr_pointer_motion_event/'

seat.c:
- In configure_libinput() use wlr_input_device->type rather than width_mm
- In new_pointer() use wlr_input_device->type rather than output_name to
  check that device is pointer.
2022-03-19 11:34:11 +00:00
Johan Malm
bd9ac3478a Remove src/damage.c 2022-03-01 20:54:52 +00:00
Consolatis
953e8a4f9d [style] rename action() to actions_run() 2022-02-24 21:17:51 +00:00
Johan Malm
581a2bb2f1 cursor+keyboard: chase wlroots master
Use wlr_input_device from input device base.
Use wlr_keyboard where possible.
2022-02-23 22:19:16 +00:00
Johan Malm
4593909744 osd: destroy old osd_tree children 2022-02-23 21:47:01 +00:00
Johan Malm
532656ad5b Use wlroots scene-graph API
Move xdg-shell and xwayland-shell surfaces to new API

Also render alt-tab on-screen-display by converting cairo-surface to
wlr_buffer
2022-02-23 21:46:48 +00:00
Johan Malm
3c92cc4dd0 Move action() prototype from labwc.h to action.h 2022-01-05 21:27:47 +00:00
Consolatis
0b45cce648 Rewrite action handling to allow multiple actions at once 2022-01-05 16:22:41 +00: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
bi4k8
58f5e8d16a factor keyboard/cursor cleanup into own functions 2022-01-01 19:24:27 +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
ARDiDo
57cc72b49e OSD: fix stuck OSD when NumLock or CapsLock are activated 2021-12-18 10:33:56 -05:00
Johan Malm
238062a859 desktop: rename functions to increase consistency
...from
- desktop_raise_view()
- desktop_move_view_to_end_of_cycle()

to
- desktop_move_to_front()
- desktop_move_to_back()
2021-12-06 21:23:49 +00:00
John Lindgren
5da0ebda5a keyboard: Remove redundant damage_all_outputs() call
It was already called earlier in handle_compositor_keybindings().
2021-12-04 12:24:47 -05:00
John Lindgren
b72d524c50 keyboard: Allow canceling the Alt-Tab switcher with Escape
This is a standard feature in most window managers (OpenBox
included) that allow window-switching via Alt-Tab.
2021-12-04 12:24:47 -05:00
Joshua Ashton
d568c60003 action: If we have a view that is an activator, use that instead of the current focus window
If we don't switch focus, we want the close button to close the window associated with it, not the current focus window.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-12-03 18:13:30 +00:00
bi4k8
031ced85ef implement Resize as an action
this requires action() to know the resize edges to use, so thread them through
2021-12-01 22:45:20 +00:00
ARDiDo
aa9720f627 Add support for basic idle and idle inhibitor protocols 2021-11-22 21:58:07 +00:00
Joshua Ashton
98085b4546 keyboard: Fix cycle view taking precedence over TTY switch
I had a bug where cycle view would not close and I was unable to switch to a TTY as it was open.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-11-01 22:14:17 +00:00
Joshua Ashton
23b5eb294e keyboard: Fix handled check
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-11-01 22:14:17 +00:00