Mercurial > sdl-ios-xcode
annotate src/video/win32/SDL_win32window.c @ 1733:0b1070f2f94d SDL-1.3
Implemented gamma correction on Windows.
Added general code to restore the video mode and gamma when windows lose focus.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 09 Jul 2006 09:02:26 +0000 |
parents | fd65f12b6de6 |
children | f7c667ded87d |
rev | line source |
---|---|
1712
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1 /* |
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3 Copyright (C) 1997-2006 Sam Lantinga |
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4 |
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7 License as published by the Free Software Foundation; either |
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
9 |
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
13 Lesser General Public License for more details. |
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
14 |
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
18 |
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
19 Sam Lantinga |
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
20 slouken@libsdl.org |
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
21 */ |
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
22 #include "SDL_config.h" |
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
23 |
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
24 #include "../SDL_sysvideo.h" |
1733
0b1070f2f94d
Implemented gamma correction on Windows.
Sam Lantinga <slouken@libsdl.org>
parents:
1732
diff
changeset
|
25 #include "../../events/SDL_keyboard_c.h" |
1712
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
26 |
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
27 #include "SDL_win32video.h" |
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
28 |
1720
a1ebb17f9c52
Cleaned up a bunch of warnings, started adding Win32 event support
Sam Lantinga <slouken@libsdl.org>
parents:
1719
diff
changeset
|
29 /* This is included after SDL_win32video.h, which includes windows.h */ |
a1ebb17f9c52
Cleaned up a bunch of warnings, started adding Win32 event support
Sam Lantinga <slouken@libsdl.org>
parents:
1719
diff
changeset
|
30 #include "SDL_syswm.h" |
a1ebb17f9c52
Cleaned up a bunch of warnings, started adding Win32 event support
Sam Lantinga <slouken@libsdl.org>
parents:
1719
diff
changeset
|
31 |
1712
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
32 |
1719
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
33 static int |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
34 SetupWindowData(SDL_Window * window, HWND hwnd, BOOL created) |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
35 { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
36 SDL_WindowData *data; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
37 |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
38 /* Allocate the window data */ |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
39 data = (SDL_WindowData *) SDL_malloc(sizeof(*data)); |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
40 if (!data) { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
41 SDL_OutOfMemory(); |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
42 return -1; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
43 } |
1722
5daa04d862f1
Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents:
1720
diff
changeset
|
44 data->windowID = window->id; |
1719
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
45 data->hwnd = hwnd; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
46 data->created = created; |
1724
6c63fc2bd986
Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents:
1722
diff
changeset
|
47 data->mouse_pressed = SDL_FALSE; |
1722
5daa04d862f1
Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents:
1720
diff
changeset
|
48 data->videodata = (SDL_VideoData *) SDL_GetVideoDevice()->driverdata; |
1719
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
49 |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
50 /* Associate the data with the window */ |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
51 if (!SetProp(hwnd, TEXT("SDL_WindowData"), data)) { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
52 SDL_free(data); |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
53 WIN_SetError("SetProp() failed"); |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
54 return -1; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
55 } |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
56 |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
57 /* Set up the window proc function */ |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
58 data->wndproc = (WNDPROC) GetWindowLongPtr(hwnd, GWLP_WNDPROC); |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
59 if (data->wndproc == NULL) { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
60 data->wndproc = DefWindowProc; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
61 } else { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
62 SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR) WIN_WindowProc); |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
63 } |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
64 |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
65 /* Fill in the SDL window with the window data */ |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
66 { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
67 POINT point; |
1720
a1ebb17f9c52
Cleaned up a bunch of warnings, started adding Win32 event support
Sam Lantinga <slouken@libsdl.org>
parents:
1719
diff
changeset
|
68 point.x = 0; |
a1ebb17f9c52
Cleaned up a bunch of warnings, started adding Win32 event support
Sam Lantinga <slouken@libsdl.org>
parents:
1719
diff
changeset
|
69 point.y = 0; |
1719
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
70 if (ClientToScreen(hwnd, &point)) { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
71 window->x = point.x; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
72 window->y = point.y; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
73 } |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
74 } |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
75 { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
76 RECT rect; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
77 if (GetClientRect(hwnd, &rect)) { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
78 window->w = rect.right; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
79 window->h = rect.bottom; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
80 } |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
81 } |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
82 { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
83 DWORD style = GetWindowLong(hwnd, GWL_STYLE); |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
84 if (style & WS_VISIBLE) { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
85 window->flags |= SDL_WINDOW_SHOWN; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
86 } else { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
87 window->flags &= ~SDL_WINDOW_SHOWN; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
88 } |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
89 if (style & (WS_BORDER | WS_THICKFRAME)) { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
90 window->flags &= ~SDL_WINDOW_BORDERLESS; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
91 } else { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
92 window->flags |= SDL_WINDOW_BORDERLESS; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
93 } |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
94 if (style & WS_THICKFRAME) { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
95 window->flags |= SDL_WINDOW_RESIZABLE; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
96 } else { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
97 window->flags &= ~SDL_WINDOW_RESIZABLE; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
98 } |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
99 if (style & WS_MAXIMIZE) { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
100 window->flags |= SDL_WINDOW_MAXIMIZED; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
101 } else { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
102 window->flags &= ~SDL_WINDOW_MAXIMIZED; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
103 } |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
104 if (style & WS_MINIMIZE) { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
105 window->flags |= SDL_WINDOW_MINIMIZED; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
106 } else { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
107 window->flags &= ~SDL_WINDOW_MINIMIZED; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
108 } |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
109 } |
1732
fd65f12b6de6
Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents:
1724
diff
changeset
|
110 if (GetFocus() == hwnd) { |
fd65f12b6de6
Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents:
1724
diff
changeset
|
111 int index = data->videodata->keyboard; |
fd65f12b6de6
Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents:
1724
diff
changeset
|
112 window->flags |= SDL_WINDOW_KEYBOARD_FOCUS; |
fd65f12b6de6
Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents:
1724
diff
changeset
|
113 SDL_SetKeyboardFocus(index, data->windowID); |
1733
0b1070f2f94d
Implemented gamma correction on Windows.
Sam Lantinga <slouken@libsdl.org>
parents:
1732
diff
changeset
|
114 |
0b1070f2f94d
Implemented gamma correction on Windows.
Sam Lantinga <slouken@libsdl.org>
parents:
1732
diff
changeset
|
115 if (window->flags & SDL_WINDOW_INPUT_GRABBED) { |
0b1070f2f94d
Implemented gamma correction on Windows.
Sam Lantinga <slouken@libsdl.org>
parents:
1732
diff
changeset
|
116 RECT rect; |
0b1070f2f94d
Implemented gamma correction on Windows.
Sam Lantinga <slouken@libsdl.org>
parents:
1732
diff
changeset
|
117 GetClientRect(hwnd, &rect); |
0b1070f2f94d
Implemented gamma correction on Windows.
Sam Lantinga <slouken@libsdl.org>
parents:
1732
diff
changeset
|
118 ClientToScreen(hwnd, (LPPOINT) & rect); |
0b1070f2f94d
Implemented gamma correction on Windows.
Sam Lantinga <slouken@libsdl.org>
parents:
1732
diff
changeset
|
119 ClientToScreen(hwnd, (LPPOINT) & rect + 1); |
0b1070f2f94d
Implemented gamma correction on Windows.
Sam Lantinga <slouken@libsdl.org>
parents:
1732
diff
changeset
|
120 ClipCursor(&rect); |
0b1070f2f94d
Implemented gamma correction on Windows.
Sam Lantinga <slouken@libsdl.org>
parents:
1732
diff
changeset
|
121 } |
1732
fd65f12b6de6
Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents:
1724
diff
changeset
|
122 } |
1719
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
123 |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
124 /* All done! */ |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
125 window->driverdata = data; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
126 return 0; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
127 } |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
128 |
1713
3e66ed1690e4
Whoops, forgot to indent
Sam Lantinga <slouken@libsdl.org>
parents:
1712
diff
changeset
|
129 int |
1718
ed4d4f1ea201
Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents:
1713
diff
changeset
|
130 WIN_CreateWindow(_THIS, SDL_Window * window) |
1712
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
131 { |
1719
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
132 HWND hwnd; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
133 LPTSTR title = NULL; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
134 HWND top; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
135 RECT rect; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
136 DWORD style = 0; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
137 int x, y; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
138 int w, h; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
139 |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
140 if (window->title) { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
141 title = WIN_UTF8ToString(window->title); |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
142 } else { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
143 title = NULL; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
144 } |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
145 |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
146 if (window->flags & SDL_WINDOW_SHOWN) { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
147 style |= WS_VISIBLE; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
148 } |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
149 if ((window->flags & (SDL_WINDOW_FULLSCREEN | SDL_WINDOW_BORDERLESS))) { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
150 style |= WS_POPUP; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
151 } else { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
152 style |= (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX); |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
153 } |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
154 if (window->flags & SDL_WINDOW_RESIZABLE) { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
155 style |= (WS_THICKFRAME | WS_MAXIMIZEBOX); |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
156 } |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
157 if (window->flags & SDL_WINDOW_MAXIMIZED) { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
158 style |= WS_MAXIMIZE; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
159 } |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
160 if (window->flags & SDL_WINDOW_MINIMIZED) { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
161 style |= WS_MINIMIZE; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
162 } |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
163 |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
164 /* Figure out what the window area will be */ |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
165 if (window->flags & SDL_WINDOW_FULLSCREEN) { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
166 top = HWND_TOPMOST; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
167 } else { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
168 top = HWND_NOTOPMOST; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
169 } |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
170 rect.left = 0; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
171 rect.top = 0; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
172 rect.right = window->w; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
173 rect.bottom = window->h; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
174 AdjustWindowRectEx(&rect, style, FALSE, 0); |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
175 w = (rect.right - rect.left); |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
176 h = (rect.bottom - rect.top); |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
177 |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
178 if ((window->flags & SDL_WINDOW_FULLSCREEN) || |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
179 window->x == SDL_WINDOWPOS_CENTERED) { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
180 x = (GetSystemMetrics(SM_CXSCREEN) - w) / 2; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
181 } else if (window->x == SDL_WINDOWPOS_UNDEFINED) { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
182 x = CW_USEDEFAULT; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
183 } else { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
184 x = window->x + rect.left; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
185 } |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
186 if ((window->flags & SDL_WINDOW_FULLSCREEN) || |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
187 window->y == SDL_WINDOWPOS_CENTERED) { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
188 y = (GetSystemMetrics(SM_CYSCREEN) - h) / 2; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
189 } else if (window->y == SDL_WINDOWPOS_UNDEFINED) { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
190 y = CW_USEDEFAULT; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
191 } else { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
192 y = window->y + rect.top; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
193 } |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
194 |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
195 hwnd = CreateWindow(SDL_Appname, |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
196 title ? title : TEXT(""), |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
197 style, x, y, w, h, NULL, NULL, SDL_Instance, NULL); |
1724
6c63fc2bd986
Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents:
1722
diff
changeset
|
198 WIN_PumpEvents(_this); |
6c63fc2bd986
Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents:
1722
diff
changeset
|
199 |
1719
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
200 if (title) { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
201 SDL_free(title); |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
202 } |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
203 |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
204 if (!hwnd) { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
205 WIN_SetError("Couldn't create window"); |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
206 return -1; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
207 } |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
208 |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
209 if (SetupWindowData(window, hwnd, TRUE) < 0) { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
210 DestroyWindow(hwnd); |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
211 return -1; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
212 } |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
213 return 0; |
1712
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
214 } |
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
215 |
1713
3e66ed1690e4
Whoops, forgot to indent
Sam Lantinga <slouken@libsdl.org>
parents:
1712
diff
changeset
|
216 int |
1718
ed4d4f1ea201
Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents:
1713
diff
changeset
|
217 WIN_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) |
1712
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
218 { |
1719
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
219 HWND hwnd = (HWND) data; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
220 LPTSTR title; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
221 int titleLen; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
222 |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
223 /* Query the title from the existing window */ |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
224 titleLen = GetWindowTextLength(hwnd); |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
225 title = SDL_stack_alloc(TCHAR, titleLen + 1); |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
226 if (title) { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
227 titleLen = GetWindowText(hwnd, title, titleLen); |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
228 } else { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
229 titleLen = 0; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
230 } |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
231 if (titleLen > 0) { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
232 window->title = WIN_StringToUTF8(title); |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
233 } |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
234 if (title) { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
235 SDL_stack_free(title); |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
236 } |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
237 |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
238 if (SetupWindowData(window, hwnd, FALSE) < 0) { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
239 return -1; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
240 } |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
241 return 0; |
1712
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
242 } |
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
243 |
1713
3e66ed1690e4
Whoops, forgot to indent
Sam Lantinga <slouken@libsdl.org>
parents:
1712
diff
changeset
|
244 void |
1718
ed4d4f1ea201
Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents:
1713
diff
changeset
|
245 WIN_SetWindowTitle(_THIS, SDL_Window * window) |
1712
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
246 { |
1719
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
247 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
248 LPTSTR title; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
249 |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
250 if (window->title) { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
251 title = WIN_UTF8ToString(window->title); |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
252 } else { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
253 title = NULL; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
254 } |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
255 SetWindowText(hwnd, title ? title : TEXT("")); |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
256 if (title) { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
257 SDL_free(title); |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
258 } |
1712
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
259 } |
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
260 |
1713
3e66ed1690e4
Whoops, forgot to indent
Sam Lantinga <slouken@libsdl.org>
parents:
1712
diff
changeset
|
261 void |
1718
ed4d4f1ea201
Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents:
1713
diff
changeset
|
262 WIN_SetWindowPosition(_THIS, SDL_Window * window) |
1712
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
263 { |
1719
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
264 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
265 RECT rect; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
266 DWORD style; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
267 HWND top; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
268 int x, y; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
269 int w, h; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
270 |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
271 /* Figure out what the window area will be */ |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
272 if (window->flags & SDL_WINDOW_FULLSCREEN) { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
273 top = HWND_TOPMOST; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
274 } else { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
275 top = HWND_NOTOPMOST; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
276 } |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
277 style = GetWindowLong(hwnd, GWL_STYLE); |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
278 rect.left = 0; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
279 rect.top = 0; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
280 rect.right = window->w; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
281 rect.bottom = window->h; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
282 AdjustWindowRectEx(&rect, style, |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
283 (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
284 NULL), 0); |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
285 w = (rect.right - rect.left); |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
286 h = (rect.bottom - rect.top); |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
287 |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
288 if ((window->flags & SDL_WINDOW_FULLSCREEN) || |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
289 window->x == SDL_WINDOWPOS_CENTERED) { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
290 x = (GetSystemMetrics(SM_CXSCREEN) - w) / 2; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
291 window->x = x - rect.left; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
292 } else { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
293 x = window->x + rect.left; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
294 } |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
295 if ((window->flags & SDL_WINDOW_FULLSCREEN) || |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
296 window->y == SDL_WINDOWPOS_CENTERED) { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
297 y = (GetSystemMetrics(SM_CYSCREEN) - h) / 2; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
298 window->y = y - rect.top; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
299 } else { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
300 y = window->y + rect.top; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
301 } |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
302 SetWindowPos(hwnd, top, x, y, h, w, (SWP_NOCOPYBITS | SWP_NOSIZE)); |
1712
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
303 } |
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
304 |
1713
3e66ed1690e4
Whoops, forgot to indent
Sam Lantinga <slouken@libsdl.org>
parents:
1712
diff
changeset
|
305 void |
1718
ed4d4f1ea201
Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents:
1713
diff
changeset
|
306 WIN_SetWindowSize(_THIS, SDL_Window * window) |
1712
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
307 { |
1719
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
308 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
309 RECT rect; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
310 DWORD style; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
311 HWND top; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
312 int w, h; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
313 |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
314 /* Figure out what the window area will be */ |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
315 if (window->flags & SDL_WINDOW_FULLSCREEN) { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
316 top = HWND_TOPMOST; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
317 } else { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
318 top = HWND_NOTOPMOST; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
319 } |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
320 style = GetWindowLong(hwnd, GWL_STYLE); |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
321 rect.left = 0; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
322 rect.top = 0; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
323 rect.right = window->w; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
324 rect.bottom = window->h; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
325 AdjustWindowRectEx(&rect, style, |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
326 (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
327 NULL), 0); |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
328 w = (rect.right - rect.left); |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
329 h = (rect.bottom - rect.top); |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
330 |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
331 SetWindowPos(hwnd, top, 0, 0, h, w, (SWP_NOCOPYBITS | SWP_NOMOVE)); |
1712
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
332 } |
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
333 |
1713
3e66ed1690e4
Whoops, forgot to indent
Sam Lantinga <slouken@libsdl.org>
parents:
1712
diff
changeset
|
334 void |
1718
ed4d4f1ea201
Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents:
1713
diff
changeset
|
335 WIN_ShowWindow(_THIS, SDL_Window * window) |
1712
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
336 { |
1719
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
337 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
338 |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
339 ShowWindow(hwnd, SW_SHOW); |
1712
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
340 } |
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
341 |
1713
3e66ed1690e4
Whoops, forgot to indent
Sam Lantinga <slouken@libsdl.org>
parents:
1712
diff
changeset
|
342 void |
1718
ed4d4f1ea201
Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents:
1713
diff
changeset
|
343 WIN_HideWindow(_THIS, SDL_Window * window) |
1712
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
344 { |
1719
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
345 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
346 |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
347 ShowWindow(hwnd, SW_HIDE); |
1712
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
348 } |
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
349 |
1713
3e66ed1690e4
Whoops, forgot to indent
Sam Lantinga <slouken@libsdl.org>
parents:
1712
diff
changeset
|
350 void |
1718
ed4d4f1ea201
Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents:
1713
diff
changeset
|
351 WIN_RaiseWindow(_THIS, SDL_Window * window) |
1712
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
352 { |
1719
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
353 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
354 HWND top; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
355 |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
356 if (window->flags & SDL_WINDOW_FULLSCREEN) { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
357 top = HWND_TOPMOST; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
358 } else { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
359 top = HWND_NOTOPMOST; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
360 } |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
361 SetWindowPos(hwnd, top, 0, 0, 0, 0, (SWP_NOMOVE | SWP_NOSIZE)); |
1712
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
362 } |
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
363 |
1713
3e66ed1690e4
Whoops, forgot to indent
Sam Lantinga <slouken@libsdl.org>
parents:
1712
diff
changeset
|
364 void |
1718
ed4d4f1ea201
Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents:
1713
diff
changeset
|
365 WIN_MaximizeWindow(_THIS, SDL_Window * window) |
1712
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
366 { |
1719
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
367 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
368 |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
369 ShowWindow(hwnd, SW_MAXIMIZE); |
1712
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
370 } |
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
371 |
1713
3e66ed1690e4
Whoops, forgot to indent
Sam Lantinga <slouken@libsdl.org>
parents:
1712
diff
changeset
|
372 void |
1718
ed4d4f1ea201
Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents:
1713
diff
changeset
|
373 WIN_MinimizeWindow(_THIS, SDL_Window * window) |
1712
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
374 { |
1719
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
375 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
376 |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
377 ShowWindow(hwnd, SW_MINIMIZE); |
1712
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
378 } |
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
379 |
1713
3e66ed1690e4
Whoops, forgot to indent
Sam Lantinga <slouken@libsdl.org>
parents:
1712
diff
changeset
|
380 void |
1718
ed4d4f1ea201
Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents:
1713
diff
changeset
|
381 WIN_RestoreWindow(_THIS, SDL_Window * window) |
1712
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
382 { |
1719
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
383 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
384 |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
385 ShowWindow(hwnd, SW_RESTORE); |
1712
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
386 } |
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
387 |
1713
3e66ed1690e4
Whoops, forgot to indent
Sam Lantinga <slouken@libsdl.org>
parents:
1712
diff
changeset
|
388 void |
1718
ed4d4f1ea201
Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents:
1713
diff
changeset
|
389 WIN_SetWindowGrab(_THIS, SDL_Window * window) |
1712
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
390 { |
1732
fd65f12b6de6
Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents:
1724
diff
changeset
|
391 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; |
fd65f12b6de6
Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents:
1724
diff
changeset
|
392 |
fd65f12b6de6
Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents:
1724
diff
changeset
|
393 if (window->flags & SDL_WINDOW_INPUT_GRABBED) { |
fd65f12b6de6
Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents:
1724
diff
changeset
|
394 if (window->flags & SDL_WINDOW_KEYBOARD_FOCUS) { |
fd65f12b6de6
Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents:
1724
diff
changeset
|
395 RECT rect; |
fd65f12b6de6
Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents:
1724
diff
changeset
|
396 GetClientRect(hwnd, &rect); |
fd65f12b6de6
Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents:
1724
diff
changeset
|
397 ClientToScreen(hwnd, (LPPOINT) & rect); |
fd65f12b6de6
Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents:
1724
diff
changeset
|
398 ClientToScreen(hwnd, (LPPOINT) & rect + 1); |
fd65f12b6de6
Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents:
1724
diff
changeset
|
399 ClipCursor(&rect); |
fd65f12b6de6
Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents:
1724
diff
changeset
|
400 } else { |
fd65f12b6de6
Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents:
1724
diff
changeset
|
401 SetFocus(hwnd); |
fd65f12b6de6
Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents:
1724
diff
changeset
|
402 } |
fd65f12b6de6
Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents:
1724
diff
changeset
|
403 } else { |
fd65f12b6de6
Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents:
1724
diff
changeset
|
404 if (window->flags & SDL_WINDOW_KEYBOARD_FOCUS) { |
fd65f12b6de6
Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents:
1724
diff
changeset
|
405 ClipCursor(NULL); |
fd65f12b6de6
Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents:
1724
diff
changeset
|
406 } |
fd65f12b6de6
Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents:
1724
diff
changeset
|
407 } |
1712
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
408 } |
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
409 |
1713
3e66ed1690e4
Whoops, forgot to indent
Sam Lantinga <slouken@libsdl.org>
parents:
1712
diff
changeset
|
410 void |
1718
ed4d4f1ea201
Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents:
1713
diff
changeset
|
411 WIN_DestroyWindow(_THIS, SDL_Window * window) |
1712
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
412 { |
1719
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
413 SDL_WindowData *data = (SDL_WindowData *) window->driverdata; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
414 |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
415 if (data) { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
416 if (data->created) { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
417 DestroyWindow(data->hwnd); |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
418 } |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
419 SDL_free(data); |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
420 } |
1712
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
421 } |
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
422 |
1713
3e66ed1690e4
Whoops, forgot to indent
Sam Lantinga <slouken@libsdl.org>
parents:
1712
diff
changeset
|
423 SDL_bool |
1718
ed4d4f1ea201
Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents:
1713
diff
changeset
|
424 WIN_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) |
1712
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
425 { |
1719
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
426 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
427 if (info->version.major <= SDL_MAJOR_VERSION) { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
428 info->window = hwnd; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
429 /* FIXME! */ |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
430 info->hglrc = NULL; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
431 return SDL_TRUE; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
432 } else { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
433 SDL_SetError("Application not compiled with SDL %d.%d\n", |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
434 SDL_MAJOR_VERSION, SDL_MINOR_VERSION); |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
435 return SDL_FALSE; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1718
diff
changeset
|
436 } |
1712
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
437 } |
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
438 |
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
439 /* vi: set ts=4 sw=4 expandtab: */ |