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

eframe Linux: Backspace & arrow keys are completely broken #5008

Closed
StarStarJ opened this issue Aug 26, 2024 · 15 comments · Fixed by #5188
Closed

eframe Linux: Backspace & arrow keys are completely broken #5008

StarStarJ opened this issue Aug 26, 2024 · 15 comments · Fixed by #5188
Labels
bug Something is broken eframe Relates to epi and eframe native-linux Problem specific to Linux

Comments

@StarStarJ
Copy link
Contributor

StarStarJ commented Aug 26, 2024

I use the latest master from egui (a9a6e0c), and run the egui_demo_app on x11 linux (no IME). I can't use arrows or backspace in a text edit

Maybe it is related to this issue:

To Reproduce
Steps to reproduce the behavior:
Simply start the demo app (native) and the keys wont work

Desktop (please complete the following information):

  • OS: debian sid x11 using KDE
@StarStarJ StarStarJ added the bug Something is broken label Aug 26, 2024
@emilk emilk added the native-linux Problem specific to Linux label Aug 26, 2024
@emilk emilk changed the title TextEdit: Backspace & arrow keys are completely broken eframe Linux: Backspace & arrow keys are completely broken Aug 26, 2024
@emilk emilk added the eframe Relates to epi and eframe label Aug 26, 2024
@rustbasic
Copy link
Contributor

Could you check if applying #4896 fixes the issue?

@StarStarJ
Copy link
Contributor Author

StarStarJ commented Aug 27, 2024

I tried your branch on rev 6ef2ef5,
which does not fix the issue.

@rustbasic
Copy link
Contributor

rustbasic commented Aug 27, 2024

I tried your branch on rev 6ef2ef5, which does not fix the issue.

It's strange. The issue only happens when state.ime_enabled is true. So applying #4896 to set state.ime_enabled to false when gaining or losing focus should fix the issue, but it's not working, which is strange.

If state.ime_enabled is false, it should be fine, but could you please find out why it doesn't work?

@rustbasic
Copy link
Contributor

rustbasic commented Aug 27, 2024

Dear emilk.

