Mercurial > sdl-ios-xcode
annotate src/video/windows/SDL_windowskeyboard.c @ 5194:93052810ceb5
Allow SDL_HINT_FRAMEBUFFER_ACCELERATION to specify the renderer to use.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 05 Feb 2011 10:11:27 -0800 |
parents | fb424691cfc7 |
children | 572a73d71b5f |
rev | line source |
---|---|
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1 /* |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
3697 | 3 Copyright (C) 1997-2010 Sam Lantinga |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7 License as published by the Free Software Foundation; either |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
9 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
13 Lesser General Public License for more details. |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
14 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
18 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
19 Sam Lantinga |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
20 slouken@libsdl.org |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
21 */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
22 #include "SDL_config.h" |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
23 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5083
diff
changeset
|
24 #ifdef _WIN32_WCE |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5083
diff
changeset
|
25 #define SDL_DISABLE_WINDOWS_IME |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5083
diff
changeset
|
26 #endif |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5083
diff
changeset
|
27 |
5062 | 28 #include "SDL_windowsvideo.h" |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
29 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
30 #include "../../events/SDL_keyboard_c.h" |
5062 | 31 #include "../../events/scancodes_windows.h" |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
32 |
4752 | 33 #include <imm.h> |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
34 #include <oleauto.h> |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
35 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5083
diff
changeset
|
36 #ifndef SDL_DISABLE_WINDOWS_IME |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
37 static void IME_Init(SDL_VideoData *videodata, HWND hwnd); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
38 static void IME_Enable(SDL_VideoData *videodata, HWND hwnd); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
39 static void IME_Disable(SDL_VideoData *videodata, HWND hwnd); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
40 static void IME_Quit(SDL_VideoData *videodata); |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5083
diff
changeset
|
41 #endif /* !SDL_DISABLE_WINDOWS_IME */ |
4752 | 42 |
2311
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
43 #ifndef MAPVK_VK_TO_VSC |
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
44 #define MAPVK_VK_TO_VSC 0 |
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
45 #endif |
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
46 #ifndef MAPVK_VSC_TO_VK |
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
47 #define MAPVK_VSC_TO_VK 1 |
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
48 #endif |
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
49 #ifndef MAPVK_VK_TO_CHAR |
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
50 #define MAPVK_VK_TO_CHAR 2 |
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
51 #endif |
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
52 |
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
53 /* Alphabetic scancodes for PC keyboards */ |
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
54 BYTE alpha_scancodes[26] = { |
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
55 30, 48, 46, 32, 18, 33, 34, 35, 23, 36, 37, 38, 50, 49, 24, |
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
56 25, 16, 19, 31, 20, 22, 47, 17, 45, 21, 44 |
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
57 }; |
2735
204be4fc2726
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2726
diff
changeset
|
58 |
2317
f537a293b3da
Windows also remaps the numeric keypad... grrr
Sam Lantinga <slouken@libsdl.org>
parents:
2311
diff
changeset
|
59 BYTE keypad_scancodes[10] = { |
f537a293b3da
Windows also remaps the numeric keypad... grrr
Sam Lantinga <slouken@libsdl.org>
parents:
2311
diff
changeset
|
60 82, 79, 80, 81, 75, 76, 77, 71, 72, 73 |
f537a293b3da
Windows also remaps the numeric keypad... grrr
Sam Lantinga <slouken@libsdl.org>
parents:
2311
diff
changeset
|
61 }; |
2311
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
62 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
63 void |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
64 WIN_InitKeyboard(_THIS) |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
65 { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
66 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; |
2311
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
67 int i; |
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
68 |
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
69 /* Make sure the alpha scancodes are correct. T isn't usually remapped */ |
2324
3202e4826c57
more valgrind errors fixed. Plus I ran make indent which changed a few files.
Bob Pendleton <bob@pendleton.com>
parents:
2317
diff
changeset
|
70 if (MapVirtualKey('T', MAPVK_VK_TO_VSC) != alpha_scancodes['T' - 'A']) { |
2724
0e2b65f32298
Added Wacom API headers.
Sam Lantinga <slouken@libsdl.org>
parents:
2324
diff
changeset
|
71 #if 0 |
2726
f23ebf1ddac4
Dynamically load wintab32.dll
Sam Lantinga <slouken@libsdl.org>
parents:
2724
diff
changeset
|
72 printf |
f23ebf1ddac4
Dynamically load wintab32.dll
Sam Lantinga <slouken@libsdl.org>
parents:
2724
diff
changeset
|
73 ("Fixing alpha scancode map, assuming US QWERTY layout!\nPlease send the following 26 lines of output to the SDL mailing list <sdl@libsdl.org>, including a description of your keyboard hardware.\n"); |
2724
0e2b65f32298
Added Wacom API headers.
Sam Lantinga <slouken@libsdl.org>
parents:
2324
diff
changeset
|
74 #endif |
2311
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
75 for (i = 0; i < SDL_arraysize(alpha_scancodes); ++i) { |
2324
3202e4826c57
more valgrind errors fixed. Plus I ran make indent which changed a few files.
Bob Pendleton <bob@pendleton.com>
parents:
2317
diff
changeset
|
76 alpha_scancodes[i] = MapVirtualKey('A' + i, MAPVK_VK_TO_VSC); |
2724
0e2b65f32298
Added Wacom API headers.
Sam Lantinga <slouken@libsdl.org>
parents:
2324
diff
changeset
|
77 #if 0 |
2324
3202e4826c57
more valgrind errors fixed. Plus I ran make indent which changed a few files.
Bob Pendleton <bob@pendleton.com>
parents:
2317
diff
changeset
|
78 printf("%d = %d\n", i, alpha_scancodes[i]); |
2724
0e2b65f32298
Added Wacom API headers.
Sam Lantinga <slouken@libsdl.org>
parents:
2324
diff
changeset
|
79 #endif |
2311
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
80 } |
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
81 } |
2317
f537a293b3da
Windows also remaps the numeric keypad... grrr
Sam Lantinga <slouken@libsdl.org>
parents:
2311
diff
changeset
|
82 if (MapVirtualKey(VK_NUMPAD0, MAPVK_VK_TO_VSC) != keypad_scancodes[0]) { |
2724
0e2b65f32298
Added Wacom API headers.
Sam Lantinga <slouken@libsdl.org>
parents:
2324
diff
changeset
|
83 #if 0 |
2726
f23ebf1ddac4
Dynamically load wintab32.dll
Sam Lantinga <slouken@libsdl.org>
parents:
2724
diff
changeset
|
84 printf |
f23ebf1ddac4
Dynamically load wintab32.dll
Sam Lantinga <slouken@libsdl.org>
parents:
2724
diff
changeset
|
85 ("Fixing keypad scancode map!\nPlease send the following 10 lines of output to the SDL mailing list <sdl@libsdl.org>, including a description of your keyboard hardware.\n"); |
2724
0e2b65f32298
Added Wacom API headers.
Sam Lantinga <slouken@libsdl.org>
parents:
2324
diff
changeset
|
86 #endif |
2317
f537a293b3da
Windows also remaps the numeric keypad... grrr
Sam Lantinga <slouken@libsdl.org>
parents:
2311
diff
changeset
|
87 for (i = 0; i < SDL_arraysize(keypad_scancodes); ++i) { |
2324
3202e4826c57
more valgrind errors fixed. Plus I ran make indent which changed a few files.
Bob Pendleton <bob@pendleton.com>
parents:
2317
diff
changeset
|
88 keypad_scancodes[i] = |
3202e4826c57
more valgrind errors fixed. Plus I ran make indent which changed a few files.
Bob Pendleton <bob@pendleton.com>
parents:
2317
diff
changeset
|
89 MapVirtualKey(VK_NUMPAD0 + i, MAPVK_VK_TO_VSC); |
2724
0e2b65f32298
Added Wacom API headers.
Sam Lantinga <slouken@libsdl.org>
parents:
2324
diff
changeset
|
90 #if 0 |
2324
3202e4826c57
more valgrind errors fixed. Plus I ran make indent which changed a few files.
Bob Pendleton <bob@pendleton.com>
parents:
2317
diff
changeset
|
91 printf("%d = %d\n", i, keypad_scancodes[i]); |
2724
0e2b65f32298
Added Wacom API headers.
Sam Lantinga <slouken@libsdl.org>
parents:
2324
diff
changeset
|
92 #endif |
2317
f537a293b3da
Windows also remaps the numeric keypad... grrr
Sam Lantinga <slouken@libsdl.org>
parents:
2311
diff
changeset
|
93 } |
f537a293b3da
Windows also remaps the numeric keypad... grrr
Sam Lantinga <slouken@libsdl.org>
parents:
2311
diff
changeset
|
94 } |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
95 |
5062 | 96 data->key_layout = windows_scancode_table; |
2308
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
97 |
4752 | 98 data->ime_com_initialized = SDL_FALSE; |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
99 data->ime_threadmgr = 0; |
4752 | 100 data->ime_initialized = SDL_FALSE; |
101 data->ime_enabled = SDL_FALSE; | |
102 data->ime_available = SDL_FALSE; | |
103 data->ime_hwnd_main = 0; | |
104 data->ime_hwnd_current = 0; | |
105 data->ime_himc = 0; | |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
106 data->ime_composition[0] = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
107 data->ime_readingstring[0] = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
108 data->ime_cursor = 0; |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
109 |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
110 data->ime_candlist = SDL_FALSE; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
111 SDL_memset(data->ime_candidates, 0, sizeof(data->ime_candidates)); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
112 data->ime_candcount = 0; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
113 data->ime_candref = 0; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
114 data->ime_candsel = 0; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
115 data->ime_candpgsize = 0; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
116 data->ime_candlistindexbase = 0; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
117 data->ime_candvertical = SDL_TRUE; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
118 |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
119 data->ime_dirty = SDL_FALSE; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
120 SDL_memset(&data->ime_rect, 0, sizeof(data->ime_rect)); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
121 SDL_memset(&data->ime_candlistrect, 0, sizeof(data->ime_candlistrect)); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
122 data->ime_winwidth = 0; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
123 data->ime_winheight = 0; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
124 |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
125 data->ime_hkl = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
126 data->ime_himm32 = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
127 data->GetReadingString = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
128 data->ShowReadingWindow = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
129 data->ImmLockIMC = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
130 data->ImmUnlockIMC = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
131 data->ImmLockIMCC = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
132 data->ImmUnlockIMCC = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
133 data->ime_uiless = SDL_FALSE; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
134 data->ime_threadmgrex = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
135 data->ime_uielemsinkcookie = TF_INVALID_COOKIE; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
136 data->ime_alpnsinkcookie = TF_INVALID_COOKIE; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
137 data->ime_openmodesinkcookie = TF_INVALID_COOKIE; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
138 data->ime_convmodesinkcookie = TF_INVALID_COOKIE; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
139 data->ime_uielemsink = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
140 data->ime_ippasink = 0; |
4752 | 141 |
4465
3e69e077cb95
Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents:
3697
diff
changeset
|
142 WIN_UpdateKeymap(); |
2308
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
143 |
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
144 SDL_SetScancodeName(SDL_SCANCODE_APPLICATION, "Menu"); |
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
145 SDL_SetScancodeName(SDL_SCANCODE_LGUI, "Left Windows"); |
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
146 SDL_SetScancodeName(SDL_SCANCODE_RGUI, "Right Windows"); |
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
147 } |
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
148 |
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
149 void |
4465
3e69e077cb95
Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents:
3697
diff
changeset
|
150 WIN_UpdateKeymap() |
2308
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
151 { |
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
152 int i; |
5083 | 153 SDL_ScanCode scancode; |
2308
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
154 SDLKey keymap[SDL_NUM_SCANCODES]; |
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
155 |
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
156 SDL_GetDefaultKeymap(keymap); |
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
157 |
5062 | 158 for (i = 0; i < SDL_arraysize(windows_scancode_table); i++) { |
2308
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
159 |
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
160 /* Make sure this scancode is a valid character scancode */ |
5062 | 161 scancode = windows_scancode_table[i]; |
4561
e4b2b7207f79
Fixed remapping the Delete key and detecting the keypad Delete key.
Sam Lantinga <slouken@libsdl.org>
parents:
4465
diff
changeset
|
162 if (scancode == SDL_SCANCODE_UNKNOWN || keymap[scancode] >= 127) { |
2308
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
163 continue; |
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
164 } |
2311
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
165 |
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
166 /* Alphabetic keys are handled specially, since Windows remaps them */ |
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
167 if (i >= 'A' && i <= 'Z') { |
2324
3202e4826c57
more valgrind errors fixed. Plus I ran make indent which changed a few files.
Bob Pendleton <bob@pendleton.com>
parents:
2317
diff
changeset
|
168 BYTE vsc = alpha_scancodes[i - 'A']; |
2311
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
169 keymap[scancode] = MapVirtualKey(vsc, MAPVK_VSC_TO_VK) + 0x20; |
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
170 } else { |
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
171 keymap[scancode] = (MapVirtualKey(i, MAPVK_VK_TO_CHAR) & 0x7FFF); |
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
172 } |
2308
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
173 } |
4465
3e69e077cb95
Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents:
3697
diff
changeset
|
174 SDL_SetKeymap(0, keymap, SDL_NUM_SCANCODES); |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
175 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
176 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
177 void |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
178 WIN_QuitKeyboard(_THIS) |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
179 { |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5083
diff
changeset
|
180 #ifndef SDL_DISABLE_WINDOWS_IME |
4752 | 181 IME_Quit((SDL_VideoData *)_this->driverdata); |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5083
diff
changeset
|
182 #endif |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
183 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
184 |
4747 | 185 void |
4753
11b0a6a3eb4d
Changed Start/StopTextInput back to not take any parameters.
dewyatt
parents:
4752
diff
changeset
|
186 WIN_StartTextInput(_THIS) |
4747 | 187 { |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5083
diff
changeset
|
188 #ifndef SDL_DISABLE_WINDOWS_IME |
4753
11b0a6a3eb4d
Changed Start/StopTextInput back to not take any parameters.
dewyatt
parents:
4752
diff
changeset
|
189 SDL_Window *window = SDL_GetKeyboardFocus(); |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
190 if (window) { |
4753
11b0a6a3eb4d
Changed Start/StopTextInput back to not take any parameters.
dewyatt
parents:
4752
diff
changeset
|
191 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; |
11b0a6a3eb4d
Changed Start/StopTextInput back to not take any parameters.
dewyatt
parents:
4752
diff
changeset
|
192 SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata; |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
193 SDL_GetWindowSize(window, &videodata->ime_winwidth, &videodata->ime_winheight); |
4753
11b0a6a3eb4d
Changed Start/StopTextInput back to not take any parameters.
dewyatt
parents:
4752
diff
changeset
|
194 IME_Init(videodata, hwnd); |
11b0a6a3eb4d
Changed Start/StopTextInput back to not take any parameters.
dewyatt
parents:
4752
diff
changeset
|
195 IME_Enable(videodata, hwnd); |
11b0a6a3eb4d
Changed Start/StopTextInput back to not take any parameters.
dewyatt
parents:
4752
diff
changeset
|
196 } |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5083
diff
changeset
|
197 #endif /* !SDL_DISABLE_WINDOWS_IME */ |
4747 | 198 } |
199 | |
200 void | |
4753
11b0a6a3eb4d
Changed Start/StopTextInput back to not take any parameters.
dewyatt
parents:
4752
diff
changeset
|
201 WIN_StopTextInput(_THIS) |
4747 | 202 { |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5083
diff
changeset
|
203 #ifndef SDL_DISABLE_WINDOWS_IME |
4753
11b0a6a3eb4d
Changed Start/StopTextInput back to not take any parameters.
dewyatt
parents:
4752
diff
changeset
|
204 SDL_Window *window = SDL_GetKeyboardFocus(); |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
205 if (window) { |
4753
11b0a6a3eb4d
Changed Start/StopTextInput back to not take any parameters.
dewyatt
parents:
4752
diff
changeset
|
206 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; |
11b0a6a3eb4d
Changed Start/StopTextInput back to not take any parameters.
dewyatt
parents:
4752
diff
changeset
|
207 SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata; |
11b0a6a3eb4d
Changed Start/StopTextInput back to not take any parameters.
dewyatt
parents:
4752
diff
changeset
|
208 IME_Init(videodata, hwnd); |
11b0a6a3eb4d
Changed Start/StopTextInput back to not take any parameters.
dewyatt
parents:
4752
diff
changeset
|
209 IME_Disable(videodata, hwnd); |
11b0a6a3eb4d
Changed Start/StopTextInput back to not take any parameters.
dewyatt
parents:
4752
diff
changeset
|
210 } |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5083
diff
changeset
|
211 #endif /* !SDL_DISABLE_WINDOWS_IME */ |
4747 | 212 } |
213 | |
214 void | |
215 WIN_SetTextInputRect(_THIS, SDL_Rect *rect) | |
216 { | |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
217 SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
218 videodata->ime_rect = *rect; |
4747 | 219 } |
220 | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5083
diff
changeset
|
221 #ifdef SDL_DISABLE_WINDOWS_IME |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5083
diff
changeset
|
222 |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5083
diff
changeset
|
223 |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5083
diff
changeset
|
224 SDL_bool |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5083
diff
changeset
|
225 IME_HandleMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM *lParam, SDL_VideoData *videodata) |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5083
diff
changeset
|
226 { |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5083
diff
changeset
|
227 return SDL_FALSE; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5083
diff
changeset
|
228 } |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5083
diff
changeset
|
229 |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5083
diff
changeset
|
230 void IME_Present(SDL_VideoData *videodata) |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5083
diff
changeset
|
231 { |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5083
diff
changeset
|
232 } |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5083
diff
changeset
|
233 |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5083
diff
changeset
|
234 #else |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5083
diff
changeset
|
235 |
4893
b2e434e0553b
Fixed all MinGW problems (except libraries not added to build yet).
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4763
diff
changeset
|
236 #ifdef __GNUC__ |
b2e434e0553b
Fixed all MinGW problems (except libraries not added to build yet).
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4763
diff
changeset
|
237 #undef DEFINE_GUID |
4894
ac19d74e2a47
Fixed compiling with mingw32/64
Sam Lantinga <slouken@libsdl.org>
parents:
4893
diff
changeset
|
238 #define DEFINE_GUID(n,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) static const GUID n = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}} |
4893
b2e434e0553b
Fixed all MinGW problems (except libraries not added to build yet).
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4763
diff
changeset
|
239 DEFINE_GUID(IID_ITfInputProcessorProfileActivationSink, 0x71C6E74E,0x0F28,0x11D8,0xA8,0x2A,0x00,0x06,0x5B,0x84,0x43,0x5C); |
b2e434e0553b
Fixed all MinGW problems (except libraries not added to build yet).
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4763
diff
changeset
|
240 DEFINE_GUID(IID_ITfUIElementSink, 0xEA1EA136,0x19DF,0x11D7,0xA6,0xD2,0x00,0x06,0x5B,0x84,0x43,0x5C); |
b2e434e0553b
Fixed all MinGW problems (except libraries not added to build yet).
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4763
diff
changeset
|
241 DEFINE_GUID(GUID_TFCAT_TIP_KEYBOARD, 0x34745C63,0xB2F0,0x4784,0x8B,0x67,0x5E,0x12,0xC8,0x70,0x1A,0x31); |
b2e434e0553b
Fixed all MinGW problems (except libraries not added to build yet).
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4763
diff
changeset
|
242 DEFINE_GUID(IID_ITfSource, 0x4EA48A35,0x60AE,0x446F,0x8F,0xD6,0xE6,0xA8,0xD8,0x24,0x59,0xF7); |
b2e434e0553b
Fixed all MinGW problems (except libraries not added to build yet).
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4763
diff
changeset
|
243 DEFINE_GUID(IID_ITfUIElementMgr, 0xEA1EA135,0x19DF,0x11D7,0xA6,0xD2,0x00,0x06,0x5B,0x84,0x43,0x5C); |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
244 DEFINE_GUID(IID_ITfCandidateListUIElement, 0xEA1EA138,0x19DF,0x11D7,0xA6,0xD2,0x00,0x06,0x5B,0x84,0x43,0x5C); |
4893
b2e434e0553b
Fixed all MinGW problems (except libraries not added to build yet).
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4763
diff
changeset
|
245 DEFINE_GUID(IID_ITfReadingInformationUIElement, 0xEA1EA139,0x19DF,0x11D7,0xA6,0xD2,0x00,0x06,0x5B,0x84,0x43,0x5C); |
b2e434e0553b
Fixed all MinGW problems (except libraries not added to build yet).
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4763
diff
changeset
|
246 DEFINE_GUID(IID_ITfThreadMgr, 0xAA80E801,0x2021,0x11D2,0x93,0xE0,0x00,0x60,0xB0,0x67,0xB8,0x6E); |
b2e434e0553b
Fixed all MinGW problems (except libraries not added to build yet).
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4763
diff
changeset
|
247 DEFINE_GUID(CLSID_TF_ThreadMgr, 0x529A9E6B,0x6587,0x4F23,0xAB,0x9E,0x9C,0x7D,0x68,0x3E,0x3C,0x50); |
b2e434e0553b
Fixed all MinGW problems (except libraries not added to build yet).
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4763
diff
changeset
|
248 DEFINE_GUID(IID_ITfThreadMgrEx, 0x3E90ADE3,0x7594,0x4CB0,0xBB,0x58,0x69,0x62,0x8F,0x5F,0x45,0x8C); |
b2e434e0553b
Fixed all MinGW problems (except libraries not added to build yet).
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4763
diff
changeset
|
249 #endif |
b2e434e0553b
Fixed all MinGW problems (except libraries not added to build yet).
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4763
diff
changeset
|
250 |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
251 #define LANG_CHT MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
252 #define LANG_CHS MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
253 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
254 #define MAKEIMEVERSION(major,minor) ((DWORD) (((BYTE)(major) << 24) | ((BYTE)(minor) << 16) )) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
255 #define IMEID_VER(id) ((id) & 0xffff0000) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
256 #define IMEID_LANG(id) ((id) & 0x0000ffff) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
257 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
258 #define CHT_HKL_DAYI ((HKL)0xE0060404) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
259 #define CHT_HKL_NEW_PHONETIC ((HKL)0xE0080404) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
260 #define CHT_HKL_NEW_CHANG_JIE ((HKL)0xE0090404) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
261 #define CHT_HKL_NEW_QUICK ((HKL)0xE00A0404) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
262 #define CHT_HKL_HK_CANTONESE ((HKL)0xE00B0404) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
263 #define CHT_IMEFILENAME1 "TINTLGNT.IME" |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
264 #define CHT_IMEFILENAME2 "CINTLGNT.IME" |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
265 #define CHT_IMEFILENAME3 "MSTCIPHA.IME" |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
266 #define IMEID_CHT_VER42 (LANG_CHT | MAKEIMEVERSION(4, 2)) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
267 #define IMEID_CHT_VER43 (LANG_CHT | MAKEIMEVERSION(4, 3)) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
268 #define IMEID_CHT_VER44 (LANG_CHT | MAKEIMEVERSION(4, 4)) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
269 #define IMEID_CHT_VER50 (LANG_CHT | MAKEIMEVERSION(5, 0)) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
270 #define IMEID_CHT_VER51 (LANG_CHT | MAKEIMEVERSION(5, 1)) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
271 #define IMEID_CHT_VER52 (LANG_CHT | MAKEIMEVERSION(5, 2)) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
272 #define IMEID_CHT_VER60 (LANG_CHT | MAKEIMEVERSION(6, 0)) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
273 #define IMEID_CHT_VER_VISTA (LANG_CHT | MAKEIMEVERSION(7, 0)) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
274 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
275 #define CHS_HKL ((HKL)0xE00E0804) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
276 #define CHS_IMEFILENAME1 "PINTLGNT.IME" |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
277 #define CHS_IMEFILENAME2 "MSSCIPYA.IME" |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
278 #define IMEID_CHS_VER41 (LANG_CHS | MAKEIMEVERSION(4, 1)) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
279 #define IMEID_CHS_VER42 (LANG_CHS | MAKEIMEVERSION(4, 2)) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
280 #define IMEID_CHS_VER53 (LANG_CHS | MAKEIMEVERSION(5, 3)) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
281 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
282 #define LANG() LOWORD((videodata->ime_hkl)) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
283 #define PRIMLANG() ((WORD)PRIMARYLANGID(LANG())) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
284 #define SUBLANG() SUBLANGID(LANG()) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
285 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
286 static void IME_UpdateInputLocale(SDL_VideoData *videodata); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
287 static void IME_ClearComposition(SDL_VideoData *videodata); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
288 static void IME_SetWindow(SDL_VideoData* videodata, HWND hwnd); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
289 static void IME_SetupAPI(SDL_VideoData *videodata); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
290 static DWORD IME_GetId(SDL_VideoData *videodata, UINT uIndex); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
291 static void IME_SendEditingEvent(SDL_VideoData *videodata); |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
292 static void IME_DestroyTextures(SDL_VideoData *videodata); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
293 |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
294 #define SDL_IsEqualIID(riid1, riid2) SDL_IsEqualGUID(riid1, riid2) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
295 #define SDL_IsEqualGUID(rguid1, rguid2) (!SDL_memcmp(rguid1, rguid2, sizeof(GUID))) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
296 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
297 static SDL_bool UILess_SetupSinks(SDL_VideoData *videodata); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
298 static void UILess_ReleaseSinks(SDL_VideoData *videodata); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
299 static void UILess_EnableUIUpdates(SDL_VideoData *videodata); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
300 static void UILess_DisableUIUpdates(SDL_VideoData *videodata); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
301 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
302 static void |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
303 IME_Init(SDL_VideoData *videodata, HWND hwnd) |
4752 | 304 { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
305 if (videodata->ime_initialized) |
4752 | 306 return; |
307 | |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
308 videodata->ime_hwnd_main = hwnd; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
309 if (SUCCEEDED(CoInitializeEx(NULL, COINIT_APARTMENTTHREADED))) { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
310 videodata->ime_com_initialized = SDL_TRUE; |
4893
b2e434e0553b
Fixed all MinGW problems (except libraries not added to build yet).
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4763
diff
changeset
|
311 CoCreateInstance(&CLSID_TF_ThreadMgr, NULL, CLSCTX_INPROC_SERVER, &IID_ITfThreadMgr, (LPVOID *)&videodata->ime_threadmgr); |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
312 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
313 videodata->ime_initialized = SDL_TRUE; |
5092
327f181542f1
Include windows.h in a single point in the source, so we can be consistent about the definition of UNICODE and have core utility functions for Windows that all modules can share.
Sam Lantinga <slouken@libsdl.org>
parents:
5088
diff
changeset
|
314 videodata->ime_himm32 = SDL_LoadObject("imm32.dll"); |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
315 if (!videodata->ime_himm32) { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
316 videodata->ime_available = SDL_FALSE; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
317 return; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
318 } |
5092
327f181542f1
Include windows.h in a single point in the source, so we can be consistent about the definition of UNICODE and have core utility functions for Windows that all modules can share.
Sam Lantinga <slouken@libsdl.org>
parents:
5088
diff
changeset
|
319 videodata->ImmLockIMC = (LPINPUTCONTEXT2 (WINAPI *)(HIMC))SDL_LoadFunction(videodata->ime_himm32, "ImmLockIMC"); |
327f181542f1
Include windows.h in a single point in the source, so we can be consistent about the definition of UNICODE and have core utility functions for Windows that all modules can share.
Sam Lantinga <slouken@libsdl.org>
parents:
5088
diff
changeset
|
320 videodata->ImmUnlockIMC = (BOOL (WINAPI *)(HIMC))SDL_LoadFunction(videodata->ime_himm32, "ImmUnlockIMC"); |
327f181542f1
Include windows.h in a single point in the source, so we can be consistent about the definition of UNICODE and have core utility functions for Windows that all modules can share.
Sam Lantinga <slouken@libsdl.org>
parents:
5088
diff
changeset
|
321 videodata->ImmLockIMCC = (LPVOID (WINAPI *)(HIMCC))SDL_LoadFunction(videodata->ime_himm32, "ImmLockIMCC"); |
327f181542f1
Include windows.h in a single point in the source, so we can be consistent about the definition of UNICODE and have core utility functions for Windows that all modules can share.
Sam Lantinga <slouken@libsdl.org>
parents:
5088
diff
changeset
|
322 videodata->ImmUnlockIMCC = (BOOL (WINAPI *)(HIMCC))SDL_LoadFunction(videodata->ime_himm32, "ImmUnlockIMCC"); |
4752 | 323 |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
324 IME_SetWindow(videodata, hwnd); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
325 videodata->ime_himc = ImmGetContext(hwnd); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
326 ImmReleaseContext(hwnd, videodata->ime_himc); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
327 if (!videodata->ime_himc) { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
328 videodata->ime_available = SDL_FALSE; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
329 IME_Disable(videodata, hwnd); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
330 return; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
331 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
332 videodata->ime_available = SDL_TRUE; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
333 IME_UpdateInputLocale(videodata); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
334 IME_SetupAPI(videodata); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
335 videodata->ime_uiless = UILess_SetupSinks(videodata); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
336 IME_UpdateInputLocale(videodata); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
337 IME_Disable(videodata, hwnd); |
4752 | 338 } |
339 | |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
340 static void |
4752 | 341 IME_Enable(SDL_VideoData *videodata, HWND hwnd) |
342 { | |
343 if (!videodata->ime_initialized || !videodata->ime_hwnd_current) | |
344 return; | |
345 | |
346 if (!videodata->ime_available) { | |
347 IME_Disable(videodata, hwnd); | |
348 return; | |
349 } | |
350 if (videodata->ime_hwnd_current == videodata->ime_hwnd_main) | |
351 ImmAssociateContext(videodata->ime_hwnd_current, videodata->ime_himc); | |
352 | |
353 videodata->ime_enabled = SDL_TRUE; | |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
354 IME_UpdateInputLocale(videodata); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
355 UILess_EnableUIUpdates(videodata); |
4752 | 356 } |
357 | |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
358 static void |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
359 IME_Disable(SDL_VideoData *videodata, HWND hwnd) |
4752 | 360 { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
361 if (!videodata->ime_initialized || !videodata->ime_hwnd_current) |
4752 | 362 return; |
363 | |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
364 IME_ClearComposition(videodata); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
365 if (videodata->ime_hwnd_current == videodata->ime_hwnd_main) |
4893
b2e434e0553b
Fixed all MinGW problems (except libraries not added to build yet).
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4763
diff
changeset
|
366 ImmAssociateContext(videodata->ime_hwnd_current, (HIMC)0); |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
367 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
368 videodata->ime_enabled = SDL_FALSE; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
369 UILess_DisableUIUpdates(videodata); |
4752 | 370 } |
371 | |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
372 static void |
4752 | 373 IME_Quit(SDL_VideoData *videodata) |
374 { | |
375 if (!videodata->ime_initialized) | |
376 return; | |
377 | |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
378 UILess_ReleaseSinks(videodata); |
4752 | 379 if (videodata->ime_hwnd_main) |
380 ImmAssociateContext(videodata->ime_hwnd_main, videodata->ime_himc); | |
381 | |
382 videodata->ime_hwnd_main = 0; | |
383 videodata->ime_himc = 0; | |
4760 | 384 if (videodata->ime_himm32) { |
5092
327f181542f1
Include windows.h in a single point in the source, so we can be consistent about the definition of UNICODE and have core utility functions for Windows that all modules can share.
Sam Lantinga <slouken@libsdl.org>
parents:
5088
diff
changeset
|
385 SDL_UnloadObject(videodata->ime_himm32); |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
386 videodata->ime_himm32 = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
387 } |
4760 | 388 if (videodata->ime_threadmgr) { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
389 videodata->ime_threadmgr->lpVtbl->Release(videodata->ime_threadmgr); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
390 videodata->ime_threadmgr = 0; |
4752 | 391 } |
4760 | 392 if (videodata->ime_com_initialized) { |
4752 | 393 CoUninitialize(); |
394 videodata->ime_com_initialized = SDL_FALSE; | |
395 } | |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
396 IME_DestroyTextures(videodata); |
4752 | 397 videodata->ime_initialized = SDL_FALSE; |
398 } | |
399 | |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
400 static void |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
401 IME_GetReadingString(SDL_VideoData *videodata, HWND hwnd) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
402 { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
403 DWORD id = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
404 HIMC himc = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
405 WCHAR buffer[16]; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
406 WCHAR *s = buffer; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
407 DWORD len = 0; |
4893
b2e434e0553b
Fixed all MinGW problems (except libraries not added to build yet).
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4763
diff
changeset
|
408 INT err = 0; |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
409 BOOL vertical = FALSE; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
410 UINT maxuilen = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
411 static OSVERSIONINFOA osversion = {0}; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
412 if (videodata->ime_uiless) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
413 return; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
414 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
415 videodata->ime_readingstring[0] = 0; |
4760 | 416 if (!osversion.dwOSVersionInfoSize) { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
417 osversion.dwOSVersionInfoSize = sizeof(osversion); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
418 GetVersionExA(&osversion); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
419 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
420 id = IME_GetId(videodata, 0); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
421 if (!id) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
422 return; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
423 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
424 himc = ImmGetContext(hwnd); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
425 if (!himc) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
426 return; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
427 |
4760 | 428 if (videodata->GetReadingString) { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
429 len = videodata->GetReadingString(himc, 0, 0, &err, &vertical, &maxuilen); |
4760 | 430 if (len) { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
431 if (len > SDL_arraysize(buffer)) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
432 len = SDL_arraysize(buffer); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
433 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
434 len = videodata->GetReadingString(himc, len, s, &err, &vertical, &maxuilen); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
435 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
436 SDL_wcslcpy(videodata->ime_readingstring, s, len); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
437 } |
4760 | 438 else { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
439 LPINPUTCONTEXT2 lpimc = videodata->ImmLockIMC(himc); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
440 LPBYTE p = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
441 s = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
442 switch (id) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
443 { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
444 case IMEID_CHT_VER42: |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
445 case IMEID_CHT_VER43: |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
446 case IMEID_CHT_VER44: |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
447 p = *(LPBYTE *)((LPBYTE)videodata->ImmLockIMCC(lpimc->hPrivate) + 24); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
448 if (!p) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
449 break; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
450 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
451 len = *(DWORD *)(p + 7*4 + 32*4); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
452 s = (WCHAR *)(p + 56); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
453 break; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
454 case IMEID_CHT_VER51: |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
455 case IMEID_CHT_VER52: |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
456 case IMEID_CHS_VER53: |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
457 p = *(LPBYTE *)((LPBYTE)videodata->ImmLockIMCC(lpimc->hPrivate) + 4); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
458 if (!p) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
459 break; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
460 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
461 p = *(LPBYTE *)((LPBYTE)p + 1*4 + 5*4); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
462 if (!p) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
463 break; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
464 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
465 len = *(DWORD *)(p + 1*4 + (16*2+2*4) + 5*4 + 16*2); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
466 s = (WCHAR *)(p + 1*4 + (16*2+2*4) + 5*4); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
467 break; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
468 case IMEID_CHS_VER41: |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
469 { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
470 int offset = (IME_GetId(videodata, 1) >= 0x00000002) ? 8 : 7; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
471 p = *(LPBYTE *)((LPBYTE)videodata->ImmLockIMCC(lpimc->hPrivate) + offset * 4); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
472 if (!p) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
473 break; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
474 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
475 len = *(DWORD *)(p + 7*4 + 16*2*4); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
476 s = (WCHAR *)(p + 6*4 + 16*2*1); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
477 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
478 break; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
479 case IMEID_CHS_VER42: |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
480 if (osversion.dwPlatformId != VER_PLATFORM_WIN32_NT) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
481 break; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
482 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
483 p = *(LPBYTE *)((LPBYTE)videodata->ImmLockIMCC(lpimc->hPrivate) + 1*4 + 1*4 + 6*4); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
484 if (!p) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
485 break; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
486 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
487 len = *(DWORD *)(p + 1*4 + (16*2+2*4) + 5*4 + 16*2); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
488 s = (WCHAR *)(p + 1*4 + (16*2+2*4) + 5*4); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
489 break; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
490 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
491 if (s) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
492 SDL_wcslcpy(videodata->ime_readingstring, s, len + 1); |
4760 | 493 |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
494 videodata->ImmUnlockIMCC(lpimc->hPrivate); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
495 videodata->ImmUnlockIMC(himc); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
496 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
497 ImmReleaseContext(hwnd, himc); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
498 IME_SendEditingEvent(videodata); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
499 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
500 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
501 static void |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
502 IME_InputLangChanged(SDL_VideoData *videodata) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
503 { |
4760 | 504 UINT lang = PRIMLANG(); |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
505 IME_UpdateInputLocale(videodata); |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
506 if (!videodata->ime_uiless) |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
507 videodata->ime_candlistindexbase = (videodata->ime_hkl == CHT_HKL_DAYI) ? 0 : 1; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
508 |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
509 IME_SetupAPI(videodata); |
4760 | 510 if (lang != PRIMLANG()) { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
511 IME_ClearComposition(videodata); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
512 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
513 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
514 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
515 static DWORD |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
516 IME_GetId(SDL_VideoData *videodata, UINT uIndex) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
517 { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
518 static HKL hklprev = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
519 static DWORD dwRet[2] = {0}; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
520 DWORD dwVerSize = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
521 DWORD dwVerHandle = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
522 LPVOID lpVerBuffer = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
523 LPVOID lpVerData = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
524 UINT cbVerData = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
525 char szTemp[256]; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
526 HKL hkl = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
527 DWORD dwLang = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
528 if (uIndex >= sizeof(dwRet) / sizeof(dwRet[0])) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
529 return 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
530 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
531 hkl = videodata->ime_hkl; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
532 if (hklprev == hkl) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
533 return dwRet[uIndex]; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
534 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
535 hklprev = hkl; |
5110 | 536 dwLang = ((DWORD_PTR)hkl & 0xffff); |
4760 | 537 if (videodata->ime_uiless && LANG() == LANG_CHT) { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
538 dwRet[0] = IMEID_CHT_VER_VISTA; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
539 dwRet[1] = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
540 return dwRet[0]; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
541 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
542 if (hkl != CHT_HKL_NEW_PHONETIC |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
543 && hkl != CHT_HKL_NEW_CHANG_JIE |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
544 && hkl != CHT_HKL_NEW_QUICK |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
545 && hkl != CHT_HKL_HK_CANTONESE |
4760 | 546 && hkl != CHS_HKL) { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
547 dwRet[0] = dwRet[1] = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
548 return dwRet[uIndex]; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
549 } |
4760 | 550 if (ImmGetIMEFileNameA(hkl, szTemp, sizeof(szTemp) - 1) <= 0) { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
551 dwRet[0] = dwRet[1] = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
552 return dwRet[uIndex]; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
553 } |
4760 | 554 if (!videodata->GetReadingString) { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
555 #define LCID_INVARIANT MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
556 if (CompareStringA(LCID_INVARIANT, NORM_IGNORECASE, szTemp, -1, CHT_IMEFILENAME1, -1) != 2 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
557 && CompareStringA(LCID_INVARIANT, NORM_IGNORECASE, szTemp, -1, CHT_IMEFILENAME2, -1) != 2 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
558 && CompareStringA(LCID_INVARIANT, NORM_IGNORECASE, szTemp, -1, CHT_IMEFILENAME3, -1) != 2 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
559 && CompareStringA(LCID_INVARIANT, NORM_IGNORECASE, szTemp, -1, CHS_IMEFILENAME1, -1) != 2 |
4760 | 560 && CompareStringA(LCID_INVARIANT, NORM_IGNORECASE, szTemp, -1, CHS_IMEFILENAME2, -1) != 2) { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
561 dwRet[0] = dwRet[1] = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
562 return dwRet[uIndex]; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
563 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
564 #undef LCID_INVARIANT |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
565 dwVerSize = GetFileVersionInfoSizeA(szTemp, &dwVerHandle); |
4760 | 566 if (dwVerSize) { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
567 lpVerBuffer = SDL_malloc(dwVerSize); |
4760 | 568 if (lpVerBuffer) { |
569 if (GetFileVersionInfoA(szTemp, dwVerHandle, dwVerSize, lpVerBuffer)) { | |
570 if (VerQueryValueA(lpVerBuffer, "\\", &lpVerData, &cbVerData)) { | |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
571 #define pVerFixedInfo ((VS_FIXEDFILEINFO FAR*)lpVerData) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
572 DWORD dwVer = pVerFixedInfo->dwFileVersionMS; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
573 dwVer = (dwVer & 0x00ff0000) << 8 | (dwVer & 0x000000ff) << 16; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
574 if (videodata->GetReadingString || |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
575 dwLang == LANG_CHT && ( |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
576 dwVer == MAKEIMEVERSION(4, 2) || |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
577 dwVer == MAKEIMEVERSION(4, 3) || |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
578 dwVer == MAKEIMEVERSION(4, 4) || |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
579 dwVer == MAKEIMEVERSION(5, 0) || |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
580 dwVer == MAKEIMEVERSION(5, 1) || |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
581 dwVer == MAKEIMEVERSION(5, 2) || |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
582 dwVer == MAKEIMEVERSION(6, 0)) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
583 || |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
584 dwLang == LANG_CHS && ( |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
585 dwVer == MAKEIMEVERSION(4, 1) || |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
586 dwVer == MAKEIMEVERSION(4, 2) || |
4760 | 587 dwVer == MAKEIMEVERSION(5, 3))) { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
588 dwRet[0] = dwVer | dwLang; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
589 dwRet[1] = pVerFixedInfo->dwFileVersionLS; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
590 SDL_free(lpVerBuffer); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
591 return dwRet[0]; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
592 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
593 #undef pVerFixedInfo |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
594 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
595 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
596 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
597 SDL_free(lpVerBuffer); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
598 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
599 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
600 dwRet[0] = dwRet[1] = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
601 return dwRet[uIndex]; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
602 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
603 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
604 static void |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
605 IME_SetupAPI(SDL_VideoData *videodata) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
606 { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
607 char ime_file[MAX_PATH + 1]; |
5092
327f181542f1
Include windows.h in a single point in the source, so we can be consistent about the definition of UNICODE and have core utility functions for Windows that all modules can share.
Sam Lantinga <slouken@libsdl.org>
parents:
5088
diff
changeset
|
608 void* hime = 0; |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
609 HKL hkl = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
610 videodata->GetReadingString = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
611 videodata->ShowReadingWindow = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
612 if (videodata->ime_uiless) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
613 return; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
614 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
615 hkl = videodata->ime_hkl; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
616 if (ImmGetIMEFileNameA(hkl, ime_file, sizeof(ime_file) - 1) <= 0) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
617 return; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
618 |
5092
327f181542f1
Include windows.h in a single point in the source, so we can be consistent about the definition of UNICODE and have core utility functions for Windows that all modules can share.
Sam Lantinga <slouken@libsdl.org>
parents:
5088
diff
changeset
|
619 hime = SDL_LoadObject(ime_file); |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
620 if (!hime) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
621 return; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
622 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
623 videodata->GetReadingString = (UINT (WINAPI *)(HIMC, UINT, LPWSTR, PINT, BOOL*, PUINT)) |
5092
327f181542f1
Include windows.h in a single point in the source, so we can be consistent about the definition of UNICODE and have core utility functions for Windows that all modules can share.
Sam Lantinga <slouken@libsdl.org>
parents:
5088
diff
changeset
|
624 SDL_LoadFunction(hime, "GetReadingString"); |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
625 videodata->ShowReadingWindow = (BOOL (WINAPI *)(HIMC, BOOL)) |
5092
327f181542f1
Include windows.h in a single point in the source, so we can be consistent about the definition of UNICODE and have core utility functions for Windows that all modules can share.
Sam Lantinga <slouken@libsdl.org>
parents:
5088
diff
changeset
|
626 SDL_LoadFunction(hime, "ShowReadingWindow"); |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
627 |
4760 | 628 if (videodata->ShowReadingWindow) { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
629 HIMC himc = ImmGetContext(videodata->ime_hwnd_current); |
4760 | 630 if (himc) { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
631 videodata->ShowReadingWindow(himc, FALSE); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
632 ImmReleaseContext(videodata->ime_hwnd_current, himc); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
633 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
634 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
635 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
636 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
637 static void |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
638 IME_SetWindow(SDL_VideoData* videodata, HWND hwnd) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
639 { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
640 videodata->ime_hwnd_current = hwnd; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
641 if (videodata->ime_threadmgr) { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
642 struct ITfDocumentMgr *document_mgr = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
643 if (SUCCEEDED(videodata->ime_threadmgr->lpVtbl->AssociateFocus(videodata->ime_threadmgr, hwnd, NULL, &document_mgr))) { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
644 if (document_mgr) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
645 document_mgr->lpVtbl->Release(document_mgr); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
646 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
647 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
648 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
649 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
650 static void |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
651 IME_UpdateInputLocale(SDL_VideoData *videodata) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
652 { |
4760 | 653 static HKL hklprev = 0; |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
654 videodata->ime_hkl = GetKeyboardLayout(0); |
4760 | 655 if (hklprev == videodata->ime_hkl) |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
656 return; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
657 |
4760 | 658 hklprev = videodata->ime_hkl; |
4914 | 659 switch (PRIMLANG()) { |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
660 case LANG_CHINESE: |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
661 videodata->ime_candvertical = SDL_TRUE; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
662 if (SUBLANG() == SUBLANG_CHINESE_SIMPLIFIED) |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
663 videodata->ime_candvertical = SDL_FALSE; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
664 |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
665 break; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
666 case LANG_JAPANESE: |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
667 videodata->ime_candvertical = SDL_TRUE; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
668 break; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
669 case LANG_KOREAN: |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
670 videodata->ime_candvertical = SDL_FALSE; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
671 break; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
672 } |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
673 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
674 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
675 static void |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
676 IME_ClearComposition(SDL_VideoData *videodata) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
677 { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
678 HIMC himc = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
679 if (!videodata->ime_initialized) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
680 return; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
681 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
682 himc = ImmGetContext(videodata->ime_hwnd_current); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
683 if (!himc) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
684 return; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
685 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
686 ImmNotifyIME(himc, NI_COMPOSITIONSTR, CPS_CANCEL, 0); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
687 if (videodata->ime_uiless) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
688 ImmSetCompositionString(himc, SCS_SETSTR, TEXT(""), sizeof(TCHAR), TEXT(""), sizeof(TCHAR)); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
689 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
690 ImmNotifyIME(himc, NI_CLOSECANDIDATE, 0, 0); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
691 ImmReleaseContext(videodata->ime_hwnd_current, himc); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
692 SDL_SendEditingText("", 0, 0); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
693 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
694 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
695 static void |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
696 IME_GetCompositionString(SDL_VideoData *videodata, HIMC himc, DWORD string) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
697 { |
4760 | 698 LONG length = ImmGetCompositionStringW(himc, string, videodata->ime_composition, sizeof(videodata->ime_composition)); |
699 if (length < 0) | |
700 length = 0; | |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
701 |
4760 | 702 length /= sizeof(videodata->ime_composition[0]); |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
703 videodata->ime_cursor = LOWORD(ImmGetCompositionStringW(himc, GCS_CURSORPOS, 0, 0)); |
4760 | 704 if (videodata->ime_composition[videodata->ime_cursor] == 0x3000) { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
705 int i; |
4760 | 706 for (i = videodata->ime_cursor + 1; i < length; ++i) |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
707 videodata->ime_composition[i - 1] = videodata->ime_composition[i]; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
708 |
4760 | 709 --length; |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
710 } |
4760 | 711 videodata->ime_composition[length] = 0; |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
712 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
713 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
714 static void |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
715 IME_SendInputEvent(SDL_VideoData *videodata) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
716 { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
717 char *s = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
718 s = WIN_StringToUTF8(videodata->ime_composition); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
719 SDL_SendKeyboardText(s); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
720 SDL_free(s); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
721 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
722 videodata->ime_composition[0] = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
723 videodata->ime_readingstring[0] = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
724 videodata->ime_cursor = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
725 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
726 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
727 static void |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
728 IME_SendEditingEvent(SDL_VideoData *videodata) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
729 { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
730 char *s = 0; |
4760 | 731 WCHAR buffer[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; |
732 buffer[0] = 0; | |
733 if (videodata->ime_readingstring[0]) { | |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
734 size_t len = SDL_min(SDL_wcslen(videodata->ime_composition), (size_t)videodata->ime_cursor); |
4760 | 735 SDL_wcslcpy(buffer, videodata->ime_composition, len + 1); |
736 SDL_wcslcat(buffer, videodata->ime_readingstring, sizeof(buffer)); | |
737 SDL_wcslcat(buffer, &videodata->ime_composition[len], sizeof(buffer) - len); | |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
738 } |
4760 | 739 else { |
740 SDL_wcslcpy(buffer, videodata->ime_composition, sizeof(videodata->ime_composition)); | |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
741 } |
4760 | 742 s = WIN_StringToUTF8(buffer); |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
743 SDL_SendEditingText(s, videodata->ime_cursor + SDL_wcslen(videodata->ime_readingstring), 0); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
744 SDL_free(s); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
745 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
746 |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
747 static void |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
748 IME_AddCandidate(SDL_VideoData *videodata, UINT i, LPCWSTR candidate) |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
749 { |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
750 LPWSTR dst = videodata->ime_candidates[i]; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
751 *dst++ = (WCHAR)(TEXT('0') + ((i + videodata->ime_candlistindexbase) % 10)); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
752 if (videodata->ime_candvertical) |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
753 *dst++ = TEXT(' '); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
754 |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
755 while (*candidate && (SDL_arraysize(videodata->ime_candidates[i]) > (dst - videodata->ime_candidates[i]))) |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
756 *dst++ = *candidate++; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
757 |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
758 *dst = (WCHAR)'\0'; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
759 } |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
760 |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
761 static void |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
762 IME_GetCandidateList(HIMC himc, SDL_VideoData *videodata) |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
763 { |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
764 LPCANDIDATELIST cand_list = 0; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
765 DWORD size = ImmGetCandidateListW(himc, 0, 0, 0); |
4914 | 766 if (size) { |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
767 cand_list = (LPCANDIDATELIST)SDL_malloc(size); |
4914 | 768 if (cand_list) { |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
769 size = ImmGetCandidateListW(himc, 0, cand_list, size); |
4914 | 770 if (size) { |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
771 int i = 0; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
772 int j = 0; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
773 int page_start = 0; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
774 videodata->ime_candsel = cand_list->dwSelection; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
775 videodata->ime_candcount = cand_list->dwCount; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
776 |
4914 | 777 if (LANG() == LANG_CHS && IME_GetId(videodata, 0)) { |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
778 const UINT maxcandchar = 18; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
779 UINT i = 0; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
780 UINT cchars = 0; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
781 |
4914 | 782 for (; i < videodata->ime_candcount; ++i) { |
5110 | 783 UINT len = SDL_wcslen((LPWSTR)((DWORD_PTR)cand_list + cand_list->dwOffset[i])) + 1; |
4914 | 784 if (len + cchars > maxcandchar) { |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
785 if (i > cand_list->dwSelection) |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
786 break; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
787 |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
788 page_start = i; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
789 cchars = len; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
790 } |
4914 | 791 else { |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
792 cchars += len; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
793 } |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
794 } |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
795 videodata->ime_candpgsize = i - page_start; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
796 } |
4914 | 797 else { |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
798 videodata->ime_candpgsize = SDL_min(cand_list->dwPageSize, MAX_CANDLIST); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
799 page_start = (cand_list->dwSelection / videodata->ime_candpgsize) * videodata->ime_candpgsize; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
800 } |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
801 SDL_memset(&videodata->ime_candidates, 0, sizeof(videodata->ime_candidates)); |
4914 | 802 for (i = page_start, j = 0; (DWORD)i < cand_list->dwCount && j < (int)videodata->ime_candpgsize; i++, j++) { |
5110 | 803 LPCWSTR candidate = (LPCWSTR)((DWORD_PTR)cand_list + cand_list->dwOffset[i]); |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
804 IME_AddCandidate(videodata, j, candidate); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
805 } |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
806 if (PRIMLANG() == LANG_KOREAN || (PRIMLANG() == LANG_CHT && !IME_GetId(videodata, 0))) |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
807 videodata->ime_candsel = -1; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
808 |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
809 } |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
810 SDL_free(cand_list); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
811 } |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
812 } |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
813 } |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
814 |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
815 static void |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
816 IME_ShowCandidateList(SDL_VideoData *videodata) |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
817 { |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
818 videodata->ime_dirty = SDL_TRUE; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
819 videodata->ime_candlist = SDL_TRUE; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
820 IME_DestroyTextures(videodata); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
821 IME_SendEditingEvent(videodata); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
822 } |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
823 |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
824 static void |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
825 IME_HideCandidateList(SDL_VideoData *videodata) |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
826 { |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
827 videodata->ime_dirty = SDL_FALSE; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
828 videodata->ime_candlist = SDL_FALSE; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
829 IME_DestroyTextures(videodata); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
830 IME_SendEditingEvent(videodata); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
831 } |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
832 |
4752 | 833 SDL_bool |
834 IME_HandleMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM *lParam, SDL_VideoData *videodata) | |
835 { | |
836 SDL_bool trap = SDL_FALSE; | |
837 HIMC himc = 0; | |
838 if (!videodata->ime_initialized || !videodata->ime_available || !videodata->ime_enabled) | |
839 return SDL_FALSE; | |
840 | |
4914 | 841 switch (msg) { |
4752 | 842 case WM_INPUTLANGCHANGE: |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
843 IME_InputLangChanged(videodata); |
4752 | 844 break; |
845 case WM_IME_SETCONTEXT: | |
846 *lParam = 0; | |
847 break; | |
848 case WM_IME_STARTCOMPOSITION: | |
849 trap = SDL_TRUE; | |
850 break; | |
851 case WM_IME_COMPOSITION: | |
852 trap = SDL_TRUE; | |
853 himc = ImmGetContext(hwnd); | |
4760 | 854 if (*lParam & GCS_RESULTSTR) { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
855 IME_GetCompositionString(videodata, himc, GCS_RESULTSTR); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
856 IME_SendInputEvent(videodata); |
4752 | 857 } |
4760 | 858 if (*lParam & GCS_COMPSTR) { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
859 if (!videodata->ime_uiless) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
860 videodata->ime_readingstring[0] = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
861 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
862 IME_GetCompositionString(videodata, himc, GCS_COMPSTR); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
863 IME_SendEditingEvent(videodata); |
4752 | 864 } |
865 ImmReleaseContext(hwnd, himc); | |
866 break; | |
867 case WM_IME_ENDCOMPOSITION: | |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
868 videodata->ime_composition[0] = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
869 videodata->ime_readingstring[0] = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
870 videodata->ime_cursor = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
871 SDL_SendEditingText("", 0, 0); |
4752 | 872 break; |
873 case WM_IME_NOTIFY: | |
4914 | 874 switch (wParam) { |
4752 | 875 case IMN_SETCONVERSIONMODE: |
876 case IMN_SETOPENSTATUS: | |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
877 IME_UpdateInputLocale(videodata); |
4752 | 878 break; |
879 case IMN_OPENCANDIDATE: | |
880 case IMN_CHANGECANDIDATE: | |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
881 if (videodata->ime_uiless) |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
882 break; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
883 |
4752 | 884 trap = SDL_TRUE; |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
885 IME_ShowCandidateList(videodata); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
886 himc = ImmGetContext(hwnd); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
887 if (!himc) |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
888 break; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
889 |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
890 IME_GetCandidateList(himc, videodata); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
891 ImmReleaseContext(hwnd, himc); |
4752 | 892 break; |
893 case IMN_CLOSECANDIDATE: | |
894 trap = SDL_TRUE; | |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
895 IME_HideCandidateList(videodata); |
4752 | 896 break; |
897 case IMN_PRIVATE: | |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
898 { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
899 DWORD dwId = IME_GetId(videodata, 0); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
900 IME_GetReadingString(videodata, hwnd); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
901 switch (dwId) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
902 { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
903 case IMEID_CHT_VER42: |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
904 case IMEID_CHT_VER43: |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
905 case IMEID_CHT_VER44: |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
906 case IMEID_CHS_VER41: |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
907 case IMEID_CHS_VER42: |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
908 if (*lParam == 1 || *lParam == 2) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
909 trap = SDL_TRUE; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
910 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
911 break; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
912 case IMEID_CHT_VER50: |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
913 case IMEID_CHT_VER51: |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
914 case IMEID_CHT_VER52: |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
915 case IMEID_CHT_VER60: |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
916 case IMEID_CHS_VER53: |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
917 if (*lParam == 16 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
918 || *lParam == 17 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
919 || *lParam == 26 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
920 || *lParam == 27 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
921 || *lParam == 28) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
922 trap = SDL_TRUE; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
923 break; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
924 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
925 } |
4752 | 926 break; |
927 default: | |
928 trap = SDL_TRUE; | |
929 break; | |
930 } | |
931 break; | |
932 } | |
933 return trap; | |
934 } | |
935 | |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
936 static void |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
937 IME_CloseCandidateList(SDL_VideoData *videodata) |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
938 { |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
939 IME_HideCandidateList(videodata); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
940 videodata->ime_candcount = 0; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
941 SDL_memset(videodata->ime_candidates, 0, sizeof(videodata->ime_candidates)); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
942 } |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
943 |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
944 static void |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
945 UILess_GetCandidateList(SDL_VideoData *videodata, ITfCandidateListUIElement *pcandlist) |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
946 { |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
947 UINT selection = 0; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
948 UINT count = 0; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
949 UINT page = 0; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
950 UINT pgcount = 0; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
951 DWORD pgstart = 0; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
952 DWORD pgsize = 0; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
953 UINT i, j; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
954 pcandlist->lpVtbl->GetSelection(pcandlist, &selection); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
955 pcandlist->lpVtbl->GetCount(pcandlist, &count); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
956 pcandlist->lpVtbl->GetCurrentPage(pcandlist, &page); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
957 |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
958 videodata->ime_candsel = selection; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
959 videodata->ime_candcount = count; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
960 IME_ShowCandidateList(videodata); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
961 |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
962 pcandlist->lpVtbl->GetPageIndex(pcandlist, 0, 0, &pgcount); |
4914 | 963 if (pgcount > 0) { |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
964 UINT *idxlist = SDL_malloc(sizeof(UINT) * pgcount); |
4914 | 965 if (idxlist) { |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
966 pcandlist->lpVtbl->GetPageIndex(pcandlist, idxlist, pgcount, &pgcount); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
967 pgstart = idxlist[page]; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
968 if (page < pgcount - 1) |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
969 pgsize = SDL_min(count, idxlist[page + 1]) - pgstart; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
970 else |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
971 pgsize = count - pgstart; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
972 |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
973 SDL_free(idxlist); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
974 } |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
975 } |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
976 videodata->ime_candpgsize = SDL_min(pgsize, MAX_CANDLIST); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
977 videodata->ime_candsel = videodata->ime_candsel - pgstart; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
978 |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
979 SDL_memset(videodata->ime_candidates, 0, sizeof(videodata->ime_candidates)); |
4914 | 980 for (i = pgstart, j = 0; (DWORD)i < count && j < videodata->ime_candpgsize; i++, j++) { |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
981 BSTR bstr; |
4914 | 982 if (SUCCEEDED(pcandlist->lpVtbl->GetString(pcandlist, i, &bstr))) { |
983 if (bstr) { | |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
984 IME_AddCandidate(videodata, j, bstr); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
985 SysFreeString(bstr); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
986 } |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
987 } |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
988 } |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
989 if (PRIMLANG() == LANG_KOREAN) |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
990 videodata->ime_candsel = -1; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
991 } |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
992 |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
993 STDMETHODIMP_(ULONG) TSFSink_AddRef(TSFSink *sink) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
994 { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
995 return ++sink->refcount; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
996 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
997 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
998 STDMETHODIMP_(ULONG)TSFSink_Release(TSFSink *sink) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
999 { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1000 --sink->refcount; |
4914 | 1001 if (sink->refcount == 0) { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1002 SDL_free(sink); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1003 return 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1004 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1005 return sink->refcount; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1006 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1007 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1008 STDMETHODIMP UIElementSink_QueryInterface(TSFSink *sink, REFIID riid, PVOID *ppv) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1009 { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1010 if (!ppv) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1011 return E_INVALIDARG; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1012 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1013 *ppv = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1014 if (SDL_IsEqualIID(riid, &IID_IUnknown)) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1015 *ppv = (IUnknown *)sink; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1016 else if (SDL_IsEqualIID(riid, &IID_ITfUIElementSink)) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1017 *ppv = (ITfUIElementSink *)sink; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1018 |
4760 | 1019 if (*ppv) { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1020 TSFSink_AddRef(sink); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1021 return S_OK; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1022 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1023 return E_NOINTERFACE; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1024 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1025 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1026 ITfUIElement *UILess_GetUIElement(SDL_VideoData *videodata, DWORD dwUIElementId) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1027 { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1028 ITfUIElementMgr *puiem = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1029 ITfUIElement *pelem = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1030 ITfThreadMgrEx *threadmgrex = videodata->ime_threadmgrex; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1031 |
4760 | 1032 if (SUCCEEDED(threadmgrex->lpVtbl->QueryInterface(threadmgrex, &IID_ITfUIElementMgr, (LPVOID *)&puiem))) { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1033 puiem->lpVtbl->GetUIElement(puiem, dwUIElementId, &pelem); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1034 puiem->lpVtbl->Release(puiem); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1035 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1036 return pelem; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1037 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1038 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1039 STDMETHODIMP UIElementSink_BeginUIElement(TSFSink *sink, DWORD dwUIElementId, BOOL *pbShow) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1040 { |
4760 | 1041 ITfUIElement *element = UILess_GetUIElement((SDL_VideoData *)sink->data, dwUIElementId); |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1042 ITfReadingInformationUIElement *preading = 0; |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1043 ITfCandidateListUIElement *pcandlist = 0; |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1044 SDL_VideoData *videodata = (SDL_VideoData *)sink->data; |
4760 | 1045 if (!element) |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1046 return E_INVALIDARG; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1047 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1048 *pbShow = FALSE; |
4760 | 1049 if (SUCCEEDED(element->lpVtbl->QueryInterface(element, &IID_ITfReadingInformationUIElement, (LPVOID *)&preading))) { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1050 BSTR bstr; |
4760 | 1051 if (SUCCEEDED(preading->lpVtbl->GetString(preading, &bstr)) && bstr) { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1052 WCHAR *s = (WCHAR *)bstr; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1053 SysFreeString(bstr); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1054 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1055 preading->lpVtbl->Release(preading); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1056 } |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1057 else if (SUCCEEDED(element->lpVtbl->QueryInterface(element, &IID_ITfCandidateListUIElement, (LPVOID *)&pcandlist))) { |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1058 videodata->ime_candref++; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1059 UILess_GetCandidateList(videodata, pcandlist); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1060 pcandlist->lpVtbl->Release(pcandlist); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1061 } |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1062 return S_OK; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1063 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1064 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1065 STDMETHODIMP UIElementSink_UpdateUIElement(TSFSink *sink, DWORD dwUIElementId) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1066 { |
4760 | 1067 ITfUIElement *element = UILess_GetUIElement((SDL_VideoData *)sink->data, dwUIElementId); |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1068 ITfReadingInformationUIElement *preading = 0; |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1069 ITfCandidateListUIElement *pcandlist = 0; |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1070 SDL_VideoData *videodata = (SDL_VideoData *)sink->data; |
4760 | 1071 if (!element) |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1072 return E_INVALIDARG; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1073 |
4760 | 1074 if (SUCCEEDED(element->lpVtbl->QueryInterface(element, &IID_ITfReadingInformationUIElement, (LPVOID *)&preading))) { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1075 BSTR bstr; |
4760 | 1076 if (SUCCEEDED(preading->lpVtbl->GetString(preading, &bstr)) && bstr) { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1077 WCHAR *s = (WCHAR *)bstr; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1078 SDL_wcslcpy(videodata->ime_readingstring, s, sizeof(videodata->ime_readingstring)); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1079 IME_SendEditingEvent(videodata); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1080 SysFreeString(bstr); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1081 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1082 preading->lpVtbl->Release(preading); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1083 } |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1084 else if (SUCCEEDED(element->lpVtbl->QueryInterface(element, &IID_ITfCandidateListUIElement, (LPVOID *)&pcandlist))) { |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1085 UILess_GetCandidateList(videodata, pcandlist); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1086 pcandlist->lpVtbl->Release(pcandlist); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1087 } |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1088 return S_OK; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1089 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1090 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1091 STDMETHODIMP UIElementSink_EndUIElement(TSFSink *sink, DWORD dwUIElementId) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1092 { |
4760 | 1093 ITfUIElement *element = UILess_GetUIElement((SDL_VideoData *)sink->data, dwUIElementId); |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1094 ITfReadingInformationUIElement *preading = 0; |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1095 ITfCandidateListUIElement *pcandlist = 0; |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1096 SDL_VideoData *videodata = (SDL_VideoData *)sink->data; |
4760 | 1097 if (!element) |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1098 return E_INVALIDARG; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1099 |
4760 | 1100 if (SUCCEEDED(element->lpVtbl->QueryInterface(element, &IID_ITfReadingInformationUIElement, (LPVOID *)&preading))) { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1101 videodata->ime_readingstring[0] = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1102 IME_SendEditingEvent(videodata); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1103 preading->lpVtbl->Release(preading); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1104 } |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1105 if (SUCCEEDED(element->lpVtbl->QueryInterface(element, &IID_ITfCandidateListUIElement, (LPVOID *)&pcandlist))) { |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1106 videodata->ime_candref--; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1107 if (videodata->ime_candref == 0) |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1108 IME_CloseCandidateList(videodata); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1109 |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1110 pcandlist->lpVtbl->Release(pcandlist); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1111 } |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1112 return S_OK; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1113 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1114 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1115 STDMETHODIMP IPPASink_QueryInterface(TSFSink *sink, REFIID riid, PVOID *ppv) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1116 { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1117 if (!ppv) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1118 return E_INVALIDARG; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1119 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1120 *ppv = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1121 if (SDL_IsEqualIID(riid, &IID_IUnknown)) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1122 *ppv = (IUnknown *)sink; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1123 else if (SDL_IsEqualIID(riid, &IID_ITfInputProcessorProfileActivationSink)) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1124 *ppv = (ITfInputProcessorProfileActivationSink *)sink; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1125 |
4760 | 1126 if (*ppv) { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1127 TSFSink_AddRef(sink); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1128 return S_OK; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1129 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1130 return E_NOINTERFACE; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1131 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1132 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1133 STDMETHODIMP IPPASink_OnActivated(TSFSink *sink, DWORD dwProfileType, LANGID langid, REFCLSID clsid, REFGUID catid, REFGUID guidProfile, HKL hkl, DWORD dwFlags) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1134 { |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1135 static GUID TF_PROFILE_DAYI = {0x037B2C25, 0x480C, 0x4D7F, 0xB0, 0x27, 0xD6, 0xCA, 0x6B, 0x69, 0x78, 0x8A}; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1136 SDL_VideoData *videodata = (SDL_VideoData *)sink->data; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1137 videodata->ime_candlistindexbase = SDL_IsEqualGUID(&TF_PROFILE_DAYI, guidProfile) ? 0 : 1; |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1138 if (SDL_IsEqualIID(catid, &GUID_TFCAT_TIP_KEYBOARD) && (dwFlags & TF_IPSINK_FLAG_ACTIVE)) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1139 IME_InputLangChanged((SDL_VideoData *)sink->data); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1140 |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1141 IME_HideCandidateList(videodata); |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1142 return S_OK; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1143 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1144 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1145 static void *vtUIElementSink[] = { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1146 (void *)(UIElementSink_QueryInterface), |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1147 (void *)(TSFSink_AddRef), |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1148 (void *)(TSFSink_Release), |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1149 (void *)(UIElementSink_BeginUIElement), |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1150 (void *)(UIElementSink_UpdateUIElement), |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1151 (void *)(UIElementSink_EndUIElement) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1152 }; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1153 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1154 static void *vtIPPASink[] = { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1155 (void *)(IPPASink_QueryInterface), |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1156 (void *)(TSFSink_AddRef), |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1157 (void *)(TSFSink_Release), |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1158 (void *)(IPPASink_OnActivated) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1159 }; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1160 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1161 static void |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1162 UILess_EnableUIUpdates(SDL_VideoData *videodata) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1163 { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1164 ITfSource *source = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1165 if (!videodata->ime_threadmgrex || videodata->ime_uielemsinkcookie != TF_INVALID_COOKIE) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1166 return; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1167 |
4760 | 1168 if (SUCCEEDED(videodata->ime_threadmgrex->lpVtbl->QueryInterface(videodata->ime_threadmgrex, &IID_ITfSource, (LPVOID *)&source))) { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1169 source->lpVtbl->AdviseSink(source, &IID_ITfUIElementSink, (IUnknown *)videodata->ime_uielemsink, &videodata->ime_uielemsinkcookie); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1170 source->lpVtbl->Release(source); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1171 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1172 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1173 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1174 static void |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1175 UILess_DisableUIUpdates(SDL_VideoData *videodata) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1176 { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1177 ITfSource *source = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1178 if (!videodata->ime_threadmgrex || videodata->ime_uielemsinkcookie == TF_INVALID_COOKIE) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1179 return; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1180 |
4760 | 1181 if (SUCCEEDED(videodata->ime_threadmgrex->lpVtbl->QueryInterface(videodata->ime_threadmgrex, &IID_ITfSource, (LPVOID *)&source))) { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1182 source->lpVtbl->UnadviseSink(source, videodata->ime_uielemsinkcookie); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1183 videodata->ime_uielemsinkcookie = TF_INVALID_COOKIE; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1184 source->lpVtbl->Release(source); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1185 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1186 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1187 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1188 static SDL_bool |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1189 UILess_SetupSinks(SDL_VideoData *videodata) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1190 { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1191 TfClientId clientid = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1192 SDL_bool result = SDL_FALSE; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1193 ITfSource *source = 0; |
4893
b2e434e0553b
Fixed all MinGW problems (except libraries not added to build yet).
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4763
diff
changeset
|
1194 if (FAILED(CoCreateInstance(&CLSID_TF_ThreadMgr, NULL, CLSCTX_INPROC_SERVER, &IID_ITfThreadMgrEx, (LPVOID *)&videodata->ime_threadmgrex))) |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1195 return SDL_FALSE; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1196 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1197 if (FAILED(videodata->ime_threadmgrex->lpVtbl->ActivateEx(videodata->ime_threadmgrex, &clientid, TF_TMAE_UIELEMENTENABLEDONLY))) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1198 return SDL_FALSE; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1199 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1200 videodata->ime_uielemsink = SDL_malloc(sizeof(TSFSink)); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1201 videodata->ime_ippasink = SDL_malloc(sizeof(TSFSink)); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1202 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1203 videodata->ime_uielemsink->lpVtbl = vtUIElementSink; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1204 videodata->ime_uielemsink->refcount = 1; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1205 videodata->ime_uielemsink->data = videodata; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1206 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1207 videodata->ime_ippasink->lpVtbl = vtIPPASink; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1208 videodata->ime_ippasink->refcount = 1; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1209 videodata->ime_ippasink->data = videodata; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1210 |
4760 | 1211 if (SUCCEEDED(videodata->ime_threadmgrex->lpVtbl->QueryInterface(videodata->ime_threadmgrex, &IID_ITfSource, (LPVOID *)&source))) { |
1212 if (SUCCEEDED(source->lpVtbl->AdviseSink(source, &IID_ITfUIElementSink, (IUnknown *)videodata->ime_uielemsink, &videodata->ime_uielemsinkcookie))) { | |
1213 if (SUCCEEDED(source->lpVtbl->AdviseSink(source, &IID_ITfInputProcessorProfileActivationSink, (IUnknown *)videodata->ime_ippasink, &videodata->ime_alpnsinkcookie))) { | |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1214 result = SDL_TRUE; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1215 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1216 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1217 source->lpVtbl->Release(source); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1218 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1219 return result; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1220 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1221 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1222 #define SAFE_RELEASE(p) \ |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1223 { \ |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1224 if (p) { \ |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1225 (p)->lpVtbl->Release((p)); \ |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1226 (p) = 0; \ |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1227 } \ |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1228 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1229 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1230 static void |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1231 UILess_ReleaseSinks(SDL_VideoData *videodata) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1232 { |
4760 | 1233 ITfSource *source = 0; |
4893
b2e434e0553b
Fixed all MinGW problems (except libraries not added to build yet).
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4763
diff
changeset
|
1234 if (videodata->ime_threadmgrex && SUCCEEDED(videodata->ime_threadmgrex->lpVtbl->QueryInterface(videodata->ime_threadmgrex, &IID_ITfSource, (LPVOID *)&source))) { |
4760 | 1235 source->lpVtbl->UnadviseSink(source, videodata->ime_uielemsinkcookie); |
1236 source->lpVtbl->UnadviseSink(source, videodata->ime_alpnsinkcookie); | |
1237 SAFE_RELEASE(source); | |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1238 videodata->ime_threadmgrex->lpVtbl->Deactivate(videodata->ime_threadmgrex); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1239 SAFE_RELEASE(videodata->ime_threadmgrex); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1240 TSFSink_Release(videodata->ime_uielemsink); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1241 videodata->ime_uielemsink = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1242 TSFSink_Release(videodata->ime_ippasink); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1243 videodata->ime_ippasink = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1244 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1245 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1246 |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1247 static void * |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1248 StartDrawToBitmap(HDC hdc, HBITMAP *hhbm, int width, int height) |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1249 { |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1250 BITMAPINFO info = {0}; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1251 BITMAPINFOHEADER *infoHeader = &info.bmiHeader; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1252 BYTE *bits = NULL; |
4914 | 1253 if (hhbm) { |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1254 infoHeader->biSize = sizeof(BITMAPINFOHEADER); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1255 infoHeader->biWidth = width; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1256 infoHeader->biHeight = -1 * SDL_abs(height); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1257 infoHeader->biPlanes = 1; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1258 infoHeader->biBitCount = 32; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1259 infoHeader->biCompression = BI_RGB; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1260 *hhbm = CreateDIBSection(hdc, &info, DIB_RGB_COLORS, (void **)&bits, 0, 0); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1261 if (*hhbm) |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1262 SelectObject(hdc, *hhbm); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1263 } |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1264 return bits; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1265 } |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1266 |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1267 static void |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1268 StopDrawToBitmap(HDC hdc, HBITMAP *hhbm) |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1269 { |
4914 | 1270 if (hhbm && *hhbm) { |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1271 DeleteObject(*hhbm); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1272 *hhbm = NULL; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1273 } |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1274 } |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1275 |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1276 /* This draws only within the specified area and fills the entire region. */ |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1277 static void |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1278 DrawRect(HDC hdc, int left, int top, int right, int bottom, int pensize) |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1279 { |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1280 /* The case of no pen (PenSize = 0) is automatically taken care of. */ |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1281 const int penadjust = (int)SDL_floor(pensize / 2.0f - 0.5f); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1282 left += pensize / 2; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1283 top += pensize / 2; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1284 right -= penadjust; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1285 bottom -= penadjust; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1286 Rectangle(hdc, left, top, right, bottom); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1287 } |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1288 |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1289 static void |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1290 IME_DestroyTextures(SDL_VideoData *videodata) |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1291 { |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1292 } |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1293 |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1294 #define SDL_swap(a,b) { \ |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1295 int c = (a); \ |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1296 (a) = (b); \ |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1297 (b) = c; \ |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1298 } |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1299 |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1300 static void |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1301 IME_PositionCandidateList(SDL_VideoData *videodata, SIZE size) |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1302 { |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1303 int left, top, right, bottom; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1304 SDL_bool ok = SDL_FALSE; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1305 int winw = videodata->ime_winwidth; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1306 int winh = videodata->ime_winheight; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1307 |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1308 /* Bottom */ |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1309 left = videodata->ime_rect.x; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1310 top = videodata->ime_rect.y + videodata->ime_rect.h; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1311 right = left + size.cx; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1312 bottom = top + size.cy; |
4914 | 1313 if (right >= winw) { |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1314 left -= right - winw; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1315 right = winw; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1316 } |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1317 if (bottom < winh) |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1318 ok = SDL_TRUE; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1319 |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1320 /* Top */ |
4914 | 1321 if (!ok) { |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1322 left = videodata->ime_rect.x; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1323 top = videodata->ime_rect.y - size.cy; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1324 right = left + size.cx; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1325 bottom = videodata->ime_rect.y; |
4914 | 1326 if (right >= winw) { |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1327 left -= right - winw; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1328 right = winw; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1329 } |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1330 if (top >= 0) |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1331 ok = SDL_TRUE; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1332 } |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1333 |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1334 /* Right */ |
4914 | 1335 if (!ok) { |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1336 left = videodata->ime_rect.x + size.cx; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1337 top = 0; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1338 right = left + size.cx; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1339 bottom = size.cy; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1340 if (right < winw) |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1341 ok = SDL_TRUE; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1342 } |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1343 |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1344 /* Left */ |
4914 | 1345 if (!ok) { |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1346 left = videodata->ime_rect.x - size.cx; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1347 top = 0; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1348 right = videodata->ime_rect.x; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1349 bottom = size.cy; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1350 if (right >= 0) |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1351 ok = SDL_TRUE; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1352 } |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1353 |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1354 /* Window too small, show at (0,0) */ |
4914 | 1355 if (!ok) { |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1356 left = 0; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1357 top = 0; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1358 right = size.cx; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1359 bottom = size.cy; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1360 } |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1361 |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1362 videodata->ime_candlistrect.x = left; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1363 videodata->ime_candlistrect.y = top; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1364 videodata->ime_candlistrect.w = right - left; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1365 videodata->ime_candlistrect.h = bottom - top; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1366 } |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1367 |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1368 static void |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1369 IME_RenderCandidateList(SDL_VideoData *videodata, HDC hdc) |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1370 { |
4916
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1371 int i, j; |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1372 SIZE size = {0}; |
4916
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1373 SIZE candsizes[MAX_CANDLIST]; |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1374 SIZE maxcandsize = {0}; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1375 HBITMAP hbm = NULL; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1376 BYTE *bits = NULL; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1377 const int candcount = SDL_min(SDL_min(MAX_CANDLIST, videodata->ime_candcount), videodata->ime_candpgsize); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1378 SDL_bool vertical = videodata->ime_candvertical; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1379 |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1380 const int listborder = 1; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1381 const int listpadding = 0; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1382 const int listbordercolor = RGB(0xB4, 0xC7, 0xAA); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1383 const int listfillcolor = RGB(255, 255, 255); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1384 |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1385 const int candborder = 1; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1386 const int candpadding = 0; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1387 const int candmargin = 1; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1388 const COLORREF candbordercolor = RGB(255, 255, 255); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1389 const COLORREF candfillcolor = RGB(255, 255, 255); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1390 const COLORREF candtextcolor = RGB(0, 0, 0); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1391 const COLORREF selbordercolor = RGB(0x84, 0xAC, 0xDD); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1392 const COLORREF selfillcolor = RGB(0xD2, 0xE6, 0xFF); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1393 const COLORREF seltextcolor = RGB(0, 0, 0); |
4916
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1394 const int horzcandspacing = 5; |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1395 |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1396 HPEN listpen = listborder != 0 ? CreatePen(PS_SOLID, listborder, listbordercolor) : (HPEN)GetStockObject(NULL_PEN); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1397 HBRUSH listbrush = CreateSolidBrush(listfillcolor); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1398 HPEN candpen = candborder != 0 ? CreatePen(PS_SOLID, candborder, candbordercolor) : (HPEN)GetStockObject(NULL_PEN); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1399 HBRUSH candbrush = CreateSolidBrush(candfillcolor); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1400 HPEN selpen = candborder != 0 ? CreatePen(PS_DOT, candborder, selbordercolor) : (HPEN)GetStockObject(NULL_PEN); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1401 HBRUSH selbrush = CreateSolidBrush(selfillcolor); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1402 HFONT font = CreateFont((int)(1 + videodata->ime_rect.h * 0.75f), 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_CHARACTER_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY, VARIABLE_PITCH | FF_SWISS, TEXT("Microsoft Sans Serif")); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1403 |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1404 SetBkMode(hdc, TRANSPARENT); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1405 SelectObject(hdc, font); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1406 |
4914 | 1407 for (i = 0; i < candcount; ++i) { |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1408 const WCHAR *s = videodata->ime_candidates[i]; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1409 if (!*s) |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1410 break; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1411 |
4916
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1412 GetTextExtentPoint32W(hdc, s, SDL_wcslen(s), &candsizes[i]); |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1413 maxcandsize.cx = SDL_max(maxcandsize.cx, candsizes[i].cx); |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1414 maxcandsize.cy = SDL_max(maxcandsize.cy, candsizes[i].cy); |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1415 |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1416 } |
4916
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1417 if (vertical) { |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1418 size.cx = |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1419 (listborder * 2) + |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1420 (listpadding * 2) + |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1421 (candmargin * 2) + |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1422 (candborder * 2) + |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1423 (candpadding * 2) + |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1424 (maxcandsize.cx) |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1425 ; |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1426 size.cy = |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1427 (listborder * 2) + |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1428 (listpadding * 2) + |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1429 ((candcount + 1) * candmargin) + |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1430 (candcount * candborder * 2) + |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1431 (candcount * candpadding * 2) + |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1432 (candcount * maxcandsize.cy) |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1433 ; |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1434 } |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1435 else { |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1436 size.cx = |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1437 (listborder * 2) + |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1438 (listpadding * 2) + |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1439 ((candcount + 1) * candmargin) + |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1440 (candcount * candborder * 2) + |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1441 (candcount * candpadding * 2) + |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1442 ((candcount - 1) * horzcandspacing); |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1443 ; |
4916
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1444 |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1445 for (i = 0; i < candcount; ++i) |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1446 size.cx += candsizes[i].cx; |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1447 |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1448 size.cy = |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1449 (listborder * 2) + |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1450 (listpadding * 2) + |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1451 (candmargin * 2) + |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1452 (candborder * 2) + |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1453 (candpadding * 2) + |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1454 (maxcandsize.cy) |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1455 ; |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1456 } |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1457 |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1458 bits = StartDrawToBitmap(hdc, &hbm, size.cx, size.cy); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1459 |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1460 SelectObject(hdc, listpen); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1461 SelectObject(hdc, listbrush); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1462 DrawRect(hdc, 0, 0, size.cx, size.cy, listborder); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1463 |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1464 SelectObject(hdc, candpen); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1465 SelectObject(hdc, candbrush); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1466 SetTextColor(hdc, candtextcolor); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1467 SetBkMode(hdc, TRANSPARENT); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1468 |
4914 | 1469 for (i = 0; i < candcount; ++i) { |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1470 const WCHAR *s = videodata->ime_candidates[i]; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1471 int left, top, right, bottom; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1472 if (!*s) |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1473 break; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1474 |
4916
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1475 if (vertical) { |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1476 left = listborder + listpadding + candmargin; |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1477 top = listborder + listpadding + (i * candborder * 2) + (i * candpadding * 2) + ((i + 1) * candmargin) + (i * maxcandsize.cy); |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1478 right = size.cx - listborder - listpadding - candmargin; |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1479 bottom = top + maxcandsize.cy + (candpadding * 2) + (candborder * 2); |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1480 } |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1481 else { |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1482 left = listborder + listpadding + (i * candborder * 2) + (i * candpadding * 2) + ((i + 1) * candmargin) + (i * horzcandspacing); |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1483 |
4916
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1484 for (j = 0; j < i; ++j) |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1485 left += candsizes[j].cx; |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1486 |
4916
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1487 top = listborder + listpadding + candmargin; |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1488 right = left + candsizes[i].cx + (candpadding * 2) + (candborder * 2); |
3617cec7f0ee
Better horizontal candidate list rendering.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4914
diff
changeset
|
1489 bottom = size.cy - listborder - listpadding - candmargin; |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1490 } |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1491 |
4914 | 1492 if (i == videodata->ime_candsel) { |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1493 SelectObject(hdc, selpen); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1494 SelectObject(hdc, selbrush); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1495 SetTextColor(hdc, seltextcolor); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1496 } |
4914 | 1497 else { |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1498 SelectObject(hdc, candpen); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1499 SelectObject(hdc, candbrush); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1500 SetTextColor(hdc, candtextcolor); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1501 } |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1502 |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1503 DrawRect(hdc, left, top, right, bottom, candborder); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1504 ExtTextOutW(hdc, left + candborder + candpadding, top + candborder + candpadding, 0, NULL, s, SDL_wcslen(s), NULL); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1505 } |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1506 StopDrawToBitmap(hdc, &hbm); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1507 |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1508 DeleteObject(listpen); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1509 DeleteObject(listbrush); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1510 DeleteObject(candpen); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1511 DeleteObject(candbrush); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1512 DeleteObject(selpen); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1513 DeleteObject(selbrush); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1514 DeleteObject(font); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1515 |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1516 IME_PositionCandidateList(videodata, size); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1517 } |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1518 |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1519 static void |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1520 IME_Render(SDL_VideoData *videodata) |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1521 { |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1522 HDC hdc = CreateCompatibleDC(NULL); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1523 |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1524 if (videodata->ime_candlist) |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1525 IME_RenderCandidateList(videodata, hdc); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1526 |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1527 DeleteDC(hdc); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1528 |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1529 videodata->ime_dirty = SDL_FALSE; |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1530 } |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1531 |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1532 void IME_Present(SDL_VideoData *videodata) |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1533 { |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1534 if (videodata->ime_dirty) |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1535 IME_Render(videodata); |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1536 |
5157
fb424691cfc7
Moved the rendering code out to a separate directory in the hope that it can someday be completely decoupled from the rest of the library and be expanded to an awesome 2D on 3D library.
Sam Lantinga <slouken@libsdl.org>
parents:
5110
diff
changeset
|
1537 // FIXME: Need to show the IME bitmap |
4913
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1538 } |
6b89d83b0b5a
Windows candidate list support.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
4894
diff
changeset
|
1539 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5083
diff
changeset
|
1540 #endif /* SDL_DISABLE_WINDOWS_IME */ |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5083
diff
changeset
|
1541 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1542 /* vi: set ts=4 sw=4 expandtab: */ |