This repository has been archived by the owner on Feb 11, 2021. It is now read-only.
/
SDL_win32video.h
190 lines (159 loc) · 4.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"
#ifndef _SDL_win32video_h
#define _SDL_win32video_h
#include "../SDL_sysvideo.h"
#define WIN32_LEAN_AND_MEAN
#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
38
#include <windows.h>
39
#ifndef __GNUC__
40
#include <msctf.h>
41
42
43
44
#else
#include "SDL_msctf.h"
#endif
45
#include <imm.h>
46
47
48
49
#define MAX_CANDLIST 10
#define MAX_CANDLENGTH 256
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#if SDL_VIDEO_RENDER_D3D
//#include <d3d9.h>
#define D3D_DEBUG_INFO
#include "d3d9.h"
#endif
#if SDL_VIDEO_RENDER_DDRAW
/* WIN32_LEAN_AND_MEAN was defined, so we have to include this by hand */
#include <objbase.h>
#include "ddraw.h"
#endif
#include "SDL_win32clipboard.h"
#include "SDL_win32events.h"
#include "SDL_win32gamma.h"
#include "SDL_win32keyboard.h"
#include "SDL_win32modes.h"
#include "SDL_win32mouse.h"
#include "SDL_win32opengl.h"
#include "SDL_win32window.h"
#include "SDL_events.h"
#ifdef UNICODE
#define WIN_StringToUTF8(S) SDL_iconv_string("UTF-8", "UCS-2", (char *)S, (SDL_wcslen(S)+1)*sizeof(WCHAR))
#define WIN_UTF8ToString(S) (WCHAR *)SDL_iconv_string("UCS-2", "UTF-8", (char *)S, SDL_strlen(S)+1)
#else
#define WIN_StringToUTF8(S) SDL_iconv_string("UTF-8", "ASCII", (char *)S, (SDL_strlen(S)+1))
#define WIN_UTF8ToString(S) SDL_iconv_string("ASCII", "UTF-8", (char *)S, SDL_strlen(S)+1)
#endif
extern void WIN_SetError(const char *prefix);
81
82
83
84
85
enum { RENDER_NONE, RENDER_D3D, RENDER_DDRAW, RENDER_GDI, RENDER_GAPI, RENDER_RAW };
typedef BOOL (*PFNSHFullScreen)(HWND, DWORD);
typedef void (*PFCoordTransform)(SDL_Window*, POINT*);
86
87
88
89
90
91
92
typedef struct
{
void **lpVtbl;
int refcount;
void *data;
} TSFSink;
93
/* Definition from Win98DDK version of IMM.H */
94
typedef struct tagINPUTCONTEXT2 {
95
96
97
98
99
100
101
102
103
HWND hWnd;
BOOL fOpen;
POINT ptStatusWndPos;
POINT ptSoftKbdPos;
DWORD fdwConversion;
DWORD fdwSentence;
union {
LOGFONTA A;
LOGFONTW W;
104
} lfFont;
105
106
107
108
109
110
111
112
113
114
COMPOSITIONFORM cfCompForm;
CANDIDATEFORM cfCandForm[4];
HIMCC hCompStr;
HIMCC hCandInfo;
HIMCC hGuideLine;
HIMCC hPrivate;
DWORD dwNumMsgBuf;
HIMCC hMsgBuf;
DWORD fdwInit;
DWORD dwReserve[3];
115
} INPUTCONTEXT2, *PINPUTCONTEXT2, NEAR *NPINPUTCONTEXT2, FAR *LPINPUTCONTEXT2;
116
117
118
119
120
/* Private display data */
typedef struct SDL_VideoData
{
121
122
int render;
123
124
125
126
127
128
129
130
#if SDL_VIDEO_RENDER_D3D
HANDLE d3dDLL;
IDirect3D9 *d3d;
#endif
#if SDL_VIDEO_RENDER_DDRAW
HANDLE ddrawDLL;
IDirectDraw *ddraw;
#endif
131
132
133
134
135
#ifdef _WIN32_WCE
HMODULE hAygShell;
PFNSHFullScreen SHFullScreen;
PFCoordTransform CoordTransform;
#endif
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
const SDL_scancode *key_layout;
DWORD clipboard_count;
SDL_bool ime_com_initialized;
struct ITfThreadMgr *ime_threadmgr;
SDL_bool ime_initialized;
SDL_bool ime_enabled;
SDL_bool ime_available;
HWND ime_hwnd_main;
HWND ime_hwnd_current;
HIMC ime_himc;
WCHAR ime_composition[SDL_TEXTEDITINGEVENT_TEXT_SIZE];
WCHAR ime_readingstring[16];
int ime_cursor;
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
SDL_bool ime_candlist;
WCHAR ime_candidates[MAX_CANDLIST][MAX_CANDLENGTH];
DWORD ime_candcount;
DWORD ime_candref;
DWORD ime_candsel;
UINT ime_candpgsize;
int ime_candlistindexbase;
SDL_bool ime_candvertical;
SDL_Texture *ime_candtex;
SDL_bool ime_dirty;
SDL_Rect ime_rect;
SDL_Rect ime_candlistrect;
int ime_winwidth;
int ime_winheight;
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
HKL ime_hkl;
HMODULE ime_himm32;
UINT (WINAPI *GetReadingString)(HIMC himc, UINT uReadingBufLen, LPWSTR lpwReadingBuf, PINT pnErrorIndex, BOOL *pfIsVertical, PUINT puMaxReadingLen);
BOOL (WINAPI *ShowReadingWindow)(HIMC himc, BOOL bShow);
LPINPUTCONTEXT2 (WINAPI *ImmLockIMC)(HIMC himc);
BOOL (WINAPI *ImmUnlockIMC)(HIMC himc);
LPVOID (WINAPI *ImmLockIMCC)(HIMCC himcc);
BOOL (WINAPI *ImmUnlockIMCC)(HIMCC himcc);
SDL_bool ime_uiless;
struct ITfThreadMgrEx *ime_threadmgrex;
DWORD ime_uielemsinkcookie;
DWORD ime_alpnsinkcookie;
DWORD ime_openmodesinkcookie;
DWORD ime_convmodesinkcookie;
TSFSink *ime_uielemsink;
TSFSink *ime_ippasink;
} SDL_VideoData;
#endif /* _SDL_win32video_h */
/* vi: set ts=4 sw=4 expandtab: */