Colin Finck schrieb:
Hi,
Let me at least answer one of your questions before these get lost in the discussion.
Am 03.12.2015 um 23:03 schrieb Hans-Peter Diettrich:
Q: Is kbswitch notified of focus changes, and if so: how?
As you have already found out, kbswitch has been implemented as a system-wide keyboard layout switcher and not a per-application one. Therefore, it doesn't care about focus at all.
At a first glance I've been happy with that global switcher, but then found it unreliable and lacking a persistent (machine/user) specific default. Because I want to use a German keyboard in an otherwise English installation, the persistence of that choice is essential to me. But as this setting is subject to the control panel; and not yet implemented there; I started digging into kbswitch. Perhaps I should dig into the control panel dialog instead, but that's another topic.
A proper per-application keyboard layout switcher as part of the Language Bar should also be implemented as a shell extension instead of a tray icon to be as flexible as the Windows original. To get notified of focus changes, an application should probably hook the EVENT_SYSTEM_FOREGROUND event using the SetWinEventHook API. The rest can be done using calls to GetForegroundWindow, GetWindowThreadProcessId and GetKeyboardLayout as you already suggested.
Unfortunately, I lack deeper experience with keyboard layout internals, so this is all I can tell you for now.
Unfortunately I'm not familiar with Shell and COM and the Language Bar, just found out that the latter exists at all. I've learned about Windows internals for Win3.1, so that I can assist only in "lower level" functionality. In fact I have no real use for the bloated Windows versions past XP, I prefer using the older versions in virtual machines on my desktop or laptop instead.
You may find someone in #reactos or #reactos-dev on IRC with more expertise on this.
For a first glance on the control panel settings I'd need a link/filename of the language related dialogs. Otherwise I only can jump in where somebody else implemented a related framework, hunting bugs or implementing extensions.
Thanks for the new keywords :-) DoDi