comparison src/video/win32/SDL_win32video.h @ 4759:863ba7d1f029

Large commit with initial reading string support, TSF UILess code, etc.
author dewyatt
date Tue, 03 Aug 2010 16:57:49 -0400
parents 436183eb30c8
children 518d1679d2d0
comparison
equal deleted inserted replaced
4758:e2f4e31b41fc 4759:863ba7d1f029
31 #define UNICODE 31 #define UNICODE
32 #undef WINVER 32 #undef WINVER
33 #define WINVER 0x500 /* Need 0x410 for AlphaBlend() and 0x500 for EnumDisplayDevices() */ 33 #define WINVER 0x500 /* Need 0x410 for AlphaBlend() and 0x500 for EnumDisplayDevices() */
34 #include <windows.h> 34 #include <windows.h>
35 35
36 #include <msctf.h>
37
36 #if SDL_VIDEO_RENDER_D3D 38 #if SDL_VIDEO_RENDER_D3D
37 //#include <d3d9.h> 39 //#include <d3d9.h>
38 #define D3D_DEBUG_INFO 40 #define D3D_DEBUG_INFO
39 #include "d3d9.h" 41 #include "d3d9.h"
40 #endif 42 #endif
51 #include "SDL_win32keyboard.h" 53 #include "SDL_win32keyboard.h"
52 #include "SDL_win32modes.h" 54 #include "SDL_win32modes.h"
53 #include "SDL_win32mouse.h" 55 #include "SDL_win32mouse.h"
54 #include "SDL_win32opengl.h" 56 #include "SDL_win32opengl.h"
55 #include "SDL_win32window.h" 57 #include "SDL_win32window.h"
58 #include "SDL_events.h"
56 59
57 #ifdef UNICODE 60 #ifdef UNICODE
58 #define WIN_StringToUTF8(S) SDL_iconv_string("UTF-8", "UCS-2", (char *)S, (SDL_wcslen(S)+1)*sizeof(WCHAR)) 61 #define WIN_StringToUTF8(S) SDL_iconv_string("UTF-8", "UCS-2", (char *)S, (SDL_wcslen(S)+1)*sizeof(WCHAR))
59 #define WIN_UTF8ToString(S) (WCHAR *)SDL_iconv_string("UCS-2", "UTF-8", (char *)S, SDL_strlen(S)+1) 62 #define WIN_UTF8ToString(S) (WCHAR *)SDL_iconv_string("UCS-2", "UTF-8", (char *)S, SDL_strlen(S)+1)
60 #else 63 #else
61 #define WIN_StringToUTF8(S) SDL_iconv_string("UTF-8", "ASCII", (char *)S, (SDL_strlen(S)+1)) 64 #define WIN_StringToUTF8(S) SDL_iconv_string("UTF-8", "ASCII", (char *)S, (SDL_strlen(S)+1))
62 #define WIN_UTF8ToString(S) SDL_iconv_string("ASCII", "UTF-8", (char *)S, SDL_strlen(S)+1) 65 #define WIN_UTF8ToString(S) SDL_iconv_string("ASCII", "UTF-8", (char *)S, SDL_strlen(S)+1)
63 #endif 66 #endif
64 extern void WIN_SetError(const char *prefix); 67 extern void WIN_SetError(const char *prefix);
68
69 typedef struct
70 {
71 void **lpVtbl;
72 int refcount;
73 void *data;
74 } TSFSink;
75
76 // Definition from Win98DDK version of IMM.H
77 typedef struct tagINPUTCONTEXT2 {
78 HWND hWnd;
79 BOOL fOpen;
80 POINT ptStatusWndPos;
81 POINT ptSoftKbdPos;
82 DWORD fdwConversion;
83 DWORD fdwSentence;
84 union {
85 LOGFONTA A;
86 LOGFONTW W;
87 } lfFont;
88 COMPOSITIONFORM cfCompForm;
89 CANDIDATEFORM cfCandForm[4];
90 HIMCC hCompStr;
91 HIMCC hCandInfo;
92 HIMCC hGuideLine;
93 HIMCC hPrivate;
94 DWORD dwNumMsgBuf;
95 HIMCC hMsgBuf;
96 DWORD fdwInit;
97 DWORD dwReserve[3];
98 } INPUTCONTEXT2, *PINPUTCONTEXT2, NEAR *NPINPUTCONTEXT2, FAR *LPINPUTCONTEXT2;
65 99
66 /* Private display data */ 100 /* Private display data */
67 101
68 typedef struct SDL_VideoData 102 typedef struct SDL_VideoData
69 { 103 {
78 112
79 const SDL_scancode *key_layout; 113 const SDL_scancode *key_layout;
80 DWORD clipboard_count; 114 DWORD clipboard_count;
81 115
82 SDL_bool ime_com_initialized; 116 SDL_bool ime_com_initialized;
83 struct ITfThreadMgr *ime_thread_mgr; 117 struct ITfThreadMgr *ime_threadmgr;
84 SDL_bool ime_initialized; 118 SDL_bool ime_initialized;
85 SDL_bool ime_enabled; 119 SDL_bool ime_enabled;
86 SDL_bool ime_available; 120 SDL_bool ime_available;
87 HWND ime_hwnd_main; 121 HWND ime_hwnd_main;
88 HWND ime_hwnd_current; 122 HWND ime_hwnd_current;
89 HIMC ime_himc; 123 HIMC ime_himc;
90 124
125 WCHAR ime_composition[SDL_TEXTEDITINGEVENT_TEXT_SIZE];
126 WCHAR ime_readingstring[16];
127 int ime_cursor;
128
129 HKL ime_hkl;
130 HMODULE ime_himm32;
131 UINT (WINAPI *GetReadingString)(HIMC himc, UINT uReadingBufLen, LPWSTR lpwReadingBuf, PINT pnErrorIndex, BOOL *pfIsVertical, PUINT puMaxReadingLen);
132 BOOL (WINAPI *ShowReadingWindow)(HIMC himc, BOOL bShow);
133 LPINPUTCONTEXT2 (WINAPI *ImmLockIMC)(HIMC himc);
134 BOOL (WINAPI *ImmUnlockIMC)(HIMC himc);
135 LPVOID (WINAPI *ImmLockIMCC)(HIMCC himcc);
136 BOOL (WINAPI *ImmUnlockIMCC)(HIMCC himcc);
137
138 SDL_bool ime_uiless;
139 struct ITfThreadMgrEx *ime_threadmgrex;
140 DWORD ime_uielemsinkcookie;
141 DWORD ime_alpnsinkcookie;
142 DWORD ime_openmodesinkcookie;
143 DWORD ime_convmodesinkcookie;
144 TSFSink *ime_uielemsink;
145 TSFSink *ime_ippasink;
91 } SDL_VideoData; 146 } SDL_VideoData;
92 147
93 #endif /* _SDL_win32video_h */ 148 #endif /* _SDL_win32video_h */
94 149
95 /* vi: set ts=4 sw=4 expandtab: */ 150 /* vi: set ts=4 sw=4 expandtab: */