Commit Graph

1287 Commits

Author SHA1 Message Date
tiosgz
e1970e4d52 Keyboard: don't crash when coming from a different tty
It didn't occur to me that this is a completely valid case when a key
release event is received even though there was no press event known
to river.

(I've also just had this same crash on something else, but i don't
understand what the cause could be.)
2024-02-19 08:54:40 +00:00
Isaac Freund
d1bb27038b
Keyboard: style/naming nits and comment tweaks
This commit includes no functional changes
2024-02-18 17:29:56 +01:00
tiosgz
93c2a2fd08 deps: update zig-wlroots
Simplifies wlr_seat.keyboardNotifyEnter() signature.
2024-02-18 16:08:51 +00:00
tiosgz
bd52c155ef Keyboard: rework key processing semantic
The old eat/pass-on point of view was good when there was only the
focused client to send the key to. But where does the input method
stand? Instead, we now want to know where the key goes, treating river
and clients all equally.

Thanks to ifreund for pointing me to std.BoundedArray which simplifies
some of the logic.
2024-02-18 15:31:53 +00:00
tiosgz
a1ce53a998 KeycodeSet: move to Keyboard.zig
The file was too short and did't make much sense on its own; actually,
it's quite clearly part of the Keyboard logic.
2024-02-18 07:33:29 +00:00
Isaac Freund
2bdbe414e8
View: don't clip off CSD shadow and the like
Instead just clip to the output dimensions as originally intended.
2024-02-15 11:59:38 +01:00
Leon Henrik Plickat
653b5c6660 river: fix names of input config settings 2024-02-15 11:41:43 +01:00
Leon Henrik Plickat
0cae415a93 refactor input configuration 2024-02-14 14:54:36 +01:00
Isaac Freund
a531311ac6
XdgToplevel: handle configure timeout gracefully
Currently configure timeouts hit the "client is buggy and initiated size
change while tiled or fullscreen" code path even if the client is not in
fact buggy. This causes state to get out of sync between river and the
client, and is highly visible as the borders drawn by river no longer
align with the buffer dimensions committed by the client.

This commit fixes this by tracking acks/commits in response to
configures even after a timeout and properly integrating them with the
transaction system.
2024-02-13 14:50:58 +01:00
Isaac Freund
f0b0606e9f
View: clip scene tree to output
There are some cases in which a view can end up with a size/position
that places some part of it outside its output. For example, a window
with a large minimum size in a tiled layout that is placed near the
right or bottom edge of the output may extend past the output bounds.

The problem with this is that part of the view outside the output bounds
may be rendered on another output where it does not belong in a multi-
monitor setup.

To fix this, clip the surfaces of the view and the borders to the output
bounds.
2024-02-10 14:17:29 +01:00
Isaac Freund
93b8bbc2fd
command/zoom: always warp cursor if configured
Focus may not actually change here so seat.focus() may not automatically
warp the cursor.  Nevertheless, a cursor warp seems to be what users
expect with `set-cursor-warp on-focus` configured, especially in
combination with focus-follows-cursor.
2024-02-10 12:00:14 +01:00
Isaac Freund
026c832ba1
xdg-toplevel: handle destroy before xdg-decoration 2024-02-06 12:59:09 +01:00
tiosgz
4685f6906d
Keyboard: eat key before running mapping
To see why this is needed, compare the following flows:
  - user: press key 'j' with Super already pressed
  - Keyboard: handle mapping, focusing next view
  - Seat: send wl_keyboard.enter with keys Super and 'j'
  - Keyboard: eat key 'j'
versus:
  - user: press key 'j' with Super already pressed
  - Keyboard: eat key 'j'
  - Keyboard: handle mapping, focusing next view
  - Seat: send wl_keyboard.enter with key Super.

The necessity of this was already mentioned in 1e3b8ed1; however,
without a comment in code, it was removed in 393bfb42 as superfluous.
Hopefully, the newly added comment will prevent such mistakes in the
future.

