Greeter: Text direction is not updated in password entries
I just played around a little bit with some keyboard bugs in the greeter when this problem appeared:
- I select an Afghani keyboard (written RTL)
- I try to set an admin password but then I realize that I can't type in Afghani
- I go back to the keyboard and language options and select German everywhere
- I reopen the additional options screen and want to type an admin password but my keyboard layout is still RTL and I can't see if I'm typing in German or in Afghani now
I went back again to the main window and rechose the German layout, and then after two times the additional options screen adjusted and let me type LTR.
#2 Updated by sajolida about 1 year ago
- Parent task deleted (
I confirm some weird behaviors in the keyboard layout changes in Tails Greeter.
Sometimes I can get the password field to (apparently) change to the new keyboard layout by pressing "Tab" to switch between the first and the second password field.
- Assignee deleted (
Alan hasn't touched this ticket since it was created over 1 year ago and I think that we should unblock it.
Yes, let's make it clear that this one is up for grabs, and could be tackled by any FT member: there's no particular reason why we need to block on Alan here.
I spent too much time on this but couldn't solve it. Here is what I found out:
- If the keyboard layout is changed, the text direction of the password entry while focussed is only updated if you press Shift or Caps Lock inside the entry. I could not reproduce the Tab-related update reported by sajolida - I guess that he pressed Shift+Tab which triggered the update.
- The keyboard layout itself is not affected: You always type in the currently selected layout, it's just the text direction of the entry that is incorrect.
- The text direction update is not triggered by the Greeter (there is no Python code executed when I press Shift). It could be some weird GTK thing. Not sure whether it's worth to report upstream.
- Things like gtk_widget_reset_style don't help.
- The text direction of the entry while not focussed is not affected by the keyboard layout at all, but by the current language. This can be changed by the gtk_widget_set_direction function.
- If an RTL language is chosen in the greeter, then the text direction of the entry is RTL (whether focussed or not).
- Text entries created after the keyboard layout was changed have the correct text direction while focussed.
We could fix this by recreating the password entry every time the administration setting is opened. But the way the Greeter is implemented makes this change very hard: The password entry is created from the UI file and added as an attribute to multiple objects. I don't think solving this issue is worth the effort. But maybe I we will refactor the Greeter at some point (I would like to do that), and then we could fix this.
#11 Updated by intrigeri about 1 month ago
Alan believes that if GTK explicitly supports changing text direction globally in an already running app, then this is likely a bug in GTK. We should first check this. Interesting resources:
Else, we could manually set text direction on all entry widgets whenever the user selects a different language; in which case, having the entire UI already created (but not displayed) from the UI file on startup might be an advantage.