SDL  2.0
SDL_windowsevents.c
Go to the documentation of this file.
1 /*
2  Simple DirectMedia Layer
3  Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
4 
5  This software is provided 'as-is', without any express or implied
6  warranty. In no event will the authors be held liable for any damages
7  arising from the use of this software.
8 
9  Permission is granted to anyone to use this software for any purpose,
10  including commercial applications, and to alter it and redistribute it
11  freely, subject to the following restrictions:
12 
13  1. The origin of this software must not be misrepresented; you must not
14  claim that you wrote the original software. If you use this software
15  in a product, an acknowledgment in the product documentation would be
16  appreciated but is not required.
17  2. Altered source versions must be plainly marked as such, and must not be
18  misrepresented as being the original software.
19  3. This notice may not be removed or altered from any source distribution.
20 */
21 #include "../../SDL_internal.h"
22 
23 #if SDL_VIDEO_DRIVER_WINDOWS
24 
25 #include "SDL_windowsvideo.h"
26 #include "SDL_windowsshape.h"
27 #include "SDL_system.h"
28 #include "SDL_syswm.h"
29 #include "SDL_timer.h"
30 #include "SDL_vkeys.h"
31 #include "SDL_hints.h"
32 #include "../../events/SDL_events_c.h"
33 #include "../../events/SDL_touch_c.h"
34 #include "../../events/scancodes_windows.h"
35 #include "SDL_assert.h"
36 #include "SDL_hints.h"
37 
38 /* Dropfile support */
39 #include <shellapi.h>
40 
41 /* For GET_X_LPARAM, GET_Y_LPARAM. */
42 #include <windowsx.h>
43 
44 /* #define WMMSG_DEBUG */
45 #ifdef WMMSG_DEBUG
46 #include <stdio.h>
47 #include "wmmsg.h"
48 #endif
49 
50 /* For processing mouse WM_*BUTTON* and WM_MOUSEMOVE message-data from GetMessageExtraInfo() */
51 #define MOUSEEVENTF_FROMTOUCH 0xFF515700
52 
53 /* Masks for processing the windows KEYDOWN and KEYUP messages */
54 #define REPEATED_KEYMASK (1<<30)
55 #define EXTENDED_KEYMASK (1<<24)
56 
57 #define VK_ENTER 10 /* Keypad Enter ... no VKEY defined? */
58 #ifndef VK_OEM_NEC_EQUAL
59 #define VK_OEM_NEC_EQUAL 0x92
60 #endif
61 
62 /* Make sure XBUTTON stuff is defined that isn't in older Platform SDKs... */
63 #ifndef WM_XBUTTONDOWN
64 #define WM_XBUTTONDOWN 0x020B
65 #endif
66 #ifndef WM_XBUTTONUP
67 #define WM_XBUTTONUP 0x020C
68 #endif
69 #ifndef GET_XBUTTON_WPARAM
70 #define GET_XBUTTON_WPARAM(w) (HIWORD(w))
71 #endif
72 #ifndef WM_INPUT
73 #define WM_INPUT 0x00ff
74 #endif
75 #ifndef WM_TOUCH
76 #define WM_TOUCH 0x0240
77 #endif
78 #ifndef WM_MOUSEHWHEEL
79 #define WM_MOUSEHWHEEL 0x020E
80 #endif
81 #ifndef WM_UNICHAR
82 #define WM_UNICHAR 0x0109
83 #endif
84 
85 static SDL_Scancode
86 VKeytoScancode(WPARAM vkey)
87 {
88  switch (vkey) {
89  case VK_CLEAR: return SDL_SCANCODE_CLEAR;
90  case VK_MODECHANGE: return SDL_SCANCODE_MODE;
91  case VK_SELECT: return SDL_SCANCODE_SELECT;
92  case VK_EXECUTE: return SDL_SCANCODE_EXECUTE;
93  case VK_HELP: return SDL_SCANCODE_HELP;
94  case VK_PAUSE: return SDL_SCANCODE_PAUSE;
95  case VK_NUMLOCK: return SDL_SCANCODE_NUMLOCKCLEAR;
96 
97  case VK_F13: return SDL_SCANCODE_F13;
98  case VK_F14: return SDL_SCANCODE_F14;
99  case VK_F15: return SDL_SCANCODE_F15;
100  case VK_F16: return SDL_SCANCODE_F16;
101  case VK_F17: return SDL_SCANCODE_F17;
102  case VK_F18: return SDL_SCANCODE_F18;
103  case VK_F19: return SDL_SCANCODE_F19;
104  case VK_F20: return SDL_SCANCODE_F20;
105  case VK_F21: return SDL_SCANCODE_F21;
106  case VK_F22: return SDL_SCANCODE_F22;
107  case VK_F23: return SDL_SCANCODE_F23;
108  case VK_F24: return SDL_SCANCODE_F24;
109 
110  case VK_OEM_NEC_EQUAL: return SDL_SCANCODE_KP_EQUALS;
111  case VK_BROWSER_BACK: return SDL_SCANCODE_AC_BACK;
112  case VK_BROWSER_FORWARD: return SDL_SCANCODE_AC_FORWARD;
113  case VK_BROWSER_REFRESH: return SDL_SCANCODE_AC_REFRESH;
114  case VK_BROWSER_STOP: return SDL_SCANCODE_AC_STOP;
115  case VK_BROWSER_SEARCH: return SDL_SCANCODE_AC_SEARCH;
116  case VK_BROWSER_FAVORITES: return SDL_SCANCODE_AC_BOOKMARKS;
117  case VK_BROWSER_HOME: return SDL_SCANCODE_AC_HOME;
118  case VK_VOLUME_MUTE: return SDL_SCANCODE_AUDIOMUTE;
119  case VK_VOLUME_DOWN: return SDL_SCANCODE_VOLUMEDOWN;
120  case VK_VOLUME_UP: return SDL_SCANCODE_VOLUMEUP;
121 
122  case VK_MEDIA_NEXT_TRACK: return SDL_SCANCODE_AUDIONEXT;
123  case VK_MEDIA_PREV_TRACK: return SDL_SCANCODE_AUDIOPREV;
124  case VK_MEDIA_STOP: return SDL_SCANCODE_AUDIOSTOP;
125  case VK_MEDIA_PLAY_PAUSE: return SDL_SCANCODE_AUDIOPLAY;
126  case VK_LAUNCH_MAIL: return SDL_SCANCODE_MAIL;
127  case VK_LAUNCH_MEDIA_SELECT: return SDL_SCANCODE_MEDIASELECT;
128 
130 
131  case VK_ATTN: return SDL_SCANCODE_SYSREQ;
132  case VK_CRSEL: return SDL_SCANCODE_CRSEL;
133  case VK_EXSEL: return SDL_SCANCODE_EXSEL;
134  case VK_OEM_CLEAR: return SDL_SCANCODE_CLEAR;
135 
136  case VK_LAUNCH_APP1: return SDL_SCANCODE_APP1;
137  case VK_LAUNCH_APP2: return SDL_SCANCODE_APP2;
138 
139  default: return SDL_SCANCODE_UNKNOWN;
140  }
141 }
142 
143 static SDL_Scancode
144 WindowsScanCodeToSDLScanCode(LPARAM lParam, WPARAM wParam)
145 {
146  SDL_Scancode code;
147  int nScanCode = (lParam >> 16) & 0xFF;
148  SDL_bool bIsExtended = (lParam & (1 << 24)) != 0;
149 
150  code = VKeytoScancode(wParam);
151 
152  if (code == SDL_SCANCODE_UNKNOWN && nScanCode <= 127) {
153  code = windows_scancode_table[nScanCode];
154 
155  if (bIsExtended) {
156  switch (code) {
157  case SDL_SCANCODE_RETURN:
158  code = SDL_SCANCODE_KP_ENTER;
159  break;
160  case SDL_SCANCODE_LALT:
161  code = SDL_SCANCODE_RALT;
162  break;
163  case SDL_SCANCODE_LCTRL:
164  code = SDL_SCANCODE_RCTRL;
165  break;
166  case SDL_SCANCODE_SLASH:
167  code = SDL_SCANCODE_KP_DIVIDE;
168  break;
170  code = SDL_SCANCODE_KP_PLUS;
171  break;
172  default:
173  break;
174  }
175  } else {
176  switch (code) {
177  case SDL_SCANCODE_HOME:
178  code = SDL_SCANCODE_KP_7;
179  break;
180  case SDL_SCANCODE_UP:
181  code = SDL_SCANCODE_KP_8;
182  break;
183  case SDL_SCANCODE_PAGEUP:
184  code = SDL_SCANCODE_KP_9;
185  break;
186  case SDL_SCANCODE_LEFT:
187  code = SDL_SCANCODE_KP_4;
188  break;
189  case SDL_SCANCODE_RIGHT:
190  code = SDL_SCANCODE_KP_6;
191  break;
192  case SDL_SCANCODE_END:
193  code = SDL_SCANCODE_KP_1;
194  break;
195  case SDL_SCANCODE_DOWN:
196  code = SDL_SCANCODE_KP_2;
197  break;
199  code = SDL_SCANCODE_KP_3;
200  break;
201  case SDL_SCANCODE_INSERT:
202  code = SDL_SCANCODE_KP_0;
203  break;
204  case SDL_SCANCODE_DELETE:
205  code = SDL_SCANCODE_KP_PERIOD;
206  break;
209  break;
210  default:
211  break;
212  }
213  }
214  }
215  return code;
216 }
217 
218 static SDL_bool
219 WIN_ShouldIgnoreFocusClick()
220 {
222 }
223 
224 static void
225 WIN_CheckWParamMouseButton(SDL_bool bwParamMousePressed, SDL_bool bSDLMousePressed, SDL_WindowData *data, Uint8 button, SDL_MouseID mouseID)
226 {
227  if (data->focus_click_pending & SDL_BUTTON(button)) {
228  /* Ignore the button click for activation */
229  if (!bwParamMousePressed) {
230  data->focus_click_pending &= ~SDL_BUTTON(button);
231  WIN_UpdateClipCursor(data->window);
232  }
233  if (WIN_ShouldIgnoreFocusClick()) {
234  return;
235  }
236  }
237 
238  if (bwParamMousePressed && !bSDLMousePressed) {
239  SDL_SendMouseButton(data->window, mouseID, SDL_PRESSED, button);
240  } else if (!bwParamMousePressed && bSDLMousePressed) {
241  SDL_SendMouseButton(data->window, mouseID, SDL_RELEASED, button);
242  }
243 }
244 
245 /*
246 * Some windows systems fail to send a WM_LBUTTONDOWN sometimes, but each mouse move contains the current button state also
247 * so this funciton reconciles our view of the world with the current buttons reported by windows
248 */
249 static void
250 WIN_CheckWParamMouseButtons(WPARAM wParam, SDL_WindowData *data, SDL_MouseID mouseID)
251 {
252  if (wParam != data->mouse_button_flags) {
253  Uint32 mouseFlags = SDL_GetMouseState(NULL, NULL);
254  WIN_CheckWParamMouseButton((wParam & MK_LBUTTON), (mouseFlags & SDL_BUTTON_LMASK), data, SDL_BUTTON_LEFT, mouseID);
255  WIN_CheckWParamMouseButton((wParam & MK_MBUTTON), (mouseFlags & SDL_BUTTON_MMASK), data, SDL_BUTTON_MIDDLE, mouseID);
256  WIN_CheckWParamMouseButton((wParam & MK_RBUTTON), (mouseFlags & SDL_BUTTON_RMASK), data, SDL_BUTTON_RIGHT, mouseID);
257  WIN_CheckWParamMouseButton((wParam & MK_XBUTTON1), (mouseFlags & SDL_BUTTON_X1MASK), data, SDL_BUTTON_X1, mouseID);
258  WIN_CheckWParamMouseButton((wParam & MK_XBUTTON2), (mouseFlags & SDL_BUTTON_X2MASK), data, SDL_BUTTON_X2, mouseID);
259  data->mouse_button_flags = wParam;
260  }
261 }
262 
263 
264 static void
265 WIN_CheckRawMouseButtons(ULONG rawButtons, SDL_WindowData *data)
266 {
267  if (rawButtons != data->mouse_button_flags) {
268  Uint32 mouseFlags = SDL_GetMouseState(NULL, NULL);
269  if ((rawButtons & RI_MOUSE_BUTTON_1_DOWN))
270  WIN_CheckWParamMouseButton((rawButtons & RI_MOUSE_BUTTON_1_DOWN), (mouseFlags & SDL_BUTTON_LMASK), data, SDL_BUTTON_LEFT, 0);
271  if ((rawButtons & RI_MOUSE_BUTTON_1_UP))
272  WIN_CheckWParamMouseButton(!(rawButtons & RI_MOUSE_BUTTON_1_UP), (mouseFlags & SDL_BUTTON_LMASK), data, SDL_BUTTON_LEFT, 0);
273  if ((rawButtons & RI_MOUSE_BUTTON_2_DOWN))
274  WIN_CheckWParamMouseButton((rawButtons & RI_MOUSE_BUTTON_2_DOWN), (mouseFlags & SDL_BUTTON_RMASK), data, SDL_BUTTON_RIGHT, 0);
275  if ((rawButtons & RI_MOUSE_BUTTON_2_UP))
276  WIN_CheckWParamMouseButton(!(rawButtons & RI_MOUSE_BUTTON_2_UP), (mouseFlags & SDL_BUTTON_RMASK), data, SDL_BUTTON_RIGHT, 0);
277  if ((rawButtons & RI_MOUSE_BUTTON_3_DOWN))
278  WIN_CheckWParamMouseButton((rawButtons & RI_MOUSE_BUTTON_3_DOWN), (mouseFlags & SDL_BUTTON_MMASK), data, SDL_BUTTON_MIDDLE, 0);
279  if ((rawButtons & RI_MOUSE_BUTTON_3_UP))
280  WIN_CheckWParamMouseButton(!(rawButtons & RI_MOUSE_BUTTON_3_UP), (mouseFlags & SDL_BUTTON_MMASK), data, SDL_BUTTON_MIDDLE, 0);
281  if ((rawButtons & RI_MOUSE_BUTTON_4_DOWN))
282  WIN_CheckWParamMouseButton((rawButtons & RI_MOUSE_BUTTON_4_DOWN), (mouseFlags & SDL_BUTTON_X1MASK), data, SDL_BUTTON_X1, 0);
283  if ((rawButtons & RI_MOUSE_BUTTON_4_UP))
284  WIN_CheckWParamMouseButton(!(rawButtons & RI_MOUSE_BUTTON_4_UP), (mouseFlags & SDL_BUTTON_X1MASK), data, SDL_BUTTON_X1, 0);
285  if ((rawButtons & RI_MOUSE_BUTTON_5_DOWN))
286  WIN_CheckWParamMouseButton((rawButtons & RI_MOUSE_BUTTON_5_DOWN), (mouseFlags & SDL_BUTTON_X2MASK), data, SDL_BUTTON_X2, 0);
287  if ((rawButtons & RI_MOUSE_BUTTON_5_UP))
288  WIN_CheckWParamMouseButton(!(rawButtons & RI_MOUSE_BUTTON_5_UP), (mouseFlags & SDL_BUTTON_X2MASK), data, SDL_BUTTON_X2, 0);
289  data->mouse_button_flags = rawButtons;
290  }
291 }
292 
293 static void
294 WIN_CheckAsyncMouseRelease(SDL_WindowData *data)
295 {
296  Uint32 mouseFlags;
297  SHORT keyState;
298 
299  /* mouse buttons may have changed state here, we need to resync them,
300  but we will get a WM_MOUSEMOVE right away which will fix things up if in non raw mode also
301  */
302  mouseFlags = SDL_GetMouseState(NULL, NULL);
303 
304  keyState = GetAsyncKeyState(VK_LBUTTON);
305  if (!(keyState & 0x8000)) {
306  WIN_CheckWParamMouseButton(SDL_FALSE, (mouseFlags & SDL_BUTTON_LMASK), data, SDL_BUTTON_LEFT, 0);
307  }
308  keyState = GetAsyncKeyState(VK_RBUTTON);
309  if (!(keyState & 0x8000)) {
310  WIN_CheckWParamMouseButton(SDL_FALSE, (mouseFlags & SDL_BUTTON_RMASK), data, SDL_BUTTON_RIGHT, 0);
311  }
312  keyState = GetAsyncKeyState(VK_MBUTTON);
313  if (!(keyState & 0x8000)) {
314  WIN_CheckWParamMouseButton(SDL_FALSE, (mouseFlags & SDL_BUTTON_MMASK), data, SDL_BUTTON_MIDDLE, 0);
315  }
316  keyState = GetAsyncKeyState(VK_XBUTTON1);
317  if (!(keyState & 0x8000)) {
318  WIN_CheckWParamMouseButton(SDL_FALSE, (mouseFlags & SDL_BUTTON_X1MASK), data, SDL_BUTTON_X1, 0);
319  }
320  keyState = GetAsyncKeyState(VK_XBUTTON2);
321  if (!(keyState & 0x8000)) {
322  WIN_CheckWParamMouseButton(SDL_FALSE, (mouseFlags & SDL_BUTTON_X2MASK), data, SDL_BUTTON_X2, 0);
323  }
324  data->mouse_button_flags = 0;
325 }
326 
327 static BOOL
328 WIN_ConvertUTF32toUTF8(UINT32 codepoint, char * text)
329 {
330  if (codepoint <= 0x7F) {
331  text[0] = (char) codepoint;
332  text[1] = '\0';
333  } else if (codepoint <= 0x7FF) {
334  text[0] = 0xC0 | (char) ((codepoint >> 6) & 0x1F);
335  text[1] = 0x80 | (char) (codepoint & 0x3F);
336  text[2] = '\0';
337  } else if (codepoint <= 0xFFFF) {
338  text[0] = 0xE0 | (char) ((codepoint >> 12) & 0x0F);
339  text[1] = 0x80 | (char) ((codepoint >> 6) & 0x3F);
340  text[2] = 0x80 | (char) (codepoint & 0x3F);
341  text[3] = '\0';
342  } else if (codepoint <= 0x10FFFF) {
343  text[0] = 0xF0 | (char) ((codepoint >> 18) & 0x0F);
344  text[1] = 0x80 | (char) ((codepoint >> 12) & 0x3F);
345  text[2] = 0x80 | (char) ((codepoint >> 6) & 0x3F);
346  text[3] = 0x80 | (char) (codepoint & 0x3F);
347  text[4] = '\0';
348  } else {
349  return SDL_FALSE;
350  }
351  return SDL_TRUE;
352 }
353 
354 static SDL_bool
355 ShouldGenerateWindowCloseOnAltF4(void)
356 {
358 }
359 
360 /* Win10 "Fall Creators Update" introduced the bug that SetCursorPos() (as used by SDL_WarpMouseInWindow())
361  doesn't reliably generate WM_MOUSEMOVE events anymore (see #3931) which breaks relative mouse mode via warping.
362  This is used to implement a workaround.. */
363 static SDL_bool isWin10FCUorNewer = SDL_FALSE;
364 
365 LRESULT CALLBACK
366 WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
367 {
369  LRESULT returnCode = -1;
370 
371  /* Send a SDL_SYSWMEVENT if the application wants them */
373  SDL_SysWMmsg wmmsg;
374 
375  SDL_VERSION(&wmmsg.version);
377  wmmsg.msg.win.hwnd = hwnd;
378  wmmsg.msg.win.msg = msg;
379  wmmsg.msg.win.wParam = wParam;
380  wmmsg.msg.win.lParam = lParam;
381  SDL_SendSysWMEvent(&wmmsg);
382  }
383 
384  /* Get the window data for the window */
385  data = (SDL_WindowData *) GetProp(hwnd, TEXT("SDL_WindowData"));
386  if (!data) {
387  return CallWindowProc(DefWindowProc, hwnd, msg, wParam, lParam);
388  }
389 
390 #ifdef WMMSG_DEBUG
391  {
392  char message[1024];
393  if (msg > MAX_WMMSG) {
394  SDL_snprintf(message, sizeof(message), "Received windows message: %p UNKNOWN (%d) -- 0x%X, 0x%X\n", hwnd, msg, wParam, lParam);
395  } else {
396  SDL_snprintf(message, sizeof(message), "Received windows message: %p %s -- 0x%X, 0x%X\n", hwnd, wmtab[msg], wParam, lParam);
397  }
398  OutputDebugStringA(message);
399  }
400 #endif /* WMMSG_DEBUG */
401 
402  if (IME_HandleMessage(hwnd, msg, wParam, &lParam, data->videodata))
403  return 0;
404 
405  switch (msg) {
406 
407  case WM_SHOWWINDOW:
408  {
409  if (wParam) {
411  } else {
413  }
414  }
415  break;
416 
417  case WM_NCACTIVATE:
418  {
419  /* Don't immediately clip the cursor in case we're clicking minimize/maximize buttons */
420  data->skip_update_clipcursor = SDL_TRUE;
421  }
422  break;
423 
424  case WM_ACTIVATE:
425  {
426  POINT cursorPos;
427  BOOL minimized;
428 
429  /* Don't mark the window as shown if it's activated before being shown */
430  if (!IsWindowVisible(hwnd)) {
431  break;
432  }
433 
434  minimized = HIWORD(wParam);
435  if (!minimized && (LOWORD(wParam) != WA_INACTIVE)) {
436  if (LOWORD(wParam) == WA_CLICKACTIVE) {
437  if (GetAsyncKeyState(VK_LBUTTON)) {
438  data->focus_click_pending |= SDL_BUTTON_LMASK;
439  }
440  if (GetAsyncKeyState(VK_RBUTTON)) {
441  data->focus_click_pending |= SDL_BUTTON_RMASK;
442  }
443  if (GetAsyncKeyState(VK_MBUTTON)) {
444  data->focus_click_pending |= SDL_BUTTON_MMASK;
445  }
446  if (GetAsyncKeyState(VK_XBUTTON1)) {
447  data->focus_click_pending |= SDL_BUTTON_X1MASK;
448  }
449  if (GetAsyncKeyState(VK_XBUTTON2)) {
450  data->focus_click_pending |= SDL_BUTTON_X2MASK;
451  }
452  }
453 
455  if (SDL_GetKeyboardFocus() != data->window) {
456  SDL_SetKeyboardFocus(data->window);
457  }
458 
459  GetCursorPos(&cursorPos);
460  ScreenToClient(hwnd, &cursorPos);
461  SDL_SendMouseMotion(data->window, 0, 0, cursorPos.x, cursorPos.y);
462 
463  WIN_CheckAsyncMouseRelease(data);
464 
465  /*
466  * FIXME: Update keyboard state
467  */
468  WIN_CheckClipboardUpdate(data->videodata);
469 
470  SDL_ToggleModState(KMOD_CAPS, (GetKeyState(VK_CAPITAL) & 0x0001) != 0);
471  SDL_ToggleModState(KMOD_NUM, (GetKeyState(VK_NUMLOCK) & 0x0001) != 0);
472  } else {
473  RECT rect;
474 
475  data->in_window_deactivation = SDL_TRUE;
476 
477  if (SDL_GetKeyboardFocus() == data->window) {
480  }
481 
482  if (GetClipCursor(&rect) && SDL_memcmp(&rect, &data->cursor_clipped_rect, sizeof(rect) == 0)) {
483  ClipCursor(NULL);
484  SDL_zero(data->cursor_clipped_rect);
485  }
486 
487  data->in_window_deactivation = SDL_FALSE;
488  }
489  }
490  returnCode = 0;
491  break;
492 
493  case WM_MOUSEMOVE:
494  {
495  SDL_Mouse *mouse = SDL_GetMouse();
496  if (!mouse->relative_mode || mouse->relative_mode_warp) {
497  SDL_MouseID mouseID = (((GetMessageExtraInfo() & MOUSEEVENTF_FROMTOUCH) == MOUSEEVENTF_FROMTOUCH) ? SDL_TOUCH_MOUSEID : 0);
498  SDL_SendMouseMotion(data->window, mouseID, 0, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
499  if (isWin10FCUorNewer && mouseID != SDL_TOUCH_MOUSEID && mouse->relative_mode_warp) {
500  /* To work around #3931, Win10 bug introduced in Fall Creators Update, where
501  SetCursorPos() (SDL_WarpMouseInWindow()) doesn't reliably generate mouse events anymore,
502  after each windows mouse event generate a fake event for the middle of the window
503  if relative_mode_warp is used */
504  int center_x = 0, center_y = 0;
505  SDL_GetWindowSize(data->window, &center_x, &center_y);
506  center_x /= 2;
507  center_y /= 2;
508  SDL_SendMouseMotion(data->window, mouseID, 0, center_x, center_y);
509  }
510  }
511  }
512  /* don't break here, fall through to check the wParam like the button presses */
513  case WM_LBUTTONUP:
514  case WM_RBUTTONUP:
515  case WM_MBUTTONUP:
516  case WM_XBUTTONUP:
517  case WM_LBUTTONDOWN:
518  case WM_LBUTTONDBLCLK:
519  case WM_RBUTTONDOWN:
520  case WM_RBUTTONDBLCLK:
521  case WM_MBUTTONDOWN:
522  case WM_MBUTTONDBLCLK:
523  case WM_XBUTTONDOWN:
524  case WM_XBUTTONDBLCLK:
525  {
526  SDL_Mouse *mouse = SDL_GetMouse();
527  if (!mouse->relative_mode || mouse->relative_mode_warp) {
528  SDL_MouseID mouseID = (((GetMessageExtraInfo() & MOUSEEVENTF_FROMTOUCH) == MOUSEEVENTF_FROMTOUCH) ? SDL_TOUCH_MOUSEID : 0);
529  WIN_CheckWParamMouseButtons(wParam, data, mouseID);
530  }
531  }
532  break;
533 
534  case WM_INPUT:
535  {
536  SDL_Mouse *mouse = SDL_GetMouse();
537  HRAWINPUT hRawInput = (HRAWINPUT)lParam;
538  RAWINPUT inp;
539  UINT size = sizeof(inp);
540  const SDL_bool isRelative = mouse->relative_mode || mouse->relative_mode_warp;
541  const SDL_bool isCapture = ((data->window->flags & SDL_WINDOW_MOUSE_CAPTURE) != 0);
542 
543  if (!isRelative || mouse->focus != data->window) {
544  if (!isCapture) {
545  break;
546  }
547  }
548 
549  GetRawInputData(hRawInput, RID_INPUT, &inp, &size, sizeof(RAWINPUTHEADER));
550 
551  /* Mouse data */
552  if (inp.header.dwType == RIM_TYPEMOUSE) {
553  if (isRelative) {
554  RAWMOUSE* rawmouse = &inp.data.mouse;
555 
556  if ((rawmouse->usFlags & 0x01) == MOUSE_MOVE_RELATIVE) {
557  SDL_SendMouseMotion(data->window, 0, 1, (int)rawmouse->lLastX, (int)rawmouse->lLastY);
558  } else {
559  /* synthesize relative moves from the abs position */
560  static SDL_Point initialMousePoint;
561  if (initialMousePoint.x == 0 && initialMousePoint.y == 0) {
562  initialMousePoint.x = rawmouse->lLastX;
563  initialMousePoint.y = rawmouse->lLastY;
564  }
565 
566  SDL_SendMouseMotion(data->window, 0, 1, (int)(rawmouse->lLastX-initialMousePoint.x), (int)(rawmouse->lLastY-initialMousePoint.y));
567 
568  initialMousePoint.x = rawmouse->lLastX;
569  initialMousePoint.y = rawmouse->lLastY;
570  }
571  WIN_CheckRawMouseButtons(rawmouse->usButtonFlags, data);
572  } else if (isCapture) {
573  /* we check for where Windows thinks the system cursor lives in this case, so we don't really lose mouse accel, etc. */
574  POINT pt;
575  RECT hwndRect;
576  HWND currentHnd;
577 
578  GetCursorPos(&pt);
579  currentHnd = WindowFromPoint(pt);
580  ScreenToClient(hwnd, &pt);
581  GetClientRect(hwnd, &hwndRect);
582 
583  /* if in the window, WM_MOUSEMOVE, etc, will cover it. */
584  if(currentHnd != hwnd || pt.x < 0 || pt.y < 0 || pt.x > hwndRect.right || pt.y > hwndRect.right) {
585  SDL_SendMouseMotion(data->window, 0, 0, (int)pt.x, (int)pt.y);
586  SDL_SendMouseButton(data->window, 0, GetAsyncKeyState(VK_LBUTTON) & 0x8000 ? SDL_PRESSED : SDL_RELEASED, SDL_BUTTON_LEFT);
587  SDL_SendMouseButton(data->window, 0, GetAsyncKeyState(VK_RBUTTON) & 0x8000 ? SDL_PRESSED : SDL_RELEASED, SDL_BUTTON_RIGHT);
588  SDL_SendMouseButton(data->window, 0, GetAsyncKeyState(VK_MBUTTON) & 0x8000 ? SDL_PRESSED : SDL_RELEASED, SDL_BUTTON_MIDDLE);
589  SDL_SendMouseButton(data->window, 0, GetAsyncKeyState(VK_XBUTTON1) & 0x8000 ? SDL_PRESSED : SDL_RELEASED, SDL_BUTTON_X1);
590  SDL_SendMouseButton(data->window, 0, GetAsyncKeyState(VK_XBUTTON2) & 0x8000 ? SDL_PRESSED : SDL_RELEASED, SDL_BUTTON_X2);
591  }
592  } else {
593  SDL_assert(0 && "Shouldn't happen");
594  }
595  }
596  }
597  break;
598 
599  case WM_MOUSEWHEEL:
600  case WM_MOUSEHWHEEL:
601  {
602  short amount = GET_WHEEL_DELTA_WPARAM(wParam);
603  float fAmount = (float) amount / WHEEL_DELTA;
604  if (msg == WM_MOUSEWHEEL)
605  SDL_SendMouseWheel(data->window, 0, 0.0f, fAmount, SDL_MOUSEWHEEL_NORMAL);
606  else
607  SDL_SendMouseWheel(data->window, 0, fAmount, 0.0f, SDL_MOUSEWHEEL_NORMAL);
608  }
609  break;
610 
611 #ifdef WM_MOUSELEAVE
612  case WM_MOUSELEAVE:
613  if (SDL_GetMouseFocus() == data->window && !SDL_GetMouse()->relative_mode && !(data->window->flags & SDL_WINDOW_MOUSE_CAPTURE)) {
614  if (!IsIconic(hwnd)) {
615  POINT cursorPos;
616  GetCursorPos(&cursorPos);
617  ScreenToClient(hwnd, &cursorPos);
618  SDL_SendMouseMotion(data->window, 0, 0, cursorPos.x, cursorPos.y);
619  }
621  }
622  returnCode = 0;
623  break;
624 #endif /* WM_MOUSELEAVE */
625 
626  case WM_KEYDOWN:
627  case WM_SYSKEYDOWN:
628  {
629  SDL_Scancode code = WindowsScanCodeToSDLScanCode(lParam, wParam);
630  const Uint8 *keyboardState = SDL_GetKeyboardState(NULL);
631 
632  /* Detect relevant keyboard shortcuts */
633  if (keyboardState[SDL_SCANCODE_LALT] == SDL_PRESSED || keyboardState[SDL_SCANCODE_RALT] == SDL_PRESSED) {
634  /* ALT+F4: Close window */
635  if (code == SDL_SCANCODE_F4 && ShouldGenerateWindowCloseOnAltF4()) {
637  }
638  }
639 
640  if (code != SDL_SCANCODE_UNKNOWN) {
642  }
643  }
644 
645  returnCode = 0;
646  break;
647 
648  case WM_SYSKEYUP:
649  case WM_KEYUP:
650  {
651  SDL_Scancode code = WindowsScanCodeToSDLScanCode(lParam, wParam);
652  const Uint8 *keyboardState = SDL_GetKeyboardState(NULL);
653 
654  if (code != SDL_SCANCODE_UNKNOWN) {
655  if (code == SDL_SCANCODE_PRINTSCREEN &&
656  keyboardState[code] == SDL_RELEASED) {
658  }
660  }
661  }
662  returnCode = 0;
663  break;
664 
665  case WM_UNICHAR:
666  if (wParam == UNICODE_NOCHAR) {
667  returnCode = 1;
668  break;
669  }
670  /* otherwise fall through to below */
671  case WM_CHAR:
672  {
673  char text[5];
674  if (WIN_ConvertUTF32toUTF8((UINT32)wParam, text)) {
676  }
677  }
678  returnCode = 0;
679  break;
680 
681 #ifdef WM_INPUTLANGCHANGE
682  case WM_INPUTLANGCHANGE:
683  {
686  }
687  returnCode = 1;
688  break;
689 #endif /* WM_INPUTLANGCHANGE */
690 
691  case WM_NCLBUTTONDOWN:
692  {
693  data->in_title_click = SDL_TRUE;
694  }
695  break;
696 
697  case WM_CAPTURECHANGED:
698  {
699  data->in_title_click = SDL_FALSE;
700 
701  /* The mouse may have been released during a modal loop */
702  WIN_CheckAsyncMouseRelease(data);
703  }
704  break;
705 
706 #ifdef WM_GETMINMAXINFO
707  case WM_GETMINMAXINFO:
708  {
709  MINMAXINFO *info;
710  RECT size;
711  int x, y;
712  int w, h;
713  int min_w, min_h;
714  int max_w, max_h;
715  BOOL constrain_max_size;
716 
717  if (SDL_IsShapedWindow(data->window))
718  Win32_ResizeWindowShape(data->window);
719 
720  /* If this is an expected size change, allow it */
721  if (data->expected_resize) {
722  break;
723  }
724 
725  /* Get the current position of our window */
726  GetWindowRect(hwnd, &size);
727  x = size.left;
728  y = size.top;
729 
730  /* Calculate current size of our window */
731  SDL_GetWindowSize(data->window, &w, &h);
732  SDL_GetWindowMinimumSize(data->window, &min_w, &min_h);
733  SDL_GetWindowMaximumSize(data->window, &max_w, &max_h);
734 
735  /* Store in min_w and min_h difference between current size and minimal
736  size so we don't need to call AdjustWindowRectEx twice */
737  min_w -= w;
738  min_h -= h;
739  if (max_w && max_h) {
740  max_w -= w;
741  max_h -= h;
742  constrain_max_size = TRUE;
743  } else {
744  constrain_max_size = FALSE;
745  }
746 
747  if (!(SDL_GetWindowFlags(data->window) & SDL_WINDOW_BORDERLESS)) {
748  LONG style = GetWindowLong(hwnd, GWL_STYLE);
749  /* DJM - according to the docs for GetMenu(), the
750  return value is undefined if hwnd is a child window.
751  Apparently it's too difficult for MS to check
752  inside their function, so I have to do it here.
753  */
754  BOOL menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL);
755  size.top = 0;
756  size.left = 0;
757  size.bottom = h;
758  size.right = w;
759 
760  AdjustWindowRectEx(&size, style, menu, 0);
761  w = size.right - size.left;
762  h = size.bottom - size.top;
763  }
764 
765  /* Fix our size to the current size */
766  info = (MINMAXINFO *) lParam;
768  info->ptMinTrackSize.x = w + min_w;
769  info->ptMinTrackSize.y = h + min_h;
770  if (constrain_max_size) {
771  info->ptMaxTrackSize.x = w + max_w;
772  info->ptMaxTrackSize.y = h + max_h;
773  }
774  } else {
775  info->ptMaxSize.x = w;
776  info->ptMaxSize.y = h;
777  info->ptMaxPosition.x = x;
778  info->ptMaxPosition.y = y;
779  info->ptMinTrackSize.x = w;
780  info->ptMinTrackSize.y = h;
781  info->ptMaxTrackSize.x = w;
782  info->ptMaxTrackSize.y = h;
783  }
784  }
785  returnCode = 0;
786  break;
787 #endif /* WM_GETMINMAXINFO */
788 
789  case WM_WINDOWPOSCHANGING:
790 
791  if (data->expected_resize) {
792  returnCode = 0;
793  }
794  break;
795 
796  case WM_WINDOWPOSCHANGED:
797  {
798  RECT rect;
799  int x, y;
800  int w, h;
801 
802  if (data->initializing || data->in_border_change) {
803  break;
804  }
805 
806  if (!GetClientRect(hwnd, &rect) || IsRectEmpty(&rect)) {
807  break;
808  }
809  ClientToScreen(hwnd, (LPPOINT) & rect);
810  ClientToScreen(hwnd, (LPPOINT) & rect + 1);
811 
812  WIN_UpdateClipCursor(data->window);
813 
814  x = rect.left;
815  y = rect.top;
817 
818  w = rect.right - rect.left;
819  h = rect.bottom - rect.top;
821  h);
822 
823  /* Forces a WM_PAINT event */
824  InvalidateRect(hwnd, NULL, FALSE);
825  }
826  break;
827 
828  case WM_SIZE:
829  {
830  switch (wParam) {
831  case SIZE_MAXIMIZED:
832  SDL_SendWindowEvent(data->window,
834  SDL_SendWindowEvent(data->window,
836  break;
837  case SIZE_MINIMIZED:
838  SDL_SendWindowEvent(data->window,
840  break;
841  default:
842  SDL_SendWindowEvent(data->window,
844  break;
845  }
846  }
847  break;
848 
849  case WM_SETCURSOR:
850  {
851  Uint16 hittest;
852 
853  hittest = LOWORD(lParam);
854  if (hittest == HTCLIENT) {
855  SetCursor(SDL_cursor);
856  returnCode = TRUE;
858  SetCursor(NULL);
859  returnCode = TRUE;
860  }
861  }
862  break;
863 
864  /* We were occluded, refresh our display */
865  case WM_PAINT:
866  {
867  RECT rect;
868  if (GetUpdateRect(hwnd, &rect, FALSE)) {
869  ValidateRect(hwnd, NULL);
871  0, 0);
872  }
873  }
874  returnCode = 0;
875  break;
876 
877  /* We'll do our own drawing, prevent flicker */
878  case WM_ERASEBKGND:
879  {
880  }
881  return (1);
882 
883  case WM_SYSCOMMAND:
884  {
885  if ((wParam & 0xFFF0) == SC_KEYMENU) {
886  return (0);
887  }
888 
889 #if defined(SC_SCREENSAVE) || defined(SC_MONITORPOWER)
890  /* Don't start the screensaver or blank the monitor in fullscreen apps */
891  if ((wParam & 0xFFF0) == SC_SCREENSAVE ||
892  (wParam & 0xFFF0) == SC_MONITORPOWER) {
893  if (SDL_GetVideoDevice()->suspend_screensaver) {
894  return (0);
895  }
896  }
897 #endif /* System has screensaver support */
898  }
899  break;
900 
901  case WM_CLOSE:
902  {
904  }
905  returnCode = 0;
906  break;
907 
908  case WM_TOUCH:
909  if (data->videodata->GetTouchInputInfo && data->videodata->CloseTouchInputHandle) {
910  UINT i, num_inputs = LOWORD(wParam);
911  PTOUCHINPUT inputs = SDL_stack_alloc(TOUCHINPUT, num_inputs);
912  if (data->videodata->GetTouchInputInfo((HTOUCHINPUT)lParam, num_inputs, inputs, sizeof(TOUCHINPUT))) {
913  RECT rect;
914  float x, y;
915 
916  if (!GetClientRect(hwnd, &rect) ||
917  (rect.right == rect.left && rect.bottom == rect.top)) {
918  if (inputs) {
919  SDL_stack_free(inputs);
920  }
921  break;
922  }
923  ClientToScreen(hwnd, (LPPOINT) & rect);
924  ClientToScreen(hwnd, (LPPOINT) & rect + 1);
925  rect.top *= 100;
926  rect.left *= 100;
927  rect.bottom *= 100;
928  rect.right *= 100;
929 
930  for (i = 0; i < num_inputs; ++i) {
931  PTOUCHINPUT input = &inputs[i];
932 
933  const SDL_TouchID touchId = (SDL_TouchID)((size_t)input->hSource);
934  if (SDL_AddTouch(touchId, "") < 0) {
935  continue;
936  }
937 
938  /* Get the normalized coordinates for the window */
939  x = (float)(input->x - rect.left)/(rect.right - rect.left);
940  y = (float)(input->y - rect.top)/(rect.bottom - rect.top);
941 
942  if (input->dwFlags & TOUCHEVENTF_DOWN) {
943  SDL_SendTouch(touchId, input->dwID, SDL_TRUE, x, y, 1.0f);
944  }
945  if (input->dwFlags & TOUCHEVENTF_MOVE) {
946  SDL_SendTouchMotion(touchId, input->dwID, x, y, 1.0f);
947  }
948  if (input->dwFlags & TOUCHEVENTF_UP) {
949  SDL_SendTouch(touchId, input->dwID, SDL_FALSE, x, y, 1.0f);
950  }
951  }
952  }
953  SDL_stack_free(inputs);
954 
955  data->videodata->CloseTouchInputHandle((HTOUCHINPUT)lParam);
956  return 0;
957  }
958  break;
959 
960  case WM_DROPFILES:
961  {
962  UINT i;
963  HDROP drop = (HDROP) wParam;
964  UINT count = DragQueryFile(drop, 0xFFFFFFFF, NULL, 0);
965  for (i = 0; i < count; ++i) {
966  UINT size = DragQueryFile(drop, i, NULL, 0) + 1;
967  LPTSTR buffer = SDL_stack_alloc(TCHAR, size);
968  if (buffer) {
969  if (DragQueryFile(drop, i, buffer, size)) {
970  char *file = WIN_StringToUTF8(buffer);
971  SDL_SendDropFile(data->window, file);
972  SDL_free(file);
973  }
975  }
976  }
977  SDL_SendDropComplete(data->window);
978  DragFinish(drop);
979  return 0;
980  }
981  break;
982 
983  case WM_NCCALCSIZE:
984  {
985  Uint32 window_flags = SDL_GetWindowFlags(data->window);
986  if (wParam == TRUE && (window_flags & SDL_WINDOW_BORDERLESS) && !(window_flags & SDL_WINDOW_FULLSCREEN)) {
987  /* When borderless, need to tell windows that the size of the non-client area is 0 */
988  if (!(window_flags & SDL_WINDOW_RESIZABLE)) {
989  int w, h;
990  NCCALCSIZE_PARAMS *params = (NCCALCSIZE_PARAMS *)lParam;
991  w = data->window->windowed.w;
992  h = data->window->windowed.h;
993  params->rgrc[0].right = params->rgrc[0].left + w;
994  params->rgrc[0].bottom = params->rgrc[0].top + h;
995  }
996  return 0;
997  }
998  }
999  break;
1000 
1001  case WM_NCHITTEST:
1002  {
1003  SDL_Window *window = data->window;
1004  if (window->hit_test) {
1005  POINT winpoint = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
1006  if (ScreenToClient(hwnd, &winpoint)) {
1007  const SDL_Point point = { (int) winpoint.x, (int) winpoint.y };
1008  const SDL_HitTestResult rc = window->hit_test(window, &point, window->hit_test_data);
1009  switch (rc) {
1010  #define POST_HIT_TEST(ret) { SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_HIT_TEST, 0, 0); return ret; }
1011  case SDL_HITTEST_DRAGGABLE: POST_HIT_TEST(HTCAPTION);
1012  case SDL_HITTEST_RESIZE_TOPLEFT: POST_HIT_TEST(HTTOPLEFT);
1013  case SDL_HITTEST_RESIZE_TOP: POST_HIT_TEST(HTTOP);
1014  case SDL_HITTEST_RESIZE_TOPRIGHT: POST_HIT_TEST(HTTOPRIGHT);
1015  case SDL_HITTEST_RESIZE_RIGHT: POST_HIT_TEST(HTRIGHT);
1016  case SDL_HITTEST_RESIZE_BOTTOMRIGHT: POST_HIT_TEST(HTBOTTOMRIGHT);
1017  case SDL_HITTEST_RESIZE_BOTTOM: POST_HIT_TEST(HTBOTTOM);
1018  case SDL_HITTEST_RESIZE_BOTTOMLEFT: POST_HIT_TEST(HTBOTTOMLEFT);
1019  case SDL_HITTEST_RESIZE_LEFT: POST_HIT_TEST(HTLEFT);
1020  #undef POST_HIT_TEST
1021  case SDL_HITTEST_NORMAL: return HTCLIENT;
1022  }
1023  }
1024  /* If we didn't return, this will call DefWindowProc below. */
1025  }
1026  }
1027  break;
1028  }
1029 
1030  /* If there's a window proc, assume it's going to handle messages */
1031  if (data->wndproc) {
1032  return CallWindowProc(data->wndproc, hwnd, msg, wParam, lParam);
1033  } else if (returnCode >= 0) {
1034  return returnCode;
1035  } else {
1036  return CallWindowProc(DefWindowProc, hwnd, msg, wParam, lParam);
1037  }
1038 }
1039 
1040 static void WIN_UpdateClipCursorForWindows()
1041 {
1043  SDL_Window *window;
1044 
1045  if (_this) {
1046  for (window = _this->windows; window; window = window->next) {
1047  if (window->driverdata) {
1049  }
1050  }
1051  }
1052 }
1053 
1054 /* A message hook called before TranslateMessage() */
1055 static SDL_WindowsMessageHook g_WindowsMessageHook = NULL;
1056 static void *g_WindowsMessageHookData = NULL;
1057 
1059 {
1060  g_WindowsMessageHook = callback;
1061  g_WindowsMessageHookData = userdata;
1062 }
1063 
1064 void
1066 {
1067  const Uint8 *keystate;
1068  MSG msg;
1069  DWORD start_ticks = GetTickCount();
1070 
1072  while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
1073  if (g_WindowsMessageHook) {
1074  g_WindowsMessageHook(g_WindowsMessageHookData, msg.hwnd, msg.message, msg.wParam, msg.lParam);
1075  }
1076 
1077  /* Always translate the message in case it's a non-SDL window (e.g. with Qt integration) */
1078  TranslateMessage(&msg);
1079  DispatchMessage(&msg);
1080 
1081  /* Make sure we don't busy loop here forever if there are lots of events coming in */
1082  if (SDL_TICKS_PASSED(msg.time, start_ticks)) {
1083  break;
1084  }
1085  }
1086  }
1087 
1088  /* Windows loses a shift KEYUP event when you have both pressed at once and let go of one.
1089  You won't get a KEYUP until both are released, and that keyup will only be for the second
1090  key you released. Take heroic measures and check the keystate as of the last handled event,
1091  and if we think a key is pressed when Windows doesn't, unstick it in SDL's state. */
1092  keystate = SDL_GetKeyboardState(NULL);
1093  if ((keystate[SDL_SCANCODE_LSHIFT] == SDL_PRESSED) && !(GetKeyState(VK_LSHIFT) & 0x8000)) {
1095  }
1096  if ((keystate[SDL_SCANCODE_RSHIFT] == SDL_PRESSED) && !(GetKeyState(VK_RSHIFT) & 0x8000)) {
1098  }
1099 
1100  /* Update the clipping rect in case someone else has stolen it */
1101  WIN_UpdateClipCursorForWindows();
1102 }
1103 
1104 /* to work around #3931, a bug introduced in Win10 Fall Creators Update (build nr. 16299)
1105  we need to detect the windows version. this struct and the function below does that.
1106  usually this struct and the corresponding function (RtlGetVersion) are in <Ntddk.h>
1107  but here we just load it dynamically */
1108 struct SDL_WIN_OSVERSIONINFOW {
1109  ULONG dwOSVersionInfoSize;
1110  ULONG dwMajorVersion;
1111  ULONG dwMinorVersion;
1112  ULONG dwBuildNumber;
1113  ULONG dwPlatformId;
1114  WCHAR szCSDVersion[128];
1115 };
1116 
1117 static SDL_bool
1118 IsWin10FCUorNewer(void)
1119 {
1120  HMODULE handle = GetModuleHandleW(L"ntdll.dll");
1121  if (handle) {
1122  typedef LONG(WINAPI* RtlGetVersionPtr)(struct SDL_WIN_OSVERSIONINFOW*);
1123  RtlGetVersionPtr getVersionPtr = (RtlGetVersionPtr)GetProcAddress(handle, "RtlGetVersion");
1124  if (getVersionPtr != NULL) {
1125  struct SDL_WIN_OSVERSIONINFOW info;
1126  SDL_zero(info);
1127  info.dwOSVersionInfoSize = sizeof(info);
1128  if (getVersionPtr(&info) == 0) { /* STATUS_SUCCESS == 0 */
1129  if ((info.dwMajorVersion == 10 && info.dwMinorVersion == 0 && info.dwBuildNumber >= 16299) ||
1130  (info.dwMajorVersion == 10 && info.dwMinorVersion > 0) ||
1131  (info.dwMajorVersion > 10))
1132  {
1133  return SDL_TRUE;
1134  }
1135  }
1136  }
1137  }
1138  return SDL_FALSE;
1139 }
1140 
1141 static int app_registered = 0;
1142 LPTSTR SDL_Appname = NULL;
1143 Uint32 SDL_Appstyle = 0;
1144 HINSTANCE SDL_Instance = NULL;
1145 
1146 /* Register the class for this application */
1147 int
1148 SDL_RegisterApp(char *name, Uint32 style, void *hInst)
1149 {
1150  const char *hint;
1151  WNDCLASSEX wcex;
1152  TCHAR path[MAX_PATH];
1153 
1154  /* Only do this once... */
1155  if (app_registered) {
1156  ++app_registered;
1157  return (0);
1158  }
1159  if (!name && !SDL_Appname) {
1160  name = "SDL_app";
1161 #if defined(CS_BYTEALIGNCLIENT) || defined(CS_OWNDC)
1162  SDL_Appstyle = (CS_BYTEALIGNCLIENT | CS_OWNDC);
1163 #endif
1164  SDL_Instance = hInst ? hInst : GetModuleHandle(NULL);
1165  }
1166 
1167  if (name) {
1169  SDL_Appstyle = style;
1170  SDL_Instance = hInst ? hInst : GetModuleHandle(NULL);
1171  }
1172 
1173  /* Register the application class */
1174  wcex.cbSize = sizeof(WNDCLASSEX);
1175  wcex.hCursor = NULL;
1176  wcex.hIcon = NULL;
1177  wcex.hIconSm = NULL;
1178  wcex.lpszMenuName = NULL;
1179  wcex.lpszClassName = SDL_Appname;
1180  wcex.style = SDL_Appstyle;
1181  wcex.hbrBackground = NULL;
1182  wcex.lpfnWndProc = WIN_WindowProc;
1183  wcex.hInstance = SDL_Instance;
1184  wcex.cbClsExtra = 0;
1185  wcex.cbWndExtra = 0;
1186 
1188  if (hint && *hint) {
1189  wcex.hIcon = LoadIcon(SDL_Instance, MAKEINTRESOURCE(SDL_atoi(hint)));
1190 
1192  if (hint && *hint) {
1193  wcex.hIconSm = LoadIcon(SDL_Instance, MAKEINTRESOURCE(SDL_atoi(hint)));
1194  }
1195  } else {
1196  /* Use the first icon as a default icon, like in the Explorer */
1197  GetModuleFileName(SDL_Instance, path, MAX_PATH);
1198  ExtractIconEx(path, 0, &wcex.hIcon, &wcex.hIconSm, 1);
1199  }
1200 
1201  if (!RegisterClassEx(&wcex)) {
1202  return SDL_SetError("Couldn't register application class");
1203  }
1204 
1205  isWin10FCUorNewer = IsWin10FCUorNewer();
1206 
1207  app_registered = 1;
1208  return 0;
1209 }
1210 
1211 /* Unregisters the windowclass registered in SDL_RegisterApp above. */
1212 void
1214 {
1215  WNDCLASSEX wcex;
1216 
1217  /* SDL_RegisterApp might not have been called before */
1218  if (!app_registered) {
1219  return;
1220  }
1221  --app_registered;
1222  if (app_registered == 0) {
1223  /* Check for any registered window classes. */
1224  if (GetClassInfoEx(SDL_Instance, SDL_Appname, &wcex)) {
1225  UnregisterClass(SDL_Appname, SDL_Instance);
1226  if (wcex.hIcon) DestroyIcon(wcex.hIcon);
1227  if (wcex.hIconSm) DestroyIcon(wcex.hIconSm);
1228  }
1230  SDL_Appname = NULL;
1231  }
1232 }
1233 
1234 #endif /* SDL_VIDEO_DRIVER_WINDOWS */
1235 
1236 /* vi: set ts=4 sw=4 expandtab: */
SDL_HITTEST_DRAGGABLE
@ SDL_HITTEST_DRAGGABLE
Definition: SDL_video.h:1023
SDL_SCANCODE_KP_2
@ SDL_SCANCODE_KP_2
Definition: SDL_scancode.h:189
SDL_GetMouse
SDL_Mouse * SDL_GetMouse(void)
Definition: SDL_mouse.c:144
SDL_zero
#define SDL_zero(x)
Definition: SDL_stdinc.h:416
SDL_WINDOW_MOUSE_CAPTURE
@ SDL_WINDOW_MOUSE_CAPTURE
Definition: SDL_video.h:116
SDL_SysWMmsg
Definition: SDL_syswm.h:136
SDL_SCANCODE_AC_FORWARD
@ SDL_SCANCODE_AC_FORWARD
Definition: SDL_scancode.h:364
SDL_SCANCODE_RCTRL
@ SDL_SCANCODE_RCTRL
Definition: SDL_scancode.h:332
SDL_GetMouseState
#define SDL_GetMouseState
Definition: SDL_dynapi_overrides.h:246
Uint8
uint8_t Uint8
Definition: SDL_stdinc.h:179
SDL_Point::x
int x
Definition: SDL_rect.h:50
SDL_SCANCODE_PRINTSCREEN
@ SDL_SCANCODE_PRINTSCREEN
Definition: SDL_scancode.h:166
SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4
#define SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4
Tell SDL not to generate window-close events for Alt+F4 on Windows.
Definition: SDL_hints.h:913
SDL_SCANCODE_HELP
@ SDL_SCANCODE_HELP
Definition: SDL_scancode.h:228
SDL_SendSysWMEvent
int SDL_SendSysWMEvent(SDL_SysWMmsg *message)
Definition: SDL_events.c:956
SDL_SysWMmsg::subsystem
SDL_SYSWM_TYPE subsystem
Definition: SDL_syswm.h:138
g_WindowsEnableMessageLoop
SDL_bool g_WindowsEnableMessageLoop
Uint16
uint16_t Uint16
Definition: SDL_stdinc.h:191
WIN_UTF8ToString
#define WIN_UTF8ToString(S)
Definition: SDL_windows.h:47
SDL_SCANCODE_LEFT
@ SDL_SCANCODE_LEFT
Definition: SDL_scancode.h:177
SDL_SCANCODE_F17
@ SDL_SCANCODE_F17
Definition: SDL_scancode.h:219
SDL_SCANCODE_F13
@ SDL_SCANCODE_F13
Definition: SDL_scancode.h:215
SDL_SCANCODE_SELECT
@ SDL_SCANCODE_SELECT
Definition: SDL_scancode.h:230
SDL_SCANCODE_APP2
@ SDL_SCANCODE_APP2
Definition: SDL_scancode.h:389
WIN_UpdateClipCursor
void WIN_UpdateClipCursor(SDL_Window *window)
SDL_IsShapedWindow
#define SDL_IsShapedWindow
Definition: SDL_dynapi_overrides.h:371
NULL
#define NULL
Definition: begin_code.h:164
SDL_SCANCODE_KP_PERIOD
@ SDL_SCANCODE_KP_PERIOD
Definition: SDL_scancode.h:198
handle
EGLImageKHR EGLint EGLint * handle
Definition: eglext.h:937
SDL_timer.h
message
GLuint GLsizei const GLchar * message
Definition: SDL_opengl_glext.h:2483
SDL_HINT_WINDOWS_INTRESOURCE_ICON
#define SDL_HINT_WINDOWS_INTRESOURCE_ICON
A variable to specify custom icon resource id from RC file on Windows platform.
Definition: SDL_hints.h:240
SDL_SCANCODE_SLASH
@ SDL_SCANCODE_SLASH
Definition: SDL_scancode.h:149
TRUE
#define TRUE
Definition: edid-parse.c:33
SDL_WINDOWEVENT_CLOSE
@ SDL_WINDOWEVENT_CLOSE
Definition: SDL_video.h:167
SDL_VERSION
#define SDL_VERSION(x)
Macro to determine SDL version program was compiled against.
Definition: SDL_version.h:79
SDL_SCANCODE_RIGHT
@ SDL_SCANCODE_RIGHT
Definition: SDL_scancode.h:176
SDL_VideoData::PTOUCHINPUT
PTOUCHINPUT
Definition: SDL_windowsvideo.h:135
SDL_BUTTON_RIGHT
#define SDL_BUTTON_RIGHT
Definition: SDL_mouse.h:284
SDL_WindowsMessageHook
void(* SDL_WindowsMessageHook)(void *userdata, void *hWnd, unsigned int message, Uint64 wParam, Sint64 lParam)
Set a function that is called for every windows message, before TranslateMessage()
Definition: SDL_system.h:49
SDL_BUTTON_RMASK
#define SDL_BUTTON_RMASK
Definition: SDL_mouse.h:289
SDL_SysWMmsg::version
SDL_version version
Definition: SDL_syswm.h:137
SDL_WindowData
Definition: SDL_androidwindow.h:36
count
GLuint GLuint GLsizei count
Definition: SDL_opengl.h:1571
SDL_SCANCODE_VOLUMEDOWN
@ SDL_SCANCODE_VOLUMEDOWN
Definition: SDL_scancode.h:240
KMOD_NUM
@ KMOD_NUM
Definition: SDL_keycode.h:336
SDL_GetWindowFlags
#define SDL_GetWindowFlags
Definition: SDL_dynapi_overrides.h:518
SDL_SCANCODE_F15
@ SDL_SCANCODE_F15
Definition: SDL_scancode.h:217
SDL_WINDOW_FULLSCREEN
@ SDL_WINDOW_FULLSCREEN
Definition: SDL_video.h:100
SDL_WINDOWEVENT_RESIZED
@ SDL_WINDOWEVENT_RESIZED
Definition: SDL_video.h:155
SDL_Scancode
SDL_Scancode
The SDL keyboard scancode representation.
Definition: SDL_scancode.h:44
SDL_SCANCODE_KP_8
@ SDL_SCANCODE_KP_8
Definition: SDL_scancode.h:195
SDL_BUTTON_X2MASK
#define SDL_BUTTON_X2MASK
Definition: SDL_mouse.h:291
TOUCHEVENTF_MOVE
#define TOUCHEVENTF_MOVE
Definition: SDL_windowsvideo.h:58
params
const GLfloat * params
Definition: SDL_opengl_glext.h:371
SDL_UnregisterApp
void SDL_UnregisterApp(void)
SDL_SysWMmsg::msg
union SDL_SysWMmsg::@16 msg
SDL_VideoData::BOOL
BOOL(WINAPI *CloseTouchInputHandle)(HTOUCHINPUT)
SDL_SCANCODE_UP
@ SDL_SCANCODE_UP
Definition: SDL_scancode.h:179
SDL_SetKeyboardFocus
void SDL_SetKeyboardFocus(SDL_Window *window)
Definition: SDL_keyboard.c:630
callback
static Uint32 callback(Uint32 interval, void *param)
Definition: testtimer.c:34
Uint32
uint32_t Uint32
Definition: SDL_stdinc.h:203
SDL_ENABLE
#define SDL_ENABLE
Definition: SDL_events.h:756
SDL_HITTEST_RESIZE_TOPLEFT
@ SDL_HITTEST_RESIZE_TOPLEFT
Definition: SDL_video.h:1024
input
GLenum GLenum GLenum input
Definition: SDL_opengl_glext.h:9374
path
GLsizei const GLchar *const * path
Definition: SDL_opengl_glext.h:3730
SDL_SCANCODE_VOLUMEUP
@ SDL_SCANCODE_VOLUMEUP
Definition: SDL_scancode.h:239
SDL_SendTouch
int SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid, SDL_bool down, float x, float y, float pressure)
Definition: SDL_touch.c:222
SDL_SCANCODE_EXECUTE
@ SDL_SCANCODE_EXECUTE
Definition: SDL_scancode.h:227
SDL_SCANCODE_PAGEDOWN
@ SDL_SCANCODE_PAGEDOWN
Definition: SDL_scancode.h:175
SDL_VideoData::ULONG
ULONG
Definition: SDL_windowsvideo.h:136
SDL_WINDOWEVENT_MOVED
@ SDL_WINDOWEVENT_MOVED
Definition: SDL_video.h:153
SDL_GetHint
#define SDL_GetHint
Definition: SDL_dynapi_overrides.h:191
SDL_RELEASED
#define SDL_RELEASED
Definition: SDL_events.h:49
SDL_RegisterApp
int SDL_RegisterApp(char *name, Uint32 style, void *hInst)
h
GLfloat GLfloat GLfloat GLfloat h
Definition: SDL_opengl_glext.h:1946
SDL_SCANCODE_F18
@ SDL_SCANCODE_F18
Definition: SDL_scancode.h:220
SDL_SetMouseFocus
void SDL_SetMouseFocus(SDL_Window *window)
Definition: SDL_mouse.c:177
SDL_SCANCODE_KP_6
@ SDL_SCANCODE_KP_6
Definition: SDL_scancode.h:193
SDL_SendTouchMotion
int SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid, float x, float y, float pressure)
Definition: SDL_touch.c:284
SDL_MouseID
Uint32 SDL_MouseID
Definition: SDL_mouse_c.h:28
SDL_SCANCODE_LALT
@ SDL_SCANCODE_LALT
Definition: SDL_scancode.h:330
SDL_SendKeyboardKey
int SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode)
Definition: SDL_keyboard.c:679
SDL_WINDOW_RESIZABLE
@ SDL_WINDOW_RESIZABLE
Definition: SDL_video.h:105
SDL_SCANCODE_KP_EQUALS
@ SDL_SCANCODE_KP_EQUALS
Definition: SDL_scancode.h:214
data
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: SDL_opengl.h:1974
SDL_BUTTON_X1
#define SDL_BUTTON_X1
Definition: SDL_mouse.h:285
WIN_CheckClipboardUpdate
void WIN_CheckClipboardUpdate(struct SDL_VideoData *data)
SDL_Window
The type used to identify a window.
Definition: SDL_sysvideo.h:74
SDL_stack_alloc
#define SDL_stack_alloc(type, count)
Definition: SDL_stdinc.h:354
SDL_GetKeyboardFocus
#define SDL_GetKeyboardFocus
Definition: SDL_dynapi_overrides.h:216
SDL_SCANCODE_KP_1
@ SDL_SCANCODE_KP_1
Definition: SDL_scancode.h:188
SDL_TOUCH_MOUSEID
#define SDL_TOUCH_MOUSEID
Definition: SDL_touch.h:53
SDL_WINDOWEVENT_SHOWN
@ SDL_WINDOWEVENT_SHOWN
Definition: SDL_video.h:149
SDL_SCANCODE_CAPSLOCK
@ SDL_SCANCODE_CAPSLOCK
Definition: SDL_scancode.h:151
SDL_GetWindowSize
#define SDL_GetWindowSize
Definition: SDL_dynapi_overrides.h:527
SDL_SendKeyboardText
int SDL_SendKeyboardText(const char *text)
Definition: SDL_keyboard.c:789
SDL_cursor
HCURSOR SDL_cursor
SDL_PRESSED
#define SDL_PRESSED
Definition: SDL_events.h:50
SDL_HITTEST_RESIZE_BOTTOMRIGHT
@ SDL_HITTEST_RESIZE_BOTTOMRIGHT
Definition: SDL_video.h:1028
SDL_GetHintBoolean
#define SDL_GetHintBoolean
Definition: SDL_dynapi_overrides.h:608
SDL_ToggleModState
void SDL_ToggleModState(const SDL_Keymod modstate, const SDL_bool toggle)
Definition: SDL_keyboard.c:865
buffer
GLuint buffer
Definition: SDL_opengl_glext.h:533
SDL_Mouse::relative_mode
SDL_bool relative_mode
Definition: SDL_mouse_c.h:87
SDL_SCANCODE_F16
@ SDL_SCANCODE_F16
Definition: SDL_scancode.h:218
SDL_HITTEST_RESIZE_TOPRIGHT
@ SDL_HITTEST_RESIZE_TOPRIGHT
Definition: SDL_video.h:1026
SDL_SCANCODE_KP_MULTIPLY
@ SDL_SCANCODE_KP_MULTIPLY
Definition: SDL_scancode.h:184
windows_scancode_table
static const SDL_Scancode windows_scancode_table[]
Definition: scancodes_windows.h:27
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:121
SDL_BUTTON_LEFT
#define SDL_BUTTON_LEFT
Definition: SDL_mouse.h:282
SDL_HitTestResult
SDL_HitTestResult
Possible return values from the SDL_HitTest callback.
Definition: SDL_video.h:1021
SDL_windowsshape.h
SDL_windowsvideo.h
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
SDL_GetEventState
#define SDL_GetEventState(type)
Definition: SDL_events.h:769
SDL_SCANCODE_PAUSE
@ SDL_SCANCODE_PAUSE
Definition: SDL_scancode.h:168
window
EGLSurface EGLNativeWindowType * window
Definition: eglext.h:1025
SDL_SCANCODE_KP_7
@ SDL_SCANCODE_KP_7
Definition: SDL_scancode.h:194
SDL_memcmp
#define SDL_memcmp
Definition: SDL_dynapi_overrides.h:389
SDL_free
#define SDL_free
Definition: SDL_dynapi_overrides.h:377
SDL_SCANCODE_F24
@ SDL_SCANCODE_F24
Definition: SDL_scancode.h:226
SDL_SCANCODE_SYSREQ
@ SDL_SCANCODE_SYSREQ
Definition: SDL_scancode.h:269
SDL_HITTEST_RESIZE_BOTTOM
@ SDL_HITTEST_RESIZE_BOTTOM
Definition: SDL_video.h:1029
SDL_SCANCODE_F21
@ SDL_SCANCODE_F21
Definition: SDL_scancode.h:223
SDL_GetKeyboardState
#define SDL_GetKeyboardState
Definition: SDL_dynapi_overrides.h:217
name
GLuint const GLchar * name
Definition: SDL_opengl_glext.h:660
SDL_SCANCODE_KP_4
@ SDL_SCANCODE_KP_4
Definition: SDL_scancode.h:191
SDL_SCANCODE_KP_0
@ SDL_SCANCODE_KP_0
Definition: SDL_scancode.h:197
WIN_PumpEvents
void WIN_PumpEvents(_THIS)
SDL_SendDropFile
int SDL_SendDropFile(SDL_Window *window, const char *file)
Definition: SDL_dropevents.c:80
SDL_HITTEST_RESIZE_LEFT
@ SDL_HITTEST_RESIZE_LEFT
Definition: SDL_video.h:1031
rect
SDL_Rect rect
Definition: testrelative.c:27
SDL_SendMouseMotion
int SDL_SendMouseMotion(SDL_Window *window, SDL_MouseID mouseID, int relative, int x, int y)
Definition: SDL_mouse.c:263
SDL_WINDOWEVENT_EXPOSED
@ SDL_WINDOWEVENT_EXPOSED
Definition: SDL_video.h:151
SDL_SCANCODE_MAIL
@ SDL_SCANCODE_MAIL
Definition: SDL_scancode.h:358
SDL_BUTTON_MIDDLE
#define SDL_BUTTON_MIDDLE
Definition: SDL_mouse.h:283
SDL_SCANCODE_F14
@ SDL_SCANCODE_F14
Definition: SDL_scancode.h:216
TOUCHEVENTF_DOWN
#define TOUCHEVENTF_DOWN
Definition: SDL_windowsvideo.h:59
SDL_SCANCODE_KP_9
@ SDL_SCANCODE_KP_9
Definition: SDL_scancode.h:196
SDL_assert.h
SDL_SCANCODE_F20
@ SDL_SCANCODE_F20
Definition: SDL_scancode.h:222
SDL_VideoData::int
int
Definition: SDL_windowsvideo.h:135
SDL_BUTTON_LMASK
#define SDL_BUTTON_LMASK
Definition: SDL_mouse.h:287
_THIS
#define _THIS
Definition: SDL_alsa_audio.h:31
text
static char text[MAX_TEXT_LENGTH]
Definition: testime.c:47
SDL_SCANCODE_KP_DIVIDE
@ SDL_SCANCODE_KP_DIVIDE
Definition: SDL_scancode.h:183
SDL_GetWindowMinimumSize
#define SDL_GetWindowMinimumSize
Definition: SDL_dynapi_overrides.h:529
SDL_SCANCODE_AC_BACK
@ SDL_SCANCODE_AC_BACK
Definition: SDL_scancode.h:363
SDL_Mouse
Definition: SDL_mouse_c.h:44
SDL_AddTouch
int SDL_AddTouch(SDL_TouchID touchID, const char *name)
Definition: SDL_touch.c:136
SDL_TRUE
@ SDL_TRUE
Definition: SDL_stdinc.h:164
SDL_SendDropComplete
int SDL_SendDropComplete(SDL_Window *window)
Definition: SDL_dropevents.c:92
SDL_Instance
HINSTANCE SDL_Instance
SDL_Mouse::relative_mode_warp
SDL_bool relative_mode_warp
Definition: SDL_mouse_c.h:88
WIN_WindowProc
LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
SDL_SCANCODE_AC_STOP
@ SDL_SCANCODE_AC_STOP
Definition: SDL_scancode.h:365
SDL_assert
#define SDL_assert(condition)
Definition: SDL_assert.h:169
SDL_BUTTON_X1MASK
#define SDL_BUTTON_X1MASK
Definition: SDL_mouse.h:290
SDL_Mouse::focus
SDL_Window * focus
Definition: SDL_mouse_c.h:77
SDL_WINDOWEVENT_MINIMIZED
@ SDL_WINDOWEVENT_MINIMIZED
Definition: SDL_video.h:159
Win32_ResizeWindowShape
int Win32_ResizeWindowShape(SDL_Window *window)
SDL_SCANCODE_KP_PLUS
@ SDL_SCANCODE_KP_PLUS
Definition: SDL_scancode.h:186
SDL_SCANCODE_APP1
@ SDL_SCANCODE_APP1
Definition: SDL_scancode.h:388
SDL_TouchID
Sint64 SDL_TouchID
Definition: SDL_touch.h:41
SDL_SCANCODE_LCTRL
@ SDL_SCANCODE_LCTRL
Definition: SDL_scancode.h:328
SDL_VideoDevice
Definition: SDL_sysvideo.h:149
SDL_SCANCODE_AUDIOMUTE
@ SDL_SCANCODE_AUDIOMUTE
Definition: SDL_scancode.h:355
WIN_ResetDeadKeys
void WIN_ResetDeadKeys(void)
size
GLsizeiptr size
Definition: SDL_opengl_glext.h:537
y
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1574
SDL_HITTEST_NORMAL
@ SDL_HITTEST_NORMAL
Definition: SDL_video.h:1022
WIN_UpdateKeymap
void WIN_UpdateKeymap(void)
SDL_SCANCODE_UNKNOWN
@ SDL_SCANCODE_UNKNOWN
Definition: SDL_scancode.h:45
SDL_SendMouseWheel
int SDL_SendMouseWheel(SDL_Window *window, SDL_MouseID mouseID, float x, float y, SDL_MouseWheelDirection direction)
Definition: SDL_mouse.c:538
SDL_SCANCODE_LSHIFT
@ SDL_SCANCODE_LSHIFT
Definition: SDL_scancode.h:329
SDL_SCANCODE_MEDIASELECT
@ SDL_SCANCODE_MEDIASELECT
Definition: SDL_scancode.h:356
SDL_HITTEST_RESIZE_RIGHT
@ SDL_HITTEST_RESIZE_RIGHT
Definition: SDL_video.h:1027
SDL_SCANCODE_CLEAR
@ SDL_SCANCODE_CLEAR
Definition: SDL_scancode.h:271
SDL_atoi
#define SDL_atoi
Definition: SDL_dynapi_overrides.h:410
SDL_SCANCODE_DELETE
@ SDL_SCANCODE_DELETE
Definition: SDL_scancode.h:173
wmtab
char * wmtab[]
Definition: wmmsg.h:24
SDL_SCANCODE_AC_REFRESH
@ SDL_SCANCODE_AC_REFRESH
Definition: SDL_scancode.h:366
SDL_SCANCODE_NONUSBACKSLASH
@ SDL_SCANCODE_NONUSBACKSLASH
Definition: SDL_scancode.h:200
SDL_SCANCODE_AUDIOSTOP
@ SDL_SCANCODE_AUDIOSTOP
Definition: SDL_scancode.h:353
SDL_stack_free
#define SDL_stack_free(data)
Definition: SDL_stdinc.h:355
SDL_Point
The structure that defines a point.
Definition: SDL_rect.h:49
SDL_Window::next
SDL_Window * next
Definition: SDL_sysvideo.h:114
SDL_SetError
#define SDL_SetError
Definition: SDL_dynapi_overrides.h:30
SDL_vkeys.h
SDL_snprintf
#define SDL_snprintf
Definition: SDL_dynapi_overrides.h:40
SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL
#define SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL
Definition: SDL_hints.h:241
SDL_GetMouseFocus
#define SDL_GetMouseFocus
Definition: SDL_dynapi_overrides.h:245
SDL_SetWindowsMessageHook
void SDL_SetWindowsMessageHook(SDL_WindowsMessageHook callback, void *userdata)
SDL_system.h
MAX_WMMSG
#define MAX_WMMSG
Definition: wmmsg.h:22
SDL_GetWindowMaximumSize
#define SDL_GetWindowMaximumSize
Definition: SDL_dynapi_overrides.h:531
SDL_hints.h
SDL_SCANCODE_AC_HOME
@ SDL_SCANCODE_AC_HOME
Definition: SDL_scancode.h:362
SDL_SCANCODE_PAGEUP
@ SDL_SCANCODE_PAGEUP
Definition: SDL_scancode.h:172
SDL_SCANCODE_NUMLOCKCLEAR
@ SDL_SCANCODE_NUMLOCKCLEAR
Definition: SDL_scancode.h:181
WIN_StringToUTF8
#define WIN_StringToUTF8(S)
Definition: SDL_windows.h:46
SDL_SCANCODE_MODE
@ SDL_SCANCODE_MODE
Definition: SDL_scancode.h:337
SDL_SendKeymapChangedEvent
int SDL_SendKeymapChangedEvent(void)
Definition: SDL_events.c:973
SDL_SendWindowEvent
int SDL_SendWindowEvent(SDL_Window *window, Uint8 windowevent, int data1, int data2)
Definition: SDL_windowevents.c:74
SDL_SCANCODE_F23
@ SDL_SCANCODE_F23
Definition: SDL_scancode.h:225
SDL_Appstyle
Uint32 SDL_Appstyle
TOUCHEVENTF_UP
#define TOUCHEVENTF_UP
Definition: SDL_windowsvideo.h:60
SDL_SYSWMEVENT
@ SDL_SYSWMEVENT
Definition: SDL_events.h:93
SDL_TICKS_PASSED
#define SDL_TICKS_PASSED(A, B)
Compare SDL ticks values, and return true if A has passed B.
Definition: SDL_timer.h:56
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:162
SDL_Appname
LPTSTR SDL_Appname
SDL_SCANCODE_KP_3
@ SDL_SCANCODE_KP_3
Definition: SDL_scancode.h:190
SDL_MOUSEWHEEL_NORMAL
@ SDL_MOUSEWHEEL_NORMAL
Definition: SDL_mouse.h:68
SDL_WINDOWEVENT_HIDDEN
@ SDL_WINDOWEVENT_HIDDEN
Definition: SDL_video.h:150
SDL_GetVideoDevice
SDL_VideoDevice * SDL_GetVideoDevice(void)
Definition: SDL_video.c:586
SDL_BUTTON_X2
#define SDL_BUTTON_X2
Definition: SDL_mouse.h:286
SDL_WINDOWEVENT_RESTORED
@ SDL_WINDOWEVENT_RESTORED
Definition: SDL_video.h:161
SDL_SCANCODE_CRSEL
@ SDL_SCANCODE_CRSEL
Definition: SDL_scancode.h:278
SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH
#define SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH
Allow mouse click events when clicking to focus an SDL window.
Definition: SDL_hints.h:305
SDL_FALSE
@ SDL_FALSE
Definition: SDL_stdinc.h:163
SDL_SCANCODE_F19
@ SDL_SCANCODE_F19
Definition: SDL_scancode.h:221
SDL_SCANCODE_INSERT
@ SDL_SCANCODE_INSERT
Definition: SDL_scancode.h:169
SDL_SCANCODE_F22
@ SDL_SCANCODE_F22
Definition: SDL_scancode.h:224
SDL_SCANCODE_AC_SEARCH
@ SDL_SCANCODE_AC_SEARCH
Definition: SDL_scancode.h:361
SDL_SCANCODE_AUDIOPLAY
@ SDL_SCANCODE_AUDIOPLAY
Definition: SDL_scancode.h:354
SDL_SCANCODE_DOWN
@ SDL_SCANCODE_DOWN
Definition: SDL_scancode.h:178
SDL_BUTTON
#define SDL_BUTTON(X)
Definition: SDL_mouse.h:281
SDL_SCANCODE_RALT
@ SDL_SCANCODE_RALT
Definition: SDL_scancode.h:334
VK_OEM_102
#define VK_OEM_102
Definition: SDL_vkeys.h:74
SDL_SCANCODE_END
@ SDL_SCANCODE_END
Definition: SDL_scancode.h:174
SDL_SCANCODE_EXSEL
@ SDL_SCANCODE_EXSEL
Definition: SDL_scancode.h:279
IME_HandleMessage
SDL_bool IME_HandleMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM *lParam, struct SDL_VideoData *videodata)
SDL_SCANCODE_RSHIFT
@ SDL_SCANCODE_RSHIFT
Definition: SDL_scancode.h:333
wmmsg.h
SDL_SCANCODE_AUDIOPREV
@ SDL_SCANCODE_AUDIOPREV
Definition: SDL_scancode.h:352
SDL_VideoData::UINT
UINT
Definition: SDL_windowsvideo.h:135
SDL_HITTEST_RESIZE_TOP
@ SDL_HITTEST_RESIZE_TOP
Definition: SDL_video.h:1025
i
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:50
KMOD_CAPS
@ KMOD_CAPS
Definition: SDL_keycode.h:337
SDL_BUTTON_MMASK
#define SDL_BUTTON_MMASK
Definition: SDL_mouse.h:288
TOUCHINPUT
Definition: SDL_windowsvideo.h:64
button
SDL_Texture * button
Definition: testgamecontroller.c:67
g_WindowFrameUsableWhileCursorHidden
SDL_bool g_WindowFrameUsableWhileCursorHidden
SDL_SCANCODE_HOME
@ SDL_SCANCODE_HOME
Definition: SDL_scancode.h:171
SDL_SCANCODE_RETURN
@ SDL_SCANCODE_RETURN
Definition: SDL_scancode.h:92
SDL_HITTEST_RESIZE_BOTTOMLEFT
@ SDL_HITTEST_RESIZE_BOTTOMLEFT
Definition: SDL_video.h:1030
SDL_Point::y
int y
Definition: SDL_rect.h:51
SDL_SendMouseButton
int SDL_SendMouseButton(SDL_Window *window, SDL_MouseID mouseID, Uint8 state, Uint8 button)
Definition: SDL_mouse.c:532
SDL_WINDOWEVENT_MAXIMIZED
@ SDL_WINDOWEVENT_MAXIMIZED
Definition: SDL_video.h:160
FALSE
#define FALSE
Definition: edid-parse.c:34
SDL_SCANCODE_AUDIONEXT
@ SDL_SCANCODE_AUDIONEXT
Definition: SDL_scancode.h:351
SDL_SYSWM_WINDOWS
@ SDL_SYSWM_WINDOWS
Definition: SDL_syswm.h:119
SDL_syswm.h
SDL_SCANCODE_KP_ENTER
@ SDL_SCANCODE_KP_ENTER
Definition: SDL_scancode.h:187
SDL_WINDOW_BORDERLESS
@ SDL_WINDOW_BORDERLESS
Definition: SDL_video.h:104
SDL_VideoDevice::windows
SDL_Window * windows
Definition: SDL_sysvideo.h:317
w
GLubyte GLubyte GLubyte GLubyte w
Definition: SDL_opengl_glext.h:731
SDL_SCANCODE_F4
@ SDL_SCANCODE_F4
Definition: SDL_scancode.h:156
SDL_SCANCODE_AC_BOOKMARKS
@ SDL_SCANCODE_AC_BOOKMARKS
Definition: SDL_scancode.h:367