zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SDL_windowswindow.c
Go to the documentation of this file.
1 /*
2  Simple DirectMedia Layer
3  Copyright (C) 1997-2013 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_config.h"
22 
23 #if SDL_VIDEO_DRIVER_WINDOWS
24 
25 #include "SDL_assert.h"
26 #include "../SDL_sysvideo.h"
27 #include "../SDL_pixels_c.h"
28 #include "../../events/SDL_keyboard_c.h"
29 
30 #include "SDL_windowsvideo.h"
31 #include "SDL_windowswindow.h"
32 
33 /* Dropfile support */
34 #include <shellapi.h>
35 
36 /* This is included after SDL_windowsvideo.h, which includes windows.h */
37 #include "SDL_syswm.h"
38 
39 /* Windows CE compatibility */
40 #ifndef SWP_NOCOPYBITS
41 #define SWP_NOCOPYBITS 0
42 #endif
43 
44 /* Fake window to help with DirectInput events. */
45 HWND SDL_HelperWindow = NULL;
46 static WCHAR *SDL_HelperWindowClassName = TEXT("SDLHelperWindowInputCatcher");
47 static WCHAR *SDL_HelperWindowName = TEXT("SDLHelperWindowInputMsgWindow");
48 static ATOM SDL_HelperWindowClass = 0;
49 
50 #define STYLE_BASIC (WS_CLIPSIBLINGS | WS_CLIPCHILDREN)
51 #define STYLE_FULLSCREEN (WS_POPUP)
52 #define STYLE_BORDERLESS (WS_POPUP)
53 #define STYLE_NORMAL (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX)
54 #define STYLE_RESIZABLE (WS_THICKFRAME | WS_MAXIMIZEBOX)
55 #define STYLE_MASK (STYLE_FULLSCREEN | STYLE_BORDERLESS | STYLE_NORMAL | STYLE_RESIZABLE)
56 
57 static DWORD
58 GetWindowStyle(SDL_Window * window)
59 {
60  DWORD style = 0;
61 
62  if (window->flags & SDL_WINDOW_FULLSCREEN) {
63  style |= STYLE_FULLSCREEN;
64  } else {
65  if (window->flags & SDL_WINDOW_BORDERLESS) {
66  style |= STYLE_BORDERLESS;
67  } else {
68  style |= STYLE_NORMAL;
69  }
70  if (window->flags & SDL_WINDOW_RESIZABLE) {
71  style |= STYLE_RESIZABLE;
72  }
73  }
74  return style;
75 }
76 
77 static void
78 WIN_SetWindowPositionInternal(_THIS, SDL_Window * window, UINT flags)
79 {
80  HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
81  RECT rect;
82  DWORD style;
83  HWND top;
84  BOOL menu;
85  int x, y;
86  int w, h;
87 
88  /* Figure out what the window area will be */
90  top = HWND_TOPMOST;
91  } else {
92  top = HWND_NOTOPMOST;
93  }
94  style = GetWindowLong(hwnd, GWL_STYLE);
95  rect.left = 0;
96  rect.top = 0;
97  rect.right = window->w;
98  rect.bottom = window->h;
99  menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL);
100  AdjustWindowRectEx(&rect, style, menu, 0);
101  w = (rect.right - rect.left);
102  h = (rect.bottom - rect.top);
103  x = window->x + rect.left;
104  y = window->y + rect.top;
105 
106  SetWindowPos(hwnd, top, x, y, w, h, flags);
107 }
108 
109 static int
110 SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created)
111 {
112  SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
114 
115  /* Allocate the window data */
116  data = (SDL_WindowData *) SDL_malloc(sizeof(*data));
117  if (!data) {
118  return SDL_OutOfMemory();
119  }
120  data->window = window;
121  data->hwnd = hwnd;
122  data->hdc = GetDC(hwnd);
123  data->created = created;
124  data->mouse_button_flags = 0;
125  data->videodata = videodata;
126 
127  window->driverdata = data;
128 
129  /* Associate the data with the window */
130  if (!SetProp(hwnd, TEXT("SDL_WindowData"), data)) {
131  ReleaseDC(hwnd, data->hdc);
132  SDL_free(data);
133  return WIN_SetError("SetProp() failed");
134  }
135 
136  /* Set up the window proc function */
137 #ifdef GWLP_WNDPROC
138  data->wndproc = (WNDPROC) GetWindowLongPtr(hwnd, GWLP_WNDPROC);
139  if (data->wndproc == WIN_WindowProc) {
140  data->wndproc = NULL;
141  } else {
142  SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR) WIN_WindowProc);
143  }
144 #else
145  data->wndproc = (WNDPROC) GetWindowLong(hwnd, GWL_WNDPROC);
146  if (data->wndproc == WIN_WindowProc) {
147  data->wndproc = NULL;
148  } else {
149  SetWindowLong(hwnd, GWL_WNDPROC, (LONG_PTR) WIN_WindowProc);
150  }
151 #endif
152 
153  /* Fill in the SDL window with the window data */
154  {
155  RECT rect;
156  if (GetClientRect(hwnd, &rect)) {
157  int w = rect.right;
158  int h = rect.bottom;
159  if ((window->w && window->w != w) || (window->h && window->h != h)) {
160  /* We tried to create a window larger than the desktop and Windows didn't allow it. Override! */
161  WIN_SetWindowPositionInternal(_this, window, SWP_NOCOPYBITS | SWP_NOZORDER | SWP_NOACTIVATE);
162  } else {
163  window->w = w;
164  window->h = h;
165  }
166  }
167  }
168  {
169  POINT point;
170  point.x = 0;
171  point.y = 0;
172  if (ClientToScreen(hwnd, &point)) {
173  window->x = point.x;
174  window->y = point.y;
175  }
176  }
177  {
178  DWORD style = GetWindowLong(hwnd, GWL_STYLE);
179  if (style & WS_VISIBLE) {
180  window->flags |= SDL_WINDOW_SHOWN;
181  } else {
182  window->flags &= ~SDL_WINDOW_SHOWN;
183  }
184  if (style & (WS_BORDER | WS_THICKFRAME)) {
185  window->flags &= ~SDL_WINDOW_BORDERLESS;
186  } else {
187  window->flags |= SDL_WINDOW_BORDERLESS;
188  }
189  if (style & WS_THICKFRAME) {
190  window->flags |= SDL_WINDOW_RESIZABLE;
191  } else {
192  window->flags &= ~SDL_WINDOW_RESIZABLE;
193  }
194 #ifdef WS_MAXIMIZE
195  if (style & WS_MAXIMIZE) {
196  window->flags |= SDL_WINDOW_MAXIMIZED;
197  } else
198 #endif
199  {
200  window->flags &= ~SDL_WINDOW_MAXIMIZED;
201  }
202 #ifdef WS_MINIMIZE
203  if (style & WS_MINIMIZE) {
204  window->flags |= SDL_WINDOW_MINIMIZED;
205  } else
206 #endif
207  {
208  window->flags &= ~SDL_WINDOW_MINIMIZED;
209  }
210  }
211  if (GetFocus() == hwnd) {
212  window->flags |= SDL_WINDOW_INPUT_FOCUS;
213  SDL_SetKeyboardFocus(data->window);
214 
215  if (window->flags & SDL_WINDOW_INPUT_GRABBED) {
216  RECT rect;
217  GetClientRect(hwnd, &rect);
218  ClientToScreen(hwnd, (LPPOINT) & rect);
219  ClientToScreen(hwnd, (LPPOINT) & rect + 1);
220  ClipCursor(&rect);
221  }
222  }
223 
224  /* Enable multi-touch */
225  if (videodata->RegisterTouchWindow) {
226  videodata->RegisterTouchWindow(hwnd, (TWF_FINETOUCH|TWF_WANTPALM));
227  }
228 
229  /* Enable dropping files */
230  DragAcceptFiles(hwnd, TRUE);
231 
232  /* All done! */
233  return 0;
234 }
235 
236 int
238 {
239  HWND hwnd;
240  RECT rect;
241  DWORD style = STYLE_BASIC;
242  int x, y;
243  int w, h;
244 
245  style |= GetWindowStyle(window);
246 
247  /* Figure out what the window area will be */
248  rect.left = window->x;
249  rect.top = window->y;
250  rect.right = window->x + window->w;
251  rect.bottom = window->y + window->h;
252  AdjustWindowRectEx(&rect, style, FALSE, 0);
253  x = rect.left;
254  y = rect.top;
255  w = (rect.right - rect.left);
256  h = (rect.bottom - rect.top);
257 
258  hwnd =
259  CreateWindow(SDL_Appname, TEXT(""), style, x, y, w, h, NULL, NULL,
260  SDL_Instance, NULL);
261  if (!hwnd) {
262  return WIN_SetError("Couldn't create window");
263  }
264 
266 
267  if (SetupWindowData(_this, window, hwnd, SDL_TRUE) < 0) {
268  DestroyWindow(hwnd);
269  return -1;
270  }
271 #if SDL_VIDEO_OPENGL_WGL
272  if (window->flags & SDL_WINDOW_OPENGL) {
273  if (WIN_GL_SetupWindow(_this, window) < 0) {
274  WIN_DestroyWindow(_this, window);
275  return -1;
276  }
277  }
278 #endif
279  return 0;
280 }
281 
282 int
283 WIN_CreateWindowFrom(_THIS, SDL_Window * window, const void *data)
284 {
285  HWND hwnd = (HWND) data;
286  LPTSTR title;
287  int titleLen;
288 
289  /* Query the title from the existing window */
290  titleLen = GetWindowTextLength(hwnd);
291  title = SDL_stack_alloc(TCHAR, titleLen + 1);
292  if (title) {
293  titleLen = GetWindowText(hwnd, title, titleLen);
294  } else {
295  titleLen = 0;
296  }
297  if (titleLen > 0) {
298  window->title = WIN_StringToUTF8(title);
299  }
300  if (title) {
301  SDL_stack_free(title);
302  }
303 
304  if (SetupWindowData(_this, window, hwnd, SDL_FALSE) < 0) {
305  return -1;
306  }
307  return 0;
308 }
309 
310 void
312 {
313  HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
314  LPTSTR title;
315 
316  if (window->title) {
317  title = WIN_UTF8ToString(window->title);
318  } else {
319  title = NULL;
320  }
321  SetWindowText(hwnd, title ? title : TEXT(""));
322  SDL_free(title);
323 }
324 
325 void
327 {
328  HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
329  HICON hicon = NULL;
330  BYTE *icon_bmp;
331  int icon_len, y;
332  SDL_RWops *dst;
333 
334  /* Create temporary bitmap buffer */
335  icon_len = 40 + icon->h * icon->w * 4;
336  icon_bmp = SDL_stack_alloc(BYTE, icon_len);
337  dst = SDL_RWFromMem(icon_bmp, icon_len);
338  if (!dst) {
339  SDL_stack_free(icon_bmp);
340  return;
341  }
342 
343  /* Write the BITMAPINFO header */
344  SDL_WriteLE32(dst, 40);
345  SDL_WriteLE32(dst, icon->w);
346  SDL_WriteLE32(dst, icon->h * 2);
347  SDL_WriteLE16(dst, 1);
348  SDL_WriteLE16(dst, 32);
349  SDL_WriteLE32(dst, BI_RGB);
350  SDL_WriteLE32(dst, icon->h * icon->w * 4);
351  SDL_WriteLE32(dst, 0);
352  SDL_WriteLE32(dst, 0);
353  SDL_WriteLE32(dst, 0);
354  SDL_WriteLE32(dst, 0);
355 
356  /* Write the pixels upside down into the bitmap buffer */
358  y = icon->h;
359  while (y--) {
360  Uint8 *src = (Uint8 *) icon->pixels + y * icon->pitch;
361  SDL_RWwrite(dst, src, icon->pitch, 1);
362  }
363 
364  hicon = CreateIconFromResource(icon_bmp, icon_len, TRUE, 0x00030000);
365 
366  SDL_RWclose(dst);
367  SDL_stack_free(icon_bmp);
368 
369  /* Set the icon for the window */
370  SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM) hicon);
371 
372  /* Set the icon in the task manager (should we do this?) */
373  SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM) hicon);
374 }
375 
376 void
378 {
379  WIN_SetWindowPositionInternal(_this, window, SWP_NOCOPYBITS | SWP_NOSIZE | SWP_NOACTIVATE);
380 }
381 
382 void
384 {
385  WIN_SetWindowPositionInternal(_this, window, SWP_NOCOPYBITS | SWP_NOMOVE | SWP_NOACTIVATE);
386 }
387 
388 void
390 {
391  HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
392  ShowWindow(hwnd, SW_SHOW);
393 }
394 
395 void
397 {
398  HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
399  ShowWindow(hwnd, SW_HIDE);
400 }
401 
402 void
404 {
405  WIN_SetWindowPositionInternal(_this, window, SWP_NOCOPYBITS | SWP_NOMOVE | SWP_NOSIZE);
406 }
407 
408 void
410 {
411  HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
412  ShowWindow(hwnd, SW_MAXIMIZE);
413 }
414 
415 void
417 {
418  HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
419  ShowWindow(hwnd, SW_MINIMIZE);
420 }
421 
422 void
423 WIN_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered)
424 {
425  HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
426  DWORD style = GetWindowLong(hwnd, GWL_STYLE);
427 
428  if (bordered) {
429  style &= ~STYLE_BORDERLESS;
430  style |= STYLE_NORMAL;
431  } else {
432  style &= ~STYLE_NORMAL;
433  style |= STYLE_BORDERLESS;
434  }
435 
436  SetWindowLong(hwnd, GWL_STYLE, style);
437  WIN_SetWindowPositionInternal(_this, window, SWP_NOCOPYBITS | SWP_FRAMECHANGED | SWP_NOREPOSITION | SWP_NOZORDER |SWP_NOACTIVATE | SWP_NOSENDCHANGING);
438 }
439 
440 void
442 {
443  HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
444 
445  ShowWindow(hwnd, SW_RESTORE);
446 }
447 
448 void
450 {
451  SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
452  HWND hwnd = data->hwnd;
453  RECT rect;
454  SDL_Rect bounds;
455  DWORD style;
456  HWND top;
457  BOOL menu;
458  int x, y;
459  int w, h;
460 
462  top = HWND_TOPMOST;
463  } else {
464  top = HWND_NOTOPMOST;
465  }
466 
467  style = GetWindowLong(hwnd, GWL_STYLE);
468  style &= ~STYLE_MASK;
469  style |= GetWindowStyle(window);
470 
471  WIN_GetDisplayBounds(_this, display, &bounds);
472 
473  if (fullscreen) {
474  x = bounds.x;
475  y = bounds.y;
476  w = bounds.w;
477  h = bounds.h;
478  } else {
479  rect.left = 0;
480  rect.top = 0;
481  rect.right = window->windowed.w;
482  rect.bottom = window->windowed.h;
483  menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL);
484  AdjustWindowRectEx(&rect, style, menu, 0);
485  w = (rect.right - rect.left);
486  h = (rect.bottom - rect.top);
487  x = window->windowed.x + rect.left;
488  y = window->windowed.y + rect.top;
489  }
490  SetWindowLong(hwnd, GWL_STYLE, style);
491  SetWindowPos(hwnd, top, x, y, w, h, SWP_NOCOPYBITS);
492 }
493 
494 int
495 WIN_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp)
496 {
497  SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
498  SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata;
499  HDC hdc;
500  BOOL succeeded = FALSE;
501 
502  hdc = CreateDC(data->DeviceName, NULL, NULL, NULL);
503  if (hdc) {
504  succeeded = SetDeviceGammaRamp(hdc, (LPVOID)ramp);
505  if (!succeeded) {
506  WIN_SetError("SetDeviceGammaRamp()");
507  }
508  DeleteDC(hdc);
509  }
510  return succeeded ? 0 : -1;
511 }
512 
513 int
515 {
516  SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
517  SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata;
518  HDC hdc;
519  BOOL succeeded = FALSE;
520 
521  hdc = CreateDC(data->DeviceName, NULL, NULL, NULL);
522  if (hdc) {
523  succeeded = GetDeviceGammaRamp(hdc, (LPVOID)ramp);
524  if (!succeeded) {
525  WIN_SetError("GetDeviceGammaRamp()");
526  }
527  DeleteDC(hdc);
528  }
529  return succeeded ? 0 : -1;
530 }
531 
532 void
533 WIN_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed)
534 {
535  HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
536 
537  if (grabbed) {
538  RECT rect;
539  GetClientRect(hwnd, &rect);
540  ClientToScreen(hwnd, (LPPOINT) & rect);
541  ClientToScreen(hwnd, (LPPOINT) & rect + 1);
542  ClipCursor(&rect);
543  } else {
544  ClipCursor(NULL);
545  }
546 
547  if (window->flags & SDL_WINDOW_FULLSCREEN) {
548  UINT flags = SWP_NOCOPYBITS | SWP_NOMOVE | SWP_NOSIZE;
549 
550  if (!(window->flags & SDL_WINDOW_SHOWN)) {
551  flags |= SWP_NOACTIVATE;
552  }
553  WIN_SetWindowPositionInternal(_this, window, flags);
554  }
555 }
556 
557 void
559 {
560  SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
561 
562  if (data) {
563  ReleaseDC(data->hwnd, data->hdc);
564  if (data->created) {
565  DestroyWindow(data->hwnd);
566  } else {
567  /* Restore any original event handler... */
568  if (data->wndproc != NULL) {
569 #ifdef GWLP_WNDPROC
570  SetWindowLongPtr(data->hwnd, GWLP_WNDPROC,
571  (LONG_PTR) data->wndproc);
572 #else
573  SetWindowLong(data->hwnd, GWL_WNDPROC,
574  (LONG_PTR) data->wndproc);
575 #endif
576  }
577  }
578  SDL_free(data);
579  }
580 }
581 
582 SDL_bool
584 {
585  HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
586  if (info->version.major <= SDL_MAJOR_VERSION) {
588  info->info.win.window = hwnd;
589  return SDL_TRUE;
590  } else {
591  SDL_SetError("Application not compiled with SDL %d.%d\n",
593  return SDL_FALSE;
594  }
595 }
596 
597 
598 /*
599  * Creates a HelperWindow used for DirectInput events.
600  */
601 int
602 SDL_HelperWindowCreate(void)
603 {
604  HINSTANCE hInstance = GetModuleHandle(NULL);
605  WNDCLASS wce;
606 
607  /* Make sure window isn't created twice. */
608  if (SDL_HelperWindow != NULL) {
609  return 0;
610  }
611 
612  /* Create the class. */
613  SDL_zero(wce);
614  wce.lpfnWndProc = DefWindowProc;
615  wce.lpszClassName = (LPCWSTR) SDL_HelperWindowClassName;
616  wce.hInstance = hInstance;
617 
618  /* Register the class. */
619  SDL_HelperWindowClass = RegisterClass(&wce);
620  if (SDL_HelperWindowClass == 0) {
621  return WIN_SetError("Unable to create Helper Window Class");
622  }
623 
624  /* Create the window. */
625  SDL_HelperWindow = CreateWindowEx(0, SDL_HelperWindowClassName,
626  SDL_HelperWindowName,
627  WS_OVERLAPPED, CW_USEDEFAULT,
628  CW_USEDEFAULT, CW_USEDEFAULT,
629  CW_USEDEFAULT, HWND_MESSAGE, NULL,
630  hInstance, NULL);
631  if (SDL_HelperWindow == NULL) {
632  UnregisterClass(SDL_HelperWindowClassName, hInstance);
633  return WIN_SetError("Unable to create Helper Window");
634  }
635 
636  return 0;
637 }
638 
639 
640 /*
641  * Destroys the HelperWindow previously created with SDL_HelperWindowCreate.
642  */
643 void
644 SDL_HelperWindowDestroy(void)
645 {
646  HINSTANCE hInstance = GetModuleHandle(NULL);
647 
648  /* Destroy the window. */
649  if (SDL_HelperWindow != NULL) {
650  if (DestroyWindow(SDL_HelperWindow) == 0) {
651  WIN_SetError("Unable to destroy Helper Window");
652  return;
653  }
654  SDL_HelperWindow = NULL;
655  }
656 
657  /* Unregister the class. */
658  if (SDL_HelperWindowClass != 0) {
659  if ((UnregisterClass(SDL_HelperWindowClassName, hInstance)) == 0) {
660  WIN_SetError("Unable to destroy Helper Window Class");
661  return;
662  }
663  SDL_HelperWindowClass = 0;
664  }
665 }
666 
667 void WIN_OnWindowEnter(_THIS, SDL_Window * window)
668 {
669 #ifdef WM_MOUSELEAVE
670  SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
671  TRACKMOUSEEVENT trackMouseEvent;
672 
673  if (!data || !data->hwnd) {
674  /* The window wasn't fully initialized */
675  return;
676  }
677 
678  trackMouseEvent.cbSize = sizeof(TRACKMOUSEEVENT);
679  trackMouseEvent.dwFlags = TME_LEAVE;
680  trackMouseEvent.hwndTrack = data->hwnd;
681 
682  TrackMouseEvent(&trackMouseEvent);
683 #endif /* WM_MOUSELEAVE */
684 }
685 
686 #endif /* SDL_VIDEO_DRIVER_WINDOWS */
687 
688 /* vi: set ts=4 sw=4 expandtab: */
#define BI_RGB
Definition: SDL_bmp.c:43
#define SDL_MINOR_VERSION
Definition: SDL_version.h:61
HINSTANCE SDL_Instance
#define WIN_UTF8ToString(S)
Definition: SDL_windows.h:42
void WIN_SetWindowSize(_THIS, SDL_Window *window)
GLfloat GLfloat GLfloat GLfloat h
Definition: glew.h:7294
void SDL_SetKeyboardFocus(SDL_Window *window)
Definition: SDL_keyboard.c:611
#define NULL
Definition: ftobjs.h:61
#define SDL_stack_free(data)
Definition: SDL_stdinc.h:227
#define SDL_RWwrite(ctx, ptr, size, n)
Definition: SDL_rwops.h:188
#define SDL_MAJOR_VERSION
Definition: SDL_version.h:60
void WIN_RaiseWindow(_THIS, SDL_Window *window)
SDL_bool
Definition: SDL_stdinc.h:116
int WIN_GetWindowGammaRamp(_THIS, SDL_Window *window, Uint16 *ramp)
LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
void WIN_DestroyWindow(_THIS, SDL_Window *window)
EGLSurface EGLint x
Definition: eglext.h:293
SDL_bool WIN_GetWindowWMInfo(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info)
A collection of pixels used in software blitting.
Definition: SDL_surface.h:69
void WIN_MaximizeWindow(_THIS, SDL_Window *window)
DECLSPEC void SDLCALL SDL_free(void *mem)
SDL_version version
Definition: SDL_syswm.h:161
Uint8 major
Definition: SDL_version.h:53
LPTSTR SDL_Appname
SDL_SYSWM_TYPE subsystem
Definition: SDL_syswm.h:162
char * display
Definition: visualinfo.c:85
typedef UINT(WINAPI *PFNWGLGETCONTEXTGPUIDAMDPROC)(HGLRC hglrc)
if(!yyg->yy_init)
SDL_Rect windowed
Definition: SDL_sysvideo.h:84
DECLSPEC size_t SDLCALL SDL_WriteLE32(SDL_RWops *dst, Uint32 value)
Definition: SDL_rwops.c:728
void WIN_OnWindowEnter(_THIS, SDL_Window *window)
typedef HDC(WINAPI *PFNWGLGETCURRENTREADDCARBPROC)(VOID)
void WIN_SetWindowPosition(_THIS, SDL_Window *window)
int WIN_CreateWindow(_THIS, SDL_Window *window)
static SDL_VideoDevice * _this
Definition: SDL_video.c:92
TCHAR DeviceName[32]
DECLSPEC SDL_RWops *SDLCALL SDL_RWFromMem(void *mem, int size)
Definition: SDL_rwops.c:567
int WIN_GetDisplayBounds(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect)
GLenum GLenum dst
Definition: glew.h:2396
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl2ext.h:848
void * pixels
Definition: SDL_surface.h:75
void WIN_MinimizeWindow(_THIS, SDL_Window *window)
#define _THIS
void WIN_SetWindowIcon(_THIS, SDL_Window *window, SDL_Surface *icon)
void WIN_ShowWindow(_THIS, SDL_Window *window)
#define WIN_StringToUTF8(S)
Definition: SDL_windows.h:41
DECLSPEC int SDLCALL SDL_SetError(const char *fmt,...)
Definition: SDL_error.c:53
DECLSPEC void *SDLCALL SDL_malloc(size_t size)
char * title
Definition: SDL_sysvideo.h:75
int x
Definition: SDL_rect.h:65
GLfloat GLfloat GLfloat top
Definition: glew.h:13816
#define FALSE
Definition: ftobjs.h:57
int w
Definition: SDL_rect.h:66
union SDL_SysWMinfo::@78 info
void WIN_RestoreWindow(_THIS, SDL_Window *window)
typedef LPVOID(WINAPI *PFNWGLCREATEIMAGEBUFFERI3DPROC)(HDC hDC
#define SDL_assert(condition)
Definition: SDL_assert.h:159
int WIN_SetWindowGammaRamp(_THIS, SDL_Window *window, const Uint16 *ramp)
SDL_bool SDL_ShouldAllowTopmost(void)
Definition: SDL_video.c:3207
EGLSurface EGLint EGLint y
Definition: eglext.h:293
#define SDL_OutOfMemory()
Definition: SDL_error.h:52
SDL_PixelFormat * format
Definition: SDL_surface.h:72
#define SDL_RWclose(ctx)
Definition: SDL_rwops.h:189
int WIN_SetError(const char *prefix)
void WIN_SetWindowTitle(_THIS, SDL_Window *window)
void WIN_PumpEvents(_THIS)
GLenum GLsizei GLsizei GLsizei GLsizei GLbitfield flags
Definition: glew.h:2767
SDL_VideoDisplay * SDL_GetDisplayForWindow(SDL_Window *window)
Definition: SDL_video.c:996
void WIN_SetWindowGrab(_THIS, SDL_Window *window, SDL_bool grabbed)
int h
Definition: SDL_rect.h:66
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:129
typedef DWORD(WINAPI *XInputGetState_t)(DWORD dwUserIndex
DECLSPEC size_t SDLCALL SDL_WriteLE16(SDL_RWops *dst, Uint16 value)
Definition: SDL_rwops.c:714
void WIN_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen)
GLint GLint GLint GLint GLint w
Definition: gl2ext.h:1215
#define SDL_stack_alloc(type, count)
Definition: SDL_stdinc.h:226
uint16_t Uint16
An unsigned 16-bit integer type.
Definition: SDL_stdinc.h:137
void WIN_SetWindowBordered(_THIS, SDL_Window *window, SDL_bool bordered)
#define SDL_zero(x)
Definition: SDL_stdinc.h:254
void * driverdata
Definition: SDL_sysvideo.h:99
GLenum src
Definition: glew.h:2396
int WIN_CreateWindowFrom(_THIS, SDL_Window *window, const void *data)
void WIN_HideWindow(_THIS, SDL_Window *window)
Uint32 flags
Definition: SDL_sysvideo.h:81
int y
Definition: SDL_rect.h:65
#define TRUE
Definition: ftobjs.h:53
A rectangle, with the origin at the upper left.
Definition: SDL_rect.h:63
typedef BOOL(WINAPI *PFNWGLSETSTEREOEMITTERSTATE3DLPROC)(HDC hDC