SFML community forums

Help => System => Topic started by: dydya-stepa on March 07, 2012, 11:34:42 am

Title: How to handle language switch? (Ctrl+Shift or Alt+Shift)
Post by: dydya-stepa on March 07, 2012, 11:34:42 am
Want to improve my text box so a user can decide in what language to type. So far seems like sfml doesn't handle language switch by default - nothing happens and i'm always with my system default language.
Title: How to handle language switch? (Ctrl+Shift or Alt+Shift)
Post by: Laurent on March 07, 2012, 12:04:32 pm
There's nothing to do to make language switches work, it's all handled by the OS.

I've made some tests, and I found that changing the language works in SFML, but only after you "do" something with the window: move it, resize it, click the icon. And you have to do this everytime you change the language, otherwise it won't be applied.

This is really strange and I have no idea why it behaves like this. It definitely needs further investigation. I'll add an issue to the tracker.

By the way, we're only talking about Windows, right? I haven't tested other OSes and don't even knwo how language switch works on them.
Title: How to handle language switch? (Ctrl+Shift or Alt+Shift)
Post by: Mario on March 07, 2012, 02:16:31 pm
I'm quite sure your active window should receive a window message notifying you about the change - which I guess is dropped or unhandled right now. More to read about it here (http://msdn.microsoft.com/en-us/goglobal/bb688135#eve).
Title: How to handle language switch? (Ctrl+Shift or Alt+Shift)
Post by: Laurent on March 07, 2012, 02:23:43 pm
Quote
I'm quite sure your active window should receive a window message notifying you about the change - which I guess is dropped or unhandled right now. More to read about it here.

It does receive the messages (WM_INPUTLANGCHANGEREQUEST and WM_INPUTLANGCHANGE), and they don't need to be handled explicitely (and I'm not dropping them explicitely). But for some obscure reason they don't reach the SFML's event loop until something happens on the window (resize, move, ...). ... like I said right above ;)
Title: How to handle language switch? (Ctrl+Shift or Alt+Shift)
Post by: dydya-stepa on March 07, 2012, 03:12:58 pm
I'm talking only about Windows.

Heh, and I'm running fullscreen  :) . So hard to do something with the window.
Title: How to handle language switch? (Ctrl+Shift or Alt+Shift)
Post by: Laurent on March 13, 2012, 08:51:53 am
I found two interesting things.

1. It seems to work fine on Windows 7

2. I found this thread (http://www.sfml-dev.org/forum/viewtopic.php?t=4152) and the given workaround (a modification inside SFML) solves the problem
Title: How to handle language switch? (Ctrl+Shift or Alt+Shift)
Post by: dydya-stepa on March 13, 2012, 02:54:48 pm
1) I was actually testing it on Windows 7 and it didn't work. That's how a found that issue

2) You mean now the latest SFML contains this fix ? Or I should do it myself if i need to
Title: How to handle language switch? (Ctrl+Shift or Alt+Shift)
Post by: Laurent on March 13, 2012, 05:00:22 pm
Quote
I was actually testing it on Windows 7 and it didn't work. That's how a found that issue

Uh :?
Note that for me, Ctrl+Alt doesn't work, but it's a different problem, not related to SFML. I found several reports on internet for the same bug. I had to assign a shortcut to a specific language (like Ctrl+0 to switch to english), and this one works fine.

Quote
You mean now the latest SFML contains this fix ?

No, because I still don't understand why this modification makes it work. I'm not supposed to do this modification (and I don't want to).