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

With X11 shift:both_capslock, pressing and releasing shift in a textbox acts as it was not released #844

Closed
5225225 opened this issue Oct 25, 2021 · 1 comment · Fixed by #849
Labels
bug Something is broken egui-winit porblems related to winit native-linux Problem specific to Linux

Comments

@5225225
Copy link
Contributor

5225225 commented Oct 25, 2021

Describe the bug
When I press shift inside any TextEdit that has text in it, and then move the cursor with the arrow keys or clicking, all text from the original position to the new one is selected.

To Reproduce
Steps to reproduce the behavior:

  1. Be using X11 and have the shift:both_capslock option set (setxkbmap -option shift:both_capslock to set, setxkbmap -option to clear all options, run setxkbmap -query to see what options have been set already).
  2. Type some text in a TextEdit. I used the egui_demo_app.
  3. Press and release shift. Left or right shift, either works.
  4. Move the text cursor. Any method works, I've tested the mouse, arrow keys, and home/end keys.

Expected behavior
Moving the cursor should not select text if shift is not actively being pressed

Desktop (please complete the following information):

  • OS: Arch Linux (xorg-server version 1.20.13-2, i3-gaps wm version 4.20-1)

I've had a look, and it looks like

let pressed = input.state == winit::event::ElementState::Pressed;
is at fault here. When I have this option set, I never actually get this being set to false. If I press left shift, I get a pressed event, if I then press right shift, this event isn't triggered. When I release left shift, nothing happens, and when I release right shift, pressed = false is set.

If look at on_event in the same file, we do get ModifiersChanged events that look to be correct. Maybe we should be looking at that event instead?

@5225225 5225225 added the bug Something is broken label Oct 25, 2021
@emilk emilk added native-linux Problem specific to Linux egui-winit porblems related to winit labels Oct 26, 2021
@emilk
Copy link
Owner

emilk commented Oct 26, 2021

Listening to ModifiersChanged instead sounds reasonable! Do you want to make a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken egui-winit porblems related to winit native-linux Problem specific to Linux
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants