summaryrefslogtreecommitdiff
path: root/src/Fl_win32.cxx
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2014-09-15 09:44:35 +0000
committerPierre Ossman <ossman@cendio.se>2014-09-15 09:44:35 +0000
commit1c7409e0a12765282a121779ac59168c94de6ef5 (patch)
tree7d3a5327dfef685e61f720c63ae2612ed5ab0b29 /src/Fl_win32.cxx
parent5101a8ea1c74729d6416278f043ec0de877706fe (diff)
Add methods to enable and disable the system's input methods.
This needs to be done from FLTK as it affects the window interaction, which FLTK is largely responsible for. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10314 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_win32.cxx')
-rw-r--r--src/Fl_win32.cxx32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx
index 776bce1c0..ff6da442d 100644
--- a/src/Fl_win32.cxx
+++ b/src/Fl_win32.cxx
@@ -119,6 +119,8 @@ static HMODULE get_wsock_mod() {
* size and link dependencies.
*/
static HMODULE s_imm_module = 0;
+typedef BOOL (WINAPI* flTypeImmAssociateContextEx)(HWND, HIMC, DWORD);
+static flTypeImmAssociateContextEx flImmAssociateContextEx = 0;
typedef HIMC (WINAPI* flTypeImmGetContext)(HWND);
static flTypeImmGetContext flImmGetContext = 0;
typedef BOOL (WINAPI* flTypeImmSetCompositionWindow)(HIMC, LPCOMPOSITIONFORM);
@@ -131,6 +133,7 @@ static void get_imm_module() {
if (!s_imm_module)
Fl::fatal("FLTK Lib Error: IMM32.DLL file not found!\n\n"
"Please check your input method manager library accessibility.");
+ flImmAssociateContextEx = (flTypeImmAssociateContextEx)GetProcAddress(s_imm_module, "ImmAssociateContextEx");
flImmGetContext = (flTypeImmGetContext)GetProcAddress(s_imm_module, "ImmGetContext");
flImmSetCompositionWindow = (flTypeImmSetCompositionWindow)GetProcAddress(s_imm_module, "ImmSetCompositionWindow");
flImmReleaseContext = (flTypeImmReleaseContext)GetProcAddress(s_imm_module, "ImmReleaseContext");
@@ -460,6 +463,32 @@ public:
};
static Fl_Win32_At_Exit win32_at_exit;
+static char im_enabled = 1;
+
+void Fl::enable_im() {
+ fl_open_display();
+
+ Fl_X* i = Fl_X::first;
+ while (i) {
+ flImmAssociateContextEx(i->xid, 0, IACE_DEFAULT);
+ i = i->next;
+ }
+
+ im_enabled = 1;
+}
+
+void Fl::disable_im() {
+ fl_open_display();
+
+ Fl_X* i = Fl_X::first;
+ while (i) {
+ flImmAssociateContextEx(i->xid, 0, 0);
+ i = i->next;
+ }
+
+ im_enabled = 0;
+}
+
////////////////////////////////////////////////////////////////
int Fl::x()
@@ -1878,6 +1907,9 @@ Fl_X* Fl_X::make(Fl_Window* w) {
// Register all windows for potential drag'n'drop operations
RegisterDragDrop(x->xid, flIDropTarget);
+ if (!im_enabled)
+ flImmAssociateContextEx(x->xid, 0, 0);
+
return x;
}