comparison src/video/windows/SDL_windowsvideo.h @ 5062:e8916fe9cfc8

Fixed bug #925 Changed "win32" to "windows"
author Sam Lantinga <slouken@libsdl.org>
date Thu, 20 Jan 2011 18:04:05 -0800
parents src/video/win32/SDL_win32video.h@40ef2ad3757c
children 25d4feb7c127
comparison
equal deleted inserted replaced
5061:9e9940eae455 5062:e8916fe9cfc8
1 /*
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2010 Sam Lantinga
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
19 Sam Lantinga
20 slouken@libsdl.org
21 */
22 #include "SDL_config.h"
23
24 #ifndef _SDL_windowsvideo_h
25 #define _SDL_windowsvideo_h
26
27 #include "../SDL_sysvideo.h"
28
29 #define WIN32_LEAN_AND_MEAN
30 #define STRICT
31 #ifndef UNICODE
32 #define UNICODE
33 #endif
34 #undef WINVER
35 #define WINVER 0x500 /* Need 0x410 for AlphaBlend() and 0x500 for EnumDisplayDevices() */
36
37 #include <windows.h>
38
39 #ifndef __GNUC__
40 #include <msctf.h>
41 #else
42 #include "SDL_msctf.h"
43 #endif
44
45 #include <imm.h>
46
47 #define MAX_CANDLIST 10
48 #define MAX_CANDLENGTH 256
49
50 #if SDL_VIDEO_RENDER_D3D
51 //#include <d3d9.h>
52 #define D3D_DEBUG_INFO
53 #include "d3d9.h"
54 #endif
55
56 #if SDL_VIDEO_RENDER_DDRAW
57 /* WIN32_LEAN_AND_MEAN was defined, so we have to include this by hand */
58 #include <objbase.h>
59 #include "ddraw.h"
60 #endif
61
62 #include "SDL_windowsclipboard.h"
63 #include "SDL_windowsevents.h"
64 #include "SDL_windowsgamma.h"
65 #include "SDL_windowskeyboard.h"
66 #include "SDL_windowsmodes.h"
67 #include "SDL_windowsmouse.h"
68 #include "SDL_windowsopengl.h"
69 #include "SDL_windowswindow.h"
70 #include "SDL_events.h"
71
72 #ifdef UNICODE
73 #define WIN_StringToUTF8(S) SDL_iconv_string("UTF-8", "UCS-2", (char *)S, (SDL_wcslen(S)+1)*sizeof(WCHAR))
74 #define WIN_UTF8ToString(S) (WCHAR *)SDL_iconv_string("UCS-2", "UTF-8", (char *)S, SDL_strlen(S)+1)
75 #else
76 #define WIN_StringToUTF8(S) SDL_iconv_string("UTF-8", "ASCII", (char *)S, (SDL_strlen(S)+1))
77 #define WIN_UTF8ToString(S) SDL_iconv_string("ASCII", "UTF-8", (char *)S, SDL_strlen(S)+1)
78 #endif
79 extern void WIN_SetError(const char *prefix);
80
81 enum { RENDER_NONE, RENDER_D3D, RENDER_DDRAW, RENDER_GDI, RENDER_GAPI, RENDER_RAW };
82
83 #if WINVER < 0x0601
84 /* Touch input definitions */
85 #define TWF_FINETOUCH 1
86 #define TWF_WANTPALM 2
87
88 #define TOUCHEVENTF_MOVE 0x0001
89 #define TOUCHEVENTF_DOWN 0x0002
90 #define TOUCHEVENTF_UP 0x0004
91
92 DECLARE_HANDLE(HTOUCHINPUT);
93
94 typedef struct _TOUCHINPUT {
95 LONG x;
96 LONG y;
97 HANDLE hSource;
98 DWORD dwID;
99 DWORD dwFlags;
100 DWORD dwMask;
101 DWORD dwTime;
102 ULONG_PTR dwExtraInfo;
103 DWORD cxContact;
104 DWORD cyContact;
105 } TOUCHINPUT, *PTOUCHINPUT;
106
107 #endif /* WINVER < 0x0601 */
108
109 typedef BOOL (*PFNSHFullScreen)(HWND, DWORD);
110 typedef void (*PFCoordTransform)(SDL_Window*, POINT*);
111
112 typedef struct
113 {
114 void **lpVtbl;
115 int refcount;
116 void *data;
117 } TSFSink;
118
119 /* Definition from Win98DDK version of IMM.H */
120 typedef struct tagINPUTCONTEXT2 {
121 HWND hWnd;
122 BOOL fOpen;
123 POINT ptStatusWndPos;
124 POINT ptSoftKbdPos;
125 DWORD fdwConversion;
126 DWORD fdwSentence;
127 union {
128 LOGFONTA A;
129 LOGFONTW W;
130 } lfFont;
131 COMPOSITIONFORM cfCompForm;
132 CANDIDATEFORM cfCandForm[4];
133 HIMCC hCompStr;
134 HIMCC hCandInfo;
135 HIMCC hGuideLine;
136 HIMCC hPrivate;
137 DWORD dwNumMsgBuf;
138 HIMCC hMsgBuf;
139 DWORD fdwInit;
140 DWORD dwReserve[3];
141 } INPUTCONTEXT2, *PINPUTCONTEXT2, NEAR *NPINPUTCONTEXT2, FAR *LPINPUTCONTEXT2;
142
143 /* Private display data */
144
145 typedef struct SDL_VideoData
146 {
147 int render;
148
149 #if SDL_VIDEO_RENDER_D3D
150 HANDLE d3dDLL;
151 IDirect3D9 *d3d;
152 #endif
153 #if SDL_VIDEO_RENDER_DDRAW
154 HANDLE ddrawDLL;
155 IDirectDraw *ddraw;
156 #endif
157 #ifdef _WIN32_WCE
158 HMODULE hAygShell;
159 PFNSHFullScreen SHFullScreen;
160 PFCoordTransform CoordTransform;
161 #endif
162
163 const SDL_scancode *key_layout;
164 DWORD clipboard_count;
165
166 /* Touch input functions */
167 HANDLE userDLL;
168 BOOL (WINAPI *CloseTouchInputHandle)( HTOUCHINPUT );
169 BOOL (WINAPI *GetTouchInputInfo)( HTOUCHINPUT, UINT, PTOUCHINPUT, int );
170 BOOL (WINAPI *RegisterTouchWindow)( HWND, ULONG );
171
172 SDL_bool ime_com_initialized;
173 struct ITfThreadMgr *ime_threadmgr;
174 SDL_bool ime_initialized;
175 SDL_bool ime_enabled;
176 SDL_bool ime_available;
177 HWND ime_hwnd_main;
178 HWND ime_hwnd_current;
179 HIMC ime_himc;
180
181 WCHAR ime_composition[SDL_TEXTEDITINGEVENT_TEXT_SIZE];
182 WCHAR ime_readingstring[16];
183 int ime_cursor;
184
185 SDL_bool ime_candlist;
186 WCHAR ime_candidates[MAX_CANDLIST][MAX_CANDLENGTH];
187 DWORD ime_candcount;
188 DWORD ime_candref;
189 DWORD ime_candsel;
190 UINT ime_candpgsize;
191 int ime_candlistindexbase;
192 SDL_bool ime_candvertical;
193
194 SDL_Texture *ime_candtex;
195 SDL_bool ime_dirty;
196 SDL_Rect ime_rect;
197 SDL_Rect ime_candlistrect;
198 int ime_winwidth;
199 int ime_winheight;
200
201 HKL ime_hkl;
202 HMODULE ime_himm32;
203 UINT (WINAPI *GetReadingString)(HIMC himc, UINT uReadingBufLen, LPWSTR lpwReadingBuf, PINT pnErrorIndex, BOOL *pfIsVertical, PUINT puMaxReadingLen);
204 BOOL (WINAPI *ShowReadingWindow)(HIMC himc, BOOL bShow);
205 LPINPUTCONTEXT2 (WINAPI *ImmLockIMC)(HIMC himc);
206 BOOL (WINAPI *ImmUnlockIMC)(HIMC himc);
207 LPVOID (WINAPI *ImmLockIMCC)(HIMCC himcc);
208 BOOL (WINAPI *ImmUnlockIMCC)(HIMCC himcc);
209
210 SDL_bool ime_uiless;
211 struct ITfThreadMgrEx *ime_threadmgrex;
212 DWORD ime_uielemsinkcookie;
213 DWORD ime_alpnsinkcookie;
214 DWORD ime_openmodesinkcookie;
215 DWORD ime_convmodesinkcookie;
216 TSFSink *ime_uielemsink;
217 TSFSink *ime_ippasink;
218 } SDL_VideoData;
219
220 #endif /* _SDL_windowsvideo_h */
221
222 /* vi: set ts=4 sw=4 expandtab: */