GDK W32: Support switching input modules at runtime
This leverages the normal input module switching mechanism in GTK by making it think that the gtk-im-module setting changed. The backend returns gtk-im-module value as "ime" if W32 IME API says that an IME is in use. Otherwise it returns and empty string - this still triggers an input module loading code, which, not being able to load the desired module (which is and empty string), falls back to looking at current keyboard layout. Paired with the code that signals gtk-im-module change on keyboard layout switches, this is sufficient to make GTK capable of loading appropriate input modules at runtime. At least, the kinds of modules that specify languages for which they are loaded automatically by default, and the IME module. Loading other kinds of input modules might still work via specifying the gtk-im-module setting in gtk ini file, but doing so will likely make GTK incapable of loading the IME input module that is used for Korean, Chinese and Japanese (and some other languages). Until someone figures out a way to actually change gtk-im-module setting on Windows at runtime with meaningful values, the behaviour introduced by this commit seems like a sufficient workaround.
This commit is contained in:
@ -389,6 +389,15 @@ _gdk_win32_screen_get_setting (GdkScreen *screen,
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (strcmp ("gtk-im-module", name) == 0)
|
||||
{
|
||||
if (_gdk_input_locale_is_ime)
|
||||
g_value_set_string (value, "ime");
|
||||
else
|
||||
g_value_set_string (value, "");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user