DBus server for keyboard layouts
l.lunak at suse.cz
Fri Oct 5 07:52:28 PDT 2007
On Friday 05 of October 2007, Sergey Udaltsov wrote:
> > How exactly should that work when switching between applications?
> There can be 3 scenarios:
> 1. If you switch to the "classic" app (which does not support
> "context-driven" layouts), there are no changes:
I think "classic app" is somewhat misleading here ... how about "the vast
majority of apps" ? It rather changes what's written below.
> - if DE/WM implements "layout per window" mode, each application
> "remembers" its layout.
> - otherwise the layout is preserved on switching
Which I expect would be so annoying that keyboard switcher would have to
implement the layout per window feature.
> 2. If the app supports "context-driven" layouts, the layout would be
> changed depending on where you caret would be put to, immediately
> after switch.
Given the asynchronous nature of the desktop, this part of your proposal is
prone to race conditions. Imagine:
- two apps running, app A has support, app B is "classic", as you say
- keyboard switcher (let me call it kxkb for short) has layout per window
- B is active
1) user switches to A
2) kxkb saves B's active layout and switches layout to A's remembered layout
3) A asks kxkb to switch to layout matching the active part of the document
4) user switches back to B
5) kxkb saves A's layout and switches the layout to the one it saved for B
As far as I can see, there are several race conditions:
- 2 vs 3, i.e. A asks kxkb for the change before kxkb notices changed active
window, thus changing saved layout for B
- 3 vs 4+5, i.e. A takes a while to activate and asks kxkb to change layout
after kxkb has already switched back for B, again setting wrong layout for B
Maybe there are more, but these two are enough and they're both realistic. I
think you cannot just have apps say "switch (the global layout) to layout
XYZ". A possible solution I see is e.g. instead having setLayoutForWindow(
window_id, layout ).
> > I don't
> > think people would like it if their global keyboard layout changed
> > "randomly" just because they happen to have a multi-language document
> > open in a text editor.
> Of course, this all should be optional behavior - like per-window
> layout settings in GNOME these days. But I think many people would
> actually like that idea - it would save some keypresses in situations
> where necessary layout is obvious.
SUSE LINUX, s.r.o. e-mail: l.lunak at suse.cz , l.lunak at kde.org
Lihovarska 1060/12 tel: +420 284 028 972
190 00 Prague 9 fax: +420 284 028 951
Czech Republic http//www.suse.cz
More information about the xdg