mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-30 09:00:31 -08:00
* 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.
This commit is contained in:
parent
855b42a23d
commit
c902b9205b
3 changed files with 58 additions and 0 deletions
|
|
@ -1,3 +1,13 @@
|
|||
2009-07-22 Jason Rumney <jasonr@gnu.org>
|
||||
|
||||
* 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 <cyd@stupidchicken.com>
|
||||
|
||||
* fileio.c: Revert 2009-07-16 changes.
|
||||
|
|
|
|||
45
src/w32fns.c
45
src/w32fns.c
|
|
@ -252,6 +252,9 @@ typedef BOOL (WINAPI * TrackMouseEvent_Proc)
|
|||
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 @@ TrackMouseEvent_Proc track_mouse_event_fn = NULL;
|
|||
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 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
|
|||
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 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
|
|||
|
||||
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 @@ globals_of_w32fns ()
|
|||
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,
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <sys/stat.h>
|
||||
#include <imm.h>
|
||||
|
||||
#include "charset.h"
|
||||
#include "character.h"
|
||||
|
|
@ -5128,6 +5129,8 @@ w32_draw_window_cursor (w, glyph_row, x, y, cursor_type, cursor_width, on_p, act
|
|||
= (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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue