diff options
Diffstat (limited to 'apps/plugins/sdl/src/video/wincommon')
-rw-r--r-- | apps/plugins/sdl/src/video/wincommon/SDL_lowvideo.h | 152 | ||||
-rw-r--r-- | apps/plugins/sdl/src/video/wincommon/SDL_sysevents.c | 855 | ||||
-rw-r--r-- | apps/plugins/sdl/src/video/wincommon/SDL_sysmouse.c | 259 | ||||
-rw-r--r-- | apps/plugins/sdl/src/video/wincommon/SDL_sysmouse_c.h | 33 | ||||
-rw-r--r-- | apps/plugins/sdl/src/video/wincommon/SDL_syswm.c | 297 | ||||
-rw-r--r-- | apps/plugins/sdl/src/video/wincommon/SDL_syswm_c.h | 35 | ||||
-rw-r--r-- | apps/plugins/sdl/src/video/wincommon/SDL_wingl.c | 659 | ||||
-rw-r--r-- | apps/plugins/sdl/src/video/wincommon/SDL_wingl_c.h | 135 | ||||
-rw-r--r-- | apps/plugins/sdl/src/video/wincommon/wmmsg.h | 1030 |
9 files changed, 3455 insertions, 0 deletions
diff --git a/apps/plugins/sdl/src/video/wincommon/SDL_lowvideo.h b/apps/plugins/sdl/src/video/wincommon/SDL_lowvideo.h new file mode 100644 index 0000000000..89d1a88e89 --- /dev/null +++ b/apps/plugins/sdl/src/video/wincommon/SDL_lowvideo.h | |||
@@ -0,0 +1,152 @@ | |||
1 | /* | ||
2 | SDL - Simple DirectMedia Layer | ||
3 | Copyright (C) 1997-2012 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_lowvideo_h | ||
25 | #define _SDL_lowvideo_h | ||
26 | |||
27 | #define WIN32_LEAN_AND_MEAN | ||
28 | #include <windows.h> | ||
29 | |||
30 | #ifndef SetClassLongPtr | ||
31 | #define SetClassLongPtr SetClassLong | ||
32 | #endif | ||
33 | #ifndef GetWindowLongPtr | ||
34 | #define GetWindowLongPtr GetWindowLong | ||
35 | #endif | ||
36 | #ifndef SetWindowLongPtr | ||
37 | #define SetWindowLongPtr SetWindowLong | ||
38 | #endif | ||
39 | #ifndef GWLP_WNDPROC | ||
40 | #define GWLP_WNDPROC GWL_WNDPROC | ||
41 | #endif | ||
42 | #ifndef GWLP_HINSTANCE | ||
43 | #define GWLP_HINSTANCE GWL_HINSTANCE | ||
44 | #endif | ||
45 | #ifndef GCLP_HICON | ||
46 | #define GCLP_HICON GCL_HICON | ||
47 | #endif | ||
48 | |||
49 | #include "../SDL_sysvideo.h" | ||
50 | |||
51 | /* Hidden "this" pointer for the video functions */ | ||
52 | #define _THIS SDL_VideoDevice *this | ||
53 | |||
54 | #define FULLSCREEN() \ | ||
55 | ((SDL_VideoSurface->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN) | ||
56 | |||
57 | #define WINDIB_FULLSCREEN() \ | ||
58 | ( \ | ||
59 | SDL_VideoSurface && \ | ||
60 | FULLSCREEN() && \ | ||
61 | (((SDL_VideoSurface->flags & SDL_OPENGL ) == SDL_OPENGL ) || \ | ||
62 | ((SDL_strcmp(this->name, "windib") == 0) || \ | ||
63 | (SDL_strcmp(this->name, "gapi") == 0))) \ | ||
64 | ) | ||
65 | #define DDRAW_FULLSCREEN() \ | ||
66 | ( \ | ||
67 | SDL_VideoSurface && \ | ||
68 | FULLSCREEN() && \ | ||
69 | ((SDL_VideoSurface->flags & SDL_OPENGL ) != SDL_OPENGL ) && \ | ||
70 | (SDL_strcmp(this->name, "directx") == 0) \ | ||
71 | ) | ||
72 | |||
73 | #define DINPUT_FULLSCREEN() \ | ||
74 | ( \ | ||
75 | FULLSCREEN() && \ | ||
76 | (strcmp(this->name, "directx") == 0) \ | ||
77 | ) | ||
78 | |||
79 | #define DINPUT() (strcmp(this->name, "directx") == 0) | ||
80 | |||
81 | /* The main window -- and a function to set it for the audio */ | ||
82 | #ifdef _WIN32_WCE | ||
83 | extern LPWSTR SDL_Appname; | ||
84 | #else | ||
85 | extern LPSTR SDL_Appname; | ||
86 | #endif | ||
87 | extern HINSTANCE SDL_Instance; | ||
88 | extern HWND SDL_Window; | ||
89 | extern BOOL SDL_windowid; | ||
90 | |||
91 | /* Variables and functions exported to other parts of the native video | ||
92 | subsystem (SDL_sysevents.c) | ||
93 | */ | ||
94 | extern void WIN_FlushMessageQueue(); | ||
95 | |||
96 | /* Called by windows message loop when application is activated */ | ||
97 | extern void (*WIN_Activate)(_THIS, BOOL active, BOOL minimized); | ||
98 | |||
99 | /* Called by windows message loop when system palette is available */ | ||
100 | extern void (*WIN_RealizePalette)(_THIS); | ||
101 | |||
102 | /* Called by windows message loop when the system palette changes */ | ||
103 | extern void (*WIN_PaletteChanged)(_THIS, HWND window); | ||
104 | |||
105 | /* Called by windows message loop when a portion of the screen needs update */ | ||
106 | extern void (*WIN_WinPAINT)(_THIS, HDC hdc); | ||
107 | |||
108 | /* Called by windows message loop when the message isn't handled */ | ||
109 | extern LONG (*HandleMessage)(_THIS, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); | ||
110 | |||
111 | /* The window cursor (from SDL_sysmouse.c) */ | ||
112 | extern HCURSOR SDL_hcursor; | ||
113 | |||
114 | /* The bounds of the window in screen coordinates */ | ||
115 | extern RECT SDL_bounds; | ||
116 | |||
117 | /* The position of the window in windowed mode */ | ||
118 | extern int SDL_windowX; | ||
119 | extern int SDL_windowY; | ||
120 | |||
121 | /* Flag -- SDL is performing a resize, rather than the user */ | ||
122 | extern int SDL_resizing; | ||
123 | |||
124 | /* Flag -- the mouse is in relative motion mode */ | ||
125 | extern int mouse_relative; | ||
126 | |||
127 | /* The GDI fullscreen mode currently active */ | ||
128 | #ifndef NO_CHANGEDISPLAYSETTINGS | ||
129 | extern DEVMODE SDL_desktop_mode; | ||
130 | extern DEVMODE SDL_fullscreen_mode; | ||
131 | #endif | ||
132 | |||
133 | /* The system gamma ramp for GDI modes */ | ||
134 | extern WORD *gamma_saved; | ||
135 | |||
136 | /* This is really from SDL_dx5audio.c */ | ||
137 | extern void DX5_SoundFocus(HWND window); | ||
138 | |||
139 | /* DJM: This is really from SDL_sysevents.c, we need it in | ||
140 | GDL_CreateWindow as well */ | ||
141 | LRESULT CALLBACK WinMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); | ||
142 | |||
143 | #ifdef _WIN64 | ||
144 | #define SDL_ToUnicode ToUnicode | ||
145 | #else | ||
146 | /* JFP: Implementation of ToUnicode() that works on 9x/ME/2K/XP */ | ||
147 | typedef int (WINAPI *ToUnicodeFN)(UINT, UINT, const BYTE *, LPWSTR, int, UINT); | ||
148 | |||
149 | extern ToUnicodeFN SDL_ToUnicode; | ||
150 | #endif | ||
151 | |||
152 | #endif /* SDL_lowvideo_h */ | ||
diff --git a/apps/plugins/sdl/src/video/wincommon/SDL_sysevents.c b/apps/plugins/sdl/src/video/wincommon/SDL_sysevents.c new file mode 100644 index 0000000000..76c67a1ccd --- /dev/null +++ b/apps/plugins/sdl/src/video/wincommon/SDL_sysevents.c | |||
@@ -0,0 +1,855 @@ | |||
1 | /* | ||
2 | SDL - Simple DirectMedia Layer | ||
3 | Copyright (C) 1997-2012 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 | #define WIN32_LEAN_AND_MEAN | ||
25 | #include <windows.h> | ||
26 | |||
27 | /* Make sure XBUTTON stuff is defined that isn't in older Platform SDKs... */ | ||
28 | #ifndef WM_XBUTTONDOWN | ||
29 | #define WM_XBUTTONDOWN 0x020B | ||
30 | #endif | ||
31 | #ifndef WM_XBUTTONUP | ||
32 | #define WM_XBUTTONUP 0x020C | ||
33 | #endif | ||
34 | #ifndef GET_XBUTTON_WPARAM | ||
35 | #define GET_XBUTTON_WPARAM(w) (HIWORD(w)) | ||
36 | #endif | ||
37 | |||
38 | #include "SDL_events.h" | ||
39 | #include "SDL_video.h" | ||
40 | #include "SDL_syswm.h" | ||
41 | #include "../SDL_sysvideo.h" | ||
42 | #include "../../events/SDL_sysevents.h" | ||
43 | #include "../../events/SDL_events_c.h" | ||
44 | #include "SDL_lowvideo.h" | ||
45 | #include "SDL_syswm_c.h" | ||
46 | #include "SDL_main.h" | ||
47 | #include "SDL_loadso.h" | ||
48 | |||
49 | #ifdef WMMSG_DEBUG | ||
50 | #include "wmmsg.h" | ||
51 | #endif | ||
52 | |||
53 | #include "../windib/SDL_gapidibvideo.h" | ||
54 | |||
55 | #ifdef SDL_VIDEO_DRIVER_GAPI | ||
56 | #include "../gapi/SDL_gapivideo.h" | ||
57 | #endif | ||
58 | |||
59 | #ifdef _WIN32_WCE | ||
60 | #define IsZoomed(HWND) 1 | ||
61 | #define NO_GETKEYBOARDSTATE | ||
62 | #if _WIN32_WCE < 420 | ||
63 | #define NO_CHANGEDISPLAYSETTINGS | ||
64 | #endif | ||
65 | #endif | ||
66 | |||
67 | /* The window we use for everything... */ | ||
68 | #ifdef _WIN32_WCE | ||
69 | LPWSTR SDL_Appname = NULL; | ||
70 | #else | ||
71 | LPSTR SDL_Appname = NULL; | ||
72 | #endif | ||
73 | Uint32 SDL_Appstyle = 0; | ||
74 | HINSTANCE SDL_Instance = NULL; | ||
75 | HWND SDL_Window = NULL; | ||
76 | RECT SDL_bounds = {0, 0, 0, 0}; | ||
77 | int SDL_windowX = 0; | ||
78 | int SDL_windowY = 0; | ||
79 | int SDL_resizing = 0; | ||
80 | int mouse_relative = 0; | ||
81 | int posted = 0; | ||
82 | #ifndef NO_CHANGEDISPLAYSETTINGS | ||
83 | DEVMODE SDL_desktop_mode; | ||
84 | DEVMODE SDL_fullscreen_mode; | ||
85 | #endif | ||
86 | WORD *gamma_saved = NULL; | ||
87 | |||
88 | |||
89 | /* Functions called by the message processing function */ | ||
90 | LONG (*HandleMessage)(_THIS, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)=NULL; | ||
91 | void (*WIN_Activate)(_THIS, BOOL active, BOOL iconic); | ||
92 | void (*WIN_RealizePalette)(_THIS); | ||
93 | void (*WIN_PaletteChanged)(_THIS, HWND window); | ||
94 | void (*WIN_WinPAINT)(_THIS, HDC hdc); | ||
95 | extern void DIB_SwapGamma(_THIS); | ||
96 | |||
97 | #ifndef NO_GETKEYBOARDSTATE | ||
98 | #ifndef _WIN64 | ||
99 | /* Variables and support functions for SDL_ToUnicode() */ | ||
100 | static int codepage; | ||
101 | static int Is9xME(); | ||
102 | static int GetCodePage(); | ||
103 | static int WINAPI ToUnicode9xME(UINT vkey, UINT scancode, const BYTE *keystate, LPWSTR wchars, int wsize, UINT flags); | ||
104 | |||
105 | ToUnicodeFN SDL_ToUnicode = ToUnicode9xME; | ||
106 | #endif | ||
107 | #endif /* !NO_GETKEYBOARDSTATE */ | ||
108 | |||
109 | |||
110 | #if defined(_WIN32_WCE) | ||
111 | |||
112 | //AdjustWindowRect is not available under WinCE 2003 | ||
113 | #define AdjustWindowRect(a,b,c) (AdjustWindowRectEx((a),(b),(c),0)) | ||
114 | |||
115 | // dynamically load aygshell dll because we want SDL to work on HPC and be300 | ||
116 | HINSTANCE aygshell = NULL; | ||
117 | BOOL (WINAPI *SHFullScreen)(HWND hwndRequester, DWORD dwState) = 0; | ||
118 | |||
119 | #define SHFS_SHOWTASKBAR 0x0001 | ||
120 | #define SHFS_HIDETASKBAR 0x0002 | ||
121 | #define SHFS_SHOWSIPBUTTON 0x0004 | ||
122 | #define SHFS_HIDESIPBUTTON 0x0008 | ||
123 | #define SHFS_SHOWSTARTICON 0x0010 | ||
124 | #define SHFS_HIDESTARTICON 0x0020 | ||
125 | |||
126 | static void LoadAygshell(void) | ||
127 | { | ||
128 | if( !aygshell ) | ||
129 | aygshell = SDL_LoadObject("aygshell.dll"); | ||
130 | if( (aygshell != 0) && (SHFullScreen == 0) ) | ||
131 | { | ||
132 | SHFullScreen = (int (WINAPI *)(struct HWND__ *,unsigned long)) SDL_LoadFunction(aygshell, "SHFullScreen"); | ||
133 | } | ||
134 | } | ||
135 | |||
136 | #endif | ||
137 | |||
138 | /* JC 14 Mar 2006 | ||
139 | This is used all over the place, in the windib driver and in the dx5 driver | ||
140 | So we may as well stick it here instead of having multiple copies scattered | ||
141 | about | ||
142 | */ | ||
143 | void WIN_FlushMessageQueue() | ||
144 | { | ||
145 | MSG msg; | ||
146 | while ( PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) ) { | ||
147 | if ( msg.message == WM_QUIT ) break; | ||
148 | TranslateMessage( &msg ); | ||
149 | DispatchMessage( &msg ); | ||
150 | } | ||
151 | } | ||
152 | |||
153 | static void SDL_RestoreGameMode(void) | ||
154 | { | ||
155 | #ifdef _WIN32_WCE //Under ce we don't minimize, therefore no restore | ||
156 | |||
157 | #ifdef SDL_VIDEO_DRIVER_GAPI | ||
158 | SDL_VideoDevice *this = current_video; | ||
159 | if(SDL_strcmp(this->name, "gapi") == 0) | ||
160 | { | ||
161 | if( this->hidden->gapiInfo->suspended ) | ||
162 | { | ||
163 | this->hidden->gapiInfo->suspended = 0; | ||
164 | } | ||
165 | } | ||
166 | #endif | ||
167 | |||
168 | #else | ||
169 | ShowWindow(SDL_Window, SW_RESTORE); | ||
170 | #endif | ||
171 | |||
172 | #ifndef NO_CHANGEDISPLAYSETTINGS | ||
173 | #ifndef _WIN32_WCE | ||
174 | ChangeDisplaySettings(&SDL_fullscreen_mode, CDS_FULLSCREEN); | ||
175 | #endif | ||
176 | #endif /* NO_CHANGEDISPLAYSETTINGS */ | ||
177 | } | ||
178 | static void SDL_RestoreDesktopMode(void) | ||
179 | { | ||
180 | |||
181 | #ifdef _WIN32_WCE | ||
182 | |||
183 | #ifdef SDL_VIDEO_DRIVER_GAPI | ||
184 | SDL_VideoDevice *this = current_video; | ||
185 | if(SDL_strcmp(this->name, "gapi") == 0) | ||
186 | { | ||
187 | if( !this->hidden->gapiInfo->suspended ) | ||
188 | { | ||
189 | this->hidden->gapiInfo->suspended = 1; | ||
190 | } | ||
191 | } | ||
192 | #endif | ||
193 | |||
194 | #else | ||
195 | /* WinCE does not have a taskbar, so minimizing is not convenient */ | ||
196 | ShowWindow(SDL_Window, SW_MINIMIZE); | ||
197 | #endif | ||
198 | |||
199 | #ifndef NO_CHANGEDISPLAYSETTINGS | ||
200 | #ifndef _WIN32_WCE | ||
201 | ChangeDisplaySettings(NULL, 0); | ||
202 | #endif | ||
203 | #endif /* NO_CHANGEDISPLAYSETTINGS */ | ||
204 | } | ||
205 | |||
206 | #ifdef WM_MOUSELEAVE | ||
207 | /* | ||
208 | Special code to handle mouse leave events - this sucks... | ||
209 | http://support.microsoft.com/support/kb/articles/q183/1/07.asp | ||
210 | |||
211 | TrackMouseEvent() is only available on Win98 and WinNT. | ||
212 | _TrackMouseEvent() is available on Win95, but isn't yet in the mingw32 | ||
213 | development environment, and only works on systems that have had IE 3.0 | ||
214 | or newer installed on them (which is not the case with the base Win95). | ||
215 | Therefore, we implement our own version of _TrackMouseEvent() which | ||
216 | uses our own implementation if TrackMouseEvent() is not available. | ||
217 | */ | ||
218 | static BOOL (WINAPI *_TrackMouseEvent)(TRACKMOUSEEVENT *ptme) = NULL; | ||
219 | |||
220 | static VOID CALLBACK | ||
221 | TrackMouseTimerProc(HWND hWnd, UINT uMsg, UINT idEvent, DWORD dwTime) | ||
222 | { | ||
223 | union { RECT rect; POINT pt; } rectpt; /* prevent type-punning issue. */ | ||
224 | POINT pt; | ||
225 | |||
226 | GetClientRect(hWnd, &rectpt.rect); | ||
227 | MapWindowPoints(hWnd, NULL, &rectpt.pt, 2); | ||
228 | GetCursorPos(&pt); | ||
229 | if ( !PtInRect(&rectpt.rect, pt) || (WindowFromPoint(pt) != hWnd) ) { | ||
230 | if ( !KillTimer(hWnd, idEvent) ) { | ||
231 | /* Error killing the timer! */ | ||
232 | } | ||
233 | PostMessage(hWnd, WM_MOUSELEAVE, 0, 0); | ||
234 | } | ||
235 | } | ||
236 | static BOOL WINAPI WIN_TrackMouseEvent(TRACKMOUSEEVENT *ptme) | ||
237 | { | ||
238 | if ( ptme->dwFlags == TME_LEAVE ) { | ||
239 | return SetTimer(ptme->hwndTrack, ptme->dwFlags, 100, | ||
240 | (TIMERPROC)TrackMouseTimerProc) != 0; | ||
241 | } | ||
242 | return FALSE; | ||
243 | } | ||
244 | #endif /* WM_MOUSELEAVE */ | ||
245 | |||
246 | int sysevents_mouse_pressed = 0; | ||
247 | |||
248 | /* The main Win32 event handler | ||
249 | DJM: This is no longer static as (DX5/DIB)_CreateWindow needs it | ||
250 | */ | ||
251 | LRESULT CALLBACK WinMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) | ||
252 | { | ||
253 | SDL_VideoDevice *this = current_video; | ||
254 | #ifdef WMMSG_DEBUG | ||
255 | fprintf(stderr, "Received windows message: "); | ||
256 | if ( msg > MAX_WMMSG ) { | ||
257 | fprintf(stderr, "%d", msg); | ||
258 | } else { | ||
259 | fprintf(stderr, "%s", wmtab[msg]); | ||
260 | } | ||
261 | fprintf(stderr, " -- 0x%X, 0x%X\n", wParam, lParam); | ||
262 | #endif | ||
263 | switch (msg) { | ||
264 | |||
265 | case WM_ACTIVATE: { | ||
266 | SDL_VideoDevice *this = current_video; | ||
267 | BOOL active, minimized; | ||
268 | Uint8 appstate; | ||
269 | |||
270 | minimized = HIWORD(wParam); | ||
271 | active = (LOWORD(wParam) != WA_INACTIVE) && !minimized; | ||
272 | if ( active ) { | ||
273 | /* Gain the following states */ | ||
274 | appstate = SDL_APPACTIVE|SDL_APPINPUTFOCUS; | ||
275 | if ( !(SDL_GetAppState() & SDL_APPINPUTFOCUS) ) { | ||
276 | if ( this->input_grab != SDL_GRAB_OFF ) { | ||
277 | WIN_GrabInput(this, SDL_GRAB_ON); | ||
278 | } | ||
279 | if ( ! DDRAW_FULLSCREEN() ) { | ||
280 | DIB_SwapGamma(this); | ||
281 | } | ||
282 | if ( WINDIB_FULLSCREEN() ) { | ||
283 | SDL_RestoreGameMode(); | ||
284 | } | ||
285 | } | ||
286 | #if defined(_WIN32_WCE) | ||
287 | if ( WINDIB_FULLSCREEN() ) { | ||
288 | LoadAygshell(); | ||
289 | if( SHFullScreen ) | ||
290 | SHFullScreen(SDL_Window, SHFS_HIDESTARTICON|SHFS_HIDETASKBAR|SHFS_HIDESIPBUTTON); | ||
291 | else | ||
292 | ShowWindow(FindWindow(TEXT("HHTaskBar"),NULL),SW_HIDE); | ||
293 | } | ||
294 | #endif | ||
295 | posted = SDL_PrivateAppActive(1, appstate); | ||
296 | } else { | ||
297 | /* Lose the following states */ | ||
298 | appstate = SDL_APPINPUTFOCUS; | ||
299 | if ( minimized ) { | ||
300 | appstate |= SDL_APPACTIVE; | ||
301 | } | ||
302 | |||
303 | if ( SDL_GetAppState() & SDL_APPINPUTFOCUS ) { | ||
304 | if ( this->input_grab != SDL_GRAB_OFF ) { | ||
305 | WIN_GrabInput(this, SDL_GRAB_OFF); | ||
306 | } | ||
307 | if ( ! DDRAW_FULLSCREEN() ) { | ||
308 | DIB_SwapGamma(this); | ||
309 | } | ||
310 | if ( WINDIB_FULLSCREEN() ) { | ||
311 | appstate |= SDL_APPMOUSEFOCUS; | ||
312 | SDL_RestoreDesktopMode(); | ||
313 | /* A fullscreen app gets hidden but will not get a minimize event */ | ||
314 | appstate |= (SDL_APPACTIVE | SDL_APPMOUSEFOCUS); | ||
315 | #if defined(_WIN32_WCE) | ||
316 | LoadAygshell(); | ||
317 | if( SHFullScreen ) | ||
318 | SHFullScreen(SDL_Window, SHFS_SHOWSTARTICON|SHFS_SHOWTASKBAR|SHFS_SHOWSIPBUTTON); | ||
319 | else | ||
320 | ShowWindow(FindWindow(TEXT("HHTaskBar"),NULL),SW_SHOW); | ||
321 | #endif | ||
322 | } | ||
323 | } | ||
324 | posted = SDL_PrivateAppActive(0, appstate); | ||
325 | } | ||
326 | WIN_Activate(this, active, minimized); | ||
327 | return(0); | ||
328 | } | ||
329 | break; | ||
330 | |||
331 | case WM_MOUSEMOVE: { | ||
332 | |||
333 | #ifdef WM_MOUSELEAVE | ||
334 | if ( SDL_VideoSurface ) { | ||
335 | /* mouse has entered the window */ | ||
336 | |||
337 | if ( !(SDL_GetAppState() & SDL_APPMOUSEFOCUS) ) { | ||
338 | TRACKMOUSEEVENT tme; | ||
339 | |||
340 | tme.cbSize = sizeof(tme); | ||
341 | tme.dwFlags = TME_LEAVE; | ||
342 | tme.hwndTrack = SDL_Window; | ||
343 | _TrackMouseEvent(&tme); | ||
344 | } | ||
345 | } | ||
346 | #endif /* WM_MOUSELEAVE */ | ||
347 | |||
348 | /* Mouse motion is handled in DIB_PumpEvents or | ||
349 | * DX5_PumpEvents, depending on the video driver | ||
350 | * in use */ | ||
351 | |||
352 | posted = SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS); | ||
353 | } | ||
354 | return(0); | ||
355 | |||
356 | #ifdef WM_MOUSELEAVE | ||
357 | case WM_MOUSELEAVE: { | ||
358 | |||
359 | if ( SDL_VideoSurface ) { | ||
360 | /* mouse has left the window */ | ||
361 | posted = SDL_PrivateAppActive(0, SDL_APPMOUSEFOCUS); | ||
362 | } | ||
363 | } | ||
364 | return(0); | ||
365 | #endif /* WM_MOUSELEAVE */ | ||
366 | |||
367 | case WM_LBUTTONDOWN: | ||
368 | case WM_LBUTTONUP: | ||
369 | case WM_MBUTTONDOWN: | ||
370 | case WM_MBUTTONUP: | ||
371 | case WM_RBUTTONDOWN: | ||
372 | case WM_RBUTTONUP: | ||
373 | case WM_XBUTTONDOWN: | ||
374 | case WM_XBUTTONUP: { | ||
375 | /* Mouse is handled by DirectInput when fullscreen */ | ||
376 | if ( SDL_VideoSurface && ! DINPUT() ) { | ||
377 | WORD xbuttonval = 0; | ||
378 | Uint8 button, state; | ||
379 | int x, y; | ||
380 | |||
381 | /* DJM: | ||
382 | We want the SDL window to take focus so that | ||
383 | it acts like a normal windows "component" | ||
384 | (e.g. gains keyboard focus on a mouse click). | ||
385 | */ | ||
386 | SetFocus(SDL_Window); | ||
387 | |||
388 | /* Figure out which button to use */ | ||
389 | switch (msg) { | ||
390 | case WM_LBUTTONDOWN: | ||
391 | button = SDL_BUTTON_LEFT; | ||
392 | state = SDL_PRESSED; | ||
393 | break; | ||
394 | case WM_LBUTTONUP: | ||
395 | button = SDL_BUTTON_LEFT; | ||
396 | state = SDL_RELEASED; | ||
397 | break; | ||
398 | case WM_MBUTTONDOWN: | ||
399 | button = SDL_BUTTON_MIDDLE; | ||
400 | state = SDL_PRESSED; | ||
401 | break; | ||
402 | case WM_MBUTTONUP: | ||
403 | button = SDL_BUTTON_MIDDLE; | ||
404 | state = SDL_RELEASED; | ||
405 | break; | ||
406 | case WM_RBUTTONDOWN: | ||
407 | button = SDL_BUTTON_RIGHT; | ||
408 | state = SDL_PRESSED; | ||
409 | break; | ||
410 | case WM_RBUTTONUP: | ||
411 | button = SDL_BUTTON_RIGHT; | ||
412 | state = SDL_RELEASED; | ||
413 | break; | ||
414 | case WM_XBUTTONDOWN: | ||
415 | xbuttonval = GET_XBUTTON_WPARAM(wParam); | ||
416 | button = SDL_BUTTON_X1 + xbuttonval - 1; | ||
417 | state = SDL_PRESSED; | ||
418 | break; | ||
419 | case WM_XBUTTONUP: | ||
420 | xbuttonval = GET_XBUTTON_WPARAM(wParam); | ||
421 | button = SDL_BUTTON_X1 + xbuttonval - 1; | ||
422 | state = SDL_RELEASED; | ||
423 | break; | ||
424 | default: | ||
425 | /* Eh? Unknown button? */ | ||
426 | return(0); | ||
427 | } | ||
428 | if ( state == SDL_PRESSED ) { | ||
429 | /* Grab mouse so we get up events */ | ||
430 | if ( ++sysevents_mouse_pressed > 0 ) { | ||
431 | SetCapture(hwnd); | ||
432 | } | ||
433 | } else { | ||
434 | /* Release mouse after all up events */ | ||
435 | if ( --sysevents_mouse_pressed <= 0 ) { | ||
436 | ReleaseCapture(); | ||
437 | sysevents_mouse_pressed = 0; | ||
438 | } | ||
439 | } | ||
440 | if ( mouse_relative ) { | ||
441 | /* RJR: March 28, 2000 | ||
442 | report internal mouse position if in relative mode */ | ||
443 | x = 0; y = 0; | ||
444 | } else { | ||
445 | x = (Sint16)LOWORD(lParam); | ||
446 | y = (Sint16)HIWORD(lParam); | ||
447 | #ifdef _WIN32_WCE | ||
448 | if (SDL_VideoSurface) | ||
449 | GapiTransform(this->hidden->userOrientation, | ||
450 | this->hidden->hiresFix, &x, &y); | ||
451 | #endif | ||
452 | } | ||
453 | posted = SDL_PrivateMouseButton( | ||
454 | state, button, x, y); | ||
455 | |||
456 | /* | ||
457 | * MSDN says: | ||
458 | * "Unlike the WM_LBUTTONUP, WM_MBUTTONUP, and WM_RBUTTONUP | ||
459 | * messages, an application should return TRUE from [an | ||
460 | * XBUTTON message] if it processes it. Doing so will allow | ||
461 | * software that simulates this message on Microsoft Windows | ||
462 | * systems earlier than Windows 2000 to determine whether | ||
463 | * the window procedure processed the message or called | ||
464 | * DefWindowProc to process it. | ||
465 | */ | ||
466 | if (xbuttonval > 0) | ||
467 | return(TRUE); | ||
468 | } | ||
469 | } | ||
470 | return(0); | ||
471 | |||
472 | |||
473 | #if (_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400) | ||
474 | case WM_MOUSEWHEEL: | ||
475 | if ( SDL_VideoSurface && ! DINPUT() ) { | ||
476 | int move = (short)HIWORD(wParam); | ||
477 | if ( move ) { | ||
478 | Uint8 button; | ||
479 | if ( move > 0 ) | ||
480 | button = SDL_BUTTON_WHEELUP; | ||
481 | else | ||
482 | button = SDL_BUTTON_WHEELDOWN; | ||
483 | posted = SDL_PrivateMouseButton( | ||
484 | SDL_PRESSED, button, 0, 0); | ||
485 | posted |= SDL_PrivateMouseButton( | ||
486 | SDL_RELEASED, button, 0, 0); | ||
487 | } | ||
488 | } | ||
489 | return(0); | ||
490 | #endif | ||
491 | |||
492 | #ifdef WM_GETMINMAXINFO | ||
493 | /* This message is sent as a way for us to "check" the values | ||
494 | * of a position change. If we don't like it, we can adjust | ||
495 | * the values before they are changed. | ||
496 | */ | ||
497 | case WM_GETMINMAXINFO: { | ||
498 | MINMAXINFO *info; | ||
499 | RECT size; | ||
500 | int x, y; | ||
501 | int style; | ||
502 | int width; | ||
503 | int height; | ||
504 | |||
505 | /* We don't want to clobber an internal resize */ | ||
506 | if ( SDL_resizing ) | ||
507 | return(0); | ||
508 | |||
509 | /* We allow resizing with the SDL_RESIZABLE flag */ | ||
510 | if ( SDL_PublicSurface && | ||
511 | (SDL_PublicSurface->flags & SDL_RESIZABLE) ) { | ||
512 | return(0); | ||
513 | } | ||
514 | |||
515 | /* Get the current position of our window */ | ||
516 | GetWindowRect(SDL_Window, &size); | ||
517 | x = size.left; | ||
518 | y = size.top; | ||
519 | |||
520 | /* Calculate current width and height of our window */ | ||
521 | size.top = 0; | ||
522 | size.left = 0; | ||
523 | if ( SDL_PublicSurface != NULL ) { | ||
524 | size.bottom = SDL_PublicSurface->h; | ||
525 | size.right = SDL_PublicSurface->w; | ||
526 | } else { | ||
527 | size.bottom = 0; | ||
528 | size.right = 0; | ||
529 | } | ||
530 | |||
531 | /* DJM - according to the docs for GetMenu(), the | ||
532 | return value is undefined if hwnd is a child window. | ||
533 | Aparently it's too difficult for MS to check | ||
534 | inside their function, so I have to do it here. | ||
535 | */ | ||
536 | style = GetWindowLong(hwnd, GWL_STYLE); | ||
537 | AdjustWindowRect( | ||
538 | &size, | ||
539 | style, | ||
540 | style & WS_CHILDWINDOW ? FALSE | ||
541 | : GetMenu(hwnd) != NULL); | ||
542 | |||
543 | width = size.right - size.left; | ||
544 | height = size.bottom - size.top; | ||
545 | |||
546 | /* Fix our size to the current size */ | ||
547 | info = (MINMAXINFO *)lParam; | ||
548 | info->ptMaxSize.x = width; | ||
549 | info->ptMaxSize.y = height; | ||
550 | info->ptMaxPosition.x = x; | ||
551 | info->ptMaxPosition.y = y; | ||
552 | info->ptMinTrackSize.x = width; | ||
553 | info->ptMinTrackSize.y = height; | ||
554 | info->ptMaxTrackSize.x = width; | ||
555 | info->ptMaxTrackSize.y = height; | ||
556 | } | ||
557 | return(0); | ||
558 | #endif /* WM_GETMINMAXINFO */ | ||
559 | |||
560 | case WM_WINDOWPOSCHANGING: { | ||
561 | WINDOWPOS *windowpos = (WINDOWPOS*)lParam; | ||
562 | |||
563 | /* When menu is at the side or top, Windows likes | ||
564 | to try to reposition the fullscreen window when | ||
565 | changing video modes. | ||
566 | */ | ||
567 | if ( !SDL_resizing && | ||
568 | SDL_PublicSurface && | ||
569 | (SDL_PublicSurface->flags & SDL_FULLSCREEN) ) { | ||
570 | windowpos->x = 0; | ||
571 | windowpos->y = 0; | ||
572 | } | ||
573 | } | ||
574 | return(0); | ||
575 | |||
576 | case WM_WINDOWPOSCHANGED: { | ||
577 | SDL_VideoDevice *this = current_video; | ||
578 | POINT pt; | ||
579 | int w, h; | ||
580 | |||
581 | GetClientRect(SDL_Window, &SDL_bounds); | ||
582 | |||
583 | /* avoiding type-punning here... */ | ||
584 | pt.x = SDL_bounds.left; | ||
585 | pt.y = SDL_bounds.top; | ||
586 | ClientToScreen(SDL_Window, &pt); | ||
587 | SDL_bounds.left = pt.x; | ||
588 | SDL_bounds.top = pt.y; | ||
589 | |||
590 | pt.x = SDL_bounds.right; | ||
591 | pt.y = SDL_bounds.bottom; | ||
592 | ClientToScreen(SDL_Window, &pt); | ||
593 | SDL_bounds.right = pt.x; | ||
594 | SDL_bounds.bottom = pt.y; | ||
595 | |||
596 | if ( !SDL_resizing && !IsZoomed(SDL_Window) && | ||
597 | SDL_PublicSurface && | ||
598 | !(SDL_PublicSurface->flags & SDL_FULLSCREEN) ) { | ||
599 | SDL_windowX = SDL_bounds.left; | ||
600 | SDL_windowY = SDL_bounds.top; | ||
601 | } | ||
602 | w = SDL_bounds.right-SDL_bounds.left; | ||
603 | h = SDL_bounds.bottom-SDL_bounds.top; | ||
604 | if ( this->input_grab != SDL_GRAB_OFF ) { | ||
605 | ClipCursor(&SDL_bounds); | ||
606 | } | ||
607 | if ( SDL_PublicSurface && | ||
608 | (SDL_PublicSurface->flags & SDL_RESIZABLE) ) { | ||
609 | SDL_PrivateResize(w, h); | ||
610 | } | ||
611 | } | ||
612 | break; | ||
613 | |||
614 | /* We need to set the cursor */ | ||
615 | case WM_SETCURSOR: { | ||
616 | Uint16 hittest; | ||
617 | |||
618 | hittest = LOWORD(lParam); | ||
619 | if ( hittest == HTCLIENT ) { | ||
620 | SetCursor(SDL_hcursor); | ||
621 | return(TRUE); | ||
622 | } | ||
623 | } | ||
624 | break; | ||
625 | |||
626 | /* We are about to get palette focus! */ | ||
627 | case WM_QUERYNEWPALETTE: { | ||
628 | WIN_RealizePalette(current_video); | ||
629 | return(TRUE); | ||
630 | } | ||
631 | break; | ||
632 | |||
633 | /* Another application changed the palette */ | ||
634 | case WM_PALETTECHANGED: { | ||
635 | WIN_PaletteChanged(current_video, (HWND)wParam); | ||
636 | } | ||
637 | break; | ||
638 | |||
639 | /* We were occluded, refresh our display */ | ||
640 | case WM_PAINT: { | ||
641 | HDC hdc; | ||
642 | PAINTSTRUCT ps; | ||
643 | |||
644 | hdc = BeginPaint(SDL_Window, &ps); | ||
645 | if ( current_video->screen && | ||
646 | !(current_video->screen->flags & SDL_OPENGL) ) { | ||
647 | WIN_WinPAINT(current_video, hdc); | ||
648 | } | ||
649 | EndPaint(SDL_Window, &ps); | ||
650 | } | ||
651 | return(0); | ||
652 | |||
653 | /* DJM: Send an expose event in this case */ | ||
654 | case WM_ERASEBKGND: { | ||
655 | posted = SDL_PrivateExpose(); | ||
656 | } | ||
657 | return(0); | ||
658 | |||
659 | case WM_CLOSE: { | ||
660 | if ( (posted = SDL_PrivateQuit()) ) | ||
661 | PostQuitMessage(0); | ||
662 | } | ||
663 | return(0); | ||
664 | |||
665 | case WM_DESTROY: { | ||
666 | PostQuitMessage(0); | ||
667 | } | ||
668 | return(0); | ||
669 | |||
670 | #ifndef NO_GETKEYBOARDSTATE | ||
671 | case WM_INPUTLANGCHANGE: | ||
672 | #ifndef _WIN64 | ||
673 | codepage = GetCodePage(); | ||
674 | #endif | ||
675 | return(TRUE); | ||
676 | #endif | ||
677 | |||
678 | default: { | ||
679 | /* Special handling by the video driver */ | ||
680 | if (HandleMessage) { | ||
681 | return(HandleMessage(current_video, | ||
682 | hwnd, msg, wParam, lParam)); | ||
683 | } | ||
684 | } | ||
685 | break; | ||
686 | } | ||
687 | return(DefWindowProc(hwnd, msg, wParam, lParam)); | ||
688 | } | ||
689 | |||
690 | /* Allow the application handle to be stored and retrieved later */ | ||
691 | static void *SDL_handle = NULL; | ||
692 | |||
693 | void SDL_SetModuleHandle(void *handle) | ||
694 | { | ||
695 | SDL_handle = handle; | ||
696 | } | ||
697 | void *SDL_GetModuleHandle(void) | ||
698 | { | ||
699 | void *handle; | ||
700 | |||
701 | if ( SDL_handle ) { | ||
702 | handle = SDL_handle; | ||
703 | } else { | ||
704 | handle = GetModuleHandle(NULL); | ||
705 | } | ||
706 | return(handle); | ||
707 | } | ||
708 | |||
709 | /* This allows the SDL_WINDOWID hack */ | ||
710 | BOOL SDL_windowid = FALSE; | ||
711 | |||
712 | static int app_registered = 0; | ||
713 | |||
714 | /* Register the class for this application -- exported for winmain.c */ | ||
715 | int SDL_RegisterApp(char *name, Uint32 style, void *hInst) | ||
716 | { | ||
717 | WNDCLASS class; | ||
718 | #ifdef WM_MOUSELEAVE | ||
719 | HMODULE handle; | ||
720 | #endif | ||
721 | |||
722 | /* Only do this once... */ | ||
723 | if ( app_registered ) { | ||
724 | ++app_registered; | ||
725 | return(0); | ||
726 | } | ||
727 | |||
728 | #ifndef CS_BYTEALIGNCLIENT | ||
729 | #define CS_BYTEALIGNCLIENT 0 | ||
730 | #endif | ||
731 | if ( ! name && ! SDL_Appname ) { | ||
732 | name = "SDL_app"; | ||
733 | SDL_Appstyle = CS_BYTEALIGNCLIENT; | ||
734 | SDL_Instance = hInst ? hInst : SDL_GetModuleHandle(); | ||
735 | } | ||
736 | |||
737 | if ( name ) { | ||
738 | #ifdef _WIN32_WCE | ||
739 | /* WinCE uses the UNICODE version */ | ||
740 | SDL_Appname = SDL_iconv_utf8_ucs2(name); | ||
741 | #else | ||
742 | SDL_Appname = SDL_iconv_utf8_locale(name); | ||
743 | #endif /* _WIN32_WCE */ | ||
744 | SDL_Appstyle = style; | ||
745 | SDL_Instance = hInst ? hInst : SDL_GetModuleHandle(); | ||
746 | } | ||
747 | |||
748 | /* Register the application class */ | ||
749 | class.hCursor = NULL; | ||
750 | class.hIcon = LoadImage(SDL_Instance, SDL_Appname, | ||
751 | IMAGE_ICON, | ||
752 | 0, 0, LR_DEFAULTCOLOR); | ||
753 | class.lpszMenuName = NULL; | ||
754 | class.lpszClassName = SDL_Appname; | ||
755 | class.hbrBackground = NULL; | ||
756 | class.hInstance = SDL_Instance; | ||
757 | class.style = SDL_Appstyle; | ||
758 | #if SDL_VIDEO_OPENGL | ||
759 | class.style |= CS_OWNDC; | ||
760 | #endif | ||
761 | class.lpfnWndProc = WinMessage; | ||
762 | class.cbWndExtra = 0; | ||
763 | class.cbClsExtra = 0; | ||
764 | if ( ! RegisterClass(&class) ) { | ||
765 | SDL_SetError("Couldn't register application class"); | ||
766 | return(-1); | ||
767 | } | ||
768 | |||
769 | #ifdef WM_MOUSELEAVE | ||
770 | /* Get the version of TrackMouseEvent() we use */ | ||
771 | _TrackMouseEvent = NULL; | ||
772 | handle = GetModuleHandle("USER32.DLL"); | ||
773 | if ( handle ) { | ||
774 | _TrackMouseEvent = (BOOL (WINAPI *)(TRACKMOUSEEVENT *))GetProcAddress(handle, "TrackMouseEvent"); | ||
775 | } | ||
776 | if ( _TrackMouseEvent == NULL ) { | ||
777 | _TrackMouseEvent = WIN_TrackMouseEvent; | ||
778 | } | ||
779 | #endif /* WM_MOUSELEAVE */ | ||
780 | |||
781 | #ifndef NO_GETKEYBOARDSTATE | ||
782 | #ifndef _WIN64 | ||
783 | /* Initialise variables for SDL_ToUnicode() */ | ||
784 | codepage = GetCodePage(); | ||
785 | |||
786 | /* Cygwin headers don't match windows.h, so we have to cast around a | ||
787 | const issue here... */ | ||
788 | SDL_ToUnicode = Is9xME() ? ToUnicode9xME : (ToUnicodeFN) ToUnicode; | ||
789 | #endif | ||
790 | #endif /* NO_GETKEYBOARDSTATE */ | ||
791 | |||
792 | app_registered = 1; | ||
793 | return(0); | ||
794 | } | ||
795 | |||
796 | /* Unregisters the windowclass registered in SDL_RegisterApp above. */ | ||
797 | void SDL_UnregisterApp() | ||
798 | { | ||
799 | WNDCLASS class; | ||
800 | |||
801 | /* SDL_RegisterApp might not have been called before */ | ||
802 | if ( !app_registered ) { | ||
803 | return; | ||
804 | } | ||
805 | --app_registered; | ||
806 | if ( app_registered == 0 ) { | ||
807 | /* Check for any registered window classes. */ | ||
808 | if ( GetClassInfo(SDL_Instance, SDL_Appname, &class) ) { | ||
809 | UnregisterClass(SDL_Appname, SDL_Instance); | ||
810 | } | ||
811 | SDL_free(SDL_Appname); | ||
812 | SDL_Appname = NULL; | ||
813 | } | ||
814 | } | ||
815 | |||
816 | #ifndef NO_GETKEYBOARDSTATE | ||
817 | #ifndef _WIN64 | ||
818 | /* JFP: Implementation of ToUnicode() that works on 9x/ME/2K/XP */ | ||
819 | |||
820 | static int Is9xME() | ||
821 | { | ||
822 | OSVERSIONINFO info; | ||
823 | |||
824 | SDL_memset(&info, 0, sizeof(info)); | ||
825 | info.dwOSVersionInfoSize = sizeof(info); | ||
826 | if (!GetVersionEx(&info)) { | ||
827 | return 0; | ||
828 | } | ||
829 | return (info.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS); | ||
830 | } | ||
831 | |||
832 | static int GetCodePage() | ||
833 | { | ||
834 | char buff[8]; | ||
835 | int lcid = MAKELCID(LOWORD(GetKeyboardLayout(0)), SORT_DEFAULT); | ||
836 | int cp = GetACP(); | ||
837 | |||
838 | if (GetLocaleInfo(lcid, LOCALE_IDEFAULTANSICODEPAGE, buff, sizeof(buff))) { | ||
839 | cp = SDL_atoi(buff); | ||
840 | } | ||
841 | return cp; | ||
842 | } | ||
843 | |||
844 | static int WINAPI ToUnicode9xME(UINT vkey, UINT scancode, const BYTE *keystate, LPWSTR wchars, int wsize, UINT flags) | ||
845 | { | ||
846 | BYTE chars[2]; | ||
847 | |||
848 | /* arg #3 should be const BYTE *, but cygwin lists it as PBYTE. */ | ||
849 | if (ToAsciiEx(vkey, scancode, (PBYTE) keystate, (WORD*)chars, 0, GetKeyboardLayout(0)) == 1) { | ||
850 | return MultiByteToWideChar(codepage, 0, (LPCSTR) chars, 1, wchars, wsize); | ||
851 | } | ||
852 | return 0; | ||
853 | } | ||
854 | #endif | ||
855 | #endif /* !NO_GETKEYBOARDSTATE */ | ||
diff --git a/apps/plugins/sdl/src/video/wincommon/SDL_sysmouse.c b/apps/plugins/sdl/src/video/wincommon/SDL_sysmouse.c new file mode 100644 index 0000000000..12d17e0e83 --- /dev/null +++ b/apps/plugins/sdl/src/video/wincommon/SDL_sysmouse.c | |||
@@ -0,0 +1,259 @@ | |||
1 | /* | ||
2 | SDL - Simple DirectMedia Layer | ||
3 | Copyright (C) 1997-2012 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 | #define WIN32_LEAN_AND_MEAN | ||
25 | #include <windows.h> | ||
26 | |||
27 | #include "SDL_mouse.h" | ||
28 | #include "../../events/SDL_events_c.h" | ||
29 | #include "../SDL_cursor_c.h" | ||
30 | #include "SDL_sysmouse_c.h" | ||
31 | #include "SDL_lowvideo.h" | ||
32 | |||
33 | #ifdef _WIN32_WCE | ||
34 | #define USE_STATIC_CURSOR | ||
35 | #endif | ||
36 | |||
37 | HCURSOR SDL_hcursor = NULL; /* Exported for SDL_eventloop.c */ | ||
38 | |||
39 | /* The implementation dependent data for the window manager cursor */ | ||
40 | /* For some reason when creating a windows cursor, the ands and xors memory | ||
41 | is not copied, so we need to keep track of it and free it when we are done | ||
42 | with the cursor. If we free the memory prematurely, the app crashes. :-} | ||
43 | */ | ||
44 | struct WMcursor { | ||
45 | HCURSOR curs; | ||
46 | #ifndef USE_STATIC_CURSOR | ||
47 | Uint8 *ands; | ||
48 | Uint8 *xors; | ||
49 | #endif | ||
50 | }; | ||
51 | |||
52 | /* Convert bits to padded bytes */ | ||
53 | #define PAD_BITS(bits) ((bits+7)/8) | ||
54 | |||
55 | #ifdef CURSOR_DEBUG | ||
56 | static void PrintBITMAP(FILE *out, char *bits, int w, int h) | ||
57 | { | ||
58 | int i; | ||
59 | unsigned char ch; | ||
60 | |||
61 | while ( h-- > 0 ) { | ||
62 | for ( i=0; i<w; ++i ) { | ||
63 | if ( (i%8) == 0 ) | ||
64 | ch = *bits++; | ||
65 | if ( ch&0x80 ) | ||
66 | fprintf(out, "X"); | ||
67 | else | ||
68 | fprintf(out, " "); | ||
69 | ch <<= 1; | ||
70 | } | ||
71 | fprintf(out, "\n"); | ||
72 | } | ||
73 | } | ||
74 | #endif | ||
75 | |||
76 | #ifndef USE_STATIC_CURSOR | ||
77 | /* Local functions to convert the SDL cursor mask into Windows format */ | ||
78 | static void memnot(Uint8 *dst, Uint8 *src, int len) | ||
79 | { | ||
80 | while ( len-- > 0 ) | ||
81 | *dst++ = ~*src++; | ||
82 | } | ||
83 | static void memxor(Uint8 *dst, Uint8 *src1, Uint8 *src2, int len) | ||
84 | { | ||
85 | while ( len-- > 0 ) | ||
86 | *dst++ = (*src1++)^(*src2++); | ||
87 | } | ||
88 | #endif /* !USE_STATIC_CURSOR */ | ||
89 | |||
90 | void WIN_FreeWMCursor(_THIS, WMcursor *cursor) | ||
91 | { | ||
92 | #ifndef USE_STATIC_CURSOR | ||
93 | if ( cursor->curs == GetCursor() ) | ||
94 | SetCursor(NULL); | ||
95 | if ( cursor->curs != NULL ) | ||
96 | DestroyCursor(cursor->curs); | ||
97 | if ( cursor->ands != NULL ) | ||
98 | SDL_free(cursor->ands); | ||
99 | if ( cursor->xors != NULL ) | ||
100 | SDL_free(cursor->xors); | ||
101 | #endif /* !USE_STATIC_CURSOR */ | ||
102 | SDL_free(cursor); | ||
103 | } | ||
104 | |||
105 | WMcursor *WIN_CreateWMCursor(_THIS, | ||
106 | Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y) | ||
107 | { | ||
108 | #ifdef USE_STATIC_CURSOR | ||
109 | WMcursor *cursor; | ||
110 | |||
111 | /* Allocate the cursor */ | ||
112 | cursor = (WMcursor *)SDL_malloc(sizeof(*cursor)); | ||
113 | if ( cursor ) { | ||
114 | cursor->curs = LoadCursor(NULL, IDC_ARROW); | ||
115 | } | ||
116 | return(cursor); | ||
117 | #else | ||
118 | WMcursor *cursor; | ||
119 | int allowed_x; | ||
120 | int allowed_y; | ||
121 | int run, pad, i; | ||
122 | Uint8 *aptr, *xptr; | ||
123 | |||
124 | /* Check to make sure the cursor size is okay */ | ||
125 | allowed_x = GetSystemMetrics(SM_CXCURSOR); | ||
126 | allowed_y = GetSystemMetrics(SM_CYCURSOR); | ||
127 | if ( (w > allowed_x) || (h > allowed_y) ) { | ||
128 | SDL_SetError("Only cursors of dimension (%dx%d) are allowed", | ||
129 | allowed_x, allowed_y); | ||
130 | return(NULL); | ||
131 | } | ||
132 | |||
133 | /* Allocate the cursor */ | ||
134 | cursor = (WMcursor *)SDL_malloc(sizeof(*cursor)); | ||
135 | if ( cursor == NULL ) { | ||
136 | SDL_SetError("Out of memory"); | ||
137 | return(NULL); | ||
138 | } | ||
139 | cursor->curs = NULL; | ||
140 | cursor->ands = NULL; | ||
141 | cursor->xors = NULL; | ||
142 | |||
143 | /* Pad out to the normal cursor size */ | ||
144 | run = PAD_BITS(w); | ||
145 | pad = PAD_BITS(allowed_x)-run; | ||
146 | aptr = cursor->ands = (Uint8 *)SDL_malloc((run+pad)*allowed_y); | ||
147 | xptr = cursor->xors = (Uint8 *)SDL_malloc((run+pad)*allowed_y); | ||
148 | if ( (aptr == NULL) || (xptr == NULL) ) { | ||
149 | WIN_FreeWMCursor(NULL, cursor); | ||
150 | SDL_OutOfMemory(); | ||
151 | return(NULL); | ||
152 | } | ||
153 | for ( i=0; i<h; ++i ) { | ||
154 | memxor(xptr, data, mask, run); | ||
155 | xptr += run; | ||
156 | data += run; | ||
157 | memnot(aptr, mask, run); | ||
158 | mask += run; | ||
159 | aptr += run; | ||
160 | SDL_memset(xptr, 0, pad); | ||
161 | xptr += pad; | ||
162 | SDL_memset(aptr, ~0, pad); | ||
163 | aptr += pad; | ||
164 | } | ||
165 | pad += run; | ||
166 | for ( ; i<allowed_y; ++i ) { | ||
167 | SDL_memset(xptr, 0, pad); | ||
168 | xptr += pad; | ||
169 | SDL_memset(aptr, ~0, pad); | ||
170 | aptr += pad; | ||
171 | } | ||
172 | |||
173 | /* Create the cursor */ | ||
174 | cursor->curs = CreateCursor( | ||
175 | (HINSTANCE)GetWindowLongPtr(SDL_Window, GWLP_HINSTANCE), | ||
176 | hot_x, hot_y, allowed_x, allowed_y, | ||
177 | cursor->ands, cursor->xors); | ||
178 | if ( cursor->curs == NULL ) { | ||
179 | WIN_FreeWMCursor(NULL, cursor); | ||
180 | SDL_SetError("Windows couldn't create the requested cursor"); | ||
181 | return(NULL); | ||
182 | } | ||
183 | return(cursor); | ||
184 | #endif /* USE_STATIC_CURSOR */ | ||
185 | } | ||
186 | |||
187 | int WIN_ShowWMCursor(_THIS, WMcursor *cursor) | ||
188 | { | ||
189 | POINT mouse_pos; | ||
190 | |||
191 | if ( !this->screen ) { | ||
192 | return(0); | ||
193 | } | ||
194 | |||
195 | /* Set the window cursor to our cursor, if applicable */ | ||
196 | if ( cursor != NULL ) { | ||
197 | SDL_hcursor = cursor->curs; | ||
198 | } else { | ||
199 | SDL_hcursor = NULL; | ||
200 | } | ||
201 | GetCursorPos(&mouse_pos); | ||
202 | if ( PtInRect(&SDL_bounds, mouse_pos) ) { | ||
203 | SetCursor(SDL_hcursor); | ||
204 | } | ||
205 | return(1); | ||
206 | } | ||
207 | |||
208 | void WIN_WarpWMCursor(_THIS, Uint16 x, Uint16 y) | ||
209 | { | ||
210 | if ( mouse_relative) { | ||
211 | /* RJR: March 28, 2000 | ||
212 | leave physical cursor at center of screen if | ||
213 | mouse hidden and grabbed */ | ||
214 | SDL_PrivateMouseMotion(0, 0, x, y); | ||
215 | } else { | ||
216 | POINT pt; | ||
217 | |||
218 | /* With DirectInput the position doesn't follow | ||
219 | * the cursor, so it is set manually */ | ||
220 | if ( DINPUT() ) { | ||
221 | SDL_PrivateMouseMotion(0, 0, x, y); | ||
222 | } | ||
223 | |||
224 | pt.x = x; | ||
225 | pt.y = y; | ||
226 | ClientToScreen(SDL_Window, &pt); | ||
227 | SetCursorPos(pt.x, pt.y); | ||
228 | } | ||
229 | } | ||
230 | |||
231 | /* Update the current mouse state and position */ | ||
232 | void WIN_UpdateMouse(_THIS) | ||
233 | { | ||
234 | POINT pt; | ||
235 | |||
236 | /* Always unset SDL_APPMOUSEFOCUS to give the WM_MOUSEMOVE event | ||
237 | * handler a chance to install a TRACKMOUSEEVENT */ | ||
238 | SDL_PrivateAppActive(0, SDL_APPMOUSEFOCUS); | ||
239 | |||
240 | GetCursorPos(&pt); | ||
241 | ScreenToClient(SDL_Window, &pt); | ||
242 | SDL_PrivateMouseMotion(0,0, (Sint16)pt.x, (Sint16)pt.y); | ||
243 | } | ||
244 | |||
245 | /* Check to see if we need to enter or leave mouse relative mode */ | ||
246 | void WIN_CheckMouseMode(_THIS) | ||
247 | { | ||
248 | #ifndef _WIN32_WCE | ||
249 | /* If the mouse is hidden and input is grabbed, we use relative mode */ | ||
250 | if ( !(SDL_cursorstate & CURSOR_VISIBLE) && | ||
251 | (this->input_grab != SDL_GRAB_OFF) ) { | ||
252 | mouse_relative = 1; | ||
253 | } else { | ||
254 | mouse_relative = 0; | ||
255 | } | ||
256 | #else | ||
257 | mouse_relative = 0; | ||
258 | #endif | ||
259 | } | ||
diff --git a/apps/plugins/sdl/src/video/wincommon/SDL_sysmouse_c.h b/apps/plugins/sdl/src/video/wincommon/SDL_sysmouse_c.h new file mode 100644 index 0000000000..5d5fe8d44a --- /dev/null +++ b/apps/plugins/sdl/src/video/wincommon/SDL_sysmouse_c.h | |||
@@ -0,0 +1,33 @@ | |||
1 | /* | ||
2 | SDL - Simple DirectMedia Layer | ||
3 | Copyright (C) 1997-2012 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 | #include "SDL_lowvideo.h" | ||
25 | |||
26 | /* Functions to be exported */ | ||
27 | extern void WIN_FreeWMCursor(_THIS, WMcursor *cursor); | ||
28 | extern WMcursor *WIN_CreateWMCursor(_THIS, | ||
29 | Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y); | ||
30 | extern int WIN_ShowWMCursor(_THIS, WMcursor *cursor); | ||
31 | extern void WIN_WarpWMCursor(_THIS, Uint16 x, Uint16 y); | ||
32 | extern void WIN_UpdateMouse(_THIS); | ||
33 | extern void WIN_CheckMouseMode(_THIS); | ||
diff --git a/apps/plugins/sdl/src/video/wincommon/SDL_syswm.c b/apps/plugins/sdl/src/video/wincommon/SDL_syswm.c new file mode 100644 index 0000000000..504d95d2c6 --- /dev/null +++ b/apps/plugins/sdl/src/video/wincommon/SDL_syswm.c | |||
@@ -0,0 +1,297 @@ | |||
1 | /* | ||
2 | SDL - Simple DirectMedia Layer | ||
3 | Copyright (C) 1997-2012 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 | #define WIN32_LEAN_AND_MEAN | ||
25 | #include <windows.h> | ||
26 | |||
27 | #include "SDL_version.h" | ||
28 | #include "SDL_video.h" | ||
29 | #include "SDL_loadso.h" | ||
30 | #include "SDL_syswm.h" | ||
31 | #include "../SDL_pixels_c.h" | ||
32 | #include "../SDL_cursor_c.h" | ||
33 | #include "SDL_syswm_c.h" | ||
34 | #include "SDL_wingl_c.h" | ||
35 | |||
36 | |||
37 | #ifdef _WIN32_WCE | ||
38 | #define DISABLE_ICON_SUPPORT | ||
39 | #endif | ||
40 | |||
41 | /* The screen icon -- needs to be freed on SDL_VideoQuit() */ | ||
42 | HICON screen_icn = NULL; | ||
43 | |||
44 | /* Win32 icon mask semantics are different from those of SDL: | ||
45 | SDL applies the mask to the icon and copies result to desktop. | ||
46 | Win32 applies the mask to the desktop and XORs the icon on. | ||
47 | This means that the SDL mask needs to be applied to the icon and | ||
48 | then inverted and passed to Win32. | ||
49 | */ | ||
50 | void WIN_SetWMIcon(_THIS, SDL_Surface *icon, Uint8 *mask) | ||
51 | { | ||
52 | #ifdef DISABLE_ICON_SUPPORT | ||
53 | return; | ||
54 | #else | ||
55 | SDL_Palette *pal_256; | ||
56 | SDL_Surface *icon_256; | ||
57 | Uint8 *pdata, *pwin32; | ||
58 | Uint8 *mdata, *mwin32, m = 0; | ||
59 | int icon_len; | ||
60 | int icon_plen; | ||
61 | int icon_mlen; | ||
62 | int icon_pitch; | ||
63 | int mask_pitch; | ||
64 | SDL_Rect bounds; | ||
65 | int i, skip; | ||
66 | int row, col; | ||
67 | struct /* quasi-BMP format */ Win32Icon { | ||
68 | Uint32 biSize; | ||
69 | Sint32 biWidth; | ||
70 | Sint32 biHeight; | ||
71 | Uint16 biPlanes; | ||
72 | Uint16 biBitCount; | ||
73 | Uint32 biCompression; | ||
74 | Uint32 biSizeImage; | ||
75 | Sint32 biXPelsPerMeter; | ||
76 | Sint32 biYPelsPerMeter; | ||
77 | Uint32 biClrUsed; | ||
78 | Uint32 biClrImportant; | ||
79 | struct /* RGBQUAD -- note it's BGR ordered */ { | ||
80 | Uint8 rgbBlue; | ||
81 | Uint8 rgbGreen; | ||
82 | Uint8 rgbRed; | ||
83 | Uint8 rgbReserved; | ||
84 | } biColors[256]; | ||
85 | /* Pixels: | ||
86 | Uint8 pixels[] | ||
87 | */ | ||
88 | /* Mask: | ||
89 | Uint8 mask[] | ||
90 | */ | ||
91 | } *icon_win32; | ||
92 | |||
93 | /* Allocate the win32 bmp icon and set everything to zero */ | ||
94 | icon_pitch = ((icon->w+3)&~3); | ||
95 | mask_pitch = ((icon->w+7)/8); | ||
96 | icon_plen = icon->h*icon_pitch; | ||
97 | icon_mlen = icon->h*mask_pitch; | ||
98 | icon_len = sizeof(*icon_win32)+icon_plen+icon_mlen; | ||
99 | icon_win32 = (struct Win32Icon *)SDL_stack_alloc(Uint8, icon_len); | ||
100 | if ( icon_win32 == NULL ) { | ||
101 | return; | ||
102 | } | ||
103 | SDL_memset(icon_win32, 0, icon_len); | ||
104 | |||
105 | /* Set the basic BMP parameters */ | ||
106 | icon_win32->biSize = sizeof(*icon_win32)-sizeof(icon_win32->biColors); | ||
107 | icon_win32->biWidth = icon->w; | ||
108 | icon_win32->biHeight = icon->h*2; | ||
109 | icon_win32->biPlanes = 1; | ||
110 | icon_win32->biBitCount = 8; | ||
111 | icon_win32->biSizeImage = icon_plen+icon_mlen; | ||
112 | |||
113 | /* Allocate a standard 256 color icon surface */ | ||
114 | icon_256 = SDL_CreateRGBSurface(SDL_SWSURFACE, icon->w, icon->h, | ||
115 | icon_win32->biBitCount, 0, 0, 0, 0); | ||
116 | if ( icon_256 == NULL ) { | ||
117 | SDL_stack_free(icon_win32); | ||
118 | return; | ||
119 | } | ||
120 | pal_256 = icon_256->format->palette; | ||
121 | if (icon->format->palette && | ||
122 | (icon->format->BitsPerPixel == icon_256->format->BitsPerPixel)){ | ||
123 | Uint8 black; | ||
124 | SDL_memcpy(pal_256->colors, icon->format->palette->colors, | ||
125 | pal_256->ncolors*sizeof(SDL_Color)); | ||
126 | /* Make sure that 0 is black! */ | ||
127 | black = SDL_FindColor(pal_256, 0x00, 0x00, 0x00); | ||
128 | pal_256->colors[black] = pal_256->colors[0]; | ||
129 | pal_256->colors[0].r = 0x00; | ||
130 | pal_256->colors[0].g = 0x00; | ||
131 | pal_256->colors[0].b = 0x00; | ||
132 | } else { | ||
133 | SDL_DitherColors(pal_256->colors, | ||
134 | icon_256->format->BitsPerPixel); | ||
135 | } | ||
136 | |||
137 | /* Now copy color data to the icon BMP */ | ||
138 | for ( i=0; i<(1<<icon_win32->biBitCount); ++i ) { | ||
139 | icon_win32->biColors[i].rgbRed = pal_256->colors[i].r; | ||
140 | icon_win32->biColors[i].rgbGreen = pal_256->colors[i].g; | ||
141 | icon_win32->biColors[i].rgbBlue = pal_256->colors[i].b; | ||
142 | } | ||
143 | |||
144 | /* Convert icon to a standard surface format. This may not always | ||
145 | be necessary, as Windows supports a variety of BMP formats, but | ||
146 | it greatly simplifies our code. | ||
147 | */ | ||
148 | bounds.x = 0; | ||
149 | bounds.y = 0; | ||
150 | bounds.w = icon->w; | ||
151 | bounds.h = icon->h; | ||
152 | if ( SDL_LowerBlit(icon, &bounds, icon_256, &bounds) < 0 ) { | ||
153 | SDL_stack_free(icon_win32); | ||
154 | SDL_FreeSurface(icon_256); | ||
155 | return; | ||
156 | } | ||
157 | |||
158 | /* Copy pixels upside-down to icon BMP, masked with the icon mask */ | ||
159 | if ( SDL_MUSTLOCK(icon_256) || (icon_256->pitch != icon_pitch) ) { | ||
160 | SDL_stack_free(icon_win32); | ||
161 | SDL_FreeSurface(icon_256); | ||
162 | SDL_SetError("Warning: Unexpected icon_256 characteristics"); | ||
163 | return; | ||
164 | } | ||
165 | pdata = (Uint8 *)icon_256->pixels; | ||
166 | mdata = mask; | ||
167 | pwin32 = (Uint8 *)icon_win32+sizeof(*icon_win32)+icon_plen-icon_pitch; | ||
168 | skip = icon_pitch - icon->w; | ||
169 | for ( row=0; row<icon->h; ++row ) { | ||
170 | for ( col=0; col<icon->w; ++col ) { | ||
171 | if ( (col%8) == 0 ) { | ||
172 | m = *mdata++; | ||
173 | } | ||
174 | if ( (m&0x80) != 0x00 ) { | ||
175 | *pwin32 = *pdata; | ||
176 | } | ||
177 | m <<= 1; | ||
178 | ++pdata; | ||
179 | ++pwin32; | ||
180 | } | ||
181 | pdata += skip; | ||
182 | pwin32 += skip; | ||
183 | pwin32 -= 2*icon_pitch; | ||
184 | } | ||
185 | SDL_FreeSurface(icon_256); | ||
186 | |||
187 | /* Copy mask inverted and upside-down to icon BMP */ | ||
188 | mdata = mask; | ||
189 | mwin32 = (Uint8 *)icon_win32 | ||
190 | +sizeof(*icon_win32)+icon_plen+icon_mlen-mask_pitch; | ||
191 | for ( row=0; row<icon->h; ++row ) { | ||
192 | for ( col=0; col<mask_pitch; ++col ) { | ||
193 | *mwin32++ = ~*mdata++; | ||
194 | } | ||
195 | mwin32 -= 2*mask_pitch; | ||
196 | } | ||
197 | |||
198 | /* Finally, create the icon handle and set the window icon */ | ||
199 | screen_icn = CreateIconFromResourceEx((Uint8 *)icon_win32, icon_len, | ||
200 | TRUE, 0x00030000, icon->w, icon->h, LR_DEFAULTCOLOR); | ||
201 | if ( screen_icn == NULL ) { | ||
202 | SDL_SetError("Couldn't create Win32 icon handle"); | ||
203 | } else { | ||
204 | SetClassLongPtr(SDL_Window, GCLP_HICON, (LONG_PTR)screen_icn); | ||
205 | } | ||
206 | SDL_stack_free(icon_win32); | ||
207 | #endif /* DISABLE_ICON_SUPPORT */ | ||
208 | } | ||
209 | |||
210 | typedef BOOL (WINAPI *PtrSetWindowTextW)(HWND hWnd, LPCWSTR lpString); | ||
211 | |||
212 | void WIN_SetWMCaption(_THIS, const char *title, const char *icon) | ||
213 | { | ||
214 | #ifdef _WIN32_WCE | ||
215 | /* WinCE uses the UNICODE version */ | ||
216 | LPWSTR lpszW = SDL_iconv_utf8_ucs2((char *)title); | ||
217 | SetWindowText(SDL_Window, lpszW); | ||
218 | SDL_free(lpszW); | ||
219 | #else | ||
220 | Uint16 *lpsz = SDL_iconv_utf8_ucs2(title); | ||
221 | size_t len = WideCharToMultiByte(CP_ACP, 0, lpsz, -1, NULL, 0, NULL, NULL); | ||
222 | char *cvt = SDL_stack_alloc(char, len + 1); | ||
223 | WideCharToMultiByte(CP_ACP, 0, lpsz, -1, cvt, len, NULL, NULL); | ||
224 | SetWindowText(SDL_Window, cvt); | ||
225 | SDL_stack_free(cvt); | ||
226 | SDL_free(lpsz); | ||
227 | #endif | ||
228 | } | ||
229 | |||
230 | int WIN_IconifyWindow(_THIS) | ||
231 | { | ||
232 | ShowWindow(SDL_Window, SW_MINIMIZE); | ||
233 | return(1); | ||
234 | } | ||
235 | |||
236 | SDL_GrabMode WIN_GrabInput(_THIS, SDL_GrabMode mode) | ||
237 | { | ||
238 | if ( mode == SDL_GRAB_OFF ) { | ||
239 | ClipCursor(NULL); | ||
240 | if ( !(SDL_cursorstate & CURSOR_VISIBLE) ) { | ||
241 | /* RJR: March 28, 2000 | ||
242 | must be leaving relative mode, move mouse from | ||
243 | center of window to where it belongs ... */ | ||
244 | POINT pt; | ||
245 | int x, y; | ||
246 | SDL_GetMouseState(&x,&y); | ||
247 | pt.x = x; | ||
248 | pt.y = y; | ||
249 | ClientToScreen(SDL_Window, &pt); | ||
250 | SetCursorPos(pt.x,pt.y); | ||
251 | } | ||
252 | #ifdef _WIN32_WCE | ||
253 | AllKeys(0); | ||
254 | #endif | ||
255 | } else { | ||
256 | ClipCursor(&SDL_bounds); | ||
257 | if ( !(SDL_cursorstate & CURSOR_VISIBLE) ) { | ||
258 | /* RJR: March 28, 2000 | ||
259 | must be entering relative mode, get ready by | ||
260 | moving mouse to center of window ... */ | ||
261 | POINT pt; | ||
262 | pt.x = (SDL_VideoSurface->w/2); | ||
263 | pt.y = (SDL_VideoSurface->h/2); | ||
264 | ClientToScreen(SDL_Window, &pt); | ||
265 | SetCursorPos(pt.x, pt.y); | ||
266 | } | ||
267 | #ifdef _WIN32_WCE | ||
268 | AllKeys(1); | ||
269 | #endif | ||
270 | } | ||
271 | return(mode); | ||
272 | } | ||
273 | |||
274 | /* If 'info' is the right version, this function fills it and returns 1. | ||
275 | Otherwise, in case of a version mismatch, it returns -1. | ||
276 | */ | ||
277 | int WIN_GetWMInfo(_THIS, SDL_SysWMinfo *info) | ||
278 | { | ||
279 | if ( info->version.major <= SDL_MAJOR_VERSION ) { | ||
280 | info->window = SDL_Window; | ||
281 | if ( SDL_VERSIONNUM(info->version.major, | ||
282 | info->version.minor, | ||
283 | info->version.patch) >= | ||
284 | SDL_VERSIONNUM(1, 2, 5) ) { | ||
285 | #if SDL_VIDEO_OPENGL | ||
286 | info->hglrc = GL_hrc; | ||
287 | #else | ||
288 | info->hglrc = NULL; | ||
289 | #endif | ||
290 | } | ||
291 | return(1); | ||
292 | } else { | ||
293 | SDL_SetError("Application not compiled with SDL %d.%d\n", | ||
294 | SDL_MAJOR_VERSION, SDL_MINOR_VERSION); | ||
295 | return(-1); | ||
296 | } | ||
297 | } | ||
diff --git a/apps/plugins/sdl/src/video/wincommon/SDL_syswm_c.h b/apps/plugins/sdl/src/video/wincommon/SDL_syswm_c.h new file mode 100644 index 0000000000..a103b433b4 --- /dev/null +++ b/apps/plugins/sdl/src/video/wincommon/SDL_syswm_c.h | |||
@@ -0,0 +1,35 @@ | |||
1 | /* | ||
2 | SDL - Simple DirectMedia Layer | ||
3 | Copyright (C) 1997-2012 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 | #include "SDL_lowvideo.h" | ||
25 | |||
26 | /* Data that needs to be freed at SDL_SYS_VideoQuit() */ | ||
27 | extern HICON screen_icn; | ||
28 | |||
29 | /* Functions to be exported */ | ||
30 | extern void WIN_SetWMIcon(_THIS, SDL_Surface *icon, Uint8 *mask); | ||
31 | extern void WIN_SetWMCaption(_THIS, const char *title, const char *icon); | ||
32 | extern int WIN_IconifyWindow(_THIS); | ||
33 | extern SDL_GrabMode WIN_GrabInput(_THIS, SDL_GrabMode mode); | ||
34 | extern int WIN_GetWMInfo(_THIS, SDL_SysWMinfo *info); | ||
35 | |||
diff --git a/apps/plugins/sdl/src/video/wincommon/SDL_wingl.c b/apps/plugins/sdl/src/video/wincommon/SDL_wingl.c new file mode 100644 index 0000000000..fc4e9846d9 --- /dev/null +++ b/apps/plugins/sdl/src/video/wincommon/SDL_wingl.c | |||
@@ -0,0 +1,659 @@ | |||
1 | /* | ||
2 | SDL - Simple DirectMedia Layer | ||
3 | Copyright (C) 1997-2012 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 | /* WGL implementation of SDL OpenGL support */ | ||
25 | |||
26 | #if SDL_VIDEO_OPENGL | ||
27 | #include "SDL_opengl.h" | ||
28 | #endif | ||
29 | #include "SDL_lowvideo.h" | ||
30 | #include "SDL_wingl_c.h" | ||
31 | |||
32 | #if SDL_VIDEO_OPENGL | ||
33 | #define DEFAULT_GL_DRIVER_PATH "OPENGL32.DLL" | ||
34 | #endif | ||
35 | |||
36 | /* If setting the HDC fails, we may need to recreate the window (MSDN) */ | ||
37 | static int WIN_GL_ResetWindow(_THIS) | ||
38 | { | ||
39 | int status = 0; | ||
40 | |||
41 | #ifndef _WIN32_WCE /* FIXME WinCE needs the UNICODE version of CreateWindow() */ | ||
42 | /* This doesn't work with DirectX code (see CVS comments) */ | ||
43 | /* If we were passed a window, then we can't create a new one */ | ||
44 | if ( !SDL_windowid && SDL_strcmp(this->name, "windib") == 0 ) { | ||
45 | /* Save the existing window attributes */ | ||
46 | LONG style; | ||
47 | RECT rect = { 0, 0, 0, 0 }; | ||
48 | style = GetWindowLong(SDL_Window, GWL_STYLE); | ||
49 | GetWindowRect(SDL_Window, &rect); | ||
50 | DestroyWindow(SDL_Window); | ||
51 | WIN_FlushMessageQueue(); | ||
52 | |||
53 | SDL_resizing = 1; | ||
54 | SDL_Window = CreateWindow(SDL_Appname, SDL_Appname, | ||
55 | style, | ||
56 | rect.left, rect.top, | ||
57 | (rect.right-rect.left)+1, | ||
58 | (rect.bottom-rect.top)+1, | ||
59 | NULL, NULL, SDL_Instance, NULL); | ||
60 | WIN_FlushMessageQueue(); | ||
61 | SDL_resizing = 0; | ||
62 | |||
63 | if ( SDL_Window ) { | ||
64 | this->SetCaption(this, this->wm_title, this->wm_icon); | ||
65 | } else { | ||
66 | SDL_SetError("Couldn't create window"); | ||
67 | status = -1; | ||
68 | } | ||
69 | } else | ||
70 | #endif /* !_WIN32_WCE */ | ||
71 | { | ||
72 | SDL_SetError("Unable to reset window for OpenGL context"); | ||
73 | status = -1; | ||
74 | } | ||
75 | return(status); | ||
76 | } | ||
77 | |||
78 | #if SDL_VIDEO_OPENGL | ||
79 | |||
80 | static int ExtensionSupported(const char *extension, const char *extensions) | ||
81 | { | ||
82 | const char *start; | ||
83 | const char *where, *terminator; | ||
84 | |||
85 | /* Extension names should not have spaces. */ | ||
86 | where = SDL_strchr(extension, ' '); | ||
87 | if ( where || *extension == '\0' ) | ||
88 | return 0; | ||
89 | |||
90 | if ( ! extensions ) | ||
91 | return 0; | ||
92 | |||
93 | /* It takes a bit of care to be fool-proof about parsing the | ||
94 | * OpenGL extensions string. Don't be fooled by sub-strings, | ||
95 | * etc. */ | ||
96 | |||
97 | start = extensions; | ||
98 | |||
99 | for (;;) | ||
100 | { | ||
101 | where = SDL_strstr(start, extension); | ||
102 | if (!where) break; | ||
103 | |||
104 | terminator = where + SDL_strlen(extension); | ||
105 | if (where == start || *(where - 1) == ' ') | ||
106 | if (*terminator == ' ' || *terminator == '\0') return 1; | ||
107 | |||
108 | start = terminator; | ||
109 | } | ||
110 | |||
111 | return 0; | ||
112 | } | ||
113 | |||
114 | static int ChoosePixelFormatARB(_THIS, const int *iAttribs, const FLOAT *fAttribs) | ||
115 | { | ||
116 | HWND hwnd; | ||
117 | HDC hdc; | ||
118 | HGLRC hglrc; | ||
119 | const char * (WINAPI *wglGetExtensionsStringARB)(HDC) = 0; | ||
120 | const char *extensions; | ||
121 | int pformat = 0; | ||
122 | UINT matches = 0; | ||
123 | |||
124 | hwnd = CreateWindow(SDL_Appname, SDL_Appname, WS_POPUP | WS_DISABLED, | ||
125 | 0, 0, 10, 10, | ||
126 | NULL, NULL, SDL_Instance, NULL); | ||
127 | WIN_FlushMessageQueue(); | ||
128 | |||
129 | hdc = GetDC(hwnd); | ||
130 | |||
131 | SetPixelFormat(hdc, ChoosePixelFormat(hdc, &GL_pfd), &GL_pfd); | ||
132 | |||
133 | hglrc = this->gl_data->wglCreateContext(hdc); | ||
134 | if ( hglrc ) { | ||
135 | this->gl_data->wglMakeCurrent(hdc, hglrc); | ||
136 | } | ||
137 | |||
138 | wglGetExtensionsStringARB = (const char * (WINAPI *)(HDC)) | ||
139 | this->gl_data->wglGetProcAddress("wglGetExtensionsStringARB"); | ||
140 | |||
141 | if( wglGetExtensionsStringARB ) { | ||
142 | extensions = wglGetExtensionsStringARB(hdc); | ||
143 | } else { | ||
144 | extensions = NULL; | ||
145 | } | ||
146 | |||
147 | this->gl_data->WGL_ARB_pixel_format = 0; | ||
148 | if( ExtensionSupported("WGL_ARB_pixel_format", extensions) ) { | ||
149 | BOOL (WINAPI *wglChoosePixelFormatARB)(HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); | ||
150 | wglChoosePixelFormatARB = | ||
151 | (BOOL (WINAPI *)(HDC, const int *, const FLOAT *, UINT, int *, UINT *)) | ||
152 | this->gl_data->wglGetProcAddress("wglChoosePixelFormatARB"); | ||
153 | if( wglChoosePixelFormatARB && | ||
154 | wglChoosePixelFormatARB(hdc, iAttribs, fAttribs, 1, &pformat, &matches) && pformat ) { | ||
155 | this->gl_data->WGL_ARB_pixel_format = 1; | ||
156 | } | ||
157 | } | ||
158 | |||
159 | if ( hglrc ) { | ||
160 | this->gl_data->wglMakeCurrent(NULL, NULL); | ||
161 | this->gl_data->wglDeleteContext(hglrc); | ||
162 | } | ||
163 | ReleaseDC(hwnd, hdc); | ||
164 | DestroyWindow(hwnd); | ||
165 | WIN_FlushMessageQueue(); | ||
166 | |||
167 | return pformat; | ||
168 | } | ||
169 | |||
170 | #endif /* SDL_VIDEO_OPENGL */ | ||
171 | |||
172 | int WIN_GL_SetupWindow(_THIS) | ||
173 | { | ||
174 | int retval; | ||
175 | #if SDL_VIDEO_OPENGL | ||
176 | int i; | ||
177 | int iAttribs[64]; | ||
178 | int *iAttr; | ||
179 | int *iAccelAttr = NULL; | ||
180 | float fAttribs[1] = { 0 }; | ||
181 | const GLubyte *(WINAPI *glGetStringFunc)(GLenum); | ||
182 | const char *wglext; | ||
183 | |||
184 | /* load the gl driver from a default path */ | ||
185 | if ( ! this->gl_config.driver_loaded ) { | ||
186 | /* no driver has been loaded, use default (ourselves) */ | ||
187 | if ( WIN_GL_LoadLibrary(this, NULL) < 0 ) { | ||
188 | return(-1); | ||
189 | } | ||
190 | } | ||
191 | |||
192 | /* Set up the pixel format descriptor with our needed format */ | ||
193 | SDL_memset(&GL_pfd, 0, sizeof(GL_pfd)); | ||
194 | GL_pfd.nSize = sizeof(GL_pfd); | ||
195 | GL_pfd.nVersion = 1; | ||
196 | GL_pfd.dwFlags = (PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL); | ||
197 | if ( this->gl_config.double_buffer ) { | ||
198 | GL_pfd.dwFlags |= PFD_DOUBLEBUFFER; | ||
199 | } | ||
200 | if ( this->gl_config.stereo ) { | ||
201 | GL_pfd.dwFlags |= PFD_STEREO; | ||
202 | } | ||
203 | GL_pfd.iPixelType = PFD_TYPE_RGBA; | ||
204 | GL_pfd.cColorBits = this->gl_config.buffer_size; | ||
205 | GL_pfd.cRedBits = this->gl_config.red_size; | ||
206 | GL_pfd.cGreenBits = this->gl_config.green_size; | ||
207 | GL_pfd.cBlueBits = this->gl_config.blue_size; | ||
208 | GL_pfd.cAlphaBits = this->gl_config.alpha_size; | ||
209 | GL_pfd.cAccumRedBits = this->gl_config.accum_red_size; | ||
210 | GL_pfd.cAccumGreenBits = this->gl_config.accum_green_size; | ||
211 | GL_pfd.cAccumBlueBits = this->gl_config.accum_blue_size; | ||
212 | GL_pfd.cAccumAlphaBits = this->gl_config.accum_alpha_size; | ||
213 | GL_pfd.cAccumBits = | ||
214 | (GL_pfd.cAccumRedBits + GL_pfd.cAccumGreenBits + | ||
215 | GL_pfd.cAccumBlueBits + GL_pfd.cAccumAlphaBits); | ||
216 | GL_pfd.cDepthBits = this->gl_config.depth_size; | ||
217 | GL_pfd.cStencilBits = this->gl_config.stencil_size; | ||
218 | |||
219 | /* setup WGL_ARB_pixel_format attribs */ | ||
220 | iAttr = &iAttribs[0]; | ||
221 | |||
222 | *iAttr++ = WGL_DRAW_TO_WINDOW_ARB; | ||
223 | *iAttr++ = GL_TRUE; | ||
224 | *iAttr++ = WGL_RED_BITS_ARB; | ||
225 | *iAttr++ = this->gl_config.red_size; | ||
226 | *iAttr++ = WGL_GREEN_BITS_ARB; | ||
227 | *iAttr++ = this->gl_config.green_size; | ||
228 | *iAttr++ = WGL_BLUE_BITS_ARB; | ||
229 | *iAttr++ = this->gl_config.blue_size; | ||
230 | |||
231 | /* We always choose either FULL or NO accel on Windows, because of flaky | ||
232 | drivers. If the app didn't specify, we use FULL, because that's | ||
233 | probably what they wanted (and if you didn't care and got FULL, that's | ||
234 | a perfectly valid result in any case. */ | ||
235 | *iAttr++ = WGL_ACCELERATION_ARB; | ||
236 | iAccelAttr = iAttr; | ||
237 | if (this->gl_config.accelerated) { | ||
238 | *iAttr++ = WGL_FULL_ACCELERATION_ARB; | ||
239 | } else { | ||
240 | *iAttr++ = WGL_NO_ACCELERATION_ARB; | ||
241 | } | ||
242 | |||
243 | if ( this->gl_config.alpha_size ) { | ||
244 | *iAttr++ = WGL_ALPHA_BITS_ARB; | ||
245 | *iAttr++ = this->gl_config.alpha_size; | ||
246 | } | ||
247 | |||
248 | *iAttr++ = WGL_DOUBLE_BUFFER_ARB; | ||
249 | *iAttr++ = this->gl_config.double_buffer; | ||
250 | |||
251 | *iAttr++ = WGL_DEPTH_BITS_ARB; | ||
252 | *iAttr++ = this->gl_config.depth_size; | ||
253 | |||
254 | if ( this->gl_config.stencil_size ) { | ||
255 | *iAttr++ = WGL_STENCIL_BITS_ARB; | ||
256 | *iAttr++ = this->gl_config.stencil_size; | ||
257 | } | ||
258 | |||
259 | if ( this->gl_config.accum_red_size ) { | ||
260 | *iAttr++ = WGL_ACCUM_RED_BITS_ARB; | ||
261 | *iAttr++ = this->gl_config.accum_red_size; | ||
262 | } | ||
263 | |||
264 | if ( this->gl_config.accum_green_size ) { | ||
265 | *iAttr++ = WGL_ACCUM_GREEN_BITS_ARB; | ||
266 | *iAttr++ = this->gl_config.accum_green_size; | ||
267 | } | ||
268 | |||
269 | if ( this->gl_config.accum_blue_size ) { | ||
270 | *iAttr++ = WGL_ACCUM_BLUE_BITS_ARB; | ||
271 | *iAttr++ = this->gl_config.accum_blue_size; | ||
272 | } | ||
273 | |||
274 | if ( this->gl_config.accum_alpha_size ) { | ||
275 | *iAttr++ = WGL_ACCUM_ALPHA_BITS_ARB; | ||
276 | *iAttr++ = this->gl_config.accum_alpha_size; | ||
277 | } | ||
278 | |||
279 | if ( this->gl_config.stereo ) { | ||
280 | *iAttr++ = WGL_STEREO_ARB; | ||
281 | *iAttr++ = GL_TRUE; | ||
282 | } | ||
283 | |||
284 | if ( this->gl_config.multisamplebuffers ) { | ||
285 | *iAttr++ = WGL_SAMPLE_BUFFERS_ARB; | ||
286 | *iAttr++ = this->gl_config.multisamplebuffers; | ||
287 | } | ||
288 | |||
289 | if ( this->gl_config.multisamplesamples ) { | ||
290 | *iAttr++ = WGL_SAMPLES_ARB; | ||
291 | *iAttr++ = this->gl_config.multisamplesamples; | ||
292 | } | ||
293 | |||
294 | *iAttr = 0; | ||
295 | |||
296 | for ( i=0; ; ++i ) { | ||
297 | /* Get the window device context for our OpenGL drawing */ | ||
298 | GL_hdc = GetDC(SDL_Window); | ||
299 | if ( GL_hdc == NULL ) { | ||
300 | SDL_SetError("Unable to get DC for SDL_Window"); | ||
301 | return(-1); | ||
302 | } | ||
303 | |||
304 | /* Choose and set the closest available pixel format */ | ||
305 | pixel_format = ChoosePixelFormatARB(this, iAttribs, fAttribs); | ||
306 | /* App said "don't care about accel" and FULL accel failed. Try NO. */ | ||
307 | if ( ( !pixel_format ) && ( this->gl_config.accelerated < 0 ) ) { | ||
308 | *iAccelAttr = WGL_NO_ACCELERATION_ARB; | ||
309 | pixel_format = ChoosePixelFormatARB(this, iAttribs, fAttribs); | ||
310 | *iAccelAttr = WGL_FULL_ACCELERATION_ARB; /* if we try again. */ | ||
311 | } | ||
312 | if ( !pixel_format ) { | ||
313 | pixel_format = ChoosePixelFormat(GL_hdc, &GL_pfd); | ||
314 | } | ||
315 | if ( !pixel_format ) { | ||
316 | SDL_SetError("No matching GL pixel format available"); | ||
317 | return(-1); | ||
318 | } | ||
319 | if ( !SetPixelFormat(GL_hdc, pixel_format, &GL_pfd) ) { | ||
320 | if ( i == 0 ) { | ||
321 | /* First time through, try resetting the window */ | ||
322 | if ( WIN_GL_ResetWindow(this) < 0 ) { | ||
323 | return(-1); | ||
324 | } | ||
325 | continue; | ||
326 | } | ||
327 | SDL_SetError("Unable to set HDC pixel format"); | ||
328 | return(-1); | ||
329 | } | ||
330 | /* We either succeeded or failed by this point */ | ||
331 | break; | ||
332 | } | ||
333 | DescribePixelFormat(GL_hdc, pixel_format, sizeof(GL_pfd), &GL_pfd); | ||
334 | |||
335 | GL_hrc = this->gl_data->wglCreateContext(GL_hdc); | ||
336 | if ( GL_hrc == NULL ) { | ||
337 | SDL_SetError("Unable to create GL context"); | ||
338 | return(-1); | ||
339 | } | ||
340 | if ( WIN_GL_MakeCurrent(this) < 0 ) { | ||
341 | return(-1); | ||
342 | } | ||
343 | gl_active = 1; | ||
344 | |||
345 | /* Get the wglGetPixelFormatAttribivARB pointer for the context */ | ||
346 | if ( this->gl_data->WGL_ARB_pixel_format ) { | ||
347 | this->gl_data->wglGetPixelFormatAttribivARB = | ||
348 | (BOOL (WINAPI *)(HDC, int, int, UINT, const int *, int *)) | ||
349 | this->gl_data->wglGetProcAddress("wglGetPixelFormatAttribivARB"); | ||
350 | } else { | ||
351 | this->gl_data->wglGetPixelFormatAttribivARB = NULL; | ||
352 | } | ||
353 | |||
354 | /* Vsync control under Windows. Checking glGetString here is | ||
355 | * somewhat a documented and reliable hack - it was originally | ||
356 | * as a feature added by mistake, but since so many people rely | ||
357 | * on it, it will not be removed. strstr should be safe here.*/ | ||
358 | glGetStringFunc = WIN_GL_GetProcAddress(this, "glGetString"); | ||
359 | if ( glGetStringFunc ) { | ||
360 | wglext = (const char *)glGetStringFunc(GL_EXTENSIONS); | ||
361 | } else { | ||
362 | /* Uh oh, something is seriously wrong here... */ | ||
363 | wglext = NULL; | ||
364 | } | ||
365 | if ( wglext && SDL_strstr(wglext, "WGL_EXT_swap_control") ) { | ||
366 | this->gl_data->wglSwapIntervalEXT = WIN_GL_GetProcAddress(this, "wglSwapIntervalEXT"); | ||
367 | this->gl_data->wglGetSwapIntervalEXT = WIN_GL_GetProcAddress(this, "wglGetSwapIntervalEXT"); | ||
368 | } else { | ||
369 | this->gl_data->wglSwapIntervalEXT = NULL; | ||
370 | this->gl_data->wglGetSwapIntervalEXT = NULL; | ||
371 | } | ||
372 | if ( this->gl_config.swap_control >= 0 ) { | ||
373 | if ( this->gl_data->wglSwapIntervalEXT ) { | ||
374 | this->gl_data->wglSwapIntervalEXT(this->gl_config.swap_control); | ||
375 | } | ||
376 | } | ||
377 | #else | ||
378 | SDL_SetError("WIN driver not configured with OpenGL"); | ||
379 | #endif | ||
380 | if ( gl_active ) { | ||
381 | retval = 0; | ||
382 | } else { | ||
383 | retval = -1; | ||
384 | } | ||
385 | return(retval); | ||
386 | } | ||
387 | |||
388 | void WIN_GL_ShutDown(_THIS) | ||
389 | { | ||
390 | #if SDL_VIDEO_OPENGL | ||
391 | /* Clean up OpenGL */ | ||
392 | if ( GL_hrc ) { | ||
393 | this->gl_data->wglMakeCurrent(NULL, NULL); | ||
394 | this->gl_data->wglDeleteContext(GL_hrc); | ||
395 | GL_hrc = NULL; | ||
396 | } | ||
397 | if ( GL_hdc ) { | ||
398 | ReleaseDC(SDL_Window, GL_hdc); | ||
399 | GL_hdc = NULL; | ||
400 | } | ||
401 | gl_active = 0; | ||
402 | |||
403 | WIN_GL_UnloadLibrary(this); | ||
404 | #endif /* SDL_VIDEO_OPENGL */ | ||
405 | } | ||
406 | |||
407 | #if SDL_VIDEO_OPENGL | ||
408 | |||
409 | /* Make the current context active */ | ||
410 | int WIN_GL_MakeCurrent(_THIS) | ||
411 | { | ||
412 | int retval; | ||
413 | |||
414 | retval = 0; | ||
415 | if ( ! this->gl_data->wglMakeCurrent(GL_hdc, GL_hrc) ) { | ||
416 | SDL_SetError("Unable to make GL context current"); | ||
417 | retval = -1; | ||
418 | } | ||
419 | return(retval); | ||
420 | } | ||
421 | |||
422 | /* Get attribute data from wgl. */ | ||
423 | int WIN_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value) | ||
424 | { | ||
425 | int retval; | ||
426 | |||
427 | if (attrib == SDL_GL_SWAP_CONTROL) { | ||
428 | if ( this->gl_data->wglGetSwapIntervalEXT ) { | ||
429 | *value = this->gl_data->wglGetSwapIntervalEXT(); | ||
430 | return 0; | ||
431 | } | ||
432 | return -1; | ||
433 | } | ||
434 | |||
435 | if ( this->gl_data->wglGetPixelFormatAttribivARB ) { | ||
436 | int wgl_attrib; | ||
437 | |||
438 | switch(attrib) { | ||
439 | case SDL_GL_RED_SIZE: | ||
440 | wgl_attrib = WGL_RED_BITS_ARB; | ||
441 | break; | ||
442 | case SDL_GL_GREEN_SIZE: | ||
443 | wgl_attrib = WGL_GREEN_BITS_ARB; | ||
444 | break; | ||
445 | case SDL_GL_BLUE_SIZE: | ||
446 | wgl_attrib = WGL_BLUE_BITS_ARB; | ||
447 | break; | ||
448 | case SDL_GL_ALPHA_SIZE: | ||
449 | wgl_attrib = WGL_ALPHA_BITS_ARB; | ||
450 | break; | ||
451 | case SDL_GL_DOUBLEBUFFER: | ||
452 | wgl_attrib = WGL_DOUBLE_BUFFER_ARB; | ||
453 | break; | ||
454 | case SDL_GL_BUFFER_SIZE: | ||
455 | wgl_attrib = WGL_COLOR_BITS_ARB; | ||
456 | break; | ||
457 | case SDL_GL_DEPTH_SIZE: | ||
458 | wgl_attrib = WGL_DEPTH_BITS_ARB; | ||
459 | break; | ||
460 | case SDL_GL_STENCIL_SIZE: | ||
461 | wgl_attrib = WGL_STENCIL_BITS_ARB; | ||
462 | break; | ||
463 | case SDL_GL_ACCUM_RED_SIZE: | ||
464 | wgl_attrib = WGL_ACCUM_RED_BITS_ARB; | ||
465 | break; | ||
466 | case SDL_GL_ACCUM_GREEN_SIZE: | ||
467 | wgl_attrib = WGL_ACCUM_GREEN_BITS_ARB; | ||
468 | break; | ||
469 | case SDL_GL_ACCUM_BLUE_SIZE: | ||
470 | wgl_attrib = WGL_ACCUM_BLUE_BITS_ARB; | ||
471 | break; | ||
472 | case SDL_GL_ACCUM_ALPHA_SIZE: | ||
473 | wgl_attrib = WGL_ACCUM_ALPHA_BITS_ARB; | ||
474 | break; | ||
475 | case SDL_GL_STEREO: | ||
476 | wgl_attrib = WGL_STEREO_ARB; | ||
477 | break; | ||
478 | case SDL_GL_MULTISAMPLEBUFFERS: | ||
479 | wgl_attrib = WGL_SAMPLE_BUFFERS_ARB; | ||
480 | break; | ||
481 | case SDL_GL_MULTISAMPLESAMPLES: | ||
482 | wgl_attrib = WGL_SAMPLES_ARB; | ||
483 | break; | ||
484 | case SDL_GL_ACCELERATED_VISUAL: | ||
485 | wgl_attrib = WGL_ACCELERATION_ARB; | ||
486 | this->gl_data->wglGetPixelFormatAttribivARB(GL_hdc, pixel_format, 0, 1, &wgl_attrib, value); | ||
487 | if ( *value == WGL_NO_ACCELERATION_ARB ) { | ||
488 | *value = SDL_FALSE; | ||
489 | } else { | ||
490 | *value = SDL_TRUE; | ||
491 | } | ||
492 | return 0; | ||
493 | default: | ||
494 | return(-1); | ||
495 | } | ||
496 | this->gl_data->wglGetPixelFormatAttribivARB(GL_hdc, pixel_format, 0, 1, &wgl_attrib, value); | ||
497 | |||
498 | return 0; | ||
499 | } | ||
500 | |||
501 | retval = 0; | ||
502 | switch ( attrib ) { | ||
503 | case SDL_GL_RED_SIZE: | ||
504 | *value = GL_pfd.cRedBits; | ||
505 | break; | ||
506 | case SDL_GL_GREEN_SIZE: | ||
507 | *value = GL_pfd.cGreenBits; | ||
508 | break; | ||
509 | case SDL_GL_BLUE_SIZE: | ||
510 | *value = GL_pfd.cBlueBits; | ||
511 | break; | ||
512 | case SDL_GL_ALPHA_SIZE: | ||
513 | *value = GL_pfd.cAlphaBits; | ||
514 | break; | ||
515 | case SDL_GL_DOUBLEBUFFER: | ||
516 | if ( GL_pfd.dwFlags & PFD_DOUBLEBUFFER ) { | ||
517 | *value = 1; | ||
518 | } else { | ||
519 | *value = 0; | ||
520 | } | ||
521 | break; | ||
522 | case SDL_GL_BUFFER_SIZE: | ||
523 | *value = GL_pfd.cColorBits; | ||
524 | break; | ||
525 | case SDL_GL_DEPTH_SIZE: | ||
526 | *value = GL_pfd.cDepthBits; | ||
527 | break; | ||
528 | case SDL_GL_STENCIL_SIZE: | ||
529 | *value = GL_pfd.cStencilBits; | ||
530 | break; | ||
531 | case SDL_GL_ACCUM_RED_SIZE: | ||
532 | *value = GL_pfd.cAccumRedBits; | ||
533 | break; | ||
534 | case SDL_GL_ACCUM_GREEN_SIZE: | ||
535 | *value = GL_pfd.cAccumGreenBits; | ||
536 | break; | ||
537 | case SDL_GL_ACCUM_BLUE_SIZE: | ||
538 | *value = GL_pfd.cAccumBlueBits; | ||
539 | break; | ||
540 | case SDL_GL_ACCUM_ALPHA_SIZE: | ||
541 | *value = GL_pfd.cAccumAlphaBits; | ||
542 | break; | ||
543 | case SDL_GL_STEREO: | ||
544 | if ( GL_pfd.dwFlags & PFD_STEREO ) { | ||
545 | *value = 1; | ||
546 | } else { | ||
547 | *value = 0; | ||
548 | } | ||
549 | break; | ||
550 | case SDL_GL_MULTISAMPLEBUFFERS: | ||
551 | *value = 0; | ||
552 | break; | ||
553 | case SDL_GL_MULTISAMPLESAMPLES: | ||
554 | *value = 1; | ||
555 | break; | ||
556 | case SDL_GL_SWAP_CONTROL: | ||
557 | if ( this->gl_data->wglGetSwapIntervalEXT ) { | ||
558 | *value = this->gl_data->wglGetSwapIntervalEXT(); | ||
559 | return 0; | ||
560 | } else { | ||
561 | return -1; | ||
562 | } | ||
563 | break; | ||
564 | default: | ||
565 | retval = -1; | ||
566 | break; | ||
567 | } | ||
568 | return retval; | ||
569 | } | ||
570 | |||
571 | void WIN_GL_SwapBuffers(_THIS) | ||
572 | { | ||
573 | SwapBuffers(GL_hdc); | ||
574 | } | ||
575 | |||
576 | void WIN_GL_UnloadLibrary(_THIS) | ||
577 | { | ||
578 | if ( this->gl_config.driver_loaded ) { | ||
579 | FreeLibrary((HMODULE)this->gl_config.dll_handle); | ||
580 | |||
581 | this->gl_data->wglGetProcAddress = NULL; | ||
582 | this->gl_data->wglCreateContext = NULL; | ||
583 | this->gl_data->wglDeleteContext = NULL; | ||
584 | this->gl_data->wglMakeCurrent = NULL; | ||
585 | this->gl_data->wglGetPixelFormatAttribivARB = NULL; | ||
586 | this->gl_data->wglSwapIntervalEXT = NULL; | ||
587 | this->gl_data->wglGetSwapIntervalEXT = NULL; | ||
588 | |||
589 | this->gl_config.dll_handle = NULL; | ||
590 | this->gl_config.driver_loaded = 0; | ||
591 | } | ||
592 | } | ||
593 | |||
594 | /* Passing a NULL path means load pointers from the application */ | ||
595 | int WIN_GL_LoadLibrary(_THIS, const char* path) | ||
596 | { | ||
597 | HMODULE handle; | ||
598 | |||
599 | if ( gl_active ) { | ||
600 | SDL_SetError("OpenGL context already created"); | ||
601 | return -1; | ||
602 | } | ||
603 | |||
604 | if ( path == NULL ) { | ||
605 | path = DEFAULT_GL_DRIVER_PATH; | ||
606 | } | ||
607 | handle = LoadLibrary(path); | ||
608 | if ( handle == NULL ) { | ||
609 | SDL_SetError("Could not load OpenGL library"); | ||
610 | return -1; | ||
611 | } | ||
612 | |||
613 | /* Unload the old driver and reset the pointers */ | ||
614 | WIN_GL_UnloadLibrary(this); | ||
615 | |||
616 | /* Load new function pointers */ | ||
617 | SDL_memset(this->gl_data, 0, sizeof(*this->gl_data)); | ||
618 | this->gl_data->wglGetProcAddress = (void * (WINAPI *)(const char *)) | ||
619 | GetProcAddress(handle, "wglGetProcAddress"); | ||
620 | this->gl_data->wglCreateContext = (HGLRC (WINAPI *)(HDC)) | ||
621 | GetProcAddress(handle, "wglCreateContext"); | ||
622 | this->gl_data->wglDeleteContext = (BOOL (WINAPI *)(HGLRC)) | ||
623 | GetProcAddress(handle, "wglDeleteContext"); | ||
624 | this->gl_data->wglMakeCurrent = (BOOL (WINAPI *)(HDC, HGLRC)) | ||
625 | GetProcAddress(handle, "wglMakeCurrent"); | ||
626 | this->gl_data->wglSwapIntervalEXT = (void (WINAPI *)(int)) | ||
627 | GetProcAddress(handle, "wglSwapIntervalEXT"); | ||
628 | this->gl_data->wglGetSwapIntervalEXT = (int (WINAPI *)(void)) | ||
629 | GetProcAddress(handle, "wglGetSwapIntervalEXT"); | ||
630 | |||
631 | if ( (this->gl_data->wglGetProcAddress == NULL) || | ||
632 | (this->gl_data->wglCreateContext == NULL) || | ||
633 | (this->gl_data->wglDeleteContext == NULL) || | ||
634 | (this->gl_data->wglMakeCurrent == NULL) ) { | ||
635 | SDL_SetError("Could not retrieve OpenGL functions"); | ||
636 | FreeLibrary(handle); | ||
637 | return -1; | ||
638 | } | ||
639 | |||
640 | this->gl_config.dll_handle = handle; | ||
641 | SDL_strlcpy(this->gl_config.driver_path, path, SDL_arraysize(this->gl_config.driver_path)); | ||
642 | this->gl_config.driver_loaded = 1; | ||
643 | return 0; | ||
644 | } | ||
645 | |||
646 | void *WIN_GL_GetProcAddress(_THIS, const char* proc) | ||
647 | { | ||
648 | void *func; | ||
649 | |||
650 | /* This is to pick up extensions */ | ||
651 | func = this->gl_data->wglGetProcAddress(proc); | ||
652 | if ( ! func ) { | ||
653 | /* This is probably a normal GL function */ | ||
654 | func = GetProcAddress(this->gl_config.dll_handle, proc); | ||
655 | } | ||
656 | return func; | ||
657 | } | ||
658 | |||
659 | #endif /* SDL_VIDEO_OPENGL */ | ||
diff --git a/apps/plugins/sdl/src/video/wincommon/SDL_wingl_c.h b/apps/plugins/sdl/src/video/wincommon/SDL_wingl_c.h new file mode 100644 index 0000000000..c3f2291dbb --- /dev/null +++ b/apps/plugins/sdl/src/video/wincommon/SDL_wingl_c.h | |||
@@ -0,0 +1,135 @@ | |||
1 | /* | ||
2 | SDL - Simple DirectMedia Layer | ||
3 | Copyright (C) 1997-2012 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 | /* WGL implementation of SDL OpenGL support */ | ||
25 | |||
26 | #include "../SDL_sysvideo.h" | ||
27 | |||
28 | |||
29 | struct SDL_PrivateGLData { | ||
30 | int gl_active; /* to stop switching drivers while we have a valid context */ | ||
31 | |||
32 | #if SDL_VIDEO_OPENGL | ||
33 | PIXELFORMATDESCRIPTOR GL_pfd; | ||
34 | HDC GL_hdc; | ||
35 | HGLRC GL_hrc; | ||
36 | int pixel_format; | ||
37 | int WGL_ARB_pixel_format; | ||
38 | |||
39 | void * (WINAPI *wglGetProcAddress)(const char *proc); | ||
40 | |||
41 | HGLRC (WINAPI *wglCreateContext)(HDC hdc); | ||
42 | |||
43 | BOOL (WINAPI *wglDeleteContext)(HGLRC hglrc); | ||
44 | |||
45 | BOOL (WINAPI *wglMakeCurrent)(HDC hdc, HGLRC hglrc); | ||
46 | |||
47 | BOOL (WINAPI *wglGetPixelFormatAttribivARB)(HDC hdc, int iPixelFormat, | ||
48 | int iLayerPlane, | ||
49 | UINT nAttributes, | ||
50 | const int *piAttributes, | ||
51 | int *piValues); | ||
52 | void (WINAPI *wglSwapIntervalEXT)(int interval); | ||
53 | int (WINAPI *wglGetSwapIntervalEXT)(void); | ||
54 | #endif /* SDL_VIDEO_OPENGL */ | ||
55 | }; | ||
56 | |||
57 | /* Old variable names */ | ||
58 | #define gl_active (this->gl_data->gl_active) | ||
59 | #define GL_pfd (this->gl_data->GL_pfd) | ||
60 | #define GL_hdc (this->gl_data->GL_hdc) | ||
61 | #define GL_hrc (this->gl_data->GL_hrc) | ||
62 | #define pixel_format (this->gl_data->pixel_format) | ||
63 | |||
64 | /* OpenGL functions */ | ||
65 | extern int WIN_GL_SetupWindow(_THIS); | ||
66 | extern void WIN_GL_ShutDown(_THIS); | ||
67 | #if SDL_VIDEO_OPENGL | ||
68 | extern int WIN_GL_MakeCurrent(_THIS); | ||
69 | extern int WIN_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value); | ||
70 | extern void WIN_GL_SwapBuffers(_THIS); | ||
71 | extern void WIN_GL_UnloadLibrary(_THIS); | ||
72 | extern int WIN_GL_LoadLibrary(_THIS, const char* path); | ||
73 | extern void *WIN_GL_GetProcAddress(_THIS, const char* proc); | ||
74 | #endif | ||
75 | |||
76 | #if SDL_VIDEO_OPENGL | ||
77 | |||
78 | #ifndef WGL_ARB_pixel_format | ||
79 | #define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000 | ||
80 | #define WGL_DRAW_TO_WINDOW_ARB 0x2001 | ||
81 | #define WGL_DRAW_TO_BITMAP_ARB 0x2002 | ||
82 | #define WGL_ACCELERATION_ARB 0x2003 | ||
83 | #define WGL_NEED_PALETTE_ARB 0x2004 | ||
84 | #define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005 | ||
85 | #define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006 | ||
86 | #define WGL_SWAP_METHOD_ARB 0x2007 | ||
87 | #define WGL_NUMBER_OVERLAYS_ARB 0x2008 | ||
88 | #define WGL_NUMBER_UNDERLAYS_ARB 0x2009 | ||
89 | #define WGL_TRANSPARENT_ARB 0x200A | ||
90 | #define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037 | ||
91 | #define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038 | ||
92 | #define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039 | ||
93 | #define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A | ||
94 | #define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B | ||
95 | #define WGL_SHARE_DEPTH_ARB 0x200C | ||
96 | #define WGL_SHARE_STENCIL_ARB 0x200D | ||
97 | #define WGL_SHARE_ACCUM_ARB 0x200E | ||
98 | #define WGL_SUPPORT_GDI_ARB 0x200F | ||
99 | #define WGL_SUPPORT_OPENGL_ARB 0x2010 | ||
100 | #define WGL_DOUBLE_BUFFER_ARB 0x2011 | ||
101 | #define WGL_STEREO_ARB 0x2012 | ||
102 | #define WGL_PIXEL_TYPE_ARB 0x2013 | ||
103 | #define WGL_COLOR_BITS_ARB 0x2014 | ||
104 | #define WGL_RED_BITS_ARB 0x2015 | ||
105 | #define WGL_RED_SHIFT_ARB 0x2016 | ||
106 | #define WGL_GREEN_BITS_ARB 0x2017 | ||
107 | #define WGL_GREEN_SHIFT_ARB 0x2018 | ||
108 | #define WGL_BLUE_BITS_ARB 0x2019 | ||
109 | #define WGL_BLUE_SHIFT_ARB 0x201A | ||
110 | #define WGL_ALPHA_BITS_ARB 0x201B | ||
111 | #define WGL_ALPHA_SHIFT_ARB 0x201C | ||
112 | #define WGL_ACCUM_BITS_ARB 0x201D | ||
113 | #define WGL_ACCUM_RED_BITS_ARB 0x201E | ||
114 | #define WGL_ACCUM_GREEN_BITS_ARB 0x201F | ||
115 | #define WGL_ACCUM_BLUE_BITS_ARB 0x2020 | ||
116 | #define WGL_ACCUM_ALPHA_BITS_ARB 0x2021 | ||
117 | #define WGL_DEPTH_BITS_ARB 0x2022 | ||
118 | #define WGL_STENCIL_BITS_ARB 0x2023 | ||
119 | #define WGL_AUX_BUFFERS_ARB 0x2024 | ||
120 | #define WGL_NO_ACCELERATION_ARB 0x2025 | ||
121 | #define WGL_GENERIC_ACCELERATION_ARB 0x2026 | ||
122 | #define WGL_FULL_ACCELERATION_ARB 0x2027 | ||
123 | #define WGL_SWAP_EXCHANGE_ARB 0x2028 | ||
124 | #define WGL_SWAP_COPY_ARB 0x2029 | ||
125 | #define WGL_SWAP_UNDEFINED_ARB 0x202A | ||
126 | #define WGL_TYPE_RGBA_ARB 0x202B | ||
127 | #define WGL_TYPE_COLORINDEX_ARB 0x202C | ||
128 | #endif | ||
129 | |||
130 | #ifndef WGL_ARB_multisample | ||
131 | #define WGL_SAMPLE_BUFFERS_ARB 0x2041 | ||
132 | #define WGL_SAMPLES_ARB 0x2042 | ||
133 | #endif | ||
134 | |||
135 | #endif | ||
diff --git a/apps/plugins/sdl/src/video/wincommon/wmmsg.h b/apps/plugins/sdl/src/video/wincommon/wmmsg.h new file mode 100644 index 0000000000..175a8ceece --- /dev/null +++ b/apps/plugins/sdl/src/video/wincommon/wmmsg.h | |||
@@ -0,0 +1,1030 @@ | |||
1 | |||
2 | #define MAX_WMMSG (sizeof(wmtab)/sizeof(wmtab[0])) | ||
3 | |||
4 | char *wmtab[] = { | ||
5 | "WM_NULL", | ||
6 | "WM_CREATE", | ||
7 | "WM_DESTROY", | ||
8 | "WM_MOVE", | ||
9 | "UNKNOWN (4)", | ||
10 | "WM_SIZE", | ||
11 | "WM_ACTIVATE", | ||
12 | "WM_SETFOCUS", | ||
13 | "WM_KILLFOCUS", | ||
14 | "UNKNOWN (9)", | ||
15 | "WM_ENABLE", | ||
16 | "WM_SETREDRAW", | ||
17 | "WM_SETTEXT", | ||
18 | "WM_GETTEXT", | ||
19 | "WM_GETTEXTLENGTH", | ||
20 | "WM_PAINT", | ||
21 | "WM_CLOSE", | ||
22 | "WM_QUERYENDSESSION", | ||
23 | "WM_QUIT", | ||
24 | "WM_QUERYOPEN", | ||
25 | "WM_ERASEBKGND", | ||
26 | "WM_SYSCOLORCHANGE", | ||
27 | "WM_ENDSESSION", | ||
28 | "UNKNOWN (23)", | ||
29 | "WM_SHOWWINDOW", | ||
30 | "UNKNOWN (25)", | ||
31 | "WM_SETTINGCHANGE", | ||
32 | "WM_DEVMODECHANGE", | ||
33 | "WM_ACTIVATEAPP", | ||
34 | "WM_FONTCHANGE", | ||
35 | "WM_TIMECHANGE", | ||
36 | "WM_CANCELMODE", | ||
37 | "WM_SETCURSOR", | ||
38 | "WM_MOUSEACTIVATE", | ||
39 | "WM_CHILDACTIVATE", | ||
40 | "WM_QUEUESYNC", | ||
41 | "WM_GETMINMAXINFO", | ||
42 | "UNKNOWN (37)", | ||
43 | "WM_PAINTICON", | ||
44 | "WM_ICONERASEBKGND", | ||
45 | "WM_NEXTDLGCTL", | ||
46 | "UNKNOWN (41)", | ||
47 | "WM_SPOOLERSTATUS", | ||
48 | "WM_DRAWITEM", | ||
49 | "WM_MEASUREITEM", | ||
50 | "WM_DELETEITEM", | ||
51 | "WM_VKEYTOITEM", | ||
52 | "WM_CHARTOITEM", | ||
53 | "WM_SETFONT", | ||
54 | "WM_GETFONT", | ||
55 | "WM_SETHOTKEY", | ||
56 | "WM_GETHOTKEY", | ||
57 | "UNKNOWN (52)", | ||
58 | "UNKNOWN (53)", | ||
59 | "UNKNOWN (54)", | ||
60 | "WM_QUERYDRAGICON", | ||
61 | "UNKNOWN (56)", | ||
62 | "WM_COMPAREITEM", | ||
63 | "UNKNOWN (58)", | ||
64 | "UNKNOWN (59)", | ||
65 | "UNKNOWN (60)", | ||
66 | "WM_GETOBJECT", | ||
67 | "UNKNOWN (62)", | ||
68 | "UNKNOWN (63)", | ||
69 | "UNKNOWN (64)", | ||
70 | "WM_COMPACTING", | ||
71 | "UNKNOWN (66)", | ||
72 | "UNKNOWN (67)", | ||
73 | "WM_COMMNOTIFY", | ||
74 | "UNKNOWN (69)", | ||
75 | "WM_WINDOWPOSCHANGING", | ||
76 | "WM_WINDOWPOSCHANGED", | ||
77 | "WM_POWER", | ||
78 | "UNKNOWN (73)", | ||
79 | "WM_COPYDATA", | ||
80 | "WM_CANCELJOURNAL", | ||
81 | "UNKNOWN (76)", | ||
82 | "UNKNOWN (77)", | ||
83 | "WM_NOTIFY", | ||
84 | "UNKNOWN (79)", | ||
85 | "WM_INPUTLANGCHANGEREQUEST", | ||
86 | "WM_INPUTLANGCHANGE", | ||
87 | "WM_TCARD", | ||
88 | "WM_HELP", | ||
89 | "WM_USERCHANGED", | ||
90 | "WM_NOTIFYFORMAT", | ||
91 | "UNKNOWN (86)", | ||
92 | "UNKNOWN (87)", | ||
93 | "UNKNOWN (88)", | ||
94 | "UNKNOWN (89)", | ||
95 | "UNKNOWN (90)", | ||
96 | "UNKNOWN (91)", | ||
97 | "UNKNOWN (92)", | ||
98 | "UNKNOWN (93)", | ||
99 | "UNKNOWN (94)", | ||
100 | "UNKNOWN (95)", | ||
101 | "UNKNOWN (96)", | ||
102 | "UNKNOWN (97)", | ||
103 | "UNKNOWN (98)", | ||
104 | "UNKNOWN (99)", | ||
105 | "UNKNOWN (100)", | ||
106 | "UNKNOWN (101)", | ||
107 | "UNKNOWN (102)", | ||
108 | "UNKNOWN (103)", | ||
109 | "UNKNOWN (104)", | ||
110 | "UNKNOWN (105)", | ||
111 | "UNKNOWN (106)", | ||
112 | "UNKNOWN (107)", | ||
113 | "UNKNOWN (108)", | ||
114 | "UNKNOWN (109)", | ||
115 | "UNKNOWN (110)", | ||
116 | "UNKNOWN (111)", | ||
117 | "UNKNOWN (112)", | ||
118 | "UNKNOWN (113)", | ||
119 | "UNKNOWN (114)", | ||
120 | "UNKNOWN (115)", | ||
121 | "UNKNOWN (116)", | ||
122 | "UNKNOWN (117)", | ||
123 | "UNKNOWN (118)", | ||
124 | "UNKNOWN (119)", | ||
125 | "UNKNOWN (120)", | ||
126 | "UNKNOWN (121)", | ||
127 | "UNKNOWN (122)", | ||
128 | "WM_CONTEXTMENU", | ||
129 | "WM_STYLECHANGING", | ||
130 | "WM_STYLECHANGED", | ||
131 | "WM_DISPLAYCHANGE", | ||
132 | "WM_GETICON", | ||
133 | "WM_SETICON", | ||
134 | "WM_NCCREATE", | ||
135 | "WM_NCDESTROY", | ||
136 | "WM_NCCALCSIZE", | ||
137 | "WM_NCHITTEST", | ||
138 | "WM_NCPAINT", | ||
139 | "WM_NCACTIVATE", | ||
140 | "WM_GETDLGCODE", | ||
141 | "WM_SYNCPAINT", | ||
142 | "UNKNOWN (137)", | ||
143 | "UNKNOWN (138)", | ||
144 | "UNKNOWN (139)", | ||
145 | "UNKNOWN (140)", | ||
146 | "UNKNOWN (141)", | ||
147 | "UNKNOWN (142)", | ||
148 | "UNKNOWN (143)", | ||
149 | "UNKNOWN (144)", | ||
150 | "UNKNOWN (145)", | ||
151 | "UNKNOWN (146)", | ||
152 | "UNKNOWN (147)", | ||
153 | "UNKNOWN (148)", | ||
154 | "UNKNOWN (149)", | ||
155 | "UNKNOWN (150)", | ||
156 | "UNKNOWN (151)", | ||
157 | "UNKNOWN (152)", | ||
158 | "UNKNOWN (153)", | ||
159 | "UNKNOWN (154)", | ||
160 | "UNKNOWN (155)", | ||
161 | "UNKNOWN (156)", | ||
162 | "UNKNOWN (157)", | ||
163 | "UNKNOWN (158)", | ||
164 | "UNKNOWN (159)", | ||
165 | "WM_NCMOUSEMOVE", | ||
166 | "WM_NCLBUTTONDOWN", | ||
167 | "WM_NCLBUTTONUP", | ||
168 | "WM_NCLBUTTONDBLCLK", | ||
169 | "WM_NCRBUTTONDOWN", | ||
170 | "WM_NCRBUTTONUP", | ||
171 | "WM_NCRBUTTONDBLCLK", | ||
172 | "WM_NCMBUTTONDOWN", | ||
173 | "WM_NCMBUTTONUP", | ||
174 | "WM_NCMBUTTONDBLCLK", | ||
175 | "UNKNOWN (170)", | ||
176 | "UNKNOWN (171)", | ||
177 | "UNKNOWN (172)", | ||
178 | "UNKNOWN (173)", | ||
179 | "UNKNOWN (174)", | ||
180 | "UNKNOWN (175)", | ||
181 | "UNKNOWN (176)", | ||
182 | "UNKNOWN (177)", | ||
183 | "UNKNOWN (178)", | ||
184 | "UNKNOWN (179)", | ||
185 | "UNKNOWN (180)", | ||
186 | "UNKNOWN (181)", | ||
187 | "UNKNOWN (182)", | ||
188 | "UNKNOWN (183)", | ||
189 | "UNKNOWN (184)", | ||
190 | "UNKNOWN (185)", | ||
191 | "UNKNOWN (186)", | ||
192 | "UNKNOWN (187)", | ||
193 | "UNKNOWN (188)", | ||
194 | "UNKNOWN (189)", | ||
195 | "UNKNOWN (190)", | ||
196 | "UNKNOWN (191)", | ||
197 | "UNKNOWN (192)", | ||
198 | "UNKNOWN (193)", | ||
199 | "UNKNOWN (194)", | ||
200 | "UNKNOWN (195)", | ||
201 | "UNKNOWN (196)", | ||
202 | "UNKNOWN (197)", | ||
203 | "UNKNOWN (198)", | ||
204 | "UNKNOWN (199)", | ||
205 | "UNKNOWN (200)", | ||
206 | "UNKNOWN (201)", | ||
207 | "UNKNOWN (202)", | ||
208 | "UNKNOWN (203)", | ||
209 | "UNKNOWN (204)", | ||
210 | "UNKNOWN (205)", | ||
211 | "UNKNOWN (206)", | ||
212 | "UNKNOWN (207)", | ||
213 | "UNKNOWN (208)", | ||
214 | "UNKNOWN (209)", | ||
215 | "UNKNOWN (210)", | ||
216 | "UNKNOWN (211)", | ||
217 | "UNKNOWN (212)", | ||
218 | "UNKNOWN (213)", | ||
219 | "UNKNOWN (214)", | ||
220 | "UNKNOWN (215)", | ||
221 | "UNKNOWN (216)", | ||
222 | "UNKNOWN (217)", | ||
223 | "UNKNOWN (218)", | ||
224 | "UNKNOWN (219)", | ||
225 | "UNKNOWN (220)", | ||
226 | "UNKNOWN (221)", | ||
227 | "UNKNOWN (222)", | ||
228 | "UNKNOWN (223)", | ||
229 | "UNKNOWN (224)", | ||
230 | "UNKNOWN (225)", | ||
231 | "UNKNOWN (226)", | ||
232 | "UNKNOWN (227)", | ||
233 | "UNKNOWN (228)", | ||
234 | "UNKNOWN (229)", | ||
235 | "UNKNOWN (230)", | ||
236 | "UNKNOWN (231)", | ||
237 | "UNKNOWN (232)", | ||
238 | "UNKNOWN (233)", | ||
239 | "UNKNOWN (234)", | ||
240 | "UNKNOWN (235)", | ||
241 | "UNKNOWN (236)", | ||
242 | "UNKNOWN (237)", | ||
243 | "UNKNOWN (238)", | ||
244 | "UNKNOWN (239)", | ||
245 | "UNKNOWN (240)", | ||
246 | "UNKNOWN (241)", | ||
247 | "UNKNOWN (242)", | ||
248 | "UNKNOWN (243)", | ||
249 | "UNKNOWN (244)", | ||
250 | "UNKNOWN (245)", | ||
251 | "UNKNOWN (246)", | ||
252 | "UNKNOWN (247)", | ||
253 | "UNKNOWN (248)", | ||
254 | "UNKNOWN (249)", | ||
255 | "UNKNOWN (250)", | ||
256 | "UNKNOWN (251)", | ||
257 | "UNKNOWN (252)", | ||
258 | "UNKNOWN (253)", | ||
259 | "UNKNOWN (254)", | ||
260 | "UNKNOWN (255)", | ||
261 | "WM_KEYDOWN", | ||
262 | "WM_KEYUP", | ||
263 | "WM_CHAR", | ||
264 | "WM_DEADCHAR", | ||
265 | "WM_SYSKEYDOWN", | ||
266 | "WM_SYSKEYUP", | ||
267 | "WM_SYSCHAR", | ||
268 | "WM_SYSDEADCHAR", | ||
269 | "WM_KEYLAST", | ||
270 | "UNKNOWN (265)", | ||
271 | "UNKNOWN (266)", | ||
272 | "UNKNOWN (267)", | ||
273 | "UNKNOWN (268)", | ||
274 | "UNKNOWN (269)", | ||
275 | "UNKNOWN (270)", | ||
276 | "UNKNOWN (271)", | ||
277 | "WM_INITDIALOG", | ||
278 | "WM_COMMAND", | ||
279 | "WM_SYSCOMMAND", | ||
280 | "WM_TIMER", | ||
281 | "WM_HSCROLL", | ||
282 | "WM_VSCROLL", | ||
283 | "WM_INITMENU", | ||
284 | "WM_INITMENUPOPUP", | ||
285 | "UNKNOWN (280)", | ||
286 | "UNKNOWN (281)", | ||
287 | "UNKNOWN (282)", | ||
288 | "UNKNOWN (283)", | ||
289 | "UNKNOWN (284)", | ||
290 | "UNKNOWN (285)", | ||
291 | "UNKNOWN (286)", | ||
292 | "WM_MENUSELECT", | ||
293 | "WM_MENUCHAR", | ||
294 | "WM_ENTERIDLE", | ||
295 | "WM_MENURBUTTONUP", | ||
296 | "WM_MENUDRAG", | ||
297 | "WM_MENUGETOBJECT", | ||
298 | "WM_UNINITMENUPOPUP", | ||
299 | "WM_MENUCOMMAND", | ||
300 | "UNKNOWN (295)", | ||
301 | "UNKNOWN (296)", | ||
302 | "UNKNOWN (297)", | ||
303 | "UNKNOWN (298)", | ||
304 | "UNKNOWN (299)", | ||
305 | "UNKNOWN (300)", | ||
306 | "UNKNOWN (301)", | ||
307 | "UNKNOWN (302)", | ||
308 | "UNKNOWN (303)", | ||
309 | "UNKNOWN (304)", | ||
310 | "UNKNOWN (305)", | ||
311 | "WM_CTLCOLORMSGBOX", | ||
312 | "WM_CTLCOLOREDIT", | ||
313 | "WM_CTLCOLORLISTBOX", | ||
314 | "WM_CTLCOLORBTN", | ||
315 | "WM_CTLCOLORDLG", | ||
316 | "WM_CTLCOLORSCROLLBAR", | ||
317 | "WM_CTLCOLORSTATIC", | ||
318 | "UNKNOWN (313)", | ||
319 | "UNKNOWN (314)", | ||
320 | "UNKNOWN (315)", | ||
321 | "UNKNOWN (316)", | ||
322 | "UNKNOWN (317)", | ||
323 | "UNKNOWN (318)", | ||
324 | "UNKNOWN (319)", | ||
325 | "UNKNOWN (320)", | ||
326 | "UNKNOWN (321)", | ||
327 | "UNKNOWN (322)", | ||
328 | "UNKNOWN (323)", | ||
329 | "UNKNOWN (324)", | ||
330 | "UNKNOWN (325)", | ||
331 | "UNKNOWN (326)", | ||
332 | "UNKNOWN (327)", | ||
333 | "UNKNOWN (328)", | ||
334 | "UNKNOWN (329)", | ||
335 | "UNKNOWN (330)", | ||
336 | "UNKNOWN (331)", | ||
337 | "UNKNOWN (332)", | ||
338 | "UNKNOWN (333)", | ||
339 | "UNKNOWN (334)", | ||
340 | "UNKNOWN (335)", | ||
341 | "UNKNOWN (336)", | ||
342 | "UNKNOWN (337)", | ||
343 | "UNKNOWN (338)", | ||
344 | "UNKNOWN (339)", | ||
345 | "UNKNOWN (340)", | ||
346 | "UNKNOWN (341)", | ||
347 | "UNKNOWN (342)", | ||
348 | "UNKNOWN (343)", | ||
349 | "UNKNOWN (344)", | ||
350 | "UNKNOWN (345)", | ||
351 | "UNKNOWN (346)", | ||
352 | "UNKNOWN (347)", | ||
353 | "UNKNOWN (348)", | ||
354 | "UNKNOWN (349)", | ||
355 | "UNKNOWN (350)", | ||
356 | "UNKNOWN (351)", | ||
357 | "UNKNOWN (352)", | ||
358 | "UNKNOWN (353)", | ||
359 | "UNKNOWN (354)", | ||
360 | "UNKNOWN (355)", | ||
361 | "UNKNOWN (356)", | ||
362 | "UNKNOWN (357)", | ||
363 | "UNKNOWN (358)", | ||
364 | "UNKNOWN (359)", | ||
365 | "UNKNOWN (360)", | ||
366 | "UNKNOWN (361)", | ||
367 | "UNKNOWN (362)", | ||
368 | "UNKNOWN (363)", | ||
369 | "UNKNOWN (364)", | ||
370 | "UNKNOWN (365)", | ||
371 | "UNKNOWN (366)", | ||
372 | "UNKNOWN (367)", | ||
373 | "UNKNOWN (368)", | ||
374 | "UNKNOWN (369)", | ||
375 | "UNKNOWN (370)", | ||
376 | "UNKNOWN (371)", | ||
377 | "UNKNOWN (372)", | ||
378 | "UNKNOWN (373)", | ||
379 | "UNKNOWN (374)", | ||
380 | "UNKNOWN (375)", | ||
381 | "UNKNOWN (376)", | ||
382 | "UNKNOWN (377)", | ||
383 | "UNKNOWN (378)", | ||
384 | "UNKNOWN (379)", | ||
385 | "UNKNOWN (380)", | ||
386 | "UNKNOWN (381)", | ||
387 | "UNKNOWN (382)", | ||
388 | "UNKNOWN (383)", | ||
389 | "UNKNOWN (384)", | ||
390 | "UNKNOWN (385)", | ||
391 | "UNKNOWN (386)", | ||
392 | "UNKNOWN (387)", | ||
393 | "UNKNOWN (388)", | ||
394 | "UNKNOWN (389)", | ||
395 | "UNKNOWN (390)", | ||
396 | "UNKNOWN (391)", | ||
397 | "UNKNOWN (392)", | ||
398 | "UNKNOWN (393)", | ||
399 | "UNKNOWN (394)", | ||
400 | "UNKNOWN (395)", | ||
401 | "UNKNOWN (396)", | ||
402 | "UNKNOWN (397)", | ||
403 | "UNKNOWN (398)", | ||
404 | "UNKNOWN (399)", | ||
405 | "UNKNOWN (400)", | ||
406 | "UNKNOWN (401)", | ||
407 | "UNKNOWN (402)", | ||
408 | "UNKNOWN (403)", | ||
409 | "UNKNOWN (404)", | ||
410 | "UNKNOWN (405)", | ||
411 | "UNKNOWN (406)", | ||
412 | "UNKNOWN (407)", | ||
413 | "UNKNOWN (408)", | ||
414 | "UNKNOWN (409)", | ||
415 | "UNKNOWN (410)", | ||
416 | "UNKNOWN (411)", | ||
417 | "UNKNOWN (412)", | ||
418 | "UNKNOWN (413)", | ||
419 | "UNKNOWN (414)", | ||
420 | "UNKNOWN (415)", | ||
421 | "UNKNOWN (416)", | ||
422 | "UNKNOWN (417)", | ||
423 | "UNKNOWN (418)", | ||
424 | "UNKNOWN (419)", | ||
425 | "UNKNOWN (420)", | ||
426 | "UNKNOWN (421)", | ||
427 | "UNKNOWN (422)", | ||
428 | "UNKNOWN (423)", | ||
429 | "UNKNOWN (424)", | ||
430 | "UNKNOWN (425)", | ||
431 | "UNKNOWN (426)", | ||
432 | "UNKNOWN (427)", | ||
433 | "UNKNOWN (428)", | ||
434 | "UNKNOWN (429)", | ||
435 | "UNKNOWN (430)", | ||
436 | "UNKNOWN (431)", | ||
437 | "UNKNOWN (432)", | ||
438 | "UNKNOWN (433)", | ||
439 | "UNKNOWN (434)", | ||
440 | "UNKNOWN (435)", | ||
441 | "UNKNOWN (436)", | ||
442 | "UNKNOWN (437)", | ||
443 | "UNKNOWN (438)", | ||
444 | "UNKNOWN (439)", | ||
445 | "UNKNOWN (440)", | ||
446 | "UNKNOWN (441)", | ||
447 | "UNKNOWN (442)", | ||
448 | "UNKNOWN (443)", | ||
449 | "UNKNOWN (444)", | ||
450 | "UNKNOWN (445)", | ||
451 | "UNKNOWN (446)", | ||
452 | "UNKNOWN (447)", | ||
453 | "UNKNOWN (448)", | ||
454 | "UNKNOWN (449)", | ||
455 | "UNKNOWN (450)", | ||
456 | "UNKNOWN (451)", | ||
457 | "UNKNOWN (452)", | ||
458 | "UNKNOWN (453)", | ||
459 | "UNKNOWN (454)", | ||
460 | "UNKNOWN (455)", | ||
461 | "UNKNOWN (456)", | ||
462 | "UNKNOWN (457)", | ||
463 | "UNKNOWN (458)", | ||
464 | "UNKNOWN (459)", | ||
465 | "UNKNOWN (460)", | ||
466 | "UNKNOWN (461)", | ||
467 | "UNKNOWN (462)", | ||
468 | "UNKNOWN (463)", | ||
469 | "UNKNOWN (464)", | ||
470 | "UNKNOWN (465)", | ||
471 | "UNKNOWN (466)", | ||
472 | "UNKNOWN (467)", | ||
473 | "UNKNOWN (468)", | ||
474 | "UNKNOWN (469)", | ||
475 | "UNKNOWN (470)", | ||
476 | "UNKNOWN (471)", | ||
477 | "UNKNOWN (472)", | ||
478 | "UNKNOWN (473)", | ||
479 | "UNKNOWN (474)", | ||
480 | "UNKNOWN (475)", | ||
481 | "UNKNOWN (476)", | ||
482 | "UNKNOWN (477)", | ||
483 | "UNKNOWN (478)", | ||
484 | "UNKNOWN (479)", | ||
485 | "UNKNOWN (480)", | ||
486 | "UNKNOWN (481)", | ||
487 | "UNKNOWN (482)", | ||
488 | "UNKNOWN (483)", | ||
489 | "UNKNOWN (484)", | ||
490 | "UNKNOWN (485)", | ||
491 | "UNKNOWN (486)", | ||
492 | "UNKNOWN (487)", | ||
493 | "UNKNOWN (488)", | ||
494 | "UNKNOWN (489)", | ||
495 | "UNKNOWN (490)", | ||
496 | "UNKNOWN (491)", | ||
497 | "UNKNOWN (492)", | ||
498 | "UNKNOWN (493)", | ||
499 | "UNKNOWN (494)", | ||
500 | "UNKNOWN (495)", | ||
501 | "UNKNOWN (496)", | ||
502 | "UNKNOWN (497)", | ||
503 | "UNKNOWN (498)", | ||
504 | "UNKNOWN (499)", | ||
505 | "UNKNOWN (500)", | ||
506 | "UNKNOWN (501)", | ||
507 | "UNKNOWN (502)", | ||
508 | "UNKNOWN (503)", | ||
509 | "UNKNOWN (504)", | ||
510 | "UNKNOWN (505)", | ||
511 | "UNKNOWN (506)", | ||
512 | "UNKNOWN (507)", | ||
513 | "UNKNOWN (508)", | ||
514 | "UNKNOWN (509)", | ||
515 | "UNKNOWN (510)", | ||
516 | "UNKNOWN (511)", | ||
517 | "WM_MOUSEMOVE", | ||
518 | "WM_LBUTTONDOWN", | ||
519 | "WM_LBUTTONUP", | ||
520 | "WM_LBUTTONDBLCLK", | ||
521 | "WM_RBUTTONDOWN", | ||
522 | "WM_RBUTTONUP", | ||
523 | "WM_RBUTTONDBLCLK", | ||
524 | "WM_MBUTTONDOWN", | ||
525 | "WM_MBUTTONUP", | ||
526 | "WM_MOUSELAST", | ||
527 | "WM_MOUSEWHEEL", | ||
528 | "WM_XBUTTONDOWN", | ||
529 | "WM_XBUTTONUP", | ||
530 | "UNKNOWN (525)", | ||
531 | "UNKNOWN (526)", | ||
532 | "UNKNOWN (527)", | ||
533 | "WM_PARENTNOTIFY", | ||
534 | "WM_ENTERMENULOOP", | ||
535 | "WM_EXITMENULOOP", | ||
536 | "WM_NEXTMENU", | ||
537 | "WM_SIZING", | ||
538 | "WM_CAPTURECHANGED", | ||
539 | "WM_MOVING", | ||
540 | "UNKNOWN (535)", | ||
541 | "WM_POWERBROADCAST", | ||
542 | "WM_DEVICECHANGE", | ||
543 | "UNKNOWN (538)", | ||
544 | "UNKNOWN (539)", | ||
545 | "UNKNOWN (540)", | ||
546 | "UNKNOWN (541)", | ||
547 | "UNKNOWN (542)", | ||
548 | "UNKNOWN (543)", | ||
549 | "WM_MDICREATE", | ||
550 | "WM_MDIDESTROY", | ||
551 | "WM_MDIACTIVATE", | ||
552 | "WM_MDIRESTORE", | ||
553 | "WM_MDINEXT", | ||
554 | "WM_MDIMAXIMIZE", | ||
555 | "WM_MDITILE", | ||
556 | "WM_MDICASCADE", | ||
557 | "WM_MDIICONARRANGE", | ||
558 | "WM_MDIGETACTIVE", | ||
559 | "UNKNOWN (554)", | ||
560 | "UNKNOWN (555)", | ||
561 | "UNKNOWN (556)", | ||
562 | "UNKNOWN (557)", | ||
563 | "UNKNOWN (558)", | ||
564 | "UNKNOWN (559)", | ||
565 | "WM_MDISETMENU", | ||
566 | "WM_ENTERSIZEMOVE", | ||
567 | "WM_EXITSIZEMOVE", | ||
568 | "WM_DROPFILES", | ||
569 | "WM_MDIREFRESHMENU", | ||
570 | "UNKNOWN (565)", | ||
571 | "UNKNOWN (566)", | ||
572 | "UNKNOWN (567)", | ||
573 | "UNKNOWN (568)", | ||
574 | "UNKNOWN (569)", | ||
575 | "UNKNOWN (570)", | ||
576 | "UNKNOWN (571)", | ||
577 | "UNKNOWN (572)", | ||
578 | "UNKNOWN (573)", | ||
579 | "UNKNOWN (574)", | ||
580 | "UNKNOWN (575)", | ||
581 | "UNKNOWN (576)", | ||
582 | "UNKNOWN (577)", | ||
583 | "UNKNOWN (578)", | ||
584 | "UNKNOWN (579)", | ||
585 | "UNKNOWN (580)", | ||
586 | "UNKNOWN (581)", | ||
587 | "UNKNOWN (582)", | ||
588 | "UNKNOWN (583)", | ||
589 | "UNKNOWN (584)", | ||
590 | "UNKNOWN (585)", | ||
591 | "UNKNOWN (586)", | ||
592 | "UNKNOWN (587)", | ||
593 | "UNKNOWN (588)", | ||
594 | "UNKNOWN (589)", | ||
595 | "UNKNOWN (590)", | ||
596 | "UNKNOWN (591)", | ||
597 | "UNKNOWN (592)", | ||
598 | "UNKNOWN (593)", | ||
599 | "UNKNOWN (594)", | ||
600 | "UNKNOWN (595)", | ||
601 | "UNKNOWN (596)", | ||
602 | "UNKNOWN (597)", | ||
603 | "UNKNOWN (598)", | ||
604 | "UNKNOWN (599)", | ||
605 | "UNKNOWN (600)", | ||
606 | "UNKNOWN (601)", | ||
607 | "UNKNOWN (602)", | ||
608 | "UNKNOWN (603)", | ||
609 | "UNKNOWN (604)", | ||
610 | "UNKNOWN (605)", | ||
611 | "UNKNOWN (606)", | ||
612 | "UNKNOWN (607)", | ||
613 | "UNKNOWN (608)", | ||
614 | "UNKNOWN (609)", | ||
615 | "UNKNOWN (610)", | ||
616 | "UNKNOWN (611)", | ||
617 | "UNKNOWN (612)", | ||
618 | "UNKNOWN (613)", | ||
619 | "UNKNOWN (614)", | ||
620 | "UNKNOWN (615)", | ||
621 | "UNKNOWN (616)", | ||
622 | "UNKNOWN (617)", | ||
623 | "UNKNOWN (618)", | ||
624 | "UNKNOWN (619)", | ||
625 | "UNKNOWN (620)", | ||
626 | "UNKNOWN (621)", | ||
627 | "UNKNOWN (622)", | ||
628 | "UNKNOWN (623)", | ||
629 | "UNKNOWN (624)", | ||
630 | "UNKNOWN (625)", | ||
631 | "UNKNOWN (626)", | ||
632 | "UNKNOWN (627)", | ||
633 | "UNKNOWN (628)", | ||
634 | "UNKNOWN (629)", | ||
635 | "UNKNOWN (630)", | ||
636 | "UNKNOWN (631)", | ||
637 | "UNKNOWN (632)", | ||
638 | "UNKNOWN (633)", | ||
639 | "UNKNOWN (634)", | ||
640 | "UNKNOWN (635)", | ||
641 | "UNKNOWN (636)", | ||
642 | "UNKNOWN (637)", | ||
643 | "UNKNOWN (638)", | ||
644 | "UNKNOWN (639)", | ||
645 | "UNKNOWN (640)", | ||
646 | "UNKNOWN (641)", | ||
647 | "UNKNOWN (642)", | ||
648 | "UNKNOWN (643)", | ||
649 | "UNKNOWN (644)", | ||
650 | "UNKNOWN (645)", | ||
651 | "UNKNOWN (646)", | ||
652 | "UNKNOWN (647)", | ||
653 | "UNKNOWN (648)", | ||
654 | "UNKNOWN (649)", | ||
655 | "UNKNOWN (650)", | ||
656 | "UNKNOWN (651)", | ||
657 | "UNKNOWN (652)", | ||
658 | "UNKNOWN (653)", | ||
659 | "UNKNOWN (654)", | ||
660 | "UNKNOWN (655)", | ||
661 | "UNKNOWN (656)", | ||
662 | "UNKNOWN (657)", | ||
663 | "UNKNOWN (658)", | ||
664 | "UNKNOWN (659)", | ||
665 | "UNKNOWN (660)", | ||
666 | "UNKNOWN (661)", | ||
667 | "UNKNOWN (662)", | ||
668 | "UNKNOWN (663)", | ||
669 | "UNKNOWN (664)", | ||
670 | "UNKNOWN (665)", | ||
671 | "UNKNOWN (666)", | ||
672 | "UNKNOWN (667)", | ||
673 | "UNKNOWN (668)", | ||
674 | "UNKNOWN (669)", | ||
675 | "UNKNOWN (670)", | ||
676 | "UNKNOWN (671)", | ||
677 | "UNKNOWN (672)", | ||
678 | "WM_MOUSEHOVER", | ||
679 | "UNKNOWN (674)", | ||
680 | "WM_MOUSELEAVE", | ||
681 | "UNKNOWN (676)", | ||
682 | "UNKNOWN (677)", | ||
683 | "UNKNOWN (678)", | ||
684 | "UNKNOWN (679)", | ||
685 | "UNKNOWN (680)", | ||
686 | "UNKNOWN (681)", | ||
687 | "UNKNOWN (682)", | ||
688 | "UNKNOWN (683)", | ||
689 | "UNKNOWN (684)", | ||
690 | "UNKNOWN (685)", | ||
691 | "UNKNOWN (686)", | ||
692 | "UNKNOWN (687)", | ||
693 | "UNKNOWN (688)", | ||
694 | "UNKNOWN (689)", | ||
695 | "UNKNOWN (690)", | ||
696 | "UNKNOWN (691)", | ||
697 | "UNKNOWN (692)", | ||
698 | "UNKNOWN (693)", | ||
699 | "UNKNOWN (694)", | ||
700 | "UNKNOWN (695)", | ||
701 | "UNKNOWN (696)", | ||
702 | "UNKNOWN (697)", | ||
703 | "UNKNOWN (698)", | ||
704 | "UNKNOWN (699)", | ||
705 | "UNKNOWN (700)", | ||
706 | "UNKNOWN (701)", | ||
707 | "UNKNOWN (702)", | ||
708 | "UNKNOWN (703)", | ||
709 | "UNKNOWN (704)", | ||
710 | "UNKNOWN (705)", | ||
711 | "UNKNOWN (706)", | ||
712 | "UNKNOWN (707)", | ||
713 | "UNKNOWN (708)", | ||
714 | "UNKNOWN (709)", | ||
715 | "UNKNOWN (710)", | ||
716 | "UNKNOWN (711)", | ||
717 | "UNKNOWN (712)", | ||
718 | "UNKNOWN (713)", | ||
719 | "UNKNOWN (714)", | ||
720 | "UNKNOWN (715)", | ||
721 | "UNKNOWN (716)", | ||
722 | "UNKNOWN (717)", | ||
723 | "UNKNOWN (718)", | ||
724 | "UNKNOWN (719)", | ||
725 | "UNKNOWN (720)", | ||
726 | "UNKNOWN (721)", | ||
727 | "UNKNOWN (722)", | ||
728 | "UNKNOWN (723)", | ||
729 | "UNKNOWN (724)", | ||
730 | "UNKNOWN (725)", | ||
731 | "UNKNOWN (726)", | ||
732 | "UNKNOWN (727)", | ||
733 | "UNKNOWN (728)", | ||
734 | "UNKNOWN (729)", | ||
735 | "UNKNOWN (730)", | ||
736 | "UNKNOWN (731)", | ||
737 | "UNKNOWN (732)", | ||
738 | "UNKNOWN (733)", | ||
739 | "UNKNOWN (734)", | ||
740 | "UNKNOWN (735)", | ||
741 | "UNKNOWN (736)", | ||
742 | "UNKNOWN (737)", | ||
743 | "UNKNOWN (738)", | ||
744 | "UNKNOWN (739)", | ||
745 | "UNKNOWN (740)", | ||
746 | "UNKNOWN (741)", | ||
747 | "UNKNOWN (742)", | ||
748 | "UNKNOWN (743)", | ||
749 | "UNKNOWN (744)", | ||
750 | "UNKNOWN (745)", | ||
751 | "UNKNOWN (746)", | ||
752 | "UNKNOWN (747)", | ||
753 | "UNKNOWN (748)", | ||
754 | "UNKNOWN (749)", | ||
755 | "UNKNOWN (750)", | ||
756 | "UNKNOWN (751)", | ||
757 | "UNKNOWN (752)", | ||
758 | "UNKNOWN (753)", | ||
759 | "UNKNOWN (754)", | ||
760 | "UNKNOWN (755)", | ||
761 | "UNKNOWN (756)", | ||
762 | "UNKNOWN (757)", | ||
763 | "UNKNOWN (758)", | ||
764 | "UNKNOWN (759)", | ||
765 | "UNKNOWN (760)", | ||
766 | "UNKNOWN (761)", | ||
767 | "UNKNOWN (762)", | ||
768 | "UNKNOWN (763)", | ||
769 | "UNKNOWN (764)", | ||
770 | "UNKNOWN (765)", | ||
771 | "UNKNOWN (766)", | ||
772 | "UNKNOWN (767)", | ||
773 | "WM_CUT", | ||
774 | "WM_COPY", | ||
775 | "WM_PASTE", | ||
776 | "WM_CLEAR", | ||
777 | "WM_UNDO", | ||
778 | "WM_RENDERFORMAT", | ||
779 | "WM_RENDERALLFORMATS", | ||
780 | "WM_DESTROYCLIPBOARD", | ||
781 | "WM_DRAWCLIPBOARD", | ||
782 | "WM_PAINTCLIPBOARD", | ||
783 | "WM_VSCROLLCLIPBOARD", | ||
784 | "WM_SIZECLIPBOARD", | ||
785 | "WM_ASKCBFORMATNAME", | ||
786 | "WM_CHANGECBCHAIN", | ||
787 | "WM_HSCROLLCLIPBOARD", | ||
788 | "WM_QUERYNEWPALETTE", | ||
789 | "WM_PALETTEISCHANGING", | ||
790 | "WM_PALETTECHANGED", | ||
791 | "WM_HOTKEY", | ||
792 | "UNKNOWN (787)", | ||
793 | "UNKNOWN (788)", | ||
794 | "UNKNOWN (789)", | ||
795 | "UNKNOWN (790)", | ||
796 | "WM_PRINT", | ||
797 | "WM_PRINTCLIENT", | ||
798 | "UNKNOWN (793)", | ||
799 | "UNKNOWN (794)", | ||
800 | "UNKNOWN (795)", | ||
801 | "UNKNOWN (796)", | ||
802 | "UNKNOWN (797)", | ||
803 | "UNKNOWN (798)", | ||
804 | "UNKNOWN (799)", | ||
805 | "UNKNOWN (800)", | ||
806 | "UNKNOWN (801)", | ||
807 | "UNKNOWN (802)", | ||
808 | "UNKNOWN (803)", | ||
809 | "UNKNOWN (804)", | ||
810 | "UNKNOWN (805)", | ||
811 | "UNKNOWN (806)", | ||
812 | "UNKNOWN (807)", | ||
813 | "UNKNOWN (808)", | ||
814 | "UNKNOWN (809)", | ||
815 | "UNKNOWN (810)", | ||
816 | "UNKNOWN (811)", | ||
817 | "UNKNOWN (812)", | ||
818 | "UNKNOWN (813)", | ||
819 | "UNKNOWN (814)", | ||
820 | "UNKNOWN (815)", | ||
821 | "UNKNOWN (816)", | ||
822 | "UNKNOWN (817)", | ||
823 | "UNKNOWN (818)", | ||
824 | "UNKNOWN (819)", | ||
825 | "UNKNOWN (820)", | ||
826 | "UNKNOWN (821)", | ||
827 | "UNKNOWN (822)", | ||
828 | "UNKNOWN (823)", | ||
829 | "UNKNOWN (824)", | ||
830 | "UNKNOWN (825)", | ||
831 | "UNKNOWN (826)", | ||
832 | "UNKNOWN (827)", | ||
833 | "UNKNOWN (828)", | ||
834 | "UNKNOWN (829)", | ||
835 | "UNKNOWN (830)", | ||
836 | "UNKNOWN (831)", | ||
837 | "UNKNOWN (832)", | ||
838 | "UNKNOWN (833)", | ||
839 | "UNKNOWN (834)", | ||
840 | "UNKNOWN (835)", | ||
841 | "UNKNOWN (836)", | ||
842 | "UNKNOWN (837)", | ||
843 | "UNKNOWN (838)", | ||
844 | "UNKNOWN (839)", | ||
845 | "UNKNOWN (840)", | ||
846 | "UNKNOWN (841)", | ||
847 | "UNKNOWN (842)", | ||
848 | "UNKNOWN (843)", | ||
849 | "UNKNOWN (844)", | ||
850 | "UNKNOWN (845)", | ||
851 | "UNKNOWN (846)", | ||
852 | "UNKNOWN (847)", | ||
853 | "UNKNOWN (848)", | ||
854 | "UNKNOWN (849)", | ||
855 | "UNKNOWN (850)", | ||
856 | "UNKNOWN (851)", | ||
857 | "UNKNOWN (852)", | ||
858 | "UNKNOWN (853)", | ||
859 | "UNKNOWN (854)", | ||
860 | "UNKNOWN (855)", | ||
861 | "WM_HANDHELDFIRST", | ||
862 | "UNKNOWN (857)", | ||
863 | "UNKNOWN (858)", | ||
864 | "UNKNOWN (859)", | ||
865 | "UNKNOWN (860)", | ||
866 | "UNKNOWN (861)", | ||
867 | "UNKNOWN (862)", | ||
868 | "WM_HANDHELDLAST", | ||
869 | "WM_AFXFIRST", | ||
870 | "UNKNOWN (865)", | ||
871 | "UNKNOWN (866)", | ||
872 | "UNKNOWN (867)", | ||
873 | "UNKNOWN (868)", | ||
874 | "UNKNOWN (869)", | ||
875 | "UNKNOWN (870)", | ||
876 | "UNKNOWN (871)", | ||
877 | "UNKNOWN (872)", | ||
878 | "UNKNOWN (873)", | ||
879 | "UNKNOWN (874)", | ||
880 | "UNKNOWN (875)", | ||
881 | "UNKNOWN (876)", | ||
882 | "UNKNOWN (877)", | ||
883 | "UNKNOWN (878)", | ||
884 | "UNKNOWN (879)", | ||
885 | "UNKNOWN (880)", | ||
886 | "UNKNOWN (881)", | ||
887 | "UNKNOWN (882)", | ||
888 | "UNKNOWN (883)", | ||
889 | "UNKNOWN (884)", | ||
890 | "UNKNOWN (885)", | ||
891 | "UNKNOWN (886)", | ||
892 | "UNKNOWN (887)", | ||
893 | "UNKNOWN (888)", | ||
894 | "UNKNOWN (889)", | ||
895 | "UNKNOWN (890)", | ||
896 | "UNKNOWN (891)", | ||
897 | "UNKNOWN (892)", | ||
898 | "UNKNOWN (893)", | ||
899 | "UNKNOWN (894)", | ||
900 | "WM_AFXLAST", | ||
901 | "WM_PENWINFIRST", | ||
902 | "UNKNOWN (897)", | ||
903 | "UNKNOWN (898)", | ||
904 | "UNKNOWN (899)", | ||
905 | "UNKNOWN (900)", | ||
906 | "UNKNOWN (901)", | ||
907 | "UNKNOWN (902)", | ||
908 | "UNKNOWN (903)", | ||
909 | "UNKNOWN (904)", | ||
910 | "UNKNOWN (905)", | ||
911 | "UNKNOWN (906)", | ||
912 | "UNKNOWN (907)", | ||
913 | "UNKNOWN (908)", | ||
914 | "UNKNOWN (909)", | ||
915 | "UNKNOWN (910)", | ||
916 | "WM_PENWINLAST", | ||
917 | "UNKNOWN (912)", | ||
918 | "UNKNOWN (913)", | ||
919 | "UNKNOWN (914)", | ||
920 | "UNKNOWN (915)", | ||
921 | "UNKNOWN (916)", | ||
922 | "UNKNOWN (917)", | ||
923 | "UNKNOWN (918)", | ||
924 | "UNKNOWN (919)", | ||
925 | "UNKNOWN (920)", | ||
926 | "UNKNOWN (921)", | ||
927 | "UNKNOWN (922)", | ||
928 | "UNKNOWN (923)", | ||
929 | "UNKNOWN (924)", | ||
930 | "UNKNOWN (925)", | ||
931 | "UNKNOWN (926)", | ||
932 | "UNKNOWN (927)", | ||
933 | "UNKNOWN (928)", | ||
934 | "UNKNOWN (929)", | ||
935 | "UNKNOWN (930)", | ||
936 | "UNKNOWN (931)", | ||
937 | "UNKNOWN (932)", | ||
938 | "UNKNOWN (933)", | ||
939 | "UNKNOWN (934)", | ||
940 | "UNKNOWN (935)", | ||
941 | "UNKNOWN (936)", | ||
942 | "UNKNOWN (937)", | ||
943 | "UNKNOWN (938)", | ||
944 | "UNKNOWN (939)", | ||
945 | "UNKNOWN (940)", | ||
946 | "UNKNOWN (941)", | ||
947 | "UNKNOWN (942)", | ||
948 | "UNKNOWN (943)", | ||
949 | "UNKNOWN (944)", | ||
950 | "UNKNOWN (945)", | ||
951 | "UNKNOWN (946)", | ||
952 | "UNKNOWN (947)", | ||
953 | "UNKNOWN (948)", | ||
954 | "UNKNOWN (949)", | ||
955 | "UNKNOWN (950)", | ||
956 | "UNKNOWN (951)", | ||
957 | "UNKNOWN (952)", | ||
958 | "UNKNOWN (953)", | ||
959 | "UNKNOWN (954)", | ||
960 | "UNKNOWN (955)", | ||
961 | "UNKNOWN (956)", | ||
962 | "UNKNOWN (957)", | ||
963 | "UNKNOWN (958)", | ||
964 | "UNKNOWN (959)", | ||
965 | "UNKNOWN (960)", | ||
966 | "UNKNOWN (961)", | ||
967 | "UNKNOWN (962)", | ||
968 | "UNKNOWN (963)", | ||
969 | "UNKNOWN (964)", | ||
970 | "UNKNOWN (965)", | ||
971 | "UNKNOWN (966)", | ||
972 | "UNKNOWN (967)", | ||
973 | "UNKNOWN (968)", | ||
974 | "UNKNOWN (969)", | ||
975 | "UNKNOWN (970)", | ||
976 | "UNKNOWN (971)", | ||
977 | "UNKNOWN (972)", | ||
978 | "UNKNOWN (973)", | ||
979 | "UNKNOWN (974)", | ||
980 | "UNKNOWN (975)", | ||
981 | "UNKNOWN (976)", | ||
982 | "UNKNOWN (977)", | ||
983 | "UNKNOWN (978)", | ||
984 | "UNKNOWN (979)", | ||
985 | "UNKNOWN (980)", | ||
986 | "UNKNOWN (981)", | ||
987 | "UNKNOWN (982)", | ||
988 | "UNKNOWN (983)", | ||
989 | "UNKNOWN (984)", | ||
990 | "UNKNOWN (985)", | ||
991 | "UNKNOWN (986)", | ||
992 | "UNKNOWN (987)", | ||
993 | "UNKNOWN (988)", | ||
994 | "UNKNOWN (989)", | ||
995 | "UNKNOWN (990)", | ||
996 | "UNKNOWN (991)", | ||
997 | "UNKNOWN (992)", | ||
998 | "UNKNOWN (993)", | ||
999 | "UNKNOWN (994)", | ||
1000 | "UNKNOWN (995)", | ||
1001 | "UNKNOWN (996)", | ||
1002 | "UNKNOWN (997)", | ||
1003 | "UNKNOWN (998)", | ||
1004 | "UNKNOWN (999)", | ||
1005 | "UNKNOWN (1000)", | ||
1006 | "UNKNOWN (1001)", | ||
1007 | "UNKNOWN (1002)", | ||
1008 | "UNKNOWN (1003)", | ||
1009 | "UNKNOWN (1004)", | ||
1010 | "UNKNOWN (1005)", | ||
1011 | "UNKNOWN (1006)", | ||
1012 | "UNKNOWN (1007)", | ||
1013 | "UNKNOWN (1008)", | ||
1014 | "UNKNOWN (1009)", | ||
1015 | "UNKNOWN (1010)", | ||
1016 | "UNKNOWN (1011)", | ||
1017 | "UNKNOWN (1012)", | ||
1018 | "UNKNOWN (1013)", | ||
1019 | "UNKNOWN (1014)", | ||
1020 | "UNKNOWN (1015)", | ||
1021 | "UNKNOWN (1016)", | ||
1022 | "UNKNOWN (1017)", | ||
1023 | "UNKNOWN (1018)", | ||
1024 | "UNKNOWN (1019)", | ||
1025 | "UNKNOWN (1020)", | ||
1026 | "UNKNOWN (1021)", | ||
1027 | "UNKNOWN (1022)", | ||
1028 | "UNKNOWN (1023)", | ||
1029 | "WM_USER" | ||
1030 | }; | ||