Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

input: Only forward modifiers in KeyboardInnerHandle::set_focus #1110

Merged
merged 3 commits into from
Sep 5, 2023
Merged

input: Only forward modifiers in KeyboardInnerHandle::set_focus #1110

merged 3 commits into from
Sep 5, 2023

Conversation

luveti
Copy link
Contributor

@luveti luveti commented Sep 1, 2023

This should fix #1107.

src/input/keyboard/mod.rs Outdated Show resolved Hide resolved
Copy link
Member

@Drakulix Drakulix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thanks

Copy link
Collaborator

@cmeissl cmeissl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ids1024
Copy link
Member

ids1024 commented Sep 1, 2023

How does this compare to behavior in other compositors? wl_keyboard::enter takes an array of pressed keys, so the previously implementation of this looks like how the Wayland protocol is intended to implement.

@Drakulix
Copy link
Member

Drakulix commented Sep 4, 2023

How does this compare to behavior in other compositors? wl_keyboard::enter takes an array of pressed keys, so the previously implementation of this looks like how the Wayland protocol is intended to implement.

Hmm sway does seem to indeed send the pressed keys: https://github.com/swaywm/sway/blob/89f85312687b7fd1777c936e169e6400cee0a4b4/sway/input/seat.c#L164-L166

@Drakulix
Copy link
Member

Drakulix commented Sep 4, 2023

So I was wondering why I don't observe this behaviour in cosmic-comp and it seems to come do to, at which point you trigger the shortcut. cosmic-comp triggers them on key-release, which means the key is removed from pressed_keys before the focus changes. There is obviously value in allowing this to work on key-pressed as well, so if we don't want to always send an empty set of keys, we need to at least honour the compositors which to intercept a key and consequentially remove the key from pressed_keys again.

@luveti
Copy link
Contributor Author

luveti commented Sep 4, 2023

@ids1024 @Drakulix I observed that XFCE (X11) will maintain pressed keys when switching windows. So I've implemented the second option and it appears to work well.

@codecov-commenter
Copy link

codecov-commenter commented Sep 5, 2023

Codecov Report

Patch coverage: 40.00% and project coverage change: -1.11% ⚠️

Comparison is base (c569c87) 24.01% compared to head (6e63f32) 22.90%.
Report is 35 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1110      +/-   ##
==========================================
- Coverage   24.01%   22.90%   -1.11%     
==========================================
  Files         140      143       +3     
  Lines       21591    22859    +1268     
==========================================
+ Hits         5184     5235      +51     
- Misses      16407    17624    +1217     
Flag Coverage Δ
wlcs-buffer 20.00% <40.00%> (-1.03%) ⬇️
wlcs-core 19.65% <40.00%> (-1.01%) ⬇️
wlcs-output 8.17% <20.00%> (-0.30%) ⬇️
wlcs-pointer-input 21.67% <40.00%> (-1.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
src/wayland/tablet_manager/tablet_seat.rs 4.72% <0.00%> (ø)
src/input/keyboard/mod.rs 12.69% <33.33%> (+0.19%) ⬆️
src/wayland/shell/xdg/mod.rs 30.97% <100.00%> (-0.63%) ⬇️

... and 27 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@Drakulix Drakulix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now this is only a bugfix, not forwarding any intercepted key presses. I don't think this is in any way controversial.

Should anyone want to discuss over semantics of key presses on focus swaps, they can open a new issue. This doesn't change behaviour, so lets move on with this PR.

Thanks @luveti for working on this! :)

@Drakulix Drakulix merged commit 63816ee into Smithay:master Sep 5, 2023
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

KeyboardInnerHandle::set_focus transfers pressed keys to newly focused client
5 participants