emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs/src ChangeLog w32fns.c w32term.c


From: Jason Rumney
Subject: [Emacs-diffs] emacs/src ChangeLog w32fns.c w32term.c
Date: Wed, 22 Jul 2009 16:03:42 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Jason Rumney <jasonr>   09/07/22 16:03:42

Modified files:
        src            : ChangeLog w32fns.c w32term.c 

Log message:
        * w32fns.c (w32_wnd_proc) [WM_IME_STARTCOMPOSITION]: Position
        IME window at cursor (Bug#2570).
        (w32_wnd_proc) [WM_IME_CHAR]: Release context when finished.
        (globals_of_w32fns): Dynamically load functions required above.
        
        * w32term.c (w32_draw_window_cursor): Send message to reposition
        any IME window.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/src/ChangeLog?cvsroot=emacs&r1=1.7659&r2=1.7660
http://cvs.savannah.gnu.org/viewcvs/emacs/src/w32fns.c?cvsroot=emacs&r1=1.359&r2=1.360
http://cvs.savannah.gnu.org/viewcvs/emacs/src/w32term.c?cvsroot=emacs&r1=1.329&r2=1.330

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/src/ChangeLog,v
retrieving revision 1.7659
retrieving revision 1.7660
diff -u -b -r1.7659 -r1.7660
--- ChangeLog   21 Jul 2009 23:34:02 -0000      1.7659
+++ ChangeLog   22 Jul 2009 16:03:39 -0000      1.7660
@@ -1,3 +1,13 @@
+2009-07-22  Jason Rumney  <address@hidden>
+
+       * w32fns.c (w32_wnd_proc) [WM_IME_STARTCOMPOSITION]: Position
+       IME window at cursor (Bug#2570).
+       (w32_wnd_proc) [WM_IME_CHAR]: Release context when finished.
+       (globals_of_w32fns): Dynamically load functions required above.
+
+       * w32term.c (w32_draw_window_cursor): Send message to reposition
+       any IME window.
+
 2009-07-21  Chong Yidong  <address@hidden>
 
        * fileio.c: Revert 2009-07-16 changes.

Index: w32fns.c
===================================================================
RCS file: /sources/emacs/emacs/src/w32fns.c,v
retrieving revision 1.359
retrieving revision 1.360
diff -u -b -r1.359 -r1.360
--- w32fns.c    1 Jul 2009 16:48:37 -0000       1.359
+++ w32fns.c    22 Jul 2009 16:03:41 -0000      1.360
@@ -252,6 +252,9 @@
 typedef LONG (WINAPI * ImmGetCompositionString_Proc)
   (IN HIMC context, IN DWORD index, OUT LPVOID buffer, IN DWORD bufLen);
 typedef HIMC (WINAPI * ImmGetContext_Proc) (IN HWND window);
+typedef HWND (WINAPI * ImmReleaseContext_Proc) (IN HWND wnd, IN HIMC context);
+typedef HWND (WINAPI * ImmSetCompositionWindow_Proc) (IN HIMC context,
+                                                     IN COMPOSITIONFORM *form);
 typedef HMONITOR (WINAPI * MonitorFromPoint_Proc) (IN POINT pt, IN DWORD 
flags);
 typedef BOOL (WINAPI * GetMonitorInfo_Proc)
   (IN HMONITOR monitor, OUT struct MONITOR_INFO* info);
@@ -260,6 +263,8 @@
 ClipboardSequence_Proc clipboard_sequence_fn = NULL;
 ImmGetCompositionString_Proc get_composition_string_fn = NULL;
 ImmGetContext_Proc get_ime_context_fn = NULL;
+ImmReleaseContext_Proc release_ime_context_fn = NULL;
+ImmSetCompositionWindow_Proc set_ime_composition_window_fn = NULL;
 MonitorFromPoint_Proc monitor_from_point_fn = NULL;
 GetMonitorInfo_Proc get_monitor_info_fn = NULL;
 
@@ -3158,6 +3163,8 @@
           buffer = alloca(size);
           size = get_composition_string_fn (context, GCS_RESULTSTR,
                                             buffer, size);
+         release_ime_context_fn (hwnd, context);
+
           signal_user_input ();
           for (i = 0; i < size / sizeof (wchar_t); i++)
             {
@@ -3173,6 +3180,40 @@
 
       break;
 
+    case WM_IME_STARTCOMPOSITION:
+      if (!set_ime_composition_window_fn)
+       goto dflt;
+      else
+       {
+         COMPOSITIONFORM form;
+         HIMC context;
+         struct window *w;
+
+         if (!context)
+           break;
+
+         f = x_window_to_frame (dpyinfo, hwnd);
+         w = XWINDOW (FRAME_SELECTED_WINDOW (f));
+
+         form.dwStyle = CFS_RECT;
+         form.ptCurrentPos.x = w32_system_caret_x;
+         form.ptCurrentPos.y = w32_system_caret_y;
+
+         form.rcArea.left = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, 0);
+         form.rcArea.top = (WINDOW_TOP_EDGE_Y (w)
+                            + WINDOW_HEADER_LINE_HEIGHT (w));
+         form.rcArea.right = (WINDOW_BOX_RIGHT_EDGE_X (w)
+                              - WINDOW_RIGHT_MARGIN_WIDTH (w)
+                              - WINDOW_RIGHT_FRINGE_WIDTH (w));
+         form.rcArea.bottom = (WINDOW_BOTTOM_EDGE_Y (w)
+                               - WINDOW_MODE_LINE_HEIGHT (w));
+
+         context = get_ime_context_fn (hwnd);
+         set_ime_composition_window_fn (context, &form);
+         release_ime_context_fn (hwnd, context);
+       }
+      break;
+
     case WM_IME_ENDCOMPOSITION:
       ignore_ime_char = 0;
       goto dflt;
@@ -7278,6 +7319,10 @@
       GetProcAddress (imm32_lib, "ImmGetCompositionStringW");
     get_ime_context_fn = (ImmGetContext_Proc)
       GetProcAddress (imm32_lib, "ImmGetContext");
+    release_ime_context_fn = (ImmReleaseContext_Proc)
+      GetProcAddress (imm32_lib, "ImmReleaseContext");
+    set_ime_composition_window_fn = (ImmSetCompositionWindow_Proc)
+      GetProcAddress (imm32_lib, "ImmSetCompositionWindow");
   }
   DEFVAR_INT ("w32-ansi-code-page",
              &w32_ansi_code_page,

Index: w32term.c
===================================================================
RCS file: /sources/emacs/emacs/src/w32term.c,v
retrieving revision 1.329
retrieving revision 1.330
diff -u -b -r1.329 -r1.330
--- w32term.c   3 Jul 2009 15:32:05 -0000       1.329
+++ w32term.c   22 Jul 2009 16:03:41 -0000      1.330
@@ -32,6 +32,7 @@
 #include <ctype.h>
 #include <errno.h>
 #include <sys/stat.h>
+#include <imm.h>
 
 #include "charset.h"
 #include "character.h"
@@ -5128,6 +5129,8 @@
            = (WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y)
               + glyph_row->ascent - w->phys_cursor_ascent);
 
+         PostMessage (hwnd, WM_IME_STARTCOMPOSITION, 0, 0);
+
          /* If the size of the active cursor changed, destroy the old
             system caret.  */
          if (w32_system_caret_hwnd




reply via email to

[Prev in Thread] Current Thread [Next in Thread]