#4896 should be applied, and is separate from the solution to this issue.
( I expected this issue to be solved with #4896, but it is not, which is unfortunate. )

@StarStarJ
Copy link
Contributor Author

You are right, it's most likely not related to your merge request

[crates/egui/src/widgets/text_edit/builder.rs:750:9] state.ime_enabled = true
ime_enabled is true, seems like winit sends that event.

maybe a regression there:
rust-windowing/winit#3092

Sadly it affects egui too

@rustbasic
Copy link
Contributor

You are right, it's most likely not related to your merge request

[crates/egui/src/widgets/text_edit/builder.rs:750:9] state.ime_enabled = true ime_enabled is true, seems like winit sends that event.

maybe a regression there: rust-windowing/winit#3092

Sadly it affects egui too

Yes. There seem to be a lot of bug reports related to IME in winit + LINUX. I created a separate option related to ime_enable, but it was not approved. When I have time, I will commit a separate option again.

emilk pushed a commit that referenced this issue Aug 28, 2024
…oses focus. (#4896)

Fix: Ensures correct IME behavior when the text input area gains or
loses focus.

Fix: Handling `state.ime_enabled` in multiple `TextEdit`.
Fix: A symptom of characters being copied when there are multiple
TextEdits.

* Related #4137
* Related #4358 
* Closes #4374
* Related #4436
* Related #4794 
* Related #4908 

* Related #5008

Fix Issues: When focus is moved elsewhere, you must set
`state.ime_enabled = false`, otherwise the IME will have problems when
focus returns.

Fix Issues: A symptom of characters being copied when there are multiple
TextEdits.
Deletes all current `IME events`, preventing them from being copied to
`other TextEdits`, without saving the `TextEdit ID`,

( Related Issues: Some `LINUX` seem to trigger an IME enable event on
startup. So, when we gained focus, we do `state.ime_enabled = false`. )
@rustbasic
Copy link
Contributor

@StarStarJ
#4896 has been applied to egui Master version, is it still in a weird state?

@StarStarJ
Copy link
Contributor Author

Yes, still buggy.
For now I disabled all IME events on Linux inside the winit handler.

@rustbasic
Copy link
Contributor

Could you please check if this can be solved with #5085?

Settings window -> Visuals -> Text Edit -> OFF IME Support

@StarStarJ
Copy link
Contributor Author

Yes that fixes it as well

@crumblingstatue
Copy link
Contributor

crumblingstatue commented Sep 28, 2024

Just as a future note: This should have been labeled regression, and blocked the 0.29 release.
This breaks all Linux X11 users.

If not outright block the release, there should be a bold

Known regressions

  • TextEdit does not respond to backspace or arrow keys on X11 Linux systems.

section in the changelog.

@crumblingstatue
Copy link
Contributor

In the meantime, I made a small patch that just ignores IME events in egui-winit

# Fix text input being broken on Linux X11
[patch.crates-io.egui-winit]
git = "https://github.com/crumblingstatue/egui.git"
branch = "ime-ignore"
[patch.crates-io.egui]
git = "https://github.com/crumblingstatue/egui.git"
branch = "ime-ignore"

@AlexanderSchuetz97
Copy link

@crumblingstatue
Thank you, I was about to go insane because of this.
Does your fix have any impact on non linux targets? I compile my app for wasm, linux, windows. (well they all have to work.)

@crumblingstatue
Copy link
Contributor

@AlexanderSchuetz97

Does your fix have any impact on non linux targets? I compile my app for wasm, linux, windows. (well they all have to work.)

Yes, it disables IME events completely. So IME support is removed on all targets.

@AlexanderSchuetz97
Copy link

@AlexanderSchuetz97

Does your fix have any impact on non linux targets? I compile my app for wasm, linux, windows. (well they all have to work.)

Yes, it disables IME events completely. So IME support is removed on all targets.

Ive had to lookup what IME is and yeah... Not relevant for me. Thank you for explaining.

486c pushed a commit to 486c/egui that referenced this issue Oct 9, 2024
…oses focus. (emilk#4896)

Fix: Ensures correct IME behavior when the text input area gains or
loses focus.

Fix: Handling `state.ime_enabled` in multiple `TextEdit`.
Fix: A symptom of characters being copied when there are multiple
TextEdits.

* Related emilk#4137
* Related emilk#4358 
* Closes emilk#4374
* Related emilk#4436
* Related emilk#4794 
* Related emilk#4908 

* Related emilk#5008

Fix Issues: When focus is moved elsewhere, you must set
`state.ime_enabled = false`, otherwise the IME will have problems when
focus returns.

Fix Issues: A symptom of characters being copied when there are multiple
TextEdits.
Deletes all current `IME events`, preventing them from being copied to
`other TextEdits`, without saving the `TextEdit ID`,

( Related Issues: Some `LINUX` seem to trigger an IME enable event on
startup. So, when we gained focus, we do `state.ime_enabled = false`. )
hacknus pushed a commit to hacknus/egui that referenced this issue Oct 30, 2024
…oses focus. (emilk#4896)

Fix: Ensures correct IME behavior when the text input area gains or
loses focus.

Fix: Handling `state.ime_enabled` in multiple `TextEdit`.
Fix: A symptom of characters being copied when there are multiple
TextEdits.

* Related emilk#4137
* Related emilk#4358 
* Closes emilk#4374
* Related emilk#4436
* Related emilk#4794 
* Related emilk#4908 

* Related emilk#5008

Fix Issues: When focus is moved elsewhere, you must set
`state.ime_enabled = false`, otherwise the IME will have problems when
focus returns.

Fix Issues: A symptom of characters being copied when there are multiple
TextEdits.
Deletes all current `IME events`, preventing them from being copied to
`other TextEdits`, without saving the `TextEdit ID`,

( Related Issues: Some `LINUX` seem to trigger an IME enable event on
startup. So, when we gained focus, we do `state.ime_enabled = false`. )
hacknus pushed a commit to hacknus/egui that referenced this issue Oct 30, 2024
* Closes emilk#5008
* Closes emilk#5182
* Bug introduced in emilk#4912

I suspect this will make IME no longer work on Linux, though I don't
know if it ever worked.
I rather have backspace/arrows working though.

Please help test this (I don't have Linux!)

# Tested on
* [x] Mac
* [ ] Linux Wayland
* [x] Linux X11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken eframe Relates to epi and eframe native-linux Problem specific to Linux
Projects
None yet
5 participants