Mercurial > sdl-ios-xcode
annotate src/video/win32/SDL_win32keyboard.c @ 5080:6d94060d16a9
Fixed bug #1011
Daniel Ellis 2010-06-25 15:20:31 PDT
SDL based applications sometimes display the wrong application name in the
Sound Preferences dialog when using pulseaudio.
I can see from the code that the SDL pulse module is initiating a new pulse
audio context and passing an application name using the function
get_progname().
The get_progname() function returns the name of the current process. However,
the process name is often not a suitable name to use. For example, the OpenShot
video editor is a python application, and so "python" is displayed in the Sound
Preferences window (see Bug #596504), when it should be displaying "OpenShot".
PulseAudio allows applications to specify the application name, either at the
time the context is created (as SDL does currently), or by special environment
variables (see http://www.pulseaudio.org/wiki/ApplicationProperties). If no
name is specified, then pulseaudio will determine the name based on the
process.
If you specify the application name when initiating the pulseaudio context,
then that will override any application name specified using an environment
variable.
As libsdl is a library, I believe the solution is for libsdl to not specify any
application name when initiating a pulseaudio context, which will enable
applications to specify the application name using environment variables. In
the case that the applications do not specify anything, pulseaudio will fall
back to using the process name anyway.
The attached patch removes the get_progname() function and passes NULL as the
application name when creating the pulseaudio context, which fixes the issue.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 23 Jan 2011 21:55:04 -0800 |
parents | 27c458e4ae31 |
children |
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 |
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
|
24 #include "SDL_win32video.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
|
25 |
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
|
26 #include "../../events/SDL_keyboard_c.h" |
2308
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
27 #include "../../events/scancodes_win32.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
|
28 |
4752 | 29 #include <imm.h> |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
30 #include <oleauto.h> |
4880
27c458e4ae31
Update VS2010 project to add new files; update new files so code builds on Win32/Win64
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
4763
diff
changeset
|
31 #include <winver.h> |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
32 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
33 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
|
34 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
|
35 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
|
36 static void IME_Quit(SDL_VideoData *videodata); |
4752 | 37 |
2311
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
38 #ifndef MAPVK_VK_TO_VSC |
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
39 #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
|
40 #endif |
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
41 #ifndef MAPVK_VSC_TO_VK |
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
42 #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
|
43 #endif |
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
44 #ifndef MAPVK_VK_TO_CHAR |
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
45 #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
|
46 #endif |
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
47 |
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
48 /* Alphabetic scancodes for PC keyboards */ |
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
49 BYTE alpha_scancodes[26] = { |
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
50 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
|
51 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
|
52 }; |
2735
204be4fc2726
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2726
diff
changeset
|
53 |
2317
f537a293b3da
Windows also remaps the numeric keypad... grrr
Sam Lantinga <slouken@libsdl.org>
parents:
2311
diff
changeset
|
54 BYTE keypad_scancodes[10] = { |
f537a293b3da
Windows also remaps the numeric keypad... grrr
Sam Lantinga <slouken@libsdl.org>
parents:
2311
diff
changeset
|
55 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
|
56 }; |
2311
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
57 |
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
|
58 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
|
59 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
|
60 { |
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
|
61 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
|
62 int i; |
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
63 |
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
64 /* 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
|
65 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
|
66 #if 0 |
2726
f23ebf1ddac4
Dynamically load wintab32.dll
Sam Lantinga <slouken@libsdl.org>
parents:
2724
diff
changeset
|
67 printf |
f23ebf1ddac4
Dynamically load wintab32.dll
Sam Lantinga <slouken@libsdl.org>
parents:
2724
diff
changeset
|
68 ("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
|
69 #endif |
2311
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
70 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
|
71 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
|
72 #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
|
73 printf("%d = %d\n", i, alpha_scancodes[i]); |
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 } |
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
76 } |
2317
f537a293b3da
Windows also remaps the numeric keypad... grrr
Sam Lantinga <slouken@libsdl.org>
parents:
2311
diff
changeset
|
77 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
|
78 #if 0 |
2726
f23ebf1ddac4
Dynamically load wintab32.dll
Sam Lantinga <slouken@libsdl.org>
parents:
2724
diff
changeset
|
79 printf |
f23ebf1ddac4
Dynamically load wintab32.dll
Sam Lantinga <slouken@libsdl.org>
parents:
2724
diff
changeset
|
80 ("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
|
81 #endif |
2317
f537a293b3da
Windows also remaps the numeric keypad... grrr
Sam Lantinga <slouken@libsdl.org>
parents:
2311
diff
changeset
|
82 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
|
83 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
|
84 MapVirtualKey(VK_NUMPAD0 + i, MAPVK_VK_TO_VSC); |
2724
0e2b65f32298
Added Wacom API headers.
Sam Lantinga <slouken@libsdl.org>
parents:
2324
diff
changeset
|
85 #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
|
86 printf("%d = %d\n", i, keypad_scancodes[i]); |
2724
0e2b65f32298
Added Wacom API headers.
Sam Lantinga <slouken@libsdl.org>
parents:
2324
diff
changeset
|
87 #endif |
2317
f537a293b3da
Windows also remaps the numeric keypad... grrr
Sam Lantinga <slouken@libsdl.org>
parents:
2311
diff
changeset
|
88 } |
f537a293b3da
Windows also remaps the numeric keypad... grrr
Sam Lantinga <slouken@libsdl.org>
parents:
2311
diff
changeset
|
89 } |
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
|
90 |
2308
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
91 data->key_layout = win32_scancode_table; |
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
92 |
4752 | 93 data->ime_com_initialized = SDL_FALSE; |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
94 data->ime_threadmgr = 0; |
4752 | 95 data->ime_initialized = SDL_FALSE; |
96 data->ime_enabled = SDL_FALSE; | |
97 data->ime_available = SDL_FALSE; | |
98 data->ime_hwnd_main = 0; | |
99 data->ime_hwnd_current = 0; | |
100 data->ime_himc = 0; | |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
101 data->ime_composition[0] = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
102 data->ime_readingstring[0] = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
103 data->ime_cursor = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
104 data->ime_hkl = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
105 data->ime_himm32 = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
106 data->GetReadingString = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
107 data->ShowReadingWindow = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
108 data->ImmLockIMC = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
109 data->ImmUnlockIMC = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
110 data->ImmLockIMCC = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
111 data->ImmUnlockIMCC = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
112 data->ime_uiless = SDL_FALSE; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
113 data->ime_threadmgrex = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
114 data->ime_uielemsinkcookie = TF_INVALID_COOKIE; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
115 data->ime_alpnsinkcookie = TF_INVALID_COOKIE; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
116 data->ime_openmodesinkcookie = TF_INVALID_COOKIE; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
117 data->ime_convmodesinkcookie = TF_INVALID_COOKIE; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
118 data->ime_uielemsink = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
119 data->ime_ippasink = 0; |
4752 | 120 |
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
|
121 WIN_UpdateKeymap(); |
2308
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
122 |
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
123 SDL_SetScancodeName(SDL_SCANCODE_APPLICATION, "Menu"); |
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
124 SDL_SetScancodeName(SDL_SCANCODE_LGUI, "Left Windows"); |
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
125 SDL_SetScancodeName(SDL_SCANCODE_RGUI, "Right Windows"); |
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
126 } |
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
127 |
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
128 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
|
129 WIN_UpdateKeymap() |
2308
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
130 { |
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
131 int i; |
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
132 SDL_scancode scancode; |
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
133 SDLKey keymap[SDL_NUM_SCANCODES]; |
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
134 |
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
135 SDL_GetDefaultKeymap(keymap); |
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
136 |
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
137 for (i = 0; i < SDL_arraysize(win32_scancode_table); i++) { |
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
138 |
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
139 /* Make sure this scancode is a valid character scancode */ |
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
140 scancode = win32_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
|
141 if (scancode == SDL_SCANCODE_UNKNOWN || keymap[scancode] >= 127) { |
2308
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
142 continue; |
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
143 } |
2311
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
144 |
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
145 /* 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
|
146 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
|
147 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
|
148 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
|
149 } else { |
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
150 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
|
151 } |
2308
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
152 } |
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
|
153 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
|
154 } |
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
|
155 |
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
|
156 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
|
157 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
|
158 { |
4752 | 159 IME_Quit((SDL_VideoData *)_this->driverdata); |
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
|
160 } |
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
|
161 |
4747 | 162 void |
4753
11b0a6a3eb4d
Changed Start/StopTextInput back to not take any parameters.
dewyatt
parents:
4752
diff
changeset
|
163 WIN_StartTextInput(_THIS) |
4747 | 164 { |
4753
11b0a6a3eb4d
Changed Start/StopTextInput back to not take any parameters.
dewyatt
parents:
4752
diff
changeset
|
165 SDL_Window *window = SDL_GetKeyboardFocus(); |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
166 if (window) { |
4753
11b0a6a3eb4d
Changed Start/StopTextInput back to not take any parameters.
dewyatt
parents:
4752
diff
changeset
|
167 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; |
11b0a6a3eb4d
Changed Start/StopTextInput back to not take any parameters.
dewyatt
parents:
4752
diff
changeset
|
168 SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata; |
11b0a6a3eb4d
Changed Start/StopTextInput back to not take any parameters.
dewyatt
parents:
4752
diff
changeset
|
169 IME_Init(videodata, hwnd); |
11b0a6a3eb4d
Changed Start/StopTextInput back to not take any parameters.
dewyatt
parents:
4752
diff
changeset
|
170 IME_Enable(videodata, hwnd); |
11b0a6a3eb4d
Changed Start/StopTextInput back to not take any parameters.
dewyatt
parents:
4752
diff
changeset
|
171 } |
4747 | 172 } |
173 | |
174 void | |
4753
11b0a6a3eb4d
Changed Start/StopTextInput back to not take any parameters.
dewyatt
parents:
4752
diff
changeset
|
175 WIN_StopTextInput(_THIS) |
4747 | 176 { |
4753
11b0a6a3eb4d
Changed Start/StopTextInput back to not take any parameters.
dewyatt
parents:
4752
diff
changeset
|
177 SDL_Window *window = SDL_GetKeyboardFocus(); |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
178 if (window) { |
4753
11b0a6a3eb4d
Changed Start/StopTextInput back to not take any parameters.
dewyatt
parents:
4752
diff
changeset
|
179 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; |
11b0a6a3eb4d
Changed Start/StopTextInput back to not take any parameters.
dewyatt
parents:
4752
diff
changeset
|
180 SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata; |
11b0a6a3eb4d
Changed Start/StopTextInput back to not take any parameters.
dewyatt
parents:
4752
diff
changeset
|
181 IME_Init(videodata, hwnd); |
11b0a6a3eb4d
Changed Start/StopTextInput back to not take any parameters.
dewyatt
parents:
4752
diff
changeset
|
182 IME_Disable(videodata, hwnd); |
11b0a6a3eb4d
Changed Start/StopTextInput back to not take any parameters.
dewyatt
parents:
4752
diff
changeset
|
183 } |
4747 | 184 } |
185 | |
186 void | |
187 WIN_SetTextInputRect(_THIS, SDL_Rect *rect) | |
188 { | |
189 | |
190 } | |
191 | |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
192 #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
|
193 #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
|
194 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
195 #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
|
196 #define IMEID_VER(id) ((id) & 0xffff0000) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
197 #define IMEID_LANG(id) ((id) & 0x0000ffff) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
198 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
199 #define CHT_HKL_DAYI ((HKL)0xE0060404) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
200 #define CHT_HKL_NEW_PHONETIC ((HKL)0xE0080404) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
201 #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
|
202 #define CHT_HKL_NEW_QUICK ((HKL)0xE00A0404) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
203 #define CHT_HKL_HK_CANTONESE ((HKL)0xE00B0404) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
204 #define CHT_IMEFILENAME1 "TINTLGNT.IME" |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
205 #define CHT_IMEFILENAME2 "CINTLGNT.IME" |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
206 #define CHT_IMEFILENAME3 "MSTCIPHA.IME" |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
207 #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
|
208 #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
|
209 #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
|
210 #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
|
211 #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
|
212 #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
|
213 #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
|
214 #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
|
215 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
216 #define CHS_HKL ((HKL)0xE00E0804) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
217 #define CHS_IMEFILENAME1 "PINTLGNT.IME" |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
218 #define CHS_IMEFILENAME2 "MSSCIPYA.IME" |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
219 #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
|
220 #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
|
221 #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
|
222 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
223 #define LANG() LOWORD((videodata->ime_hkl)) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
224 #define PRIMLANG() ((WORD)PRIMARYLANGID(LANG())) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
225 #define SUBLANG() SUBLANGID(LANG()) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
226 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
227 static void IME_UpdateInputLocale(SDL_VideoData *videodata); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
228 static void IME_ClearComposition(SDL_VideoData *videodata); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
229 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
|
230 static void IME_SetupAPI(SDL_VideoData *videodata); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
231 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
|
232 static void IME_SendEditingEvent(SDL_VideoData *videodata); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
233 #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
|
234 #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
|
235 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
236 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
|
237 static void UILess_ReleaseSinks(SDL_VideoData *videodata); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
238 static void UILess_EnableUIUpdates(SDL_VideoData *videodata); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
239 static void UILess_DisableUIUpdates(SDL_VideoData *videodata); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
240 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
241 static void |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
242 IME_Init(SDL_VideoData *videodata, HWND hwnd) |
4752 | 243 { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
244 if (videodata->ime_initialized) |
4752 | 245 return; |
246 | |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
247 videodata->ime_hwnd_main = hwnd; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
248 if (SUCCEEDED(CoInitializeEx(NULL, COINIT_APARTMENTTHREADED))) { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
249 videodata->ime_com_initialized = SDL_TRUE; |
4880
27c458e4ae31
Update VS2010 project to add new files; update new files so code builds on Win32/Win64
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
4763
diff
changeset
|
250 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
|
251 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
252 videodata->ime_initialized = SDL_TRUE; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
253 videodata->ime_himm32 = LoadLibraryA("imm32.dll"); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
254 if (!videodata->ime_himm32) { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
255 videodata->ime_available = SDL_FALSE; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
256 return; |
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 videodata->ImmLockIMC = (LPINPUTCONTEXT2 (WINAPI *)(HIMC))GetProcAddress(videodata->ime_himm32, "ImmLockIMC"); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
259 videodata->ImmUnlockIMC = (BOOL (WINAPI *)(HIMC))GetProcAddress(videodata->ime_himm32, "ImmUnlockIMC"); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
260 videodata->ImmLockIMCC = (LPVOID (WINAPI *)(HIMCC))GetProcAddress(videodata->ime_himm32, "ImmLockIMCC"); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
261 videodata->ImmUnlockIMCC = (BOOL (WINAPI *)(HIMCC))GetProcAddress(videodata->ime_himm32, "ImmUnlockIMCC"); |
4752 | 262 |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
263 IME_SetWindow(videodata, hwnd); |
4880
27c458e4ae31
Update VS2010 project to add new files; update new files so code builds on Win32/Win64
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
4763
diff
changeset
|
264 #ifdef _WIN32_WCE |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
265 videodata->ime_himc = ImmGetContext(hwnd); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
266 ImmReleaseContext(hwnd, videodata->ime_himc); |
4880
27c458e4ae31
Update VS2010 project to add new files; update new files so code builds on Win32/Win64
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
4763
diff
changeset
|
267 #endif |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
268 if (!videodata->ime_himc) { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
269 videodata->ime_available = SDL_FALSE; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
270 IME_Disable(videodata, hwnd); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
271 return; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
272 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
273 videodata->ime_available = SDL_TRUE; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
274 IME_UpdateInputLocale(videodata); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
275 IME_SetupAPI(videodata); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
276 videodata->ime_uiless = UILess_SetupSinks(videodata); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
277 IME_UpdateInputLocale(videodata); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
278 IME_Disable(videodata, hwnd); |
4752 | 279 } |
280 | |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
281 static void |
4752 | 282 IME_Enable(SDL_VideoData *videodata, HWND hwnd) |
283 { | |
284 if (!videodata->ime_initialized || !videodata->ime_hwnd_current) | |
285 return; | |
286 | |
287 if (!videodata->ime_available) { | |
288 IME_Disable(videodata, hwnd); | |
289 return; | |
290 } | |
4880
27c458e4ae31
Update VS2010 project to add new files; update new files so code builds on Win32/Win64
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
4763
diff
changeset
|
291 #ifdef _WIN32_WCE |
27c458e4ae31
Update VS2010 project to add new files; update new files so code builds on Win32/Win64
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
4763
diff
changeset
|
292 if (videodata->ime_hwnd_current == videodata->ime_hwnd_main) |
4752 | 293 ImmAssociateContext(videodata->ime_hwnd_current, videodata->ime_himc); |
4880
27c458e4ae31
Update VS2010 project to add new files; update new files so code builds on Win32/Win64
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
4763
diff
changeset
|
294 #endif |
4752 | 295 |
296 videodata->ime_enabled = SDL_TRUE; | |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
297 IME_UpdateInputLocale(videodata); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
298 UILess_EnableUIUpdates(videodata); |
4752 | 299 } |
300 | |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
301 static void |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
302 IME_Disable(SDL_VideoData *videodata, HWND hwnd) |
4752 | 303 { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
304 if (!videodata->ime_initialized || !videodata->ime_hwnd_current) |
4752 | 305 return; |
306 | |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
307 IME_ClearComposition(videodata); |
4880
27c458e4ae31
Update VS2010 project to add new files; update new files so code builds on Win32/Win64
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
4763
diff
changeset
|
308 #ifdef _WIN32_WCE |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
309 if (videodata->ime_hwnd_current == videodata->ime_hwnd_main) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
310 ImmAssociateContext(videodata->ime_hwnd_current, NULL); |
4880
27c458e4ae31
Update VS2010 project to add new files; update new files so code builds on Win32/Win64
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
4763
diff
changeset
|
311 #endif |
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_enabled = SDL_FALSE; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
314 UILess_DisableUIUpdates(videodata); |
4752 | 315 } |
316 | |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
317 static void |
4752 | 318 IME_Quit(SDL_VideoData *videodata) |
319 { | |
320 if (!videodata->ime_initialized) | |
321 return; | |
322 | |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
323 UILess_ReleaseSinks(videodata); |
4880
27c458e4ae31
Update VS2010 project to add new files; update new files so code builds on Win32/Win64
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
4763
diff
changeset
|
324 #ifdef _WIN32_WCE |
4752 | 325 if (videodata->ime_hwnd_main) |
326 ImmAssociateContext(videodata->ime_hwnd_main, videodata->ime_himc); | |
4880
27c458e4ae31
Update VS2010 project to add new files; update new files so code builds on Win32/Win64
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
4763
diff
changeset
|
327 #endif |
4752 | 328 |
329 videodata->ime_hwnd_main = 0; | |
330 videodata->ime_himc = 0; | |
4760 | 331 if (videodata->ime_himm32) { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
332 FreeLibrary(videodata->ime_himm32); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
333 videodata->ime_himm32 = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
334 } |
4760 | 335 if (videodata->ime_threadmgr) { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
336 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
|
337 videodata->ime_threadmgr = 0; |
4752 | 338 } |
4760 | 339 if (videodata->ime_com_initialized) { |
4752 | 340 CoUninitialize(); |
341 videodata->ime_com_initialized = SDL_FALSE; | |
342 } | |
343 videodata->ime_initialized = SDL_FALSE; | |
344 } | |
345 | |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
346 static void |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
347 IME_GetReadingString(SDL_VideoData *videodata, HWND hwnd) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
348 { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
349 DWORD id = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
350 HIMC himc = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
351 WCHAR buffer[16]; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
352 WCHAR *s = buffer; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
353 DWORD len = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
354 DWORD err = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
355 BOOL vertical = FALSE; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
356 UINT maxuilen = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
357 static OSVERSIONINFOA osversion = {0}; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
358 if (videodata->ime_uiless) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
359 return; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
360 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
361 videodata->ime_readingstring[0] = 0; |
4760 | 362 if (!osversion.dwOSVersionInfoSize) { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
363 osversion.dwOSVersionInfoSize = sizeof(osversion); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
364 GetVersionExA(&osversion); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
365 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
366 id = IME_GetId(videodata, 0); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
367 if (!id) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
368 return; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
369 |
4880
27c458e4ae31
Update VS2010 project to add new files; update new files so code builds on Win32/Win64
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
4763
diff
changeset
|
370 #ifdef _WIN32_WCE |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
371 himc = ImmGetContext(hwnd); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
372 if (!himc) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
373 return; |
4880
27c458e4ae31
Update VS2010 project to add new files; update new files so code builds on Win32/Win64
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
4763
diff
changeset
|
374 #endif |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
375 |
4760 | 376 if (videodata->GetReadingString) { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
377 len = videodata->GetReadingString(himc, 0, 0, &err, &vertical, &maxuilen); |
4760 | 378 if (len) { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
379 if (len > SDL_arraysize(buffer)) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
380 len = SDL_arraysize(buffer); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
381 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
382 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
|
383 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
384 SDL_wcslcpy(videodata->ime_readingstring, s, len); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
385 } |
4760 | 386 else { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
387 LPINPUTCONTEXT2 lpimc = videodata->ImmLockIMC(himc); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
388 LPBYTE p = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
389 s = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
390 switch (id) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
391 { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
392 case IMEID_CHT_VER42: |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
393 case IMEID_CHT_VER43: |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
394 case IMEID_CHT_VER44: |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
395 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
|
396 if (!p) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
397 break; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
398 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
399 len = *(DWORD *)(p + 7*4 + 32*4); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
400 s = (WCHAR *)(p + 56); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
401 break; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
402 case IMEID_CHT_VER51: |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
403 case IMEID_CHT_VER52: |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
404 case IMEID_CHS_VER53: |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
405 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
|
406 if (!p) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
407 break; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
408 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
409 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
|
410 if (!p) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
411 break; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
412 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
413 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
|
414 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
|
415 break; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
416 case IMEID_CHS_VER41: |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
417 { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
418 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
|
419 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
|
420 if (!p) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
421 break; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
422 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
423 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
|
424 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
|
425 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
426 break; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
427 case IMEID_CHS_VER42: |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
428 if (osversion.dwPlatformId != VER_PLATFORM_WIN32_NT) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
429 break; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
430 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
431 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
|
432 if (!p) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
433 break; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
434 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
435 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
|
436 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
|
437 break; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
438 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
439 if (s) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
440 SDL_wcslcpy(videodata->ime_readingstring, s, len + 1); |
4760 | 441 |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
442 videodata->ImmUnlockIMCC(lpimc->hPrivate); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
443 videodata->ImmUnlockIMC(himc); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
444 } |
4880
27c458e4ae31
Update VS2010 project to add new files; update new files so code builds on Win32/Win64
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
4763
diff
changeset
|
445 #ifdef _WIN32_WCE |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
446 ImmReleaseContext(hwnd, himc); |
4880
27c458e4ae31
Update VS2010 project to add new files; update new files so code builds on Win32/Win64
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
4763
diff
changeset
|
447 #endif |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
448 IME_SendEditingEvent(videodata); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
449 } |
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 static void |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
452 IME_InputLangChanged(SDL_VideoData *videodata) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
453 { |
4760 | 454 UINT lang = PRIMLANG(); |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
455 HWND hwndime = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
456 IME_UpdateInputLocale(videodata); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
457 IME_SetupAPI(videodata); |
4760 | 458 if (lang != PRIMLANG()) { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
459 IME_ClearComposition(videodata); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
460 } |
4880
27c458e4ae31
Update VS2010 project to add new files; update new files so code builds on Win32/Win64
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
4763
diff
changeset
|
461 #ifdef _WIN32_WCE |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
462 hwndime = ImmGetDefaultIMEWnd(videodata->ime_hwnd_current); |
4760 | 463 if (hwndime) { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
464 SendMessageA(hwndime, WM_IME_CONTROL, IMC_OPENSTATUSWINDOW, 0); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
465 SendMessageA(hwndime, WM_IME_CONTROL, IMC_CLOSESTATUSWINDOW, 0); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
466 } |
4880
27c458e4ae31
Update VS2010 project to add new files; update new files so code builds on Win32/Win64
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
4763
diff
changeset
|
467 #endif |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
468 } |
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 static DWORD |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
471 IME_GetId(SDL_VideoData *videodata, UINT uIndex) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
472 { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
473 static HKL hklprev = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
474 static DWORD dwRet[2] = {0}; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
475 DWORD dwVerSize = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
476 DWORD dwVerHandle = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
477 LPVOID lpVerBuffer = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
478 LPVOID lpVerData = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
479 UINT cbVerData = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
480 char szTemp[256]; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
481 HKL hkl = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
482 DWORD dwLang = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
483 if (uIndex >= sizeof(dwRet) / sizeof(dwRet[0])) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
484 return 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
485 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
486 hkl = videodata->ime_hkl; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
487 if (hklprev == hkl) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
488 return dwRet[uIndex]; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
489 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
490 hklprev = hkl; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
491 dwLang = ((DWORD)hkl & 0xffff); |
4760 | 492 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
|
493 dwRet[0] = IMEID_CHT_VER_VISTA; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
494 dwRet[1] = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
495 return dwRet[0]; |
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 if (hkl != CHT_HKL_NEW_PHONETIC |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
498 && hkl != CHT_HKL_NEW_CHANG_JIE |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
499 && hkl != CHT_HKL_NEW_QUICK |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
500 && hkl != CHT_HKL_HK_CANTONESE |
4760 | 501 && hkl != CHS_HKL) { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
502 dwRet[0] = dwRet[1] = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
503 return dwRet[uIndex]; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
504 } |
4880
27c458e4ae31
Update VS2010 project to add new files; update new files so code builds on Win32/Win64
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
4763
diff
changeset
|
505 #ifdef _WIN32_WCE |
4760 | 506 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
|
507 dwRet[0] = dwRet[1] = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
508 return dwRet[uIndex]; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
509 } |
4880
27c458e4ae31
Update VS2010 project to add new files; update new files so code builds on Win32/Win64
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
4763
diff
changeset
|
510 #endif |
27c458e4ae31
Update VS2010 project to add new files; update new files so code builds on Win32/Win64
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
4763
diff
changeset
|
511 if (!videodata->GetReadingString) { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
512 #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
|
513 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
|
514 && 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
|
515 && 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
|
516 && CompareStringA(LCID_INVARIANT, NORM_IGNORECASE, szTemp, -1, CHS_IMEFILENAME1, -1) != 2 |
4760 | 517 && 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
|
518 dwRet[0] = dwRet[1] = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
519 return dwRet[uIndex]; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
520 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
521 #undef LCID_INVARIANT |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
522 dwVerSize = GetFileVersionInfoSizeA(szTemp, &dwVerHandle); |
4760 | 523 if (dwVerSize) { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
524 lpVerBuffer = SDL_malloc(dwVerSize); |
4760 | 525 if (lpVerBuffer) { |
526 if (GetFileVersionInfoA(szTemp, dwVerHandle, dwVerSize, lpVerBuffer)) { | |
527 if (VerQueryValueA(lpVerBuffer, "\\", &lpVerData, &cbVerData)) { | |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
528 #define pVerFixedInfo ((VS_FIXEDFILEINFO FAR*)lpVerData) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
529 DWORD dwVer = pVerFixedInfo->dwFileVersionMS; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
530 dwVer = (dwVer & 0x00ff0000) << 8 | (dwVer & 0x000000ff) << 16; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
531 if (videodata->GetReadingString || |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
532 dwLang == LANG_CHT && ( |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
533 dwVer == MAKEIMEVERSION(4, 2) || |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
534 dwVer == MAKEIMEVERSION(4, 3) || |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
535 dwVer == MAKEIMEVERSION(4, 4) || |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
536 dwVer == MAKEIMEVERSION(5, 0) || |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
537 dwVer == MAKEIMEVERSION(5, 1) || |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
538 dwVer == MAKEIMEVERSION(5, 2) || |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
539 dwVer == MAKEIMEVERSION(6, 0)) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
540 || |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
541 dwLang == LANG_CHS && ( |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
542 dwVer == MAKEIMEVERSION(4, 1) || |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
543 dwVer == MAKEIMEVERSION(4, 2) || |
4760 | 544 dwVer == MAKEIMEVERSION(5, 3))) { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
545 dwRet[0] = dwVer | dwLang; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
546 dwRet[1] = pVerFixedInfo->dwFileVersionLS; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
547 SDL_free(lpVerBuffer); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
548 return dwRet[0]; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
549 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
550 #undef pVerFixedInfo |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
551 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
552 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
553 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
554 SDL_free(lpVerBuffer); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
555 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
556 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
557 dwRet[0] = dwRet[1] = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
558 return dwRet[uIndex]; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
559 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
560 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
561 static void |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
562 IME_SetupAPI(SDL_VideoData *videodata) |
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 char ime_file[MAX_PATH + 1]; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
565 HMODULE hime = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
566 HKL hkl = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
567 videodata->GetReadingString = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
568 videodata->ShowReadingWindow = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
569 if (videodata->ime_uiless) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
570 return; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
571 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
572 hkl = videodata->ime_hkl; |
4880
27c458e4ae31
Update VS2010 project to add new files; update new files so code builds on Win32/Win64
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
4763
diff
changeset
|
573 #ifdef _WIN32_WCE |
27c458e4ae31
Update VS2010 project to add new files; update new files so code builds on Win32/Win64
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
4763
diff
changeset
|
574 if (ImmGetIMEFileNameA(hkl, ime_file, sizeof(ime_file) - 1) <= 0) |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
575 return; |
4880
27c458e4ae31
Update VS2010 project to add new files; update new files so code builds on Win32/Win64
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
4763
diff
changeset
|
576 #endif |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
577 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
578 hime = LoadLibraryA(ime_file); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
579 if (!hime) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
580 return; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
581 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
582 videodata->GetReadingString = (UINT (WINAPI *)(HIMC, UINT, LPWSTR, PINT, BOOL*, PUINT)) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
583 GetProcAddress(hime, "GetReadingString"); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
584 videodata->ShowReadingWindow = (BOOL (WINAPI *)(HIMC, BOOL)) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
585 GetProcAddress(hime, "ShowReadingWindow"); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
586 |
4880
27c458e4ae31
Update VS2010 project to add new files; update new files so code builds on Win32/Win64
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
4763
diff
changeset
|
587 #ifdef _WIN32_WCE |
4760 | 588 if (videodata->ShowReadingWindow) { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
589 HIMC himc = ImmGetContext(videodata->ime_hwnd_current); |
4760 | 590 if (himc) { |
4880
27c458e4ae31
Update VS2010 project to add new files; update new files so code builds on Win32/Win64
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
4763
diff
changeset
|
591 videodata->ShowReadingWindow(himc, FALSE); |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
592 ImmReleaseContext(videodata->ime_hwnd_current, himc); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
593 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
594 } |
4880
27c458e4ae31
Update VS2010 project to add new files; update new files so code builds on Win32/Win64
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
4763
diff
changeset
|
595 #endif |
4759
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 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
598 static void |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
599 IME_SetWindow(SDL_VideoData* videodata, HWND hwnd) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
600 { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
601 videodata->ime_hwnd_current = hwnd; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
602 if (videodata->ime_threadmgr) { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
603 struct ITfDocumentMgr *document_mgr = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
604 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
|
605 if (document_mgr) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
606 document_mgr->lpVtbl->Release(document_mgr); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
607 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
608 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
609 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
610 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
611 static void |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
612 IME_UpdateInputLocale(SDL_VideoData *videodata) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
613 { |
4760 | 614 static HKL hklprev = 0; |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
615 videodata->ime_hkl = GetKeyboardLayout(0); |
4760 | 616 if (hklprev == videodata->ime_hkl) |
4759
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 |
4760 | 619 hklprev = videodata->ime_hkl; |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
620 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
621 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
622 static void |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
623 IME_ClearComposition(SDL_VideoData *videodata) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
624 { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
625 HIMC himc = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
626 if (!videodata->ime_initialized) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
627 return; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
628 |
4880
27c458e4ae31
Update VS2010 project to add new files; update new files so code builds on Win32/Win64
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
4763
diff
changeset
|
629 #ifdef _WIN32_WCE |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
630 himc = ImmGetContext(videodata->ime_hwnd_current); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
631 if (!himc) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
632 return; |
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 ImmNotifyIME(himc, NI_COMPOSITIONSTR, CPS_CANCEL, 0); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
635 if (videodata->ime_uiless) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
636 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
|
637 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
638 ImmNotifyIME(himc, NI_CLOSECANDIDATE, 0, 0); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
639 ImmReleaseContext(videodata->ime_hwnd_current, himc); |
4880
27c458e4ae31
Update VS2010 project to add new files; update new files so code builds on Win32/Win64
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
4763
diff
changeset
|
640 #endif |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
641 SDL_SendEditingText("", 0, 0); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
642 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
643 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
644 static void |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
645 IME_ClearEditing(SDL_VideoData *videodata) |
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_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
|
652 { |
4760 | 653 LONG length = ImmGetCompositionStringW(himc, string, videodata->ime_composition, sizeof(videodata->ime_composition)); |
654 if (length < 0) | |
655 length = 0; | |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
656 |
4760 | 657 length /= sizeof(videodata->ime_composition[0]); |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
658 videodata->ime_cursor = LOWORD(ImmGetCompositionStringW(himc, GCS_CURSORPOS, 0, 0)); |
4760 | 659 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
|
660 int i; |
4760 | 661 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
|
662 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
|
663 |
4760 | 664 --length; |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
665 } |
4760 | 666 videodata->ime_composition[length] = 0; |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
667 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
668 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
669 static void |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
670 IME_SendInputEvent(SDL_VideoData *videodata) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
671 { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
672 char *s = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
673 s = WIN_StringToUTF8(videodata->ime_composition); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
674 SDL_SendKeyboardText(s); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
675 SDL_free(s); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
676 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
677 videodata->ime_composition[0] = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
678 videodata->ime_readingstring[0] = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
679 videodata->ime_cursor = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
680 } |
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 static void |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
683 IME_SendEditingEvent(SDL_VideoData *videodata) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
684 { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
685 char *s = 0; |
4760 | 686 WCHAR buffer[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; |
687 buffer[0] = 0; | |
688 if (videodata->ime_readingstring[0]) { | |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
689 size_t len = SDL_min(SDL_wcslen(videodata->ime_composition), (size_t)videodata->ime_cursor); |
4760 | 690 SDL_wcslcpy(buffer, videodata->ime_composition, len + 1); |
691 SDL_wcslcat(buffer, videodata->ime_readingstring, sizeof(buffer)); | |
692 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
|
693 } |
4760 | 694 else { |
695 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
|
696 } |
4760 | 697 s = WIN_StringToUTF8(buffer); |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
698 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
|
699 SDL_free(s); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
700 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
701 |
4752 | 702 SDL_bool |
703 IME_HandleMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM *lParam, SDL_VideoData *videodata) | |
704 { | |
705 SDL_bool trap = SDL_FALSE; | |
706 HIMC himc = 0; | |
707 if (!videodata->ime_initialized || !videodata->ime_available || !videodata->ime_enabled) | |
708 return SDL_FALSE; | |
709 | |
710 switch (msg) | |
711 { | |
712 case WM_INPUTLANGCHANGE: | |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
713 //IME_InputLangChanged(videodata); |
4752 | 714 break; |
715 case WM_IME_SETCONTEXT: | |
716 *lParam = 0; | |
717 break; | |
718 case WM_IME_STARTCOMPOSITION: | |
719 trap = SDL_TRUE; | |
720 break; | |
721 case WM_IME_COMPOSITION: | |
722 trap = SDL_TRUE; | |
4880
27c458e4ae31
Update VS2010 project to add new files; update new files so code builds on Win32/Win64
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
4763
diff
changeset
|
723 #ifdef _WIN32_WCE |
4752 | 724 himc = ImmGetContext(hwnd); |
4760 | 725 if (*lParam & GCS_RESULTSTR) { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
726 IME_GetCompositionString(videodata, himc, GCS_RESULTSTR); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
727 IME_SendInputEvent(videodata); |
4752 | 728 } |
4760 | 729 if (*lParam & GCS_COMPSTR) { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
730 if (!videodata->ime_uiless) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
731 videodata->ime_readingstring[0] = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
732 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
733 IME_GetCompositionString(videodata, himc, GCS_COMPSTR); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
734 IME_SendEditingEvent(videodata); |
4752 | 735 } |
736 ImmReleaseContext(hwnd, himc); | |
4880
27c458e4ae31
Update VS2010 project to add new files; update new files so code builds on Win32/Win64
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
4763
diff
changeset
|
737 #endif |
4752 | 738 break; |
739 case WM_IME_ENDCOMPOSITION: | |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
740 videodata->ime_composition[0] = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
741 videodata->ime_readingstring[0] = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
742 videodata->ime_cursor = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
743 SDL_SendEditingText("", 0, 0); |
4752 | 744 break; |
745 case WM_IME_NOTIFY: | |
746 switch (wParam) | |
747 { | |
748 case IMN_SETCONVERSIONMODE: | |
749 case IMN_SETOPENSTATUS: | |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
750 IME_UpdateInputLocale(videodata); |
4752 | 751 break; |
752 case IMN_OPENCANDIDATE: | |
753 case IMN_CHANGECANDIDATE: | |
754 trap = SDL_TRUE; | |
755 break; | |
756 case IMN_CLOSECANDIDATE: | |
757 trap = SDL_TRUE; | |
758 break; | |
759 case IMN_PRIVATE: | |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
760 { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
761 DWORD dwId = IME_GetId(videodata, 0); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
762 IME_GetReadingString(videodata, hwnd); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
763 switch (dwId) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
764 { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
765 case IMEID_CHT_VER42: |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
766 case IMEID_CHT_VER43: |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
767 case IMEID_CHT_VER44: |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
768 case IMEID_CHS_VER41: |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
769 case IMEID_CHS_VER42: |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
770 if (*lParam == 1 || *lParam == 2) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
771 trap = SDL_TRUE; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
772 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
773 break; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
774 case IMEID_CHT_VER50: |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
775 case IMEID_CHT_VER51: |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
776 case IMEID_CHT_VER52: |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
777 case IMEID_CHT_VER60: |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
778 case IMEID_CHS_VER53: |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
779 if (*lParam == 16 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
780 || *lParam == 17 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
781 || *lParam == 26 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
782 || *lParam == 27 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
783 || *lParam == 28) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
784 trap = SDL_TRUE; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
785 break; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
786 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
787 } |
4752 | 788 break; |
789 default: | |
790 trap = SDL_TRUE; | |
791 break; | |
792 } | |
793 break; | |
794 } | |
795 return trap; | |
796 } | |
797 | |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
798 STDMETHODIMP_(ULONG) TSFSink_AddRef(TSFSink *sink) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
799 { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
800 return ++sink->refcount; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
801 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
802 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
803 STDMETHODIMP_(ULONG)TSFSink_Release(TSFSink *sink) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
804 { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
805 --sink->refcount; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
806 if (sink->refcount == 0) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
807 { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
808 SDL_free(sink); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
809 return 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
810 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
811 return sink->refcount; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
812 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
813 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
814 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
|
815 { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
816 if (!ppv) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
817 return E_INVALIDARG; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
818 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
819 *ppv = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
820 if (SDL_IsEqualIID(riid, &IID_IUnknown)) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
821 *ppv = (IUnknown *)sink; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
822 else if (SDL_IsEqualIID(riid, &IID_ITfUIElementSink)) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
823 *ppv = (ITfUIElementSink *)sink; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
824 |
4760 | 825 if (*ppv) { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
826 TSFSink_AddRef(sink); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
827 return S_OK; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
828 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
829 return E_NOINTERFACE; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
830 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
831 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
832 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
|
833 { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
834 ITfUIElementMgr *puiem = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
835 ITfUIElement *pelem = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
836 ITfThreadMgrEx *threadmgrex = videodata->ime_threadmgrex; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
837 |
4760 | 838 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
|
839 puiem->lpVtbl->GetUIElement(puiem, dwUIElementId, &pelem); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
840 puiem->lpVtbl->Release(puiem); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
841 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
842 return pelem; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
843 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
844 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
845 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
|
846 { |
4760 | 847 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
|
848 ITfReadingInformationUIElement *preading = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
849 SDL_VideoData *videodata = (SDL_VideoData *)sink->data; |
4760 | 850 if (!element) |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
851 return E_INVALIDARG; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
852 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
853 *pbShow = FALSE; |
4760 | 854 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
|
855 BSTR bstr; |
4760 | 856 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
|
857 WCHAR *s = (WCHAR *)bstr; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
858 SysFreeString(bstr); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
859 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
860 preading->lpVtbl->Release(preading); |
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 return S_OK; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
863 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
864 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
865 STDMETHODIMP UIElementSink_UpdateUIElement(TSFSink *sink, DWORD dwUIElementId) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
866 { |
4760 | 867 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
|
868 ITfReadingInformationUIElement *preading = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
869 SDL_VideoData *videodata = (SDL_VideoData *)sink->data; |
4760 | 870 if (!element) |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
871 return E_INVALIDARG; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
872 |
4760 | 873 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
|
874 BSTR bstr; |
4760 | 875 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
|
876 WCHAR *s = (WCHAR *)bstr; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
877 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
|
878 IME_SendEditingEvent(videodata); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
879 SysFreeString(bstr); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
880 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
881 preading->lpVtbl->Release(preading); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
882 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
883 return S_OK; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
884 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
885 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
886 STDMETHODIMP UIElementSink_EndUIElement(TSFSink *sink, DWORD dwUIElementId) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
887 { |
4760 | 888 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
|
889 ITfReadingInformationUIElement *preading = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
890 SDL_VideoData *videodata = (SDL_VideoData *)sink->data; |
4760 | 891 if (!element) |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
892 return E_INVALIDARG; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
893 |
4760 | 894 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
|
895 videodata->ime_readingstring[0] = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
896 IME_SendEditingEvent(videodata); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
897 preading->lpVtbl->Release(preading); |
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 return S_OK; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
900 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
901 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
902 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
|
903 { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
904 if (!ppv) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
905 return E_INVALIDARG; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
906 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
907 *ppv = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
908 if (SDL_IsEqualIID(riid, &IID_IUnknown)) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
909 *ppv = (IUnknown *)sink; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
910 else if (SDL_IsEqualIID(riid, &IID_ITfInputProcessorProfileActivationSink)) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
911 *ppv = (ITfInputProcessorProfileActivationSink *)sink; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
912 |
4760 | 913 if (*ppv) { |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
914 TSFSink_AddRef(sink); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
915 return S_OK; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
916 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
917 return E_NOINTERFACE; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
918 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
919 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
920 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
|
921 { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
922 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
|
923 IME_InputLangChanged((SDL_VideoData *)sink->data); |
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 return S_OK; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
926 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
927 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
928 static void *vtUIElementSink[] = { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
929 (void *)(UIElementSink_QueryInterface), |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
930 (void *)(TSFSink_AddRef), |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
931 (void *)(TSFSink_Release), |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
932 (void *)(UIElementSink_BeginUIElement), |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
933 (void *)(UIElementSink_UpdateUIElement), |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
934 (void *)(UIElementSink_EndUIElement) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
935 }; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
936 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
937 static void *vtIPPASink[] = { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
938 (void *)(IPPASink_QueryInterface), |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
939 (void *)(TSFSink_AddRef), |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
940 (void *)(TSFSink_Release), |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
941 (void *)(IPPASink_OnActivated) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
942 }; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
943 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
944 static void |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
945 UILess_EnableUIUpdates(SDL_VideoData *videodata) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
946 { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
947 ITfSource *source = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
948 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
|
949 return; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
950 |
4760 | 951 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
|
952 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
|
953 source->lpVtbl->Release(source); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
954 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
955 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
956 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
957 static void |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
958 UILess_DisableUIUpdates(SDL_VideoData *videodata) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
959 { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
960 ITfSource *source = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
961 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
|
962 return; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
963 |
4760 | 964 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
|
965 source->lpVtbl->UnadviseSink(source, videodata->ime_uielemsinkcookie); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
966 videodata->ime_uielemsinkcookie = TF_INVALID_COOKIE; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
967 source->lpVtbl->Release(source); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
968 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
969 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
970 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
971 static SDL_bool |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
972 UILess_SetupSinks(SDL_VideoData *videodata) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
973 { |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
974 TfClientId clientid = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
975 SDL_bool result = SDL_FALSE; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
976 ITfSource *source = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
977 if (FAILED(CoCreateInstance(&CLSID_TF_ThreadMgr, NULL, CLSCTX_INPROC_SERVER, &IID_ITfThreadMgrEx, &videodata->ime_threadmgrex))) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
978 return SDL_FALSE; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
979 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
980 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
|
981 return SDL_FALSE; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
982 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
983 videodata->ime_uielemsink = SDL_malloc(sizeof(TSFSink)); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
984 videodata->ime_ippasink = SDL_malloc(sizeof(TSFSink)); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
985 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
986 videodata->ime_uielemsink->lpVtbl = vtUIElementSink; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
987 videodata->ime_uielemsink->refcount = 1; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
988 videodata->ime_uielemsink->data = videodata; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
989 |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
990 videodata->ime_ippasink->lpVtbl = vtIPPASink; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
991 videodata->ime_ippasink->refcount = 1; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
992 videodata->ime_ippasink->data = videodata; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
993 |
4760 | 994 if (SUCCEEDED(videodata->ime_threadmgrex->lpVtbl->QueryInterface(videodata->ime_threadmgrex, &IID_ITfSource, (LPVOID *)&source))) { |
995 if (SUCCEEDED(source->lpVtbl->AdviseSink(source, &IID_ITfUIElementSink, (IUnknown *)videodata->ime_uielemsink, &videodata->ime_uielemsinkcookie))) { | |
996 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
|
997 result = SDL_TRUE; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
998 } |
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 source->lpVtbl->Release(source); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1001 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1002 return result; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1003 } |
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 #define SAFE_RELEASE(p) \ |
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 if (p) { \ |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1008 (p)->lpVtbl->Release((p)); \ |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1009 (p) = 0; \ |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1010 } \ |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1011 } |
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 static void |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1014 UILess_ReleaseSinks(SDL_VideoData *videodata) |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1015 { |
4760 | 1016 ITfSource *source = 0; |
1017 if (videodata->ime_threadmgrex && SUCCEEDED(videodata->ime_threadmgrex->lpVtbl->QueryInterface(videodata->ime_threadmgrex, &IID_ITfSource, &source))) { | |
1018 source->lpVtbl->UnadviseSink(source, videodata->ime_uielemsinkcookie); | |
1019 source->lpVtbl->UnadviseSink(source, videodata->ime_alpnsinkcookie); | |
1020 SAFE_RELEASE(source); | |
4759
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1021 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
|
1022 SAFE_RELEASE(videodata->ime_threadmgrex); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1023 TSFSink_Release(videodata->ime_uielemsink); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1024 videodata->ime_uielemsink = 0; |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1025 TSFSink_Release(videodata->ime_ippasink); |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1026 videodata->ime_ippasink = 0; |
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 } |
863ba7d1f029
Large commit with initial reading string support, TSF UILess code, etc.
dewyatt
parents:
4753
diff
changeset
|
1029 |
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
|
1030 /* vi: set ts=4 sw=4 expandtab: */ |