Fixes https://github.com/riverwm/river/issues/978
2024-02-05 12:33:09 +01:00
tiosgz
66f1881a72 Keyboard: fix key handling/eating logic
As noticed by leon-p, last refactorings made river send a release event
to the client even if the press event has been eaten. In addition, the
introduction of input method support means that we need to remember
*why* we've eaten the key.

Also make KeycodeSet more strict: i am not aware of any case when a
keyboard could have the same key pressed twice (specifically, keyboard
groups have this handled in wlroots), so make the behavior follow a
smaller set of possible scenarios.
2024-02-01 13:52:59 +00:00
Isaac Freund
69a51cadb4
attach-mode: code/documentation style tweaks 2024-01-13 12:36:20 -06:00
Orfeas
6a71fc65b0
attach-mode: implement after <N> 2024-01-13 12:29:09 -06:00
Isaac Freund
6e9bd83e1d
Root: use Output.PendingState for fallback
Using the same type for these has the potential to simplify some future
code.
2024-01-12 16:49:04 -06:00
Isaac Freund
62dbe34bda
river: fix -log-level filtering
This has been broken since the Zig 0.11.0 upgrade it seems.
2024-01-11 17:10:26 -06:00
Isaac Freund
c9838c31b6
Keyboard: don't send enter before keymap event
It's unclear if this is technically a violation of the protocol or not,
but it makes little sense to do this and many clients in the wild crash
if wl_keyboard.enter is sent before wl_keyboard.keymap.
2024-01-11 16:55:02 -06:00
Isaac Freund
ec8f57e704
Keyboard: check translated keysyms for mappings
If our current approch without xkbcommon translation does not match any
mapping on a key event attempt to match the translated keysym as well.

This makes e.g. the keypad number keys (e.g. KP_1) work intuitively as
they may require translation with numlock active.

The reason we stopped doing this in I7c02ebcbc was due to layout where
e.g. Super+Shift+Space is translated as Space with the Shift modifier
consumed, thereby conflicting with a separate mapping for Super+Space.
This should not be a issue anymore though as we now only run a maximum
of one mapping per key event and we attemt to match mappings without
xkbcommon translation before attempting with translation.
2024-01-11 15:06:33 -06:00
Isaac Freund
f6c434c7a7
river: log version during startup 2024-01-10 17:32:35 -06:00
Isaac Freund
cc1f988e56
Root: fix stack order on restore from 0 outputs 2024-01-09 13:11:16 -06:00
Isaac Freund
c38e7e2d87
Root: remove unneeded fallback.inflight lists 2024-01-09 13:03:55 -06:00
Isaac Freund
5947f04408
Seat: fix potential crash in handleMapping()
I haven't actually managed to reproduce a crash here yet but I feel much
more comfortable about this code with this change.
2024-01-07 16:55:10 -06:00
Leon Henrik Plickat
dd9933b6a1
keyboard-groups: use globber for identifier matching 2024-01-07 12:37:03 -06:00
Isaac Freund
540ca043df
Keyboard: fix mapping XF86ScreenSaver 2024-01-06 20:36:53 -06:00
Isaac Freund
afbc84c994
river: re-add wl_drm support for now
It seems to be a bit too early to drop support for this legacy protocol.

Xwayland apparently still relies on it for hardware acceleration as do
fairly recent mesa versions still in widespread use.
2024-01-06 19:23:55 -06:00
Wouter van Heijst
3605a46bb5 Cursor: Focus follows cursor focuses empty outputs
When `focus-follows-cursor` is set and the cursor moves onto an output
where no views are present on the currently visible tags, focus the
output itself instead of an individual view.

This is useful e.g. when you want to spawn a terminal on your empty
monitor or switch it to a different tag.  Previously such changes would
happen to the monitor on which you previous focus was, despite the
cursor being somewhere else.
2024-01-06 14:16:21 +02:00
Isaac Freund
9aa0f1a9a6
Output: fix possible crash on destroy 2024-01-05 12:50:36 -06:00
Isaac Freund
393bfb42b9
Keyboard: delete some uneeded code 2024-01-05 12:31:55 -06:00
Isaac Freund
913770975b
Cursor: clean up cursor theme loading
wlroots will now load xcursor themes at the correct scale automatically
based on the scale of the outputs where ther cursors are displayed.

Also make the error handling a bit more robust.
2024-01-04 14:44:51 -06:00
MaxVerevkin
9ce4525f08
river: Implement cursor_shape_v1 2024-01-04 14:14:00 -06:00
MaxVerevkin
9f0e0f2c0a
Cursor: actually set xcursor_name 2024-01-04 14:13:55 -06:00
Leon Henrik Plickat
c86f460135
Keyboard: Add new keyboards to groups if matched
Previously new keyboards would not be added to already existing
keyboard groups on (re-)connect. Only during the creation of
the groups themselves were devices added to them. This meant
that only keyboards connected during startup - before the init
is executed - would work with groups in a typical river session.
2024-01-04 11:00:16 -06:00
Isaac Freund
ebb6d1bdd1
xdg-activation: fix race with transaction system
This code could allows the view to be focused and urgent at the
same time if the request to activate the view is received just after
the pending focus has been set but before the transaction completes.
2024-01-04 10:10:31 -06:00
Isaac Freund
28dcd8320a
linux-dmabuf: send better per-surface feedback
This commit leverages the new wlr_scene helper to send custom feedback
per surface rather than using the same default feedback for every
surface. This should allow direct scanout to work more reliably with
multiple outputs for example.
2024-01-03 17:23:53 -06:00
Isaac Freund
80ced04f68
river: drop support for wl_drm
wl_drm is a legacy interface superseded by the linux-dmabuf
protocol. All clients should migrate.

This commit drops support for the protocol which should help find
whatever problematic clients are left in the wild.

If it turns out that this is too soon we can easily keep supporting
wl_drm for a little while longer as wlroots has not yet dropped support
for it.
2024-01-03 17:22:00 -06:00
MaxVerevkin
6a74ed99fa
river: Implement fractional_scale_v1 2024-01-03 12:47:31 -06:00
Isaac Freund
db70868c04
XdgToplevel: fix frame perfection on unmap
It looks like the old workaround for this wlroots API wart is no longer
sufficient for wlroots 0.17.
2024-01-03 12:39:43 -06:00
Isaac Freund
be4dbe3fe7
Keyboard: clarify keypress routing logic 2024-01-01 23:02:55 -06:00
Isaac Freund
40920c7818
TextInput: fix consecutive enable requests
The wording of the text-input-v3 protocol is quite confusing here
but I'm pretty sure this is now correct.
2024-01-01 23:02:55 -06:00
Isaac Freund
6f311af3b3
TextInput/InputRelay: style nits
There should be no functional changes in this commit
2024-01-01 23:02:55 -06:00
Isaac Freund
134a6bcfb5
TextInput: handle multiple text inputs correctly
The protocol states that we must send enter and leave to all text input
objects if the client has created multiple.

Only one text input is allowed to be activated by the client per seat
however.
2024-01-01 23:02:55 -06:00
Isaac Freund
49defcfb7a
TextInput: remove pending_focused_surface
This state doesn't need to exist, just get the focus from the Seat.
2024-01-01 23:02:55 -06:00
praschke
55ed16efd1
input-method: address nits 2024-01-01 23:02:55 -06:00
praschke
8f497a3570
input-method: check that the input method is active when committing 2024-01-01 23:02:55 -06:00
praschke
18d4ccdd38
input-method: send text-input enter event after all leave events 2024-01-01 23:02:55 -06:00
praschke
4af77f5ffb
input-method: setKeyboard already sends modifiers 2024-01-01 23:02:54 -06:00
praschke
2abab1e9c7
river: Implement input_method and text_input 2024-01-01 23:02:54 -06:00
Isaac Freund
3aba3abbcd
build: require at least wlroots 0.17.1
There are enough bugs fixed in 0.17.1 which are relevant to river that I
think it's worthwhile to refuse to compile against 0.17.1.
2024-01-01 22:55:15 -06:00