Mercurial > sdl-ios-xcode
annotate src/video/win32/SDL_win32window.c @ 5037:c8f11c4ced7d
Raw input is no longer used. Yay!
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Wed, 19 Jan 2011 13:44:44 -0800 |
parents | 6546eaa20271 |
children | 8b7988f42fcb |
rev | line source |
---|---|
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1 /* |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
3697 | 3 Copyright (C) 1997-2010 Sam Lantinga |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7 License as published by the Free Software Foundation; either |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
9 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
13 Lesser General Public License for more details. |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
14 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
18 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
19 Sam Lantinga |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
20 slouken@libsdl.org |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
21 */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
22 #include "SDL_config.h" |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
23 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
24 #include "../SDL_sysvideo.h" |
2970
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
25 #include "../SDL_pixels_c.h" |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
26 #include "../../events/SDL_keyboard_c.h" |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
27 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
28 #include "SDL_win32video.h" |
4569 | 29 #include "SDL_win32window.h" |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
30 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
31 /* This is included after SDL_win32video.h, which includes windows.h */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
32 #include "SDL_syswm.h" |
4569 | 33 #include "SDL_gapirender.h" |
3168 | 34 |
35 | |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
36 /* Fake window to help with DirectInput events. */ |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
37 HWND SDL_HelperWindow = NULL; |
2714
1d1be6137875
Merged last minute fixes from force feedback branch (r4031, r4033, r4034)
Sam Lantinga <slouken@libsdl.org>
parents:
2713
diff
changeset
|
38 static WCHAR *SDL_HelperWindowClassName = TEXT("SDLHelperWindowInputCatcher"); |
1d1be6137875
Merged last minute fixes from force feedback branch (r4031, r4033, r4034)
Sam Lantinga <slouken@libsdl.org>
parents:
2713
diff
changeset
|
39 static WCHAR *SDL_HelperWindowName = TEXT("SDLHelperWindowInputMsgWindow"); |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
40 static ATOM SDL_HelperWindowClass = 0; |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
41 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
42 static int |
1951
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
1913
diff
changeset
|
43 SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created) |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
44 { |
1951
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
1913
diff
changeset
|
45 SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; |
3685
64ce267332c6
Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents:
3566
diff
changeset
|
46 SDL_VideoDisplay *display = window->display; |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
47 SDL_WindowData *data; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
48 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
49 /* Allocate the window data */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
50 data = (SDL_WindowData *) SDL_malloc(sizeof(*data)); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
51 if (!data) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
52 SDL_OutOfMemory(); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
53 return -1; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
54 } |
3685
64ce267332c6
Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents:
3566
diff
changeset
|
55 data->window = window; |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
56 data->hwnd = hwnd; |
1913
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
57 data->hdc = GetDC(hwnd); |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
58 data->created = created; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
59 data->mouse_pressed = SDL_FALSE; |
1951
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
1913
diff
changeset
|
60 data->videodata = videodata; |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
61 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
62 /* Associate the data with the window */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
63 if (!SetProp(hwnd, TEXT("SDL_WindowData"), data)) { |
1913
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
64 ReleaseDC(hwnd, data->hdc); |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
65 SDL_free(data); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
66 WIN_SetError("SetProp() failed"); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
67 return -1; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
68 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
69 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
70 /* Set up the window proc function */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
71 data->wndproc = (WNDPROC) GetWindowLongPtr(hwnd, GWLP_WNDPROC); |
4733
983eb9d5ed31
Change SDL to not use DefWindowProc as the window class' window procedure.
dewyatt
parents:
3697
diff
changeset
|
72 if (data->wndproc == WIN_WindowProc) { |
3566 | 73 data->wndproc = NULL; |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
74 } |
4735 | 75 else { |
76 SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR) WIN_WindowProc); | |
77 } | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
78 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
79 /* Fill in the SDL window with the window data */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
80 { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
81 POINT point; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
82 point.x = 0; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
83 point.y = 0; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
84 if (ClientToScreen(hwnd, &point)) { |
3530
e96be66e3673
The window position is display relative, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
3528
diff
changeset
|
85 SDL_Rect bounds; |
e96be66e3673
The window position is display relative, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
3528
diff
changeset
|
86 WIN_GetDisplayBounds(_this, display, &bounds); |
e96be66e3673
The window position is display relative, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
3528
diff
changeset
|
87 window->x = point.x - bounds.x; |
e96be66e3673
The window position is display relative, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
3528
diff
changeset
|
88 window->y = point.y - bounds.y; |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
89 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
90 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
91 { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
92 RECT rect; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
93 if (GetClientRect(hwnd, &rect)) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
94 window->w = rect.right; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
95 window->h = rect.bottom; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
96 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
97 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
98 { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
99 DWORD style = GetWindowLong(hwnd, GWL_STYLE); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
100 if (style & WS_VISIBLE) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
101 window->flags |= SDL_WINDOW_SHOWN; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
102 } else { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
103 window->flags &= ~SDL_WINDOW_SHOWN; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
104 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
105 if (style & (WS_BORDER | WS_THICKFRAME)) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
106 window->flags &= ~SDL_WINDOW_BORDERLESS; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
107 } else { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
108 window->flags |= SDL_WINDOW_BORDERLESS; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
109 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
110 if (style & WS_THICKFRAME) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
111 window->flags |= SDL_WINDOW_RESIZABLE; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
112 } else { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
113 window->flags &= ~SDL_WINDOW_RESIZABLE; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
114 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
115 if (style & WS_MAXIMIZE) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
116 window->flags |= SDL_WINDOW_MAXIMIZED; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
117 } else { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
118 window->flags &= ~SDL_WINDOW_MAXIMIZED; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
119 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
120 if (style & WS_MINIMIZE) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
121 window->flags |= SDL_WINDOW_MINIMIZED; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
122 } else { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
123 window->flags &= ~SDL_WINDOW_MINIMIZED; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
124 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
125 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
126 if (GetFocus() == hwnd) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
127 window->flags |= SDL_WINDOW_INPUT_FOCUS; |
4465
3e69e077cb95
Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents:
3697
diff
changeset
|
128 SDL_SetKeyboardFocus(data->window); |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
129 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
130 if (window->flags & SDL_WINDOW_INPUT_GRABBED) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
131 RECT rect; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
132 GetClientRect(hwnd, &rect); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
133 ClientToScreen(hwnd, (LPPOINT) & rect); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
134 ClientToScreen(hwnd, (LPPOINT) & rect + 1); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
135 ClipCursor(&rect); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
136 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
137 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
138 |
4919
716b2cbf4c9e
First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents:
4902
diff
changeset
|
139 /* Enable multi-touch */ |
4948
6546eaa20271
Fixed crash on Windows XP
Sam Lantinga <slouken@libsdl.org>
parents:
4919
diff
changeset
|
140 if (videodata->RegisterTouchWindow) { |
6546eaa20271
Fixed crash on Windows XP
Sam Lantinga <slouken@libsdl.org>
parents:
4919
diff
changeset
|
141 videodata->RegisterTouchWindow(hwnd, (TWF_FINETOUCH|TWF_WANTPALM)); |
6546eaa20271
Fixed crash on Windows XP
Sam Lantinga <slouken@libsdl.org>
parents:
4919
diff
changeset
|
142 } |
4919
716b2cbf4c9e
First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents:
4902
diff
changeset
|
143 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
144 /* All done! */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
145 window->driverdata = data; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
146 return 0; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
147 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
148 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
149 int |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
150 WIN_CreateWindow(_THIS, SDL_Window * window) |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
151 { |
3685
64ce267332c6
Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents:
3566
diff
changeset
|
152 SDL_VideoDisplay *display = window->display; |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
153 HWND hwnd; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
154 RECT rect; |
3528
59ff7a2beb57
Added an API function to query geometry of multiple monitors:
Sam Lantinga <slouken@libsdl.org>
parents:
3196
diff
changeset
|
155 SDL_Rect bounds; |
1913
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
156 DWORD style = (WS_CLIPSIBLINGS | WS_CLIPCHILDREN); |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
157 int x, y; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
158 int w, h; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
159 |
2876 | 160 if (window->flags & (SDL_WINDOW_BORDERLESS | SDL_WINDOW_FULLSCREEN)) { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
161 style |= WS_POPUP; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
162 } else { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
163 style |= (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
164 } |
2876 | 165 if ((window->flags & SDL_WINDOW_RESIZABLE) |
166 && !(window->flags & SDL_WINDOW_FULLSCREEN)) { | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
167 style |= (WS_THICKFRAME | WS_MAXIMIZEBOX); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
168 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
169 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
170 /* Figure out what the window area will be */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
171 rect.left = 0; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
172 rect.top = 0; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
173 rect.right = window->w; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
174 rect.bottom = window->h; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
175 AdjustWindowRectEx(&rect, style, FALSE, 0); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
176 w = (rect.right - rect.left); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
177 h = (rect.bottom - rect.top); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
178 |
3528
59ff7a2beb57
Added an API function to query geometry of multiple monitors:
Sam Lantinga <slouken@libsdl.org>
parents:
3196
diff
changeset
|
179 WIN_GetDisplayBounds(_this, display, &bounds); |
4486
237b1eb53e4d
Fixed fullscreen window position
Sam Lantinga <slouken@libsdl.org>
parents:
4465
diff
changeset
|
180 if (window->flags & SDL_WINDOW_FULLSCREEN) { |
237b1eb53e4d
Fixed fullscreen window position
Sam Lantinga <slouken@libsdl.org>
parents:
4465
diff
changeset
|
181 /* The bounds when this window is visible is the fullscreen mode */ |
237b1eb53e4d
Fixed fullscreen window position
Sam Lantinga <slouken@libsdl.org>
parents:
4465
diff
changeset
|
182 SDL_DisplayMode fullscreen_mode; |
237b1eb53e4d
Fixed fullscreen window position
Sam Lantinga <slouken@libsdl.org>
parents:
4465
diff
changeset
|
183 if (SDL_GetWindowDisplayMode(window, &fullscreen_mode) == 0) { |
237b1eb53e4d
Fixed fullscreen window position
Sam Lantinga <slouken@libsdl.org>
parents:
4465
diff
changeset
|
184 bounds.w = fullscreen_mode.w; |
237b1eb53e4d
Fixed fullscreen window position
Sam Lantinga <slouken@libsdl.org>
parents:
4465
diff
changeset
|
185 bounds.h = fullscreen_mode.h; |
237b1eb53e4d
Fixed fullscreen window position
Sam Lantinga <slouken@libsdl.org>
parents:
4465
diff
changeset
|
186 } |
237b1eb53e4d
Fixed fullscreen window position
Sam Lantinga <slouken@libsdl.org>
parents:
4465
diff
changeset
|
187 } |
2876 | 188 if ((window->flags & SDL_WINDOW_FULLSCREEN) |
189 || window->x == SDL_WINDOWPOS_CENTERED) { | |
4486
237b1eb53e4d
Fixed fullscreen window position
Sam Lantinga <slouken@libsdl.org>
parents:
4465
diff
changeset
|
190 x = bounds.x + (bounds.w - w) / 2; |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
191 } else if (window->x == SDL_WINDOWPOS_UNDEFINED) { |
3528
59ff7a2beb57
Added an API function to query geometry of multiple monitors:
Sam Lantinga <slouken@libsdl.org>
parents:
3196
diff
changeset
|
192 if (bounds.x == 0) { |
59ff7a2beb57
Added an API function to query geometry of multiple monitors:
Sam Lantinga <slouken@libsdl.org>
parents:
3196
diff
changeset
|
193 x = CW_USEDEFAULT; |
59ff7a2beb57
Added an API function to query geometry of multiple monitors:
Sam Lantinga <slouken@libsdl.org>
parents:
3196
diff
changeset
|
194 } else { |
59ff7a2beb57
Added an API function to query geometry of multiple monitors:
Sam Lantinga <slouken@libsdl.org>
parents:
3196
diff
changeset
|
195 x = bounds.x; |
59ff7a2beb57
Added an API function to query geometry of multiple monitors:
Sam Lantinga <slouken@libsdl.org>
parents:
3196
diff
changeset
|
196 } |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
197 } else { |
3530
e96be66e3673
The window position is display relative, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
3528
diff
changeset
|
198 x = bounds.x + window->x + rect.left; |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
199 } |
2876 | 200 if ((window->flags & SDL_WINDOW_FULLSCREEN) |
201 || window->y == SDL_WINDOWPOS_CENTERED) { | |
4486
237b1eb53e4d
Fixed fullscreen window position
Sam Lantinga <slouken@libsdl.org>
parents:
4465
diff
changeset
|
202 y = bounds.y + (bounds.h - h) / 2; |
3528
59ff7a2beb57
Added an API function to query geometry of multiple monitors:
Sam Lantinga <slouken@libsdl.org>
parents:
3196
diff
changeset
|
203 } else if (window->x == SDL_WINDOWPOS_UNDEFINED) { |
59ff7a2beb57
Added an API function to query geometry of multiple monitors:
Sam Lantinga <slouken@libsdl.org>
parents:
3196
diff
changeset
|
204 if (bounds.x == 0) { |
59ff7a2beb57
Added an API function to query geometry of multiple monitors:
Sam Lantinga <slouken@libsdl.org>
parents:
3196
diff
changeset
|
205 y = CW_USEDEFAULT; |
59ff7a2beb57
Added an API function to query geometry of multiple monitors:
Sam Lantinga <slouken@libsdl.org>
parents:
3196
diff
changeset
|
206 } else { |
59ff7a2beb57
Added an API function to query geometry of multiple monitors:
Sam Lantinga <slouken@libsdl.org>
parents:
3196
diff
changeset
|
207 y = bounds.y; |
59ff7a2beb57
Added an API function to query geometry of multiple monitors:
Sam Lantinga <slouken@libsdl.org>
parents:
3196
diff
changeset
|
208 } |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
209 } else { |
3530
e96be66e3673
The window position is display relative, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
3528
diff
changeset
|
210 y = bounds.y + window->y + rect.top; |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
211 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
212 |
1956
ba0d62354872
Simplified driver window creation code.
Sam Lantinga <slouken@libsdl.org>
parents:
1952
diff
changeset
|
213 hwnd = |
ba0d62354872
Simplified driver window creation code.
Sam Lantinga <slouken@libsdl.org>
parents:
1952
diff
changeset
|
214 CreateWindow(SDL_Appname, TEXT(""), style, x, y, w, h, NULL, NULL, |
ba0d62354872
Simplified driver window creation code.
Sam Lantinga <slouken@libsdl.org>
parents:
1952
diff
changeset
|
215 SDL_Instance, NULL); |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
216 if (!hwnd) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
217 WIN_SetError("Couldn't create window"); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
218 return -1; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
219 } |
4650 | 220 //RegisterTouchWindow(hwnd, 0); |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
221 |
2710
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
222 WIN_PumpEvents(_this); |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
223 |
1951
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
1913
diff
changeset
|
224 if (SetupWindowData(_this, window, hwnd, SDL_TRUE) < 0) { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
225 DestroyWindow(hwnd); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
226 return -1; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
227 } |
1952
420716272158
Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
1951
diff
changeset
|
228 #ifdef SDL_VIDEO_OPENGL_WGL |
1913
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
229 if (window->flags & SDL_WINDOW_OPENGL) { |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
230 if (WIN_GL_SetupWindow(_this, window) < 0) { |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
231 WIN_DestroyWindow(_this, window); |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
232 return -1; |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
233 } |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
234 } |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
235 #endif |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
236 return 0; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
237 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
238 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
239 int |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
240 WIN_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
241 { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
242 HWND hwnd = (HWND) data; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
243 LPTSTR title; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
244 int titleLen; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
245 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
246 /* Query the title from the existing window */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
247 titleLen = GetWindowTextLength(hwnd); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
248 title = SDL_stack_alloc(TCHAR, titleLen + 1); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
249 if (title) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
250 titleLen = GetWindowText(hwnd, title, titleLen); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
251 } else { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
252 titleLen = 0; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
253 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
254 if (titleLen > 0) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
255 window->title = WIN_StringToUTF8(title); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
256 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
257 if (title) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
258 SDL_stack_free(title); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
259 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
260 |
1951
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
1913
diff
changeset
|
261 if (SetupWindowData(_this, window, hwnd, SDL_FALSE) < 0) { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
262 return -1; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
263 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
264 return 0; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
265 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
266 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
267 void |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
268 WIN_SetWindowTitle(_THIS, SDL_Window * window) |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
269 { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
270 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
271 LPTSTR title; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
272 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
273 if (window->title) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
274 title = WIN_UTF8ToString(window->title); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
275 } else { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
276 title = NULL; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
277 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
278 SetWindowText(hwnd, title ? title : TEXT("")); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
279 if (title) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
280 SDL_free(title); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
281 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
282 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
283 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
284 void |
2970
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
285 WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
286 { |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
287 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
288 HICON hicon = NULL; |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
289 |
2990 | 290 if (icon) { |
2970
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
291 BYTE *icon_bmp; |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
292 int icon_len; |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
293 SDL_RWops *dst; |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
294 SDL_PixelFormat format; |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
295 SDL_Surface *surface; |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
296 |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
297 /* Create temporary bitmap buffer */ |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
298 icon_len = 40 + icon->h * icon->w * 4; |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
299 icon_bmp = SDL_stack_alloc(BYTE, icon_len); |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
300 dst = SDL_RWFromMem(icon_bmp, icon_len); |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
301 if (!dst) { |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
302 SDL_stack_free(icon_bmp); |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
303 return; |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
304 } |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
305 |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
306 /* Write the BITMAPINFO header */ |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
307 SDL_WriteLE32(dst, 40); |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
308 SDL_WriteLE32(dst, icon->w); |
2990 | 309 SDL_WriteLE32(dst, icon->h * 2); |
2970
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
310 SDL_WriteLE16(dst, 1); |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
311 SDL_WriteLE16(dst, 32); |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
312 SDL_WriteLE32(dst, BI_RGB); |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
313 SDL_WriteLE32(dst, icon->h * icon->w * 4); |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
314 SDL_WriteLE32(dst, 0); |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
315 SDL_WriteLE32(dst, 0); |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
316 SDL_WriteLE32(dst, 0); |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
317 SDL_WriteLE32(dst, 0); |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
318 |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
319 /* Convert the icon to a 32-bit surface with alpha channel */ |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
320 SDL_InitFormat(&format, 32, |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
321 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000); |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
322 surface = SDL_ConvertSurface(icon, &format, 0); |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
323 if (surface) { |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
324 /* Write the pixels upside down into the bitmap buffer */ |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
325 int y = surface->h; |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
326 while (y--) { |
2990 | 327 Uint8 *src = (Uint8 *) surface->pixels + y * surface->pitch; |
2970
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
328 SDL_RWwrite(dst, src, surface->pitch, 1); |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
329 } |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
330 SDL_FreeSurface(surface); |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
331 |
3097
0d12e8f1de3c
Date: Thu, 05 Feb 2009 18:07:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
3057
diff
changeset
|
332 /* TODO: create the icon in WinCE (CreateIconFromResource isn't available) */ |
0d12e8f1de3c
Date: Thu, 05 Feb 2009 18:07:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
3057
diff
changeset
|
333 #ifndef _WIN32_WCE |
2990 | 334 hicon = |
335 CreateIconFromResource(icon_bmp, icon_len, TRUE, 0x00030000); | |
3097
0d12e8f1de3c
Date: Thu, 05 Feb 2009 18:07:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
3057
diff
changeset
|
336 #endif |
2970
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
337 } |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
338 SDL_RWclose(dst); |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
339 SDL_stack_free(icon_bmp); |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
340 } |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
341 |
2971
a3012c6652ff
Should we also set the icon in the task manager?
Sam Lantinga <slouken@libsdl.org>
parents:
2970
diff
changeset
|
342 /* Set the icon for the window */ |
2990 | 343 SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM) hicon); |
2971
a3012c6652ff
Should we also set the icon in the task manager?
Sam Lantinga <slouken@libsdl.org>
parents:
2970
diff
changeset
|
344 |
a3012c6652ff
Should we also set the icon in the task manager?
Sam Lantinga <slouken@libsdl.org>
parents:
2970
diff
changeset
|
345 /* Set the icon in the task manager (should we do this?) */ |
2990 | 346 SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM) hicon); |
2970
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
347 } |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
348 |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
349 void |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
350 WIN_SetWindowPosition(_THIS, SDL_Window * window) |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
351 { |
3685
64ce267332c6
Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents:
3566
diff
changeset
|
352 SDL_VideoDisplay *display = window->display; |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
353 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
354 RECT rect; |
3528
59ff7a2beb57
Added an API function to query geometry of multiple monitors:
Sam Lantinga <slouken@libsdl.org>
parents:
3196
diff
changeset
|
355 SDL_Rect bounds; |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
356 DWORD style; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
357 HWND top; |
3168 | 358 BOOL menu; |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
359 int x, y; |
4486
237b1eb53e4d
Fixed fullscreen window position
Sam Lantinga <slouken@libsdl.org>
parents:
4465
diff
changeset
|
360 int w, h; |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
361 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
362 /* Figure out what the window area will be */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
363 if (window->flags & SDL_WINDOW_FULLSCREEN) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
364 top = HWND_TOPMOST; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
365 } else { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
366 top = HWND_NOTOPMOST; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
367 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
368 style = GetWindowLong(hwnd, GWL_STYLE); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
369 rect.left = 0; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
370 rect.top = 0; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
371 rect.right = window->w; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
372 rect.bottom = window->h; |
3168 | 373 #ifdef _WIN32_WCE |
374 menu = FALSE; | |
375 #else | |
376 menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL); | |
377 #endif | |
378 AdjustWindowRectEx(&rect, style, menu, 0); | |
4486
237b1eb53e4d
Fixed fullscreen window position
Sam Lantinga <slouken@libsdl.org>
parents:
4465
diff
changeset
|
379 w = (rect.right - rect.left); |
237b1eb53e4d
Fixed fullscreen window position
Sam Lantinga <slouken@libsdl.org>
parents:
4465
diff
changeset
|
380 h = (rect.bottom - rect.top); |
2875
91a7e08cd238
* Implemented X11 fullscreen input grab
Sam Lantinga <slouken@libsdl.org>
parents:
2865
diff
changeset
|
381 |
3528
59ff7a2beb57
Added an API function to query geometry of multiple monitors:
Sam Lantinga <slouken@libsdl.org>
parents:
3196
diff
changeset
|
382 WIN_GetDisplayBounds(_this, display, &bounds); |
4486
237b1eb53e4d
Fixed fullscreen window position
Sam Lantinga <slouken@libsdl.org>
parents:
4465
diff
changeset
|
383 if (window->flags & SDL_WINDOW_FULLSCREEN) { |
237b1eb53e4d
Fixed fullscreen window position
Sam Lantinga <slouken@libsdl.org>
parents:
4465
diff
changeset
|
384 /* The bounds when this window is visible is the fullscreen mode */ |
237b1eb53e4d
Fixed fullscreen window position
Sam Lantinga <slouken@libsdl.org>
parents:
4465
diff
changeset
|
385 SDL_DisplayMode fullscreen_mode; |
237b1eb53e4d
Fixed fullscreen window position
Sam Lantinga <slouken@libsdl.org>
parents:
4465
diff
changeset
|
386 if (SDL_GetWindowDisplayMode(window, &fullscreen_mode) == 0) { |
237b1eb53e4d
Fixed fullscreen window position
Sam Lantinga <slouken@libsdl.org>
parents:
4465
diff
changeset
|
387 bounds.w = fullscreen_mode.w; |
237b1eb53e4d
Fixed fullscreen window position
Sam Lantinga <slouken@libsdl.org>
parents:
4465
diff
changeset
|
388 bounds.h = fullscreen_mode.h; |
237b1eb53e4d
Fixed fullscreen window position
Sam Lantinga <slouken@libsdl.org>
parents:
4465
diff
changeset
|
389 } |
237b1eb53e4d
Fixed fullscreen window position
Sam Lantinga <slouken@libsdl.org>
parents:
4465
diff
changeset
|
390 } |
2876 | 391 if ((window->flags & SDL_WINDOW_FULLSCREEN) |
392 || window->x == SDL_WINDOWPOS_CENTERED) { | |
4486
237b1eb53e4d
Fixed fullscreen window position
Sam Lantinga <slouken@libsdl.org>
parents:
4465
diff
changeset
|
393 x = bounds.x + (bounds.w - w) / 2; |
2875
91a7e08cd238
* Implemented X11 fullscreen input grab
Sam Lantinga <slouken@libsdl.org>
parents:
2865
diff
changeset
|
394 } else { |
3530
e96be66e3673
The window position is display relative, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
3528
diff
changeset
|
395 x = bounds.x + window->x + rect.left; |
2875
91a7e08cd238
* Implemented X11 fullscreen input grab
Sam Lantinga <slouken@libsdl.org>
parents:
2865
diff
changeset
|
396 } |
2876 | 397 if ((window->flags & SDL_WINDOW_FULLSCREEN) |
398 || window->y == SDL_WINDOWPOS_CENTERED) { | |
4486
237b1eb53e4d
Fixed fullscreen window position
Sam Lantinga <slouken@libsdl.org>
parents:
4465
diff
changeset
|
399 y = bounds.y + (bounds.h - h) / 2; |
2875
91a7e08cd238
* Implemented X11 fullscreen input grab
Sam Lantinga <slouken@libsdl.org>
parents:
2865
diff
changeset
|
400 } else { |
3530
e96be66e3673
The window position is display relative, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
3528
diff
changeset
|
401 y = bounds.y + window->y + rect.top; |
2875
91a7e08cd238
* Implemented X11 fullscreen input grab
Sam Lantinga <slouken@libsdl.org>
parents:
2865
diff
changeset
|
402 } |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
403 |
1956
ba0d62354872
Simplified driver window creation code.
Sam Lantinga <slouken@libsdl.org>
parents:
1952
diff
changeset
|
404 SetWindowPos(hwnd, top, x, y, 0, 0, (SWP_NOCOPYBITS | SWP_NOSIZE)); |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
405 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
406 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
407 void |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
408 WIN_SetWindowSize(_THIS, SDL_Window * window) |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
409 { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
410 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
411 RECT rect; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
412 DWORD style; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
413 HWND top; |
3168 | 414 BOOL menu; |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
415 int w, h; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
416 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
417 /* Figure out what the window area will be */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
418 if (window->flags & SDL_WINDOW_FULLSCREEN) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
419 top = HWND_TOPMOST; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
420 } else { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
421 top = HWND_NOTOPMOST; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
422 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
423 style = GetWindowLong(hwnd, GWL_STYLE); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
424 rect.left = 0; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
425 rect.top = 0; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
426 rect.right = window->w; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
427 rect.bottom = window->h; |
3168 | 428 #ifdef _WIN32_WCE |
429 menu = FALSE; | |
430 #else | |
431 menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL); | |
432 #endif | |
433 AdjustWindowRectEx(&rect, style, menu, 0); | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
434 w = (rect.right - rect.left); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
435 h = (rect.bottom - rect.top); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
436 |
2968
efe4d0ce2e97
Date: Fri, 02 Jan 2009 23:22:39 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2876
diff
changeset
|
437 SetWindowPos(hwnd, top, 0, 0, w, h, (SWP_NOCOPYBITS | SWP_NOMOVE)); |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
438 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
439 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
440 void |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
441 WIN_ShowWindow(_THIS, SDL_Window * window) |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
442 { |
4569 | 443 #ifdef _WIN32_WCE |
444 WINCE_ShowWindow(_this, window, 1); | |
445 #else | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
446 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
447 ShowWindow(hwnd, SW_SHOW); |
3168 | 448 #endif |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
449 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
450 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
451 void |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
452 WIN_HideWindow(_THIS, SDL_Window * window) |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
453 { |
4569 | 454 #ifdef _WIN32_WCE |
455 WINCE_ShowWindow(_this, window, 0); | |
456 #else | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
457 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
458 ShowWindow(hwnd, SW_HIDE); |
3168 | 459 #endif |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
460 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
461 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
462 void |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
463 WIN_RaiseWindow(_THIS, SDL_Window * window) |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
464 { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
465 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
466 HWND top; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
467 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
468 if (window->flags & SDL_WINDOW_FULLSCREEN) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
469 top = HWND_TOPMOST; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
470 } else { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
471 top = HWND_NOTOPMOST; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
472 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
473 SetWindowPos(hwnd, top, 0, 0, 0, 0, (SWP_NOMOVE | SWP_NOSIZE)); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
474 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
475 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
476 void |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
477 WIN_MaximizeWindow(_THIS, SDL_Window * window) |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
478 { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
479 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; |
4569 | 480 SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; |
3168 | 481 |
482 #ifdef _WIN32_WCE | |
4569 | 483 if((window->flags & SDL_WINDOW_FULLSCREEN) && videodata->SHFullScreen) |
484 videodata->SHFullScreen(hwnd, SHFS_HIDETASKBAR | SHFS_HIDESTARTICON | SHFS_HIDESIPBUTTON); | |
3168 | 485 #endif |
4569 | 486 |
487 ShowWindow(hwnd, SW_MAXIMIZE); | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
488 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
489 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
490 void |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
491 WIN_MinimizeWindow(_THIS, SDL_Window * window) |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
492 { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
493 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; |
4569 | 494 SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
495 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
496 ShowWindow(hwnd, SW_MINIMIZE); |
3168 | 497 |
498 #ifdef _WIN32_WCE | |
4569 | 499 if((window->flags & SDL_WINDOW_FULLSCREEN) && videodata->SHFullScreen) |
500 videodata->SHFullScreen(hwnd, SHFS_SHOWTASKBAR | SHFS_SHOWSTARTICON | SHFS_SHOWSIPBUTTON); | |
3168 | 501 #endif |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
502 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
503 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
504 void |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
505 WIN_RestoreWindow(_THIS, SDL_Window * window) |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
506 { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
507 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
508 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
509 ShowWindow(hwnd, SW_RESTORE); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
510 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
511 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
512 void |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
513 WIN_SetWindowGrab(_THIS, SDL_Window * window) |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
514 { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
515 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
516 |
2876 | 517 if ((window->flags & (SDL_WINDOW_INPUT_GRABBED | SDL_WINDOW_FULLSCREEN)) |
518 && (window->flags & SDL_WINDOW_INPUT_FOCUS)) { | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
519 RECT rect; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
520 GetClientRect(hwnd, &rect); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
521 ClientToScreen(hwnd, (LPPOINT) & rect); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
522 ClientToScreen(hwnd, (LPPOINT) & rect + 1); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
523 ClipCursor(&rect); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
524 } else { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
525 ClipCursor(NULL); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
526 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
527 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
528 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
529 void |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
530 WIN_DestroyWindow(_THIS, SDL_Window * window) |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
531 { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
532 SDL_WindowData *data = (SDL_WindowData *) window->driverdata; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
533 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
534 if (data) { |
4569 | 535 #ifdef _WIN32_WCE |
536 WINCE_ShowWindow(_this, window, 0); | |
537 #endif | |
1913
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
538 ReleaseDC(data->hwnd, data->hdc); |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
539 if (data->created) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
540 DestroyWindow(data->hwnd); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
541 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
542 SDL_free(data); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
543 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
544 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
545 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
546 SDL_bool |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
547 WIN_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
548 { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
549 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
550 if (info->version.major <= SDL_MAJOR_VERSION) { |
4900
69d9db65f248
Merged the Windows custom window system hooks into the union used by X11.
Sam Lantinga <slouken@libsdl.org>
parents:
4763
diff
changeset
|
551 info->subsystem = SDL_SYSWM_WINDOWS; |
4902
50d0bff24d81
Make the union nameless to reduce the complexity of the API.
Sam Lantinga <slouken@libsdl.org>
parents:
4900
diff
changeset
|
552 info->win.window = hwnd; |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
553 return SDL_TRUE; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
554 } else { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
555 SDL_SetError("Application not compiled with SDL %d.%d\n", |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
556 SDL_MAJOR_VERSION, SDL_MINOR_VERSION); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
557 return SDL_FALSE; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
558 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
559 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
560 |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
561 |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
562 /* |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
563 * Creates a HelperWindow used for DirectInput events. |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
564 */ |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
565 int |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
566 SDL_HelperWindowCreate(void) |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
567 { |
3097
0d12e8f1de3c
Date: Thu, 05 Feb 2009 18:07:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
3057
diff
changeset
|
568 HINSTANCE hInstance = GetModuleHandle(NULL); |
0d12e8f1de3c
Date: Thu, 05 Feb 2009 18:07:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
3057
diff
changeset
|
569 WNDCLASS wce; |
3196
413672b09bb3
Fixed some compile errors and warnings under Visual C++
Sam Lantinga <slouken@libsdl.org>
parents:
3168
diff
changeset
|
570 HWND hWndParent = NULL; |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
571 |
3045
9acb9f0f7f0d
Some more safety around the SDL_HelperWindow stuff to avoid double creations.
Edgar Simo <bobbens@gmail.com>
parents:
2990
diff
changeset
|
572 /* Make sure window isn't created twice. */ |
9acb9f0f7f0d
Some more safety around the SDL_HelperWindow stuff to avoid double creations.
Edgar Simo <bobbens@gmail.com>
parents:
2990
diff
changeset
|
573 if (SDL_HelperWindow != NULL) { |
9acb9f0f7f0d
Some more safety around the SDL_HelperWindow stuff to avoid double creations.
Edgar Simo <bobbens@gmail.com>
parents:
2990
diff
changeset
|
574 return 0; |
9acb9f0f7f0d
Some more safety around the SDL_HelperWindow stuff to avoid double creations.
Edgar Simo <bobbens@gmail.com>
parents:
2990
diff
changeset
|
575 } |
9acb9f0f7f0d
Some more safety around the SDL_HelperWindow stuff to avoid double creations.
Edgar Simo <bobbens@gmail.com>
parents:
2990
diff
changeset
|
576 |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
577 /* Create the class. */ |
2714
1d1be6137875
Merged last minute fixes from force feedback branch (r4031, r4033, r4034)
Sam Lantinga <slouken@libsdl.org>
parents:
2713
diff
changeset
|
578 SDL_zero(wce); |
3097
0d12e8f1de3c
Date: Thu, 05 Feb 2009 18:07:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
3057
diff
changeset
|
579 wce.lpfnWndProc = DefWindowProc; |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
580 wce.lpszClassName = (LPCWSTR) SDL_HelperWindowClassName; |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
581 wce.hInstance = hInstance; |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
582 |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
583 /* Register the class. */ |
3097
0d12e8f1de3c
Date: Thu, 05 Feb 2009 18:07:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
3057
diff
changeset
|
584 SDL_HelperWindowClass = RegisterClass(&wce); |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
585 if (SDL_HelperWindowClass == 0) { |
4500
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
4486
diff
changeset
|
586 WIN_SetError("Unable to create Helper Window Class"); |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
587 return -1; |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
588 } |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
589 |
3168 | 590 #ifndef _WIN32_WCE |
591 /* WinCE doesn't have HWND_MESSAGE */ | |
592 hWndParent = HWND_MESSAGE; | |
593 #endif | |
594 | |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
595 /* Create the window. */ |
2714
1d1be6137875
Merged last minute fixes from force feedback branch (r4031, r4033, r4034)
Sam Lantinga <slouken@libsdl.org>
parents:
2713
diff
changeset
|
596 SDL_HelperWindow = CreateWindowEx(0, SDL_HelperWindowClassName, |
1d1be6137875
Merged last minute fixes from force feedback branch (r4031, r4033, r4034)
Sam Lantinga <slouken@libsdl.org>
parents:
2713
diff
changeset
|
597 SDL_HelperWindowName, |
3168 | 598 WS_OVERLAPPED, CW_USEDEFAULT, |
2714
1d1be6137875
Merged last minute fixes from force feedback branch (r4031, r4033, r4034)
Sam Lantinga <slouken@libsdl.org>
parents:
2713
diff
changeset
|
599 CW_USEDEFAULT, CW_USEDEFAULT, |
3168 | 600 CW_USEDEFAULT, hWndParent, NULL, |
2714
1d1be6137875
Merged last minute fixes from force feedback branch (r4031, r4033, r4034)
Sam Lantinga <slouken@libsdl.org>
parents:
2713
diff
changeset
|
601 hInstance, NULL); |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
602 if (SDL_HelperWindow == NULL) { |
3045
9acb9f0f7f0d
Some more safety around the SDL_HelperWindow stuff to avoid double creations.
Edgar Simo <bobbens@gmail.com>
parents:
2990
diff
changeset
|
603 UnregisterClass(SDL_HelperWindowClassName, hInstance); |
4500
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
4486
diff
changeset
|
604 WIN_SetError("Unable to create Helper Window"); |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
605 return -1; |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
606 } |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
607 |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
608 return 0; |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
609 } |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
610 |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
611 |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
612 /* |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
613 * Destroys the HelperWindow previously created with SDL_HelperWindowCreate. |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
614 */ |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
615 void |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
616 SDL_HelperWindowDestroy(void) |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
617 { |
3097
0d12e8f1de3c
Date: Thu, 05 Feb 2009 18:07:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
3057
diff
changeset
|
618 HINSTANCE hInstance = GetModuleHandle(NULL); |
2863
b632927c28c8
Some error checking when destroying the HelperWindow.
Edgar Simo <bobbens@gmail.com>
parents:
2859
diff
changeset
|
619 |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
620 /* Destroy the window. */ |
2863
b632927c28c8
Some error checking when destroying the HelperWindow.
Edgar Simo <bobbens@gmail.com>
parents:
2859
diff
changeset
|
621 if (SDL_HelperWindow != NULL) { |
b632927c28c8
Some error checking when destroying the HelperWindow.
Edgar Simo <bobbens@gmail.com>
parents:
2859
diff
changeset
|
622 if (DestroyWindow(SDL_HelperWindow) == 0) { |
4500
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
4486
diff
changeset
|
623 WIN_SetError("Unable to destroy Helper Window"); |
2865 | 624 return; |
2863
b632927c28c8
Some error checking when destroying the HelperWindow.
Edgar Simo <bobbens@gmail.com>
parents:
2859
diff
changeset
|
625 } |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
626 SDL_HelperWindow = NULL; |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
627 } |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
628 |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
629 /* Unregister the class. */ |
2863
b632927c28c8
Some error checking when destroying the HelperWindow.
Edgar Simo <bobbens@gmail.com>
parents:
2859
diff
changeset
|
630 if (SDL_HelperWindowClass != 0) { |
b632927c28c8
Some error checking when destroying the HelperWindow.
Edgar Simo <bobbens@gmail.com>
parents:
2859
diff
changeset
|
631 if ((UnregisterClass(SDL_HelperWindowClassName, hInstance)) == 0) { |
4500
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
4486
diff
changeset
|
632 WIN_SetError("Unable to destroy Helper Window Class"); |
2865 | 633 return; |
2863
b632927c28c8
Some error checking when destroying the HelperWindow.
Edgar Simo <bobbens@gmail.com>
parents:
2859
diff
changeset
|
634 } |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
635 SDL_HelperWindowClass = 0; |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
636 } |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
637 } |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
638 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
639 /* vi: set ts=4 sw=4 expandtab: */ |