SDL  2.0
SDL_windowswindow.c
Go to the documentation of this file.
1 /*
2  Simple DirectMedia Layer
3  Copyright (C) 1997-2020 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 "../../core/windows/SDL_windows.h"
26 
27 #include "SDL_assert.h"
28 #include "../SDL_sysvideo.h"
29 #include "../SDL_pixels_c.h"
30 #include "../../events/SDL_keyboard_c.h"
31 #include "../../events/SDL_mouse_c.h"
32 
33 #include "SDL_windowsvideo.h"
34 #include "SDL_windowswindow.h"
35 #include "SDL_hints.h"
36 
37 /* Dropfile support */
38 #include <shellapi.h>
39 
40 /* This is included after SDL_windowsvideo.h, which includes windows.h */
41 #include "SDL_syswm.h"
42 
43 /* Windows CE compatibility */
44 #ifndef SWP_NOCOPYBITS
45 #define SWP_NOCOPYBITS 0
46 #endif
47 
48 /* Fake window to help with DirectInput events. */
49 HWND SDL_HelperWindow = NULL;
50 static WCHAR *SDL_HelperWindowClassName = TEXT("SDLHelperWindowInputCatcher");
51 static WCHAR *SDL_HelperWindowName = TEXT("SDLHelperWindowInputMsgWindow");
52 static ATOM SDL_HelperWindowClass = 0;
53 
54 /* For borderless Windows, still want the following flags:
55  - WS_CAPTION: this seems to enable the Windows minimize animation
56  - WS_SYSMENU: enables system context menu on task bar
57  - WS_MINIMIZEBOX: window will respond to Windows minimize commands sent to all windows, such as windows key + m, shaking title bar, etc.
58  This will also cause the task bar to overlap the window and other windowed behaviors, so only use this for windows that shouldn't appear to be fullscreen
59  */
60 
61 #define STYLE_BASIC (WS_CLIPSIBLINGS | WS_CLIPCHILDREN)
62 #define STYLE_FULLSCREEN (WS_POPUP)
63 #define STYLE_BORDERLESS (WS_POPUP)
64 #define STYLE_BORDERLESS_WINDOWED (WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX)
65 #define STYLE_NORMAL (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX)
66 #define STYLE_RESIZABLE (WS_THICKFRAME | WS_MAXIMIZEBOX)
67 #define STYLE_MASK (STYLE_FULLSCREEN | STYLE_BORDERLESS | STYLE_NORMAL | STYLE_RESIZABLE)
68 
69 static DWORD
70 GetWindowStyle(SDL_Window * window)
71 {
72  DWORD style = 0;
73 
74  if (window->flags & SDL_WINDOW_FULLSCREEN) {
75  style |= STYLE_FULLSCREEN;
76  } else {
77  if (window->flags & SDL_WINDOW_BORDERLESS) {
78  /* SDL 2.1:
79  This behavior more closely matches other platform where the window is borderless
80  but still interacts with the window manager (e.g. task bar shows above it, it can
81  be resized to fit within usable desktop area, etc.) so this should be the behavior
82  for a future SDL release.
83 
84  If you want a borderless window the size of the desktop that looks like a fullscreen
85  window, then you should use the SDL_WINDOW_FULLSCREEN_DESKTOP flag.
86  */
87  if (SDL_GetHintBoolean("SDL_BORDERLESS_WINDOWED_STYLE", SDL_FALSE)) {
88  style |= STYLE_BORDERLESS_WINDOWED;
89  } else {
90  style |= STYLE_BORDERLESS;
91  }
92  } else {
93  style |= STYLE_NORMAL;
94  }
95 
96  if (window->flags & SDL_WINDOW_RESIZABLE) {
97  /* You can have a borderless resizable window, but Windows doesn't always draw it correctly,
98  see https://bugzilla.libsdl.org/show_bug.cgi?id=4466
99  */
100  if (!(window->flags & SDL_WINDOW_BORDERLESS) ||
101  SDL_GetHintBoolean("SDL_BORDERLESS_RESIZABLE_STYLE", SDL_FALSE)) {
102  style |= STYLE_RESIZABLE;
103  }
104  }
105 
106  /* Need to set initialize minimize style, or when we call ShowWindow with WS_MINIMIZE it will activate a random window */
107  if (window->flags & SDL_WINDOW_MINIMIZED) {
108  style |= WS_MINIMIZE;
109  }
110  }
111  return style;
112 }
113 
114 static void
115 WIN_AdjustWindowRectWithStyle(SDL_Window *window, DWORD style, BOOL menu, int *x, int *y, int *width, int *height, SDL_bool use_current)
116 {
117  RECT rect;
118 
119  rect.left = 0;
120  rect.top = 0;
121  rect.right = (use_current ? window->w : window->windowed.w);
122  rect.bottom = (use_current ? window->h : window->windowed.h);
123 
124  /* borderless windows will have WM_NCCALCSIZE return 0 for the non-client area. When this happens, it looks like windows will send a resize message
125  expanding the window client area to the previous window + chrome size, so shouldn't need to adjust the window size for the set styles.
126  */
127  if (!(window->flags & SDL_WINDOW_BORDERLESS))
128  AdjustWindowRectEx(&rect, style, menu, 0);
129 
130  *x = (use_current ? window->x : window->windowed.x) + rect.left;
131  *y = (use_current ? window->y : window->windowed.y) + rect.top;
132  *width = (rect.right - rect.left);
133  *height = (rect.bottom - rect.top);
134 }
135 
136 static void
137 WIN_AdjustWindowRect(SDL_Window *window, int *x, int *y, int *width, int *height, SDL_bool use_current)
138 {
139  SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
140  HWND hwnd = data->hwnd;
141  DWORD style;
142  BOOL menu;
143 
144  style = GetWindowLong(hwnd, GWL_STYLE);
145  menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL);
146  WIN_AdjustWindowRectWithStyle(window, style, menu, x, y, width, height, use_current);
147 }
148 
149 static void
150 WIN_SetWindowPositionInternal(_THIS, SDL_Window * window, UINT flags)
151 {
152  SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
153  HWND hwnd = data->hwnd;
154  HWND top;
155  int x, y;
156  int w, h;
157 
158  /* Figure out what the window area will be */
160  top = HWND_TOPMOST;
161  } else {
162  top = HWND_NOTOPMOST;
163  }
164 
165  WIN_AdjustWindowRect(window, &x, &y, &w, &h, SDL_TRUE);
166 
167  data->expected_resize = SDL_TRUE;
168  SetWindowPos(hwnd, top, x, y, w, h, flags);
169  data->expected_resize = SDL_FALSE;
170 }
171 
172 static int
173 SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, HWND parent, SDL_bool created)
174 {
175  SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
177 
178  /* Allocate the window data */
179  data = (SDL_WindowData *) SDL_calloc(1, sizeof(*data));
180  if (!data) {
181  return SDL_OutOfMemory();
182  }
183  data->window = window;
184  data->hwnd = hwnd;
185  data->parent = parent;
186  data->hdc = GetDC(hwnd);
187  data->hinstance = (HINSTANCE) GetWindowLongPtr(hwnd, GWLP_HINSTANCE);
188  data->created = created;
189  data->mouse_button_flags = 0;
190  data->videodata = videodata;
191  data->initializing = SDL_TRUE;
192 
193  window->driverdata = data;
194 
195  /* Associate the data with the window */
196  if (!SetProp(hwnd, TEXT("SDL_WindowData"), data)) {
197  ReleaseDC(hwnd, data->hdc);
198  SDL_free(data);
199  return WIN_SetError("SetProp() failed");
200  }
201 
202  /* Set up the window proc function */
203 #ifdef GWLP_WNDPROC
204  data->wndproc = (WNDPROC) GetWindowLongPtr(hwnd, GWLP_WNDPROC);
205  if (data->wndproc == WIN_WindowProc) {
206  data->wndproc = NULL;
207  } else {
208  SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR) WIN_WindowProc);
209  }
210 #else
211  data->wndproc = (WNDPROC) GetWindowLong(hwnd, GWL_WNDPROC);
212  if (data->wndproc == WIN_WindowProc) {
213  data->wndproc = NULL;
214  } else {
215  SetWindowLong(hwnd, GWL_WNDPROC, (LONG_PTR) WIN_WindowProc);
216  }
217 #endif
218 
219  /* Fill in the SDL window with the window data */
220  {
221  RECT rect;
222  if (GetClientRect(hwnd, &rect)) {
223  int w = rect.right;
224  int h = rect.bottom;
225  if ((window->windowed.w && window->windowed.w != w) || (window->windowed.h && window->windowed.h != h)) {
226  /* We tried to create a window larger than the desktop and Windows didn't allow it. Override! */
227  int x, y;
228  /* Figure out what the window area will be */
229  WIN_AdjustWindowRect(window, &x, &y, &w, &h, SDL_FALSE);
230  SetWindowPos(hwnd, HWND_NOTOPMOST, x, y, w, h, SWP_NOCOPYBITS | SWP_NOZORDER | SWP_NOACTIVATE);
231  } else {
232  window->w = w;
233  window->h = h;
234  }
235  }
236  }
237  {
238  POINT point;
239  point.x = 0;
240  point.y = 0;
241  if (ClientToScreen(hwnd, &point)) {
242  window->x = point.x;
243  window->y = point.y;
244  }
245  }
246  {
247  DWORD style = GetWindowLong(hwnd, GWL_STYLE);
248  if (style & WS_VISIBLE) {
249  window->flags |= SDL_WINDOW_SHOWN;
250  } else {
251  window->flags &= ~SDL_WINDOW_SHOWN;
252  }
253  if (style & WS_POPUP) {
254  window->flags |= SDL_WINDOW_BORDERLESS;
255  } else {
256  window->flags &= ~SDL_WINDOW_BORDERLESS;
257  }
258  if (style & WS_THICKFRAME) {
259  window->flags |= SDL_WINDOW_RESIZABLE;
260  } else {
261  window->flags &= ~SDL_WINDOW_RESIZABLE;
262  }
263 #ifdef WS_MAXIMIZE
264  if (style & WS_MAXIMIZE) {
265  window->flags |= SDL_WINDOW_MAXIMIZED;
266  } else
267 #endif
268  {
269  window->flags &= ~SDL_WINDOW_MAXIMIZED;
270  }
271 #ifdef WS_MINIMIZE
272  if (style & WS_MINIMIZE) {
273  window->flags |= SDL_WINDOW_MINIMIZED;
274  } else
275 #endif
276  {
277  window->flags &= ~SDL_WINDOW_MINIMIZED;
278  }
279  }
280  if (GetFocus() == hwnd) {
281  window->flags |= SDL_WINDOW_INPUT_FOCUS;
282  SDL_SetKeyboardFocus(data->window);
283 
284  if (window->flags & SDL_WINDOW_INPUT_GRABBED) {
285  RECT rect;
286  GetClientRect(hwnd, &rect);
287  ClientToScreen(hwnd, (LPPOINT) & rect);
288  ClientToScreen(hwnd, (LPPOINT) & rect + 1);
289  ClipCursor(&rect);
290  }
291  }
292 
293  /* Enable multi-touch */
294  if (videodata->RegisterTouchWindow) {
295  videodata->RegisterTouchWindow(hwnd, (TWF_FINETOUCH|TWF_WANTPALM));
296  }
297 
298  data->initializing = SDL_FALSE;
299 
300  /* All done! */
301  return 0;
302 }
303 
304 
305 
306 int
308 {
309  HWND hwnd, parent = NULL;
310  DWORD style = STYLE_BASIC;
311  int x, y;
312  int w, h;
313 
314  if (window->flags & SDL_WINDOW_SKIP_TASKBAR) {
315  parent = CreateWindow(SDL_Appname, TEXT(""), STYLE_BASIC, 0, 0, 32, 32, NULL, NULL, SDL_Instance, NULL);
316  }
317 
318  style |= GetWindowStyle(window);
319 
320  /* Figure out what the window area will be */
321  WIN_AdjustWindowRectWithStyle(window, style, FALSE, &x, &y, &w, &h, SDL_FALSE);
322 
323  hwnd =
324  CreateWindow(SDL_Appname, TEXT(""), style, x, y, w, h, parent, NULL,
325  SDL_Instance, NULL);
326  if (!hwnd) {
327  return WIN_SetError("Couldn't create window");
328  }
329 
331 
332  if (SetupWindowData(_this, window, hwnd, parent, SDL_TRUE) < 0) {
333  DestroyWindow(hwnd);
334  if (parent) {
335  DestroyWindow(parent);
336  }
337  return -1;
338  }
339 
340  /* Inform Windows of the frame change so we can respond to WM_NCCALCSIZE */
341  SetWindowPos(hwnd, NULL, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
342 
343  if (window->flags & SDL_WINDOW_MINIMIZED) {
344  ShowWindow(hwnd, SW_SHOWMINNOACTIVE);
345  }
346 
347  if (!(window->flags & SDL_WINDOW_OPENGL)) {
348  return 0;
349  }
350 
351  /* The rest of this macro mess is for OpenGL or OpenGL ES windows */
352 #if SDL_VIDEO_OPENGL_ES2
355  && (!_this->gl_data || WIN_GL_UseEGL(_this))
356 #endif /* SDL_VIDEO_OPENGL_WGL */
357  ) {
358 #if SDL_VIDEO_OPENGL_EGL
359  if (WIN_GLES_SetupWindow(_this, window) < 0) {
361  return -1;
362  }
363  return 0;
364 #else
365  return SDL_SetError("Could not create GLES window surface (EGL support not configured)");
366 #endif /* SDL_VIDEO_OPENGL_EGL */
367  }
368 #endif /* SDL_VIDEO_OPENGL_ES2 */
369 
370 #if SDL_VIDEO_OPENGL_WGL
371  if (WIN_GL_SetupWindow(_this, window) < 0) {
373  return -1;
374  }
375 #else
376  return SDL_SetError("Could not create GL window (WGL support not configured)");
377 #endif
378 
379  return 0;
380 }
381 
382 int
384 {
385  HWND hwnd = (HWND) data;
386  LPTSTR title;
387  int titleLen;
388  SDL_bool isstack;
389 
390  /* Query the title from the existing window */
391  titleLen = GetWindowTextLength(hwnd);
392  title = SDL_small_alloc(TCHAR, titleLen + 1, &isstack);
393  if (title) {
394  titleLen = GetWindowText(hwnd, title, titleLen + 1);
395  } else {
396  titleLen = 0;
397  }
398  if (titleLen > 0) {
399  window->title = WIN_StringToUTF8(title);
400  }
401  if (title) {
402  SDL_small_free(title, isstack);
403  }
404 
405  if (SetupWindowData(_this, window, hwnd, GetParent(hwnd), SDL_FALSE) < 0) {
406  return -1;
407  }
408 
409 #if SDL_VIDEO_OPENGL_WGL
410  {
412  if (hint) {
413  /* This hint is a pointer (in string form) of the address of
414  the window to share a pixel format with
415  */
416  SDL_Window *otherWindow = NULL;
417  SDL_sscanf(hint, "%p", (void**)&otherWindow);
418 
419  /* Do some error checking on the pointer */
420  if (otherWindow != NULL && otherWindow->magic == &_this->window_magic) {
421  /* If the otherWindow has SDL_WINDOW_OPENGL set, set it for the new window as well */
422  if (otherWindow->flags & SDL_WINDOW_OPENGL) {
423  window->flags |= SDL_WINDOW_OPENGL;
424  if (!WIN_GL_SetPixelFormatFrom(_this, otherWindow, window)) {
425  return -1;
426  }
427  }
428  }
429  }
430  }
431 #endif
432  return 0;
433 }
434 
435 void
437 {
438  HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
439  LPTSTR title = WIN_UTF8ToString(window->title);
440  SetWindowText(hwnd, title);
441  SDL_free(title);
442 }
443 
444 void
446 {
447  HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
448  HICON hicon = NULL;
449  BYTE *icon_bmp;
450  int icon_len, mask_len, y;
451  SDL_RWops *dst;
452  SDL_bool isstack;
453 
454  /* Create temporary buffer for ICONIMAGE structure */
455  mask_len = (icon->h * (icon->w + 7)/8);
456  icon_len = 40 + icon->h * icon->w * sizeof(Uint32) + mask_len;
457  icon_bmp = SDL_small_alloc(BYTE, icon_len, &isstack);
458  dst = SDL_RWFromMem(icon_bmp, icon_len);
459  if (!dst) {
460  SDL_small_free(icon_bmp, isstack);
461  return;
462  }
463 
464  /* Write the BITMAPINFO header */
465  SDL_WriteLE32(dst, 40);
466  SDL_WriteLE32(dst, icon->w);
467  SDL_WriteLE32(dst, icon->h * 2);
468  SDL_WriteLE16(dst, 1);
469  SDL_WriteLE16(dst, 32);
471  SDL_WriteLE32(dst, icon->h * icon->w * sizeof(Uint32));
472  SDL_WriteLE32(dst, 0);
473  SDL_WriteLE32(dst, 0);
474  SDL_WriteLE32(dst, 0);
475  SDL_WriteLE32(dst, 0);
476 
477  /* Write the pixels upside down into the bitmap buffer */
479  y = icon->h;
480  while (y--) {
481  Uint8 *src = (Uint8 *) icon->pixels + y * icon->pitch;
482  SDL_RWwrite(dst, src, icon->w * sizeof(Uint32), 1);
483  }
484 
485  /* Write the mask */
486  SDL_memset(icon_bmp + icon_len - mask_len, 0xFF, mask_len);
487 
488  hicon = CreateIconFromResource(icon_bmp, icon_len, TRUE, 0x00030000);
489 
490  SDL_RWclose(dst);
491  SDL_small_free(icon_bmp, isstack);
492 
493  /* Set the icon for the window */
494  SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM) hicon);
495 
496  /* Set the icon in the task manager (should we do this?) */
497  SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM) hicon);
498 }
499 
500 void
502 {
503  WIN_SetWindowPositionInternal(_this, window, SWP_NOCOPYBITS | SWP_NOSIZE | SWP_NOACTIVATE);
504 }
505 
506 void
508 {
509  WIN_SetWindowPositionInternal(_this, window, SWP_NOCOPYBITS | SWP_NOMOVE | SWP_NOACTIVATE);
510 }
511 
512 int
514 {
515  HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
516  RECT rcClient, rcWindow;
517  POINT ptDiff;
518 
519  /* rcClient stores the size of the inner window, while rcWindow stores the outer size relative to the top-left
520  * screen position; so the top/left values of rcClient are always {0,0} and bottom/right are {height,width} */
521  GetClientRect(hwnd, &rcClient);
522  GetWindowRect(hwnd, &rcWindow);
523 
524  /* convert the top/left values to make them relative to
525  * the window; they will end up being slightly negative */
526  ptDiff.y = rcWindow.top;
527  ptDiff.x = rcWindow.left;
528 
529  ScreenToClient(hwnd, &ptDiff);
530 
531  rcWindow.top = ptDiff.y;
532  rcWindow.left = ptDiff.x;
533 
534  /* convert the bottom/right values to make them relative to the window,
535  * these will be slightly bigger than the inner width/height */
536  ptDiff.y = rcWindow.bottom;
537  ptDiff.x = rcWindow.right;
538 
539  ScreenToClient(hwnd, &ptDiff);
540 
541  rcWindow.bottom = ptDiff.y;
542  rcWindow.right = ptDiff.x;
543 
544  /* Now that both the inner and outer rects use the same coordinate system we can substract them to get the border size.
545  * Keep in mind that the top/left coordinates of rcWindow are negative because the border lies slightly before {0,0},
546  * so switch them around because SDL2 wants them in positive. */
547  *top = rcClient.top - rcWindow.top;
548  *left = rcClient.left - rcWindow.left;
549  *bottom = rcWindow.bottom - rcClient.bottom;
550  *right = rcWindow.right - rcClient.right;
551 
552  return 0;
553 }
554 
555 void
557 {
558  DWORD style;
559  HWND hwnd;
560  int nCmdShow;
561 
562  hwnd = ((SDL_WindowData *)window->driverdata)->hwnd;
563  nCmdShow = SW_SHOW;
564  style = GetWindowLong(hwnd, GWL_EXSTYLE);
565  if (style & WS_EX_NOACTIVATE) {
566  nCmdShow = SW_SHOWNOACTIVATE;
567  }
568  ShowWindow(hwnd, nCmdShow);
569 }
570 
571 void
573 {
574  HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
575  ShowWindow(hwnd, SW_HIDE);
576 }
577 
578 void
580 {
581  HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
582  SetForegroundWindow(hwnd);
583 }
584 
585 void
587 {
588  SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
589  HWND hwnd = data->hwnd;
590  data->expected_resize = SDL_TRUE;
591  ShowWindow(hwnd, SW_MAXIMIZE);
592  data->expected_resize = SDL_FALSE;
593 }
594 
595 void
597 {
598  HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
599  ShowWindow(hwnd, SW_MINIMIZE);
600 }
601 
602 void
604 {
605  SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
606  HWND hwnd = data->hwnd;
607  DWORD style;
608 
609  style = GetWindowLong(hwnd, GWL_STYLE);
610  style &= ~STYLE_MASK;
611  style |= GetWindowStyle(window);
612 
613  data->in_border_change = SDL_TRUE;
614  SetWindowLong(hwnd, GWL_STYLE, style);
615  WIN_SetWindowPositionInternal(_this, window, SWP_NOCOPYBITS | SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOACTIVATE);
616  data->in_border_change = SDL_FALSE;
617 }
618 
619 void
621 {
622  SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
623  HWND hwnd = data->hwnd;
624  DWORD style;
625 
626  style = GetWindowLong(hwnd, GWL_STYLE);
627  style &= ~STYLE_MASK;
628  style |= GetWindowStyle(window);
629 
630  SetWindowLong(hwnd, GWL_STYLE, style);
631 }
632 
633 void
635 {
636  SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
637  HWND hwnd = data->hwnd;
638  data->expected_resize = SDL_TRUE;
639  ShowWindow(hwnd, SW_RESTORE);
640  data->expected_resize = SDL_FALSE;
641 }
642 
643 void
645 {
646  SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
647  HWND hwnd = data->hwnd;
648  SDL_Rect bounds;
649  DWORD style;
650  HWND top;
651  int x, y;
652  int w, h;
653 
655  top = HWND_TOPMOST;
656  } else {
657  top = HWND_NOTOPMOST;
658  }
659 
660  style = GetWindowLong(hwnd, GWL_STYLE);
661  style &= ~STYLE_MASK;
662  style |= GetWindowStyle(window);
663 
664  WIN_GetDisplayBounds(_this, display, &bounds);
665 
666  if (fullscreen) {
667  x = bounds.x;
668  y = bounds.y;
669  w = bounds.w;
670  h = bounds.h;
671 
672  /* Unset the maximized flag. This fixes
673  https://bugzilla.libsdl.org/show_bug.cgi?id=3215
674  */
675  if (style & WS_MAXIMIZE) {
676  data->windowed_mode_was_maximized = SDL_TRUE;
677  style &= ~WS_MAXIMIZE;
678  }
679  } else {
680  BOOL menu;
681 
682  /* Restore window-maximization state, as applicable.
683  Special care is taken to *not* do this if and when we're
684  alt-tab'ing away (to some other window; as indicated by
685  in_window_deactivation), otherwise
686  https://bugzilla.libsdl.org/show_bug.cgi?id=3215 can reproduce!
687  */
688  if (data->windowed_mode_was_maximized && !data->in_window_deactivation) {
689  style |= WS_MAXIMIZE;
690  data->windowed_mode_was_maximized = SDL_FALSE;
691  }
692 
693  menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL);
694  WIN_AdjustWindowRectWithStyle(window, style, menu, &x, &y, &w, &h, SDL_FALSE);
695  }
696  SetWindowLong(hwnd, GWL_STYLE, style);
697  data->expected_resize = SDL_TRUE;
698  SetWindowPos(hwnd, top, x, y, w, h, SWP_NOCOPYBITS | SWP_NOACTIVATE);
699  data->expected_resize = SDL_FALSE;
700 }
701 
702 int
704 {
707  HDC hdc;
708  BOOL succeeded = FALSE;
709 
710  hdc = CreateDC(data->DeviceName, NULL, NULL, NULL);
711  if (hdc) {
712  succeeded = SetDeviceGammaRamp(hdc, (LPVOID)ramp);
713  if (!succeeded) {
714  WIN_SetError("SetDeviceGammaRamp()");
715  }
716  DeleteDC(hdc);
717  }
718  return succeeded ? 0 : -1;
719 }
720 
721 int
723 {
726  HDC hdc;
727  BOOL succeeded = FALSE;
728 
729  hdc = CreateDC(data->DeviceName, NULL, NULL, NULL);
730  if (hdc) {
731  succeeded = GetDeviceGammaRamp(hdc, (LPVOID)ramp);
732  if (!succeeded) {
733  WIN_SetError("GetDeviceGammaRamp()");
734  }
735  DeleteDC(hdc);
736  }
737  return succeeded ? 0 : -1;
738 }
739 
740 void
742 {
744 
745  if (window->flags & SDL_WINDOW_FULLSCREEN) {
746  UINT flags = SWP_NOCOPYBITS | SWP_NOMOVE | SWP_NOSIZE;
747 
748  if (!(window->flags & SDL_WINDOW_SHOWN)) {
749  flags |= SWP_NOACTIVATE;
750  }
751  WIN_SetWindowPositionInternal(_this, window, flags);
752  }
753 }
754 
755 void
757 {
758  SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
759 
760  if (data) {
761  ReleaseDC(data->hwnd, data->hdc);
762  RemoveProp(data->hwnd, TEXT("SDL_WindowData"));
763  if (data->created) {
764  DestroyWindow(data->hwnd);
765  if (data->parent) {
766  DestroyWindow(data->parent);
767  }
768  } else {
769  /* Restore any original event handler... */
770  if (data->wndproc != NULL) {
771 #ifdef GWLP_WNDPROC
772  SetWindowLongPtr(data->hwnd, GWLP_WNDPROC,
773  (LONG_PTR) data->wndproc);
774 #else
775  SetWindowLong(data->hwnd, GWL_WNDPROC,
776  (LONG_PTR) data->wndproc);
777 #endif
778  }
779  }
780  SDL_free(data);
781  }
782  window->driverdata = NULL;
783 }
784 
785 SDL_bool
787 {
788  const SDL_WindowData *data = (const SDL_WindowData *) window->driverdata;
789  if (info->version.major <= SDL_MAJOR_VERSION) {
790  int versionnum = SDL_VERSIONNUM(info->version.major, info->version.minor, info->version.patch);
791 
793  info->info.win.window = data->hwnd;
794 
795  if (versionnum >= SDL_VERSIONNUM(2, 0, 4)) {
796  info->info.win.hdc = data->hdc;
797  }
798 
799  if (versionnum >= SDL_VERSIONNUM(2, 0, 5)) {
800  info->info.win.hinstance = data->hinstance;
801  }
802 
803  return SDL_TRUE;
804  } else {
805  SDL_SetError("Application not compiled with SDL %d.%d",
807  return SDL_FALSE;
808  }
809 }
810 
811 
812 /*
813  * Creates a HelperWindow used for DirectInput events.
814  */
815 int
816 SDL_HelperWindowCreate(void)
817 {
818  HINSTANCE hInstance = GetModuleHandle(NULL);
819  WNDCLASS wce;
820 
821  /* Make sure window isn't created twice. */
822  if (SDL_HelperWindow != NULL) {
823  return 0;
824  }
825 
826  /* Create the class. */
827  SDL_zero(wce);
828  wce.lpfnWndProc = DefWindowProc;
829  wce.lpszClassName = (LPCWSTR) SDL_HelperWindowClassName;
830  wce.hInstance = hInstance;
831 
832  /* Register the class. */
833  SDL_HelperWindowClass = RegisterClass(&wce);
834  if (SDL_HelperWindowClass == 0 && GetLastError() != ERROR_CLASS_ALREADY_EXISTS) {
835  return WIN_SetError("Unable to create Helper Window Class");
836  }
837 
838  /* Create the window. */
839  SDL_HelperWindow = CreateWindowEx(0, SDL_HelperWindowClassName,
840  SDL_HelperWindowName,
841  WS_OVERLAPPED, CW_USEDEFAULT,
842  CW_USEDEFAULT, CW_USEDEFAULT,
843  CW_USEDEFAULT, HWND_MESSAGE, NULL,
844  hInstance, NULL);
845  if (SDL_HelperWindow == NULL) {
846  UnregisterClass(SDL_HelperWindowClassName, hInstance);
847  return WIN_SetError("Unable to create Helper Window");
848  }
849 
850  return 0;
851 }
852 
853 
854 /*
855  * Destroys the HelperWindow previously created with SDL_HelperWindowCreate.
856  */
857 void
858 SDL_HelperWindowDestroy(void)
859 {
860  HINSTANCE hInstance = GetModuleHandle(NULL);
861 
862  /* Destroy the window. */
863  if (SDL_HelperWindow != NULL) {
864  if (DestroyWindow(SDL_HelperWindow) == 0) {
865  WIN_SetError("Unable to destroy Helper Window");
866  return;
867  }
868  SDL_HelperWindow = NULL;
869  }
870 
871  /* Unregister the class. */
872  if (SDL_HelperWindowClass != 0) {
873  if ((UnregisterClass(SDL_HelperWindowClassName, hInstance)) == 0) {
874  WIN_SetError("Unable to destroy Helper Window Class");
875  return;
876  }
877  SDL_HelperWindowClass = 0;
878  }
879 }
880 
882 {
883  SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
884 
885  if (!data || !data->hwnd) {
886  /* The window wasn't fully initialized */
887  return;
888  }
889 
890  if (window->flags & SDL_WINDOW_ALWAYS_ON_TOP) {
891  WIN_SetWindowPositionInternal(_this, window, SWP_NOCOPYBITS | SWP_NOSIZE | SWP_NOACTIVATE);
892  }
893 
894 #ifdef WM_MOUSELEAVE
895  {
896  TRACKMOUSEEVENT trackMouseEvent;
897 
898  trackMouseEvent.cbSize = sizeof(TRACKMOUSEEVENT);
899  trackMouseEvent.dwFlags = TME_LEAVE;
900  trackMouseEvent.hwndTrack = data->hwnd;
901 
902  TrackMouseEvent(&trackMouseEvent);
903  }
904 #endif /* WM_MOUSELEAVE */
905 }
906 
907 void
909 {
910  SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
911  SDL_Mouse *mouse = SDL_GetMouse();
912  RECT rect, clipped_rect;
913 
914  if (data->in_title_click || data->focus_click_pending) {
915  return;
916  }
917  if (data->skip_update_clipcursor) {
918  data->skip_update_clipcursor = SDL_FALSE;
919  return;
920  }
921  if (!GetClipCursor(&clipped_rect)) {
922  return;
923  }
924 
925  if ((mouse->relative_mode || (window->flags & SDL_WINDOW_INPUT_GRABBED)) &&
926  (window->flags & SDL_WINDOW_INPUT_FOCUS)) {
927  if (mouse->relative_mode && !mouse->relative_mode_warp) {
928  if (GetWindowRect(data->hwnd, &rect)) {
929  LONG cx, cy;
930 
931  cx = (rect.left + rect.right) / 2;
932  cy = (rect.top + rect.bottom) / 2;
933 
934  /* Make an absurdly small clip rect */
935  rect.left = cx - 1;
936  rect.right = cx + 1;
937  rect.top = cy - 1;
938  rect.bottom = cy + 1;
939 
940  if (SDL_memcmp(&rect, &clipped_rect, sizeof(rect)) != 0) {
941  if (ClipCursor(&rect)) {
942  data->cursor_clipped_rect = rect;
943  }
944  }
945  }
946  } else {
947  if (GetClientRect(data->hwnd, &rect) && !IsRectEmpty(&rect)) {
948  ClientToScreen(data->hwnd, (LPPOINT) & rect);
949  ClientToScreen(data->hwnd, (LPPOINT) & rect + 1);
950  if (SDL_memcmp(&rect, &clipped_rect, sizeof(rect)) != 0) {
951  if (ClipCursor(&rect)) {
952  data->cursor_clipped_rect = rect;
953  }
954  }
955  }
956  }
957  } else if (SDL_memcmp(&clipped_rect, &data->cursor_clipped_rect, sizeof(clipped_rect)) == 0) {
958  ClipCursor(NULL);
959  SDL_zero(data->cursor_clipped_rect);
960  }
961 }
962 
963 int
965 {
966  return 0; /* just succeed, the real work is done elsewhere. */
967 }
968 
969 int
970 WIN_SetWindowOpacity(_THIS, SDL_Window * window, float opacity)
971 {
972  const SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
973  const HWND hwnd = data->hwnd;
974  const LONG style = GetWindowLong(hwnd, GWL_EXSTYLE);
975 
976  SDL_assert(style != 0);
977 
978  if (opacity == 1.0f) {
979  /* want it fully opaque, just mark it unlayered if necessary. */
980  if (style & WS_EX_LAYERED) {
981  if (SetWindowLong(hwnd, GWL_EXSTYLE, style & ~WS_EX_LAYERED) == 0) {
982  return WIN_SetError("SetWindowLong()");
983  }
984  }
985  } else {
986  const BYTE alpha = (BYTE) ((int) (opacity * 255.0f));
987  /* want it transparent, mark it layered if necessary. */
988  if ((style & WS_EX_LAYERED) == 0) {
989  if (SetWindowLong(hwnd, GWL_EXSTYLE, style | WS_EX_LAYERED) == 0) {
990  return WIN_SetError("SetWindowLong()");
991  }
992  }
993 
994  if (SetLayeredWindowAttributes(hwnd, 0, alpha, LWA_ALPHA) == 0) {
995  return WIN_SetError("SetLayeredWindowAttributes()");
996  }
997  }
998 
999  return 0;
1000 }
1001 
1002 void
1004 {
1005  const SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
1006  DragAcceptFiles(data->hwnd, accept ? TRUE : FALSE);
1007 }
1008 
1009 #endif /* SDL_VIDEO_DRIVER_WINDOWS */
1010 
1011 /* vi: set ts=4 sw=4 expandtab: */
SDL_GetMouse
SDL_Mouse * SDL_GetMouse(void)
Definition: SDL_mouse.c:170
WIN_CreateWindow
int WIN_CreateWindow(_THIS, SDL_Window *window)
SDL_zero
#define SDL_zero(x)
Definition: SDL_stdinc.h:418
WIN_DestroyWindow
void WIN_DestroyWindow(_THIS, SDL_Window *window)
Uint8
uint8_t Uint8
Definition: SDL_stdinc.h:179
SDL_memset
#define SDL_memset
Definition: SDL_dynapi_overrides.h:386
SDL_VideoDevice::driverdata
void * driverdata
Definition: SDL_sysvideo.h:389
SDL_small_free
#define SDL_small_free(ptr, isstack)
Definition: SDL_internal.h:40
right
GLdouble GLdouble right
Definition: SDL_opengl_glext.h:6106
WIN_HideWindow
void WIN_HideWindow(_THIS, SDL_Window *window)
Uint16
uint16_t Uint16
Definition: SDL_stdinc.h:191
WIN_UTF8ToString
#define WIN_UTF8ToString(S)
Definition: SDL_windows.h:47
SDL_Surface
A collection of pixels used in software blitting.
Definition: SDL_surface.h:71
WIN_RestoreWindow
void WIN_RestoreWindow(_THIS, SDL_Window *window)
SDL_WINDOW_ALWAYS_ON_TOP
@ SDL_WINDOW_ALWAYS_ON_TOP
Definition: SDL_video.h:116
SDL_WINDOW_MINIMIZED
@ SDL_WINDOW_MINIMIZED
Definition: SDL_video.h:105
if
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp *numpix else pixst endif endm macro pixld1_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl else error unsupported endif endm macro pixld2_s mem_operand if mov asr add asl add asl mov asr sub UNIT_X add asl mov asr add asl add asl mov asr add UNIT_X add asl else pixld1_s mem_operand pixld1_s mem_operand endif endm macro pixld0_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl endif endm macro pixld_s_internal mem_operand if mem_operand pixld2_s mem_operand pixdeinterleave basereg elseif mem_operand elseif mem_operand elseif mem_operand elseif mem_operand pixld0_s mem_operand else pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else error unsupported mem_operand if bpp mem_operand endif endm macro vuzp8 reg2 vuzp d d &reg2 endm macro vzip8 reg2 vzip d d &reg2 endm macro pixdeinterleave basereg basereg basereg basereg basereg endif endm macro pixinterleave basereg basereg basereg basereg basereg endif endm macro PF boost_increment endif if endif PF tst PF addne PF subne PF cmp ORIG_W if endif if endif if endif PF subge ORIG_W PF subges if endif if endif if endif endif endm macro cache_preload_simple endif if dst_r_bpp pld[DST_R, #(PREFETCH_DISTANCE_SIMPLE *dst_r_bpp/8)] endif if mask_bpp pld if[MASK, #(PREFETCH_DISTANCE_SIMPLE *mask_bpp/8)] endif endif endm macro fetch_mask_pixblock pixld mask_basereg pixblock_size MASK endm macro ensure_destination_ptr_alignment process_pixblock_tail_head if beq irp skip1(dst_w_bpp<=(lowbit *8)) &&((lowbit *8)<(pixblock_size *dst_w_bpp)) .if lowbit< 16 tst DST_R
Definition: pixman-arm-neon-asm.h:469
SDL_Window::magic
const void * magic
Definition: SDL_sysvideo.h:76
WIN_UpdateClipCursor
void WIN_UpdateClipCursor(SDL_Window *window)
WIN_SetWindowResizable
void WIN_SetWindowResizable(_THIS, SDL_Window *window, SDL_bool resizable)
NULL
#define NULL
Definition: begin_code.h:167
SDL_PixelFormat::format
Uint32 format
Definition: SDL_pixels.h:320
width
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
endif
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp *numpix else pixst endif endm macro pixld1_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl else error unsupported endif endm macro pixld2_s mem_operand if mov asr add asl add asl mov asr sub UNIT_X add asl mov asr add asl add asl mov asr add UNIT_X add asl else pixld1_s mem_operand pixld1_s mem_operand endif endm macro pixld0_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl endif endm macro pixld_s_internal mem_operand if mem_operand pixld2_s mem_operand pixdeinterleave basereg elseif mem_operand elseif mem_operand elseif mem_operand elseif mem_operand pixld0_s mem_operand else pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else error unsupported mem_operand if bpp mem_operand endif endm macro vuzp8 reg2 vuzp d d &reg2 endm macro vzip8 reg2 vzip d d &reg2 endm macro pixdeinterleave basereg basereg basereg basereg basereg endif endm macro pixinterleave basereg basereg basereg basereg basereg endif endm macro PF boost_increment endif if endif PF tst PF addne PF subne PF cmp ORIG_W if endif if endif if endif PF subge ORIG_W PF subges if endif if endif if endif endif endm macro cache_preload_simple endif if dst_r_bpp pld[DST_R, #(PREFETCH_DISTANCE_SIMPLE *dst_r_bpp/8)] endif if mask_bpp pld endif[MASK, #(PREFETCH_DISTANCE_SIMPLE *mask_bpp/8)] endif endif endm macro fetch_mask_pixblock pixld mask_basereg pixblock_size MASK endm macro ensure_destination_ptr_alignment process_pixblock_tail_head if beq irp skip1 beq endif SRC MASK if dst_r_bpp DST_R else add endif PF add sub src_basereg pixdeinterleave mask_basereg pixdeinterleave dst_r_basereg process_pixblock_head pixblock_size cache_preload_simple process_pixblock_tail pixinterleave dst_w_basereg irp beq endif process_pixblock_tail_head tst beq irp if pixblock_size chunk_size tst beq pixld_src SRC pixld MASK if DST_R else pixld DST_R endif if
Definition: pixman-arm-neon-asm.h:549
SDL_Surface::pixels
void * pixels
Definition: SDL_surface.h:76
TRUE
#define TRUE
Definition: edid-parse.c:33
SDL_SysWMinfo
Definition: SDL_syswm.h:202
WIN_SetWindowFullscreen
void WIN_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen)
SDL_WriteLE16
#define SDL_WriteLE16
Definition: SDL_dynapi_overrides.h:364
SDL_Surface::w
int w
Definition: SDL_surface.h:74
SDL_WindowData
Definition: SDL_androidwindow.h:39
SDL_version::minor
Uint8 minor
Definition: SDL_version.h:54
SDL_GetDisplayForWindow
SDL_VideoDisplay * SDL_GetDisplayForWindow(SDL_Window *window)
Definition: SDL_video.c:1110
SDL_WINDOW_FULLSCREEN
@ SDL_WINDOW_FULLSCREEN
Definition: SDL_video.h:99
SDL_SysWMinfo::window
Window window
Definition: SDL_syswm.h:225
SDL_WINDOW_OPENGL
@ SDL_WINDOW_OPENGL
Definition: SDL_video.h:100
SDL_VideoDevice::gl_data
struct SDL_GLDriverData * gl_data
Definition: SDL_sysvideo.h:390
top
GLdouble GLdouble GLdouble GLdouble top
Definition: SDL_opengl_glext.h:6106
SDL_VideoDevice::window_magic
Uint8 window_magic
Definition: SDL_sysvideo.h:327
SDL_SetKeyboardFocus
void SDL_SetKeyboardFocus(SDL_Window *window)
Definition: SDL_keyboard.c:630
Uint32
uint32_t Uint32
Definition: SDL_stdinc.h:203
SDL_VideoDevice::profile_mask
int profile_mask
Definition: SDL_sysvideo.h:354
SDL_WINDOW_MAXIMIZED
@ SDL_WINDOW_MAXIMIZED
Definition: SDL_video.h:106
bottom
GLint GLint bottom
Definition: SDL_opengl_glext.h:1952
SDL_VERSIONNUM
#define SDL_VERSIONNUM(X, Y, Z)
Definition: SDL_version.h:94
SDL_GetHint
#define SDL_GetHint
Definition: SDL_dynapi_overrides.h:191
h
GLfloat GLfloat GLfloat GLfloat h
Definition: SDL_opengl_glext.h:1949
SDL_small_alloc
#define SDL_small_alloc(type, count, pisstack)
Definition: SDL_internal.h:39
WIN_SetWindowGammaRamp
int WIN_SetWindowGammaRamp(_THIS, SDL_Window *window, const Uint16 *ramp)
SDL_WINDOW_INPUT_FOCUS
@ SDL_WINDOW_INPUT_FOCUS
Definition: SDL_video.h:108
WIN_GetWindowBordersSize
int WIN_GetWindowBordersSize(_THIS, SDL_Window *window, int *top, int *left, int *bottom, int *right)
SDL_WINDOW_RESIZABLE
@ SDL_WINDOW_RESIZABLE
Definition: SDL_video.h:104
data
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: SDL_opengl.h:1974
SDL_Window
The type used to identify a window.
Definition: SDL_sysvideo.h:75
WIN_SetWindowTitle
void WIN_SetWindowTitle(_THIS, SDL_Window *window)
SDL_windowswindow.h
alpha
GLfloat GLfloat GLfloat alpha
Definition: SDL_opengl_glext.h:415
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1740
WIN_SetWindowGrab
void WIN_SetWindowGrab(_THIS, SDL_Window *window, SDL_bool grabbed)
SDL_Surface::pitch
int pitch
Definition: SDL_surface.h:75
SDL_RWwrite
#define SDL_RWwrite
Definition: SDL_dynapi_overrides.h:724
SDL_VideoDevice::gl_config
struct SDL_VideoDevice::@255 gl_config
SDL_GetHintBoolean
#define SDL_GetHintBoolean
Definition: SDL_dynapi_overrides.h:608
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:121
SDL_windowsvideo.h
SDL_MINOR_VERSION
#define SDL_MINOR_VERSION
Definition: SDL_version.h:61
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
SDL_SysWMinfo::subsystem
SDL_SYSWM_TYPE subsystem
Definition: SDL_syswm.h:204
window
EGLSurface EGLNativeWindowType * window
Definition: eglext.h:1025
SDL_memcmp
#define SDL_memcmp
Definition: SDL_dynapi_overrides.h:389
SDL_free
#define SDL_free
Definition: SDL_dynapi_overrides.h:377
f
GLfloat f
Definition: SDL_opengl_glext.h:1873
height
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
WIN_SetWindowBordered
void WIN_SetWindowBordered(_THIS, SDL_Window *window, SDL_bool bordered)
WIN_CreateWindowFrom
int WIN_CreateWindowFrom(_THIS, SDL_Window *window, const void *data)
WIN_PumpEvents
void WIN_PumpEvents(_THIS)
rect
SDL_Rect rect
Definition: testrelative.c:27
WIN_SetWindowSize
void WIN_SetWindowSize(_THIS, SDL_Window *window)
SDL_GL_CONTEXT_PROFILE_ES
@ SDL_GL_CONTEXT_PROFILE_ES
Definition: SDL_video.h:232
WIN_GetWindowGammaRamp
int WIN_GetWindowGammaRamp(_THIS, SDL_Window *window, Uint16 *ramp)
WIN_SetWindowHitTest
int WIN_SetWindowHitTest(SDL_Window *window, SDL_bool enabled)
SDL_assert.h
_THIS
#define _THIS
Definition: SDL_alsa_audio.h:31
WIN_MaximizeWindow
void WIN_MaximizeWindow(_THIS, SDL_Window *window)
WIN_GetWindowWMInfo
SDL_bool WIN_GetWindowWMInfo(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info)
SDL_WINDOW_INPUT_GRABBED
@ SDL_WINDOW_INPUT_GRABBED
Definition: SDL_video.h:107
SDL_Mouse
Definition: SDL_mouse_c.h:44
SDL_TRUE
@ SDL_TRUE
Definition: SDL_stdinc.h:164
SDL_PIXELFORMAT_ARGB8888
@ SDL_PIXELFORMAT_ARGB8888
Definition: SDL_pixels.h:251
SDL_Instance
HINSTANCE SDL_Instance
WIN_WindowProc
LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
SDL_assert
#define SDL_assert(condition)
Definition: SDL_assert.h:169
SDL_WINDOW_SHOWN
@ SDL_WINDOW_SHOWN
Definition: SDL_video.h:101
SDL_VideoDisplay::driverdata
void * driverdata
Definition: SDL_sysvideo.h:140
SDL_RWFromMem
#define SDL_RWFromMem
Definition: SDL_dynapi_overrides.h:352
SDL_sscanf
#define SDL_sscanf
Definition: SDL_dynapi_overrides.h:39
SDL_ShouldAllowTopmost
SDL_bool SDL_ShouldAllowTopmost(void)
Definition: SDL_video.c:4023
SDL_DisplayData
Definition: SDL_cocoamodes.h:27
SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT
#define SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT
A variable that is the address of another SDL_Window* (as a hex string formatted with "%p").
Definition: SDL_hints.h:779
SDL_OutOfMemory
#define SDL_OutOfMemory()
Definition: SDL_error.h:52
y
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1574
BI_RGB
#define BI_RGB
Definition: SDL_bmp.c:45
WIN_MinimizeWindow
void WIN_MinimizeWindow(_THIS, SDL_Window *window)
TWF_WANTPALM
#define TWF_WANTPALM
Definition: SDL_windowsvideo.h:56
SDL_Surface::h
int h
Definition: SDL_surface.h:74
WIN_SetWindowOpacity
int WIN_SetWindowOpacity(_THIS, SDL_Window *window, float opacity)
SDL_calloc
#define SDL_calloc
Definition: SDL_dynapi_overrides.h:375
WIN_SetWindowIcon
void WIN_SetWindowIcon(_THIS, SDL_Window *window, SDL_Surface *icon)
WIN_GetDisplayBounds
int WIN_GetDisplayBounds(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect)
src
GLenum src
Definition: SDL_opengl_glext.h:1740
SDL_SysWMinfo::version
SDL_version version
Definition: SDL_syswm.h:203
SDL_VideoDisplay
Definition: SDL_sysvideo.h:127
SDL_SetError
#define SDL_SetError
Definition: SDL_dynapi_overrides.h:30
WIN_SetError
int WIN_SetError(const char *prefix)
SDL_Rect
A rectangle, with the origin at the upper left (integer).
Definition: SDL_rect.h:78
TWF_FINETOUCH
#define TWF_FINETOUCH
Definition: SDL_windowsvideo.h:55
SDL_hints.h
WIN_RaiseWindow
void WIN_RaiseWindow(_THIS, SDL_Window *window)
left
GLint left
Definition: SDL_opengl_glext.h:1952
SDL_RWclose
#define SDL_RWclose
Definition: SDL_dynapi_overrides.h:725
WIN_StringToUTF8
#define WIN_StringToUTF8(S)
Definition: SDL_windows.h:46
SDL_SysWMinfo::info
union SDL_SysWMinfo::@10 info
WIN_AcceptDragAndDrop
void WIN_AcceptDragAndDrop(SDL_Window *window, SDL_bool accept)
enabled
GLenum GLenum GLsizei const GLuint GLboolean enabled
Definition: SDL_opengl_glext.h:2482
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:162
SDL_Appname
LPTSTR SDL_Appname
SDL_WriteLE32
#define SDL_WriteLE32
Definition: SDL_dynapi_overrides.h:366
SDL_VIDEO_OPENGL_WGL
#define SDL_VIDEO_OPENGL_WGL
Definition: SDL_config_windows.h:231
SDL_FALSE
@ SDL_FALSE
Definition: SDL_stdinc.h:163
SDL_WindowData::hwnd
HWND hwnd
Definition: SDL_windowswindow.h:33
SDL_version::patch
Uint8 patch
Definition: SDL_version.h:55
SDL_version::major
Uint8 major
Definition: SDL_version.h:53
flags
GLbitfield flags
Definition: SDL_opengl_glext.h:1483
SDL_MAJOR_VERSION
#define SDL_MAJOR_VERSION
Definition: SDL_version.h:60
WIN_SetWindowPosition
void WIN_SetWindowPosition(_THIS, SDL_Window *window)
SDL_RWops
Definition: SDL_rwops.h:53
WIN_ShowWindow
void WIN_ShowWindow(_THIS, SDL_Window *window)
SDL_WINDOW_SKIP_TASKBAR
@ SDL_WINDOW_SKIP_TASKBAR
Definition: SDL_video.h:117
SDL_Window::flags
Uint32 flags
Definition: SDL_sysvideo.h:84
SDL_Surface::format
SDL_PixelFormat * format
Definition: SDL_surface.h:73
WIN_OnWindowEnter
void WIN_OnWindowEnter(_THIS, SDL_Window *window)
FALSE
#define FALSE
Definition: edid-parse.c:34
SDL_VideoData
Definition: SDL_androidvideo.h:37
SDL_SYSWM_WINDOWS
@ SDL_SYSWM_WINDOWS
Definition: SDL_syswm.h:125
SDL_syswm.h
SDL_WINDOW_BORDERLESS
@ SDL_WINDOW_BORDERLESS
Definition: SDL_video.h:103
w
GLubyte GLubyte GLubyte GLubyte w
Definition: SDL_opengl_glext.h:734