Mercurial > sdl-ios-xcode
comparison src/video/win32/SDL_win32window.c @ 2876:3fcb0d447bcd
indent
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Wed, 17 Dec 2008 07:19:55 +0000 |
parents | 91a7e08cd238 |
children | efe4d0ce2e97 |
comparison
equal
deleted
inserted
replaced
2875:91a7e08cd238 | 2876:3fcb0d447bcd |
---|---|
157 RECT rect; | 157 RECT rect; |
158 DWORD style = (WS_CLIPSIBLINGS | WS_CLIPCHILDREN); | 158 DWORD style = (WS_CLIPSIBLINGS | WS_CLIPCHILDREN); |
159 int x, y; | 159 int x, y; |
160 int w, h; | 160 int w, h; |
161 | 161 |
162 if (window->flags & (SDL_WINDOW_BORDERLESS|SDL_WINDOW_FULLSCREEN)) { | 162 if (window->flags & (SDL_WINDOW_BORDERLESS | SDL_WINDOW_FULLSCREEN)) { |
163 style |= WS_POPUP; | 163 style |= WS_POPUP; |
164 } else { | 164 } else { |
165 style |= (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX); | 165 style |= (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX); |
166 } | 166 } |
167 if ((window->flags & SDL_WINDOW_RESIZABLE) && !(window->flags & SDL_WINDOW_FULLSCREEN)) { | 167 if ((window->flags & SDL_WINDOW_RESIZABLE) |
168 && !(window->flags & SDL_WINDOW_FULLSCREEN)) { | |
168 style |= (WS_THICKFRAME | WS_MAXIMIZEBOX); | 169 style |= (WS_THICKFRAME | WS_MAXIMIZEBOX); |
169 } | 170 } |
170 | 171 |
171 /* Figure out what the window area will be */ | 172 /* Figure out what the window area will be */ |
172 if (window->flags & SDL_WINDOW_FULLSCREEN) { | 173 if (window->flags & SDL_WINDOW_FULLSCREEN) { |
180 rect.bottom = window->h; | 181 rect.bottom = window->h; |
181 AdjustWindowRectEx(&rect, style, FALSE, 0); | 182 AdjustWindowRectEx(&rect, style, FALSE, 0); |
182 w = (rect.right - rect.left); | 183 w = (rect.right - rect.left); |
183 h = (rect.bottom - rect.top); | 184 h = (rect.bottom - rect.top); |
184 | 185 |
185 if ((window->flags & SDL_WINDOW_FULLSCREEN) || window->x == SDL_WINDOWPOS_CENTERED) { | 186 if ((window->flags & SDL_WINDOW_FULLSCREEN) |
187 || window->x == SDL_WINDOWPOS_CENTERED) { | |
186 x = (GetSystemMetrics(SM_CXSCREEN) - w) / 2; | 188 x = (GetSystemMetrics(SM_CXSCREEN) - w) / 2; |
187 } else if (window->x == SDL_WINDOWPOS_UNDEFINED) { | 189 } else if (window->x == SDL_WINDOWPOS_UNDEFINED) { |
188 x = CW_USEDEFAULT; | 190 x = CW_USEDEFAULT; |
189 } else { | 191 } else { |
190 x = window->x + rect.left; | 192 x = window->x + rect.left; |
191 } | 193 } |
192 if ((window->flags & SDL_WINDOW_FULLSCREEN) || window->y == SDL_WINDOWPOS_CENTERED) { | 194 if ((window->flags & SDL_WINDOW_FULLSCREEN) |
195 || window->y == SDL_WINDOWPOS_CENTERED) { | |
193 y = (GetSystemMetrics(SM_CYSCREEN) - h) / 2; | 196 y = (GetSystemMetrics(SM_CYSCREEN) - h) / 2; |
194 } else if (window->y == SDL_WINDOWPOS_UNDEFINED) { | 197 } else if (window->y == SDL_WINDOWPOS_UNDEFINED) { |
195 y = CW_USEDEFAULT; | 198 y = CW_USEDEFAULT; |
196 } else { | 199 } else { |
197 y = window->y + rect.top; | 200 y = window->y + rect.top; |
330 rect.bottom = window->h; | 333 rect.bottom = window->h; |
331 AdjustWindowRectEx(&rect, style, | 334 AdjustWindowRectEx(&rect, style, |
332 (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != | 335 (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != |
333 NULL), 0); | 336 NULL), 0); |
334 | 337 |
335 if ((window->flags & SDL_WINDOW_FULLSCREEN) || window->x == SDL_WINDOWPOS_CENTERED) { | 338 if ((window->flags & SDL_WINDOW_FULLSCREEN) |
339 || window->x == SDL_WINDOWPOS_CENTERED) { | |
336 x = (GetSystemMetrics(SM_CXSCREEN) - window->w) / 2; | 340 x = (GetSystemMetrics(SM_CXSCREEN) - window->w) / 2; |
337 } else { | 341 } else { |
338 x = window->x + rect.left; | 342 x = window->x + rect.left; |
339 } | 343 } |
340 if ((window->flags & SDL_WINDOW_FULLSCREEN) || window->y == SDL_WINDOWPOS_CENTERED) { | 344 if ((window->flags & SDL_WINDOW_FULLSCREEN) |
345 || window->y == SDL_WINDOWPOS_CENTERED) { | |
341 y = (GetSystemMetrics(SM_CYSCREEN) - window->h) / 2; | 346 y = (GetSystemMetrics(SM_CYSCREEN) - window->h) / 2; |
342 } else { | 347 } else { |
343 y = window->y + rect.top; | 348 y = window->y + rect.top; |
344 } | 349 } |
345 | 350 |
432 void | 437 void |
433 WIN_SetWindowGrab(_THIS, SDL_Window * window) | 438 WIN_SetWindowGrab(_THIS, SDL_Window * window) |
434 { | 439 { |
435 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; | 440 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; |
436 | 441 |
437 if ((window->flags & (SDL_WINDOW_INPUT_GRABBED|SDL_WINDOW_FULLSCREEN)) && | 442 if ((window->flags & (SDL_WINDOW_INPUT_GRABBED | SDL_WINDOW_FULLSCREEN)) |
438 (window->flags & SDL_WINDOW_INPUT_FOCUS)) { | 443 && (window->flags & SDL_WINDOW_INPUT_FOCUS)) { |
439 RECT rect; | 444 RECT rect; |
440 GetClientRect(hwnd, &rect); | 445 GetClientRect(hwnd, &rect); |
441 ClientToScreen(hwnd, (LPPOINT) & rect); | 446 ClientToScreen(hwnd, (LPPOINT) & rect); |
442 ClientToScreen(hwnd, (LPPOINT) & rect + 1); | 447 ClientToScreen(hwnd, (LPPOINT) & rect + 1); |
443 ClipCursor(&rect); | 448 ClipCursor(&rect); |