Mercurial > sdl-ios-xcode
annotate src/video/win32/SDL_win32window.c @ 3097:0d12e8f1de3c
Date: Thu, 05 Feb 2009 18:07:35 +0100
From: Stefan Klug
Subject: [SDL] SDL 1.3 WinCE backend
as promised, I've started to work on the WinCE backend of SDL 1.3
I've modified the win32 video backend and the gdi renderer, to work
properly in WinCE.
The results till now are great, but there is still some work to do.
Attached are two patches with my changes.
I would be happy if someone could review and propably commit them.
The first one (configure.in.patch) should be straight forward without
any side effects.
The second one does the necessary changes to the win32 backend. I was
really unhappy to start slicing this shiny new backend with
#ifdef/#endif but I saw no other option.
The most problematic issues are:
- WinCe has no GetDIBits, so its practically impossible to fill a
BITMAPINFO with correct values. I therefore removed the bmi member from
the GDI_RenderData in SDL_gdirender.c to prevent usage of a not or not
properly initialized bmi.
- In SDL_win32window.c I exchanged some ASCII function by their general
counterparts, (In CE only the Unicode versions are available). I don't
know if this has a negative effect when running in win32
Cheers
Stefan
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 23 Mar 2009 05:35:21 +0000 |
parents | 089a77aebb7d |
children | 7f684f249ec9 |
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 |
2859 | 3 Copyright (C) 1997-2009 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 */ |
2710
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
22 |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
23 /* we need to define it, so that raw input is included */ |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
24 |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
25 #if (_WIN32_WINNT < 0x0501) |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
26 #undef _WIN32_WINNT |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
27 #define _WIN32_WINNT 0x0501 |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
28 #endif |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
29 |
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 #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
|
31 |
c121d94672cb
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_sysvideo.h" |
2970
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
33 #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
|
34 #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
|
35 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
36 #include "SDL_win32video.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
|
37 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
38 /* 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
|
39 #include "SDL_syswm.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
|
40 |
2710
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
41 extern HCTX *g_hCtx; /* the table of tablet event contexts, each windows has to have it's own tablet context */ |
2767 | 42 static Uint32 highestId = 0; /* the highest id of the tablet context */ |
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
|
43 |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
44 /* 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
|
45 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
|
46 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
|
47 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
|
48 static ATOM SDL_HelperWindowClass = 0; |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
49 |
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
|
50 static int |
1951
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
1913
diff
changeset
|
51 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
|
52 { |
1951
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
1913
diff
changeset
|
53 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
|
54 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
|
55 |
c121d94672cb
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 /* 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
|
57 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
|
58 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
|
59 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
|
60 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
|
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 data->windowID = window->id; |
c121d94672cb
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 data->hwnd = hwnd; |
1913
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
64 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
|
65 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
|
66 data->mouse_pressed = SDL_FALSE; |
1951
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
1913
diff
changeset
|
67 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
|
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 /* 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
|
70 if (!SetProp(hwnd, TEXT("SDL_WindowData"), data)) { |
1913
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
71 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
|
72 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
|
73 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
|
74 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
|
75 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
76 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
77 /* 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
|
78 data->wndproc = (WNDPROC) GetWindowLongPtr(hwnd, GWLP_WNDPROC); |
c121d94672cb
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 if (data->wndproc == 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
|
80 data->wndproc = DefWindowProc; |
c121d94672cb
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 } 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
|
82 SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR) WIN_WindowProc); |
c121d94672cb
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 } |
c121d94672cb
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 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
85 /* 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
|
86 { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
87 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
|
88 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
|
89 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
|
90 if (ClientToScreen(hwnd, &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
|
91 window->x = point.x; |
c121d94672cb
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 window->y = point.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
|
93 } |
c121d94672cb
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 } |
c121d94672cb
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 { |
c121d94672cb
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 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
|
97 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
|
98 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
|
99 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
|
100 } |
c121d94672cb
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 } |
c121d94672cb
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 { |
c121d94672cb
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 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
|
104 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
|
105 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
|
106 } 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
|
107 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
|
108 } |
c121d94672cb
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 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
|
110 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
|
111 } 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
|
112 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
|
113 } |
c121d94672cb
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 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
|
115 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
|
116 } 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
|
117 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
|
118 } |
c121d94672cb
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 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
|
120 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
|
121 } 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
|
122 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
|
123 } |
c121d94672cb
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 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
|
125 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
|
126 } 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
|
127 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
|
128 } |
c121d94672cb
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 (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
|
131 int index = data->videodata->keyboard; |
c121d94672cb
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 window->flags |= SDL_WINDOW_INPUT_FOCUS; |
c121d94672cb
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 SDL_SetKeyboardFocus(index, data->windowID); |
c121d94672cb
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 |
c121d94672cb
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 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
|
136 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
|
137 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
|
138 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
|
139 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
|
140 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
|
141 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
142 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
143 |
c121d94672cb
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 { |
2726
f23ebf1ddac4
Dynamically load wintab32.dll
Sam Lantinga <slouken@libsdl.org>
parents:
2724
diff
changeset
|
152 SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; |
2710
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
153 RAWINPUTDEVICE Rid; |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
154 AXIS TabX, TabY; |
2728
2768bd7281e0
Fixed Visual Studio compilation problems
Sam Lantinga <slouken@libsdl.org>
parents:
2726
diff
changeset
|
155 LOGCONTEXTA lc; |
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
|
156 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
|
157 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
|
158 RECT rect; |
1913
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
159 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
|
160 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
|
161 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
|
162 |
2876 | 163 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
|
164 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
|
165 } 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
|
166 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
|
167 } |
2876 | 168 if ((window->flags & SDL_WINDOW_RESIZABLE) |
169 && !(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
|
170 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
|
171 } |
c121d94672cb
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 |
c121d94672cb
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 /* 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
|
174 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
|
175 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
|
176 } 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
|
177 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
|
178 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
179 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
|
180 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
|
181 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
|
182 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
|
183 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
|
184 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
|
185 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
|
186 |
2876 | 187 if ((window->flags & SDL_WINDOW_FULLSCREEN) |
188 || window->x == SDL_WINDOWPOS_CENTERED) { | |
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
|
189 x = (GetSystemMetrics(SM_CXSCREEN) - w) / 2; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
190 } else if (window->x == SDL_WINDOWPOS_UNDEFINED) { |
c121d94672cb
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 x = CW_USEDEFAULT; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
192 } 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
|
193 x = window->x + 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
|
194 } |
2876 | 195 if ((window->flags & SDL_WINDOW_FULLSCREEN) |
196 || window->y == SDL_WINDOWPOS_CENTERED) { | |
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 y = (GetSystemMetrics(SM_CYSCREEN) - h) / 2; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
198 } else if (window->y == SDL_WINDOWPOS_UNDEFINED) { |
c121d94672cb
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 y = CW_USEDEFAULT; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
200 } 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
|
201 y = window->y + 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
|
202 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
203 |
1956
ba0d62354872
Simplified driver window creation code.
Sam Lantinga <slouken@libsdl.org>
parents:
1952
diff
changeset
|
204 hwnd = |
ba0d62354872
Simplified driver window creation code.
Sam Lantinga <slouken@libsdl.org>
parents:
1952
diff
changeset
|
205 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
|
206 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
|
207 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
|
208 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
|
209 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
|
210 } |
c121d94672cb
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 |
2710
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
212 /* we're configuring the tablet data. See Wintab reference for more info */ |
2728
2768bd7281e0
Fixed Visual Studio compilation problems
Sam Lantinga <slouken@libsdl.org>
parents:
2726
diff
changeset
|
213 if (videodata->wintabDLL |
2768bd7281e0
Fixed Visual Studio compilation problems
Sam Lantinga <slouken@libsdl.org>
parents:
2726
diff
changeset
|
214 && videodata->WTInfoA(WTI_DEFSYSCTX, 0, &lc) != 0) { |
2710
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
215 lc.lcPktData = PACKETDATA; |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
216 lc.lcPktMode = PACKETMODE; |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
217 lc.lcOptions |= CXO_MESSAGES; |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
218 lc.lcOptions |= CXO_SYSTEM; |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
219 lc.lcMoveMask = PACKETDATA; |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
220 lc.lcBtnDnMask = lc.lcBtnUpMask = PACKETDATA; |
2728
2768bd7281e0
Fixed Visual Studio compilation problems
Sam Lantinga <slouken@libsdl.org>
parents:
2726
diff
changeset
|
221 videodata->WTInfoA(WTI_DEVICES, DVC_X, &TabX); |
2768bd7281e0
Fixed Visual Studio compilation problems
Sam Lantinga <slouken@libsdl.org>
parents:
2726
diff
changeset
|
222 videodata->WTInfoA(WTI_DEVICES, DVC_Y, &TabY); |
2710
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
223 lc.lcInOrgX = 0; |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
224 lc.lcInOrgY = 0; |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
225 lc.lcInExtX = TabX.axMax; |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
226 lc.lcInExtY = TabY.axMax; |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
227 lc.lcOutOrgX = 0; |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
228 lc.lcOutOrgY = 0; |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
229 lc.lcOutExtX = GetSystemMetrics(SM_CXSCREEN); |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
230 lc.lcOutExtY = -GetSystemMetrics(SM_CYSCREEN); |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
231 if (window->id > highestId) { |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
232 HCTX *tmp_hctx; |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
233 highestId = window->id; |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
234 tmp_hctx = |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
235 (HCTX *) SDL_realloc(g_hCtx, (highestId + 1) * sizeof(HCTX)); |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
236 if (!tmp_hctx) { |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
237 SDL_OutOfMemory(); |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
238 DestroyWindow(hwnd); |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
239 return -1; |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
240 } |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
241 g_hCtx = tmp_hctx; |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
242 } |
2728
2768bd7281e0
Fixed Visual Studio compilation problems
Sam Lantinga <slouken@libsdl.org>
parents:
2726
diff
changeset
|
243 g_hCtx[window->id] = videodata->WTOpenA(hwnd, &lc, TRUE); |
2710
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
244 } |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
245 |
3097
0d12e8f1de3c
Date: Thu, 05 Feb 2009 18:07:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
3057
diff
changeset
|
246 #ifndef _WIN32_WCE /* has no RawInput */ |
2710
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
247 /* we're telling the window, we want it to report raw input events from mice */ |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
248 Rid.usUsagePage = 0x01; |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
249 Rid.usUsage = 0x02; |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
250 Rid.dwFlags = RIDEV_INPUTSINK; |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
251 Rid.hwndTarget = hwnd; |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
252 RegisterRawInputDevices(&Rid, 1, sizeof(Rid)); |
3097
0d12e8f1de3c
Date: Thu, 05 Feb 2009 18:07:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
3057
diff
changeset
|
253 #endif |
2710
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
254 |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
255 WIN_PumpEvents(_this); |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1956
diff
changeset
|
256 |
1951
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
1913
diff
changeset
|
257 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
|
258 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
|
259 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
|
260 } |
1952
420716272158
Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
1951
diff
changeset
|
261 #ifdef SDL_VIDEO_OPENGL_WGL |
1913
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
262 if (window->flags & SDL_WINDOW_OPENGL) { |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
263 if (WIN_GL_SetupWindow(_this, window) < 0) { |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
264 WIN_DestroyWindow(_this, window); |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
265 return -1; |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
266 } |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
267 } |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
268 #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
|
269 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
|
270 } |
c121d94672cb
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 |
c121d94672cb
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 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
|
273 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
|
274 { |
c121d94672cb
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 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
|
276 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
|
277 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
|
278 |
c121d94672cb
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 /* 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
|
280 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
|
281 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
|
282 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
|
283 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
|
284 } 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
|
285 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
|
286 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
287 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
|
288 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
|
289 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
290 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
|
291 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
|
292 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
293 |
1951
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
1913
diff
changeset
|
294 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
|
295 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
|
296 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
297 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
|
298 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
299 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
300 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
|
301 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
|
302 { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
303 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
|
304 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
|
305 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
306 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
|
307 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
|
308 } 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
|
309 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
|
310 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
311 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
|
312 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
|
313 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
|
314 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
315 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
316 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
317 void |
2970
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
318 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
|
319 { |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
320 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
321 HICON hicon = NULL; |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
322 |
2990 | 323 if (icon) { |
2970
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
324 BYTE *icon_bmp; |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
325 int icon_len; |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
326 SDL_RWops *dst; |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
327 SDL_PixelFormat format; |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
328 SDL_Surface *surface; |
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 /* Create temporary bitmap buffer */ |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
331 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
|
332 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
|
333 dst = SDL_RWFromMem(icon_bmp, icon_len); |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
334 if (!dst) { |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
335 SDL_stack_free(icon_bmp); |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
336 return; |
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 |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
339 /* Write the BITMAPINFO header */ |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
340 SDL_WriteLE32(dst, 40); |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
341 SDL_WriteLE32(dst, icon->w); |
2990 | 342 SDL_WriteLE32(dst, icon->h * 2); |
2970
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
343 SDL_WriteLE16(dst, 1); |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
344 SDL_WriteLE16(dst, 32); |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
345 SDL_WriteLE32(dst, BI_RGB); |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
346 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
|
347 SDL_WriteLE32(dst, 0); |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
348 SDL_WriteLE32(dst, 0); |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
349 SDL_WriteLE32(dst, 0); |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
350 SDL_WriteLE32(dst, 0); |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
351 |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
352 /* 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
|
353 SDL_InitFormat(&format, 32, |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
354 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000); |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
355 surface = SDL_ConvertSurface(icon, &format, 0); |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
356 if (surface) { |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
357 /* 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
|
358 int y = surface->h; |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
359 while (y--) { |
2990 | 360 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
|
361 SDL_RWwrite(dst, src, surface->pitch, 1); |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
362 } |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
363 SDL_FreeSurface(surface); |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
364 |
3097
0d12e8f1de3c
Date: Thu, 05 Feb 2009 18:07:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
3057
diff
changeset
|
365 /* 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
|
366 #ifndef _WIN32_WCE |
2990 | 367 hicon = |
368 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
|
369 #endif |
2970
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
370 } |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
371 SDL_RWclose(dst); |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
372 SDL_stack_free(icon_bmp); |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
373 } |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
374 |
2971
a3012c6652ff
Should we also set the icon in the task manager?
Sam Lantinga <slouken@libsdl.org>
parents:
2970
diff
changeset
|
375 /* Set the icon for the window */ |
2990 | 376 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
|
377 |
a3012c6652ff
Should we also set the icon in the task manager?
Sam Lantinga <slouken@libsdl.org>
parents:
2970
diff
changeset
|
378 /* Set the icon in the task manager (should we do this?) */ |
2990 | 379 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
|
380 } |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
381 |
94b634c56455
Added support for translucent icons on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
2968
diff
changeset
|
382 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
|
383 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
|
384 { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
385 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
|
386 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
|
387 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
|
388 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
|
389 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
|
390 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
391 /* 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
|
392 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
|
393 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
|
394 } 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
|
395 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
|
396 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
397 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
|
398 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
|
399 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
|
400 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
|
401 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
|
402 AdjustWindowRectEx(&rect, 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
|
403 (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(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
|
404 NULL), 0); |
2875
91a7e08cd238
* Implemented X11 fullscreen input grab
Sam Lantinga <slouken@libsdl.org>
parents:
2865
diff
changeset
|
405 |
2876 | 406 if ((window->flags & SDL_WINDOW_FULLSCREEN) |
407 || window->x == SDL_WINDOWPOS_CENTERED) { | |
2875
91a7e08cd238
* Implemented X11 fullscreen input grab
Sam Lantinga <slouken@libsdl.org>
parents:
2865
diff
changeset
|
408 x = (GetSystemMetrics(SM_CXSCREEN) - window->w) / 2; |
91a7e08cd238
* Implemented X11 fullscreen input grab
Sam Lantinga <slouken@libsdl.org>
parents:
2865
diff
changeset
|
409 } else { |
91a7e08cd238
* Implemented X11 fullscreen input grab
Sam Lantinga <slouken@libsdl.org>
parents:
2865
diff
changeset
|
410 x = window->x + rect.left; |
91a7e08cd238
* Implemented X11 fullscreen input grab
Sam Lantinga <slouken@libsdl.org>
parents:
2865
diff
changeset
|
411 } |
2876 | 412 if ((window->flags & SDL_WINDOW_FULLSCREEN) |
413 || window->y == SDL_WINDOWPOS_CENTERED) { | |
2875
91a7e08cd238
* Implemented X11 fullscreen input grab
Sam Lantinga <slouken@libsdl.org>
parents:
2865
diff
changeset
|
414 y = (GetSystemMetrics(SM_CYSCREEN) - window->h) / 2; |
91a7e08cd238
* Implemented X11 fullscreen input grab
Sam Lantinga <slouken@libsdl.org>
parents:
2865
diff
changeset
|
415 } else { |
91a7e08cd238
* Implemented X11 fullscreen input grab
Sam Lantinga <slouken@libsdl.org>
parents:
2865
diff
changeset
|
416 y = window->y + rect.top; |
91a7e08cd238
* Implemented X11 fullscreen input grab
Sam Lantinga <slouken@libsdl.org>
parents:
2865
diff
changeset
|
417 } |
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
|
418 |
1956
ba0d62354872
Simplified driver window creation code.
Sam Lantinga <slouken@libsdl.org>
parents:
1952
diff
changeset
|
419 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
|
420 } |
c121d94672cb
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 |
c121d94672cb
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 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
|
423 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
|
424 { |
c121d94672cb
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 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
|
426 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
|
427 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
|
428 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
|
429 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
|
430 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
431 /* 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
|
432 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
|
433 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
|
434 } 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
|
435 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
|
436 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
437 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
|
438 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
|
439 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
|
440 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
|
441 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
|
442 AdjustWindowRectEx(&rect, 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
|
443 (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(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
|
444 NULL), 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
|
445 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
|
446 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
|
447 |
2968
efe4d0ce2e97
Date: Fri, 02 Jan 2009 23:22:39 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2876
diff
changeset
|
448 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
|
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_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
|
453 { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
454 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
|
455 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
456 ShowWindow(hwnd, SW_SHOW); |
c121d94672cb
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 } |
c121d94672cb
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 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
459 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
|
460 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
|
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 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
|
463 |
c121d94672cb
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 ShowWindow(hwnd, SW_HIDE); |
c121d94672cb
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 } |
c121d94672cb
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 |
c121d94672cb
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 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
|
468 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
|
469 { |
c121d94672cb
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 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
|
471 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
|
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 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
|
474 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
|
475 } 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
|
476 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
|
477 } |
c121d94672cb
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 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
|
479 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
480 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
481 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
|
482 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
|
483 { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
484 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
|
485 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
486 ShowWindow(hwnd, SW_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
|
487 } |
c121d94672cb
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 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
|
490 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
|
491 { |
c121d94672cb
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 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
|
493 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
494 ShowWindow(hwnd, SW_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
|
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 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
497 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
|
498 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
|
499 { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
500 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
|
501 |
c121d94672cb
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 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
|
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 |
c121d94672cb
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 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
|
506 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
|
507 { |
c121d94672cb
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 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
|
509 |
2876 | 510 if ((window->flags & (SDL_WINDOW_INPUT_GRABBED | SDL_WINDOW_FULLSCREEN)) |
511 && (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
|
512 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
|
513 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
|
514 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
|
515 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
|
516 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
|
517 } 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
|
518 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
|
519 } |
c121d94672cb
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 } |
c121d94672cb
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 |
c121d94672cb
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 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
|
523 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
|
524 { |
2726
f23ebf1ddac4
Dynamically load wintab32.dll
Sam Lantinga <slouken@libsdl.org>
parents:
2724
diff
changeset
|
525 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
|
526 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
|
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 if (data) { |
1913
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
529 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
|
530 if (data->created) { |
2726
f23ebf1ddac4
Dynamically load wintab32.dll
Sam Lantinga <slouken@libsdl.org>
parents:
2724
diff
changeset
|
531 if (videodata->wintabDLL) { |
f23ebf1ddac4
Dynamically load wintab32.dll
Sam Lantinga <slouken@libsdl.org>
parents:
2724
diff
changeset
|
532 videodata->WTClose(g_hCtx[window->id]); |
f23ebf1ddac4
Dynamically load wintab32.dll
Sam Lantinga <slouken@libsdl.org>
parents:
2724
diff
changeset
|
533 } |
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
|
534 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
|
535 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
536 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
|
537 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
538 } |
c121d94672cb
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 |
c121d94672cb
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 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
|
541 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
|
542 { |
c121d94672cb
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 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
|
544 if (info->version.major <= SDL_MAJOR_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
|
545 info->window = 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
|
546 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
|
547 } 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
|
548 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
|
549 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
|
550 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
|
551 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
552 } |
c121d94672cb
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 |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
554 |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
555 /* |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
556 * 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
|
557 */ |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
558 int |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
559 SDL_HelperWindowCreate(void) |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
560 { |
3097
0d12e8f1de3c
Date: Thu, 05 Feb 2009 18:07:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
3057
diff
changeset
|
561 HINSTANCE hInstance = GetModuleHandle(NULL); |
0d12e8f1de3c
Date: Thu, 05 Feb 2009 18:07:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
3057
diff
changeset
|
562 WNDCLASS wce; |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
563 |
3045
9acb9f0f7f0d
Some more safety around the SDL_HelperWindow stuff to avoid double creations.
Edgar Simo <bobbens@gmail.com>
parents:
2990
diff
changeset
|
564 /* 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
|
565 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
|
566 return 0; |
9acb9f0f7f0d
Some more safety around the SDL_HelperWindow stuff to avoid double creations.
Edgar Simo <bobbens@gmail.com>
parents:
2990
diff
changeset
|
567 } |
9acb9f0f7f0d
Some more safety around the SDL_HelperWindow stuff to avoid double creations.
Edgar Simo <bobbens@gmail.com>
parents:
2990
diff
changeset
|
568 |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
569 /* 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
|
570 SDL_zero(wce); |
3097
0d12e8f1de3c
Date: Thu, 05 Feb 2009 18:07:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
3057
diff
changeset
|
571 wce.lpfnWndProc = DefWindowProc; |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
572 wce.lpszClassName = (LPCWSTR) SDL_HelperWindowClassName; |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
573 wce.hInstance = hInstance; |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
574 |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
575 /* Register the class. */ |
3097
0d12e8f1de3c
Date: Thu, 05 Feb 2009 18:07:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
3057
diff
changeset
|
576 SDL_HelperWindowClass = RegisterClass(&wce); |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
577 if (SDL_HelperWindowClass == 0) { |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
578 SDL_SetError("Unable to create Helper Window Class: error %d.", |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
579 GetLastError()); |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
580 return -1; |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
581 } |
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 /* 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
|
584 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
|
585 SDL_HelperWindowName, |
1d1be6137875
Merged last minute fixes from force feedback branch (r4031, r4033, r4034)
Sam Lantinga <slouken@libsdl.org>
parents:
2713
diff
changeset
|
586 WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, |
1d1be6137875
Merged last minute fixes from force feedback branch (r4031, r4033, r4034)
Sam Lantinga <slouken@libsdl.org>
parents:
2713
diff
changeset
|
587 CW_USEDEFAULT, CW_USEDEFAULT, |
1d1be6137875
Merged last minute fixes from force feedback branch (r4031, r4033, r4034)
Sam Lantinga <slouken@libsdl.org>
parents:
2713
diff
changeset
|
588 CW_USEDEFAULT, HWND_MESSAGE, NULL, |
1d1be6137875
Merged last minute fixes from force feedback branch (r4031, r4033, r4034)
Sam Lantinga <slouken@libsdl.org>
parents:
2713
diff
changeset
|
589 hInstance, NULL); |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
590 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
|
591 UnregisterClass(SDL_HelperWindowClassName, hInstance); |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
592 SDL_SetError("Unable to create Helper Window: error %d.", |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
593 GetLastError()); |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
594 return -1; |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
595 } |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
596 |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
597 return 0; |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
598 } |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
599 |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
600 |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
601 /* |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
602 * 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
|
603 */ |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
604 void |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
605 SDL_HelperWindowDestroy(void) |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
606 { |
3097
0d12e8f1de3c
Date: Thu, 05 Feb 2009 18:07:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
3057
diff
changeset
|
607 HINSTANCE hInstance = GetModuleHandle(NULL); |
2863
b632927c28c8
Some error checking when destroying the HelperWindow.
Edgar Simo <bobbens@gmail.com>
parents:
2859
diff
changeset
|
608 |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
609 /* Destroy the window. */ |
2863
b632927c28c8
Some error checking when destroying the HelperWindow.
Edgar Simo <bobbens@gmail.com>
parents:
2859
diff
changeset
|
610 if (SDL_HelperWindow != NULL) { |
b632927c28c8
Some error checking when destroying the HelperWindow.
Edgar Simo <bobbens@gmail.com>
parents:
2859
diff
changeset
|
611 if (DestroyWindow(SDL_HelperWindow) == 0) { |
2865 | 612 SDL_SetError("Unable to destroy Helper Window: error %d.", |
613 GetLastError()); | |
614 return; | |
2863
b632927c28c8
Some error checking when destroying the HelperWindow.
Edgar Simo <bobbens@gmail.com>
parents:
2859
diff
changeset
|
615 } |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
616 SDL_HelperWindow = NULL; |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
617 } |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
618 |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
619 /* Unregister the class. */ |
2863
b632927c28c8
Some error checking when destroying the HelperWindow.
Edgar Simo <bobbens@gmail.com>
parents:
2859
diff
changeset
|
620 if (SDL_HelperWindowClass != 0) { |
b632927c28c8
Some error checking when destroying the HelperWindow.
Edgar Simo <bobbens@gmail.com>
parents:
2859
diff
changeset
|
621 if ((UnregisterClass(SDL_HelperWindowClassName, hInstance)) == 0) { |
2865 | 622 SDL_SetError("Unable to destroy Helper Window Class: error %d.", |
623 GetLastError()); | |
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_HelperWindowClass = 0; |
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 |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2710
diff
changeset
|
630 |
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
|
631 /* vi: set ts=4 sw=4 expandtab: */ |