DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2599
Version: 1.3-feature


Attached file "fltk-1.3.x-keyboard-win32.patch"...


Link: http://www.fltk.org/str.php?L2599
Version: 1.3-feature
diff -up fltk-1.3.x-r8617/src/Fl_win32.cxx.orig 
fltk-1.3.x-r8617/src/Fl_win32.cxx
--- fltk-1.3.x-r8617/src/Fl_win32.cxx.orig      2011-05-05 12:58:39.625780012 
+0200
+++ fltk-1.3.x-r8617/src/Fl_win32.cxx   2011-05-05 12:58:48.124054690 +0200
@@ -131,6 +131,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);
@@ -146,6 +148,7 @@ static HMODULE 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");
@@ -649,6 +652,47 @@ void fl_get_codepage()
   }
 }
 
+void fl_update_focus(void)
+{
+  Fl_Widget *focus;
+  Fl_Window *win;
+
+  get_imm_module();
+
+  focus = Fl::grab();
+  if (!focus)
+    focus = Fl::focus();
+  if (!focus)
+    return;
+
+  // Grabs are special in that events are sent to the first
+  // available window
+  if (focus == Fl::grab())
+    win = Fl::first_window();
+  else {
+    win = focus->as_window();
+    if (!win)
+      win = focus->window();
+  }
+
+  if (!win) {
+    Fl::warning("Cannot find window for widget receiving focus");
+    return;
+  }
+
+  // No Win32 window created yet
+  if (!Fl_X::i(win) || !fl_xid(win))
+    return;
+
+  if (focus->simple_keyboard()) {
+    if (flImmGetContext(fl_xid(win)) != 0)
+      flImmAssociateContextEx(fl_xid(win), 0, 0);
+  } else {
+    if (flImmGetContext(fl_xid(win)) == 0)
+      flImmAssociateContextEx(fl_xid(win), 0, IACE_DEFAULT);
+  }
+}
+
 HWND fl_capture;
 
 static int mouse_event(Fl_Window *window, int what, int button,
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to