annotate src/video/win32/SDL_win32events.c @ 1734:f7c667ded87d SDL-1.3

The general code handles restoring video mode/gamma/etc. when the window loses focus. Support for changing fullscreen/windowed mode in progress.
author Sam Lantinga <slouken@libsdl.org>
date Sun, 09 Jul 2006 18:09:16 +0000
parents 0b1070f2f94d
children
rev   line source
1712
931d111e737a Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1 /*
931d111e737a Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
931d111e737a Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
3 Copyright (C) 1997-2006 Sam Lantinga
931d111e737a Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
4
931d111e737a Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
931d111e737a Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
6 modify it under the terms of the GNU Lesser General Public
931d111e737a Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
931d111e737a Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
931d111e737a Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
9
931d111e737a Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
931d111e737a Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
931d111e737a Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
931d111e737a Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
13 Lesser General Public License for more details.
931d111e737a Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
14
931d111e737a Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
15 You should have received a copy of the GNU Lesser General Public
931d111e737a Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
16 License along with this library; if not, write to the Free Software
931d111e737a Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
931d111e737a Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
18
931d111e737a Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
19 Sam Lantinga
931d111e737a Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
20 slouken@libsdl.org
931d111e737a Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
21 */
931d111e737a Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
22 #include "SDL_config.h"
931d111e737a Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
23
931d111e737a Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
24 #include "SDL_win32video.h"
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
25 #include "SDL_version.h"
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
26 #include "SDL_syswm.h"
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
27 #include "SDL_vkeys.h"
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
28 #include "../../events/SDL_events_c.h"
1712
931d111e737a Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
29
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
30 /*#define WMMSG_DEBUG*/
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
31 #ifdef WMMSG_DEBUG
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
32 #include "wmmsg.h"
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
33 #endif
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
34
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
35 /* Masks for processing the windows KEYDOWN and KEYUP messages */
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
36 #define REPEATED_KEYMASK (1<<30)
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
37 #define EXTENDED_KEYMASK (1<<24)
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
38
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
39
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
40 static SDLKey
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
41 TranslateKey(WPARAM vkey)
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
42 {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
43 SDLKey key;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
44
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
45 /* FIXME: Assign vkey directly to key if in ASCII range */
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
46 switch (vkey) {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
47 case VK_BACK:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
48 key = SDLK_BACKSPACE;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
49 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
50 case VK_TAB:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
51 key = SDLK_TAB;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
52 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
53 case VK_CLEAR:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
54 key = SDLK_CLEAR;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
55 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
56 case VK_RETURN:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
57 key = SDLK_RETURN;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
58 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
59 case VK_PAUSE:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
60 key = SDLK_PAUSE;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
61 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
62 case VK_ESCAPE:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
63 key = SDLK_ESCAPE;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
64 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
65 case VK_SPACE:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
66 key = SDLK_SPACE;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
67 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
68 case VK_APOSTROPHE:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
69 key = SDLK_QUOTE;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
70 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
71 case VK_COMMA:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
72 key = SDLK_COMMA;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
73 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
74 case VK_MINUS:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
75 key = SDLK_MINUS;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
76 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
77 case VK_PERIOD:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
78 key = SDLK_PERIOD;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
79 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
80 case VK_SLASH:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
81 key = SDLK_SLASH;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
82 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
83 case VK_0:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
84 key = SDLK_0;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
85 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
86 case VK_1:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
87 key = SDLK_1;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
88 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
89 case VK_2:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
90 key = SDLK_2;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
91 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
92 case VK_3:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
93 key = SDLK_3;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
94 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
95 case VK_4:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
96 key = SDLK_4;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
97 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
98 case VK_5:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
99 key = SDLK_5;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
100 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
101 case VK_6:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
102 key = SDLK_6;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
103 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
104 case VK_7:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
105 key = SDLK_7;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
106 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
107 case VK_8:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
108 key = SDLK_8;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
109 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
110 case VK_9:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
111 key = SDLK_9;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
112 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
113 case VK_SEMICOLON:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
114 key = SDLK_SEMICOLON;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
115 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
116 case VK_EQUALS:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
117 key = SDLK_EQUALS;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
118 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
119 case VK_LBRACKET:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
120 key = SDLK_LEFTBRACKET;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
121 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
122 case VK_BACKSLASH:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
123 key = SDLK_BACKSLASH;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
124 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
125 case VK_OEM_102:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
126 key = SDLK_LESS;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
127 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
128 case VK_RBRACKET:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
129 key = SDLK_RIGHTBRACKET;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
130 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
131 case VK_GRAVE:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
132 key = SDLK_BACKQUOTE;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
133 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
134 case VK_BACKTICK:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
135 key = SDLK_BACKQUOTE;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
136 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
137 case VK_A:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
138 key = SDLK_a;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
139 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
140 case VK_B:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
141 key = SDLK_b;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
142 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
143 case VK_C:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
144 key = SDLK_c;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
145 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
146 case VK_D:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
147 key = SDLK_d;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
148 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
149 case VK_E:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
150 key = SDLK_e;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
151 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
152 case VK_F:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
153 key = SDLK_f;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
154 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
155 case VK_G:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
156 key = SDLK_g;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
157 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
158 case VK_H:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
159 key = SDLK_h;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
160 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
161 case VK_I:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
162 key = SDLK_i;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
163 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
164 case VK_J:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
165 key = SDLK_j;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
166 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
167 case VK_K:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
168 key = SDLK_k;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
169 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
170 case VK_L:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
171 key = SDLK_l;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
172 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
173 case VK_M:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
174 key = SDLK_m;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
175 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
176 case VK_N:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
177 key = SDLK_n;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
178 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
179 case VK_O:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
180 key = SDLK_o;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
181 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
182 case VK_P:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
183 key = SDLK_p;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
184 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
185 case VK_Q:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
186 key = SDLK_q;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
187 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
188 case VK_R:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
189 key = SDLK_r;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
190 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
191 case VK_S:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
192 key = SDLK_s;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
193 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
194 case VK_T:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
195 key = SDLK_t;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
196 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
197 case VK_U:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
198 key = SDLK_u;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
199 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
200 case VK_V:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
201 key = SDLK_v;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
202 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
203 case VK_W:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
204 key = SDLK_w;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
205 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
206 case VK_X:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
207 key = SDLK_x;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
208 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
209 case VK_Y:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
210 key = SDLK_y;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
211 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
212 case VK_Z:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
213 key = SDLK_z;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
214 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
215 case VK_DELETE:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
216 key = SDLK_DELETE;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
217 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
218 case VK_NUMPAD0:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
219 key = SDLK_KP0;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
220 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
221 case VK_NUMPAD1:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
222 key = SDLK_KP1;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
223 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
224 case VK_NUMPAD2:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
225 key = SDLK_KP2;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
226 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
227 case VK_NUMPAD3:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
228 key = SDLK_KP3;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
229 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
230 case VK_NUMPAD4:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
231 key = SDLK_KP4;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
232 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
233 case VK_NUMPAD5:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
234 key = SDLK_KP5;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
235 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
236 case VK_NUMPAD6:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
237 key = SDLK_KP6;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
238 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
239 case VK_NUMPAD7:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
240 key = SDLK_KP7;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
241 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
242 case VK_NUMPAD8:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
243 key = SDLK_KP8;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
244 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
245 case VK_NUMPAD9:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
246 key = SDLK_KP9;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
247 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
248 case VK_DECIMAL:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
249 key = SDLK_KP_PERIOD;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
250 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
251 case VK_DIVIDE:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
252 key = SDLK_KP_DIVIDE;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
253 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
254 case VK_MULTIPLY:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
255 key = SDLK_KP_MULTIPLY;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
256 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
257 case VK_SUBTRACT:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
258 key = SDLK_KP_MINUS;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
259 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
260 case VK_ADD:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
261 key = SDLK_KP_PLUS;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
262 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
263 case VK_UP:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
264 key = SDLK_UP;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
265 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
266 case VK_DOWN:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
267 key = SDLK_DOWN;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
268 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
269 case VK_RIGHT:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
270 key = SDLK_RIGHT;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
271 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
272 case VK_LEFT:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
273 key = SDLK_LEFT;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
274 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
275 case VK_INSERT:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
276 key = SDLK_INSERT;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
277 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
278 case VK_HOME:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
279 key = SDLK_HOME;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
280 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
281 case VK_END:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
282 key = SDLK_END;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
283 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
284 case VK_PRIOR:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
285 key = SDLK_PAGEUP;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
286 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
287 case VK_NEXT:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
288 key = SDLK_PAGEDOWN;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
289 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
290 case VK_F1:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
291 key = SDLK_F1;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
292 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
293 case VK_F2:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
294 key = SDLK_F2;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
295 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
296 case VK_F3:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
297 key = SDLK_F3;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
298 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
299 case VK_F4:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
300 key = SDLK_F4;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
301 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
302 case VK_F5:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
303 key = SDLK_F5;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
304 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
305 case VK_F6:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
306 key = SDLK_F6;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
307 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
308 case VK_F7:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
309 key = SDLK_F7;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
310 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
311 case VK_F8:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
312 key = SDLK_F8;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
313 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
314 case VK_F9:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
315 key = SDLK_F9;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
316 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
317 case VK_F10:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
318 key = SDLK_F10;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
319 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
320 case VK_F11:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
321 key = SDLK_F11;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
322 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
323 case VK_F12:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
324 key = SDLK_F12;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
325 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
326 case VK_F13:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
327 key = SDLK_F13;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
328 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
329 case VK_F14:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
330 key = SDLK_F14;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
331 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
332 case VK_F15:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
333 key = SDLK_F15;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
334 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
335 case VK_NUMLOCK:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
336 key = SDLK_NUMLOCK;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
337 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
338 case VK_CAPITAL:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
339 key = SDLK_CAPSLOCK;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
340 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
341 case VK_SCROLL:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
342 key = SDLK_SCROLLOCK;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
343 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
344 case VK_RSHIFT:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
345 key = SDLK_RSHIFT;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
346 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
347 case VK_LSHIFT:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
348 key = SDLK_LSHIFT;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
349 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
350 case VK_RCONTROL:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
351 key = SDLK_RCTRL;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
352 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
353 case VK_LCONTROL:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
354 key = SDLK_LCTRL;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
355 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
356 case VK_RMENU:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
357 key = SDLK_RALT;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
358 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
359 case VK_LMENU:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
360 key = SDLK_LALT;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
361 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
362 case VK_RWIN:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
363 key = SDLK_RSUPER;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
364 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
365 case VK_LWIN:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
366 key = SDLK_LSUPER;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
367 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
368 case VK_HELP:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
369 key = SDLK_HELP;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
370 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
371 case VK_PRINT:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
372 key = SDLK_PRINT;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
373 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
374 case VK_SNAPSHOT:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
375 key = SDLK_PRINT;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
376 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
377 case VK_CANCEL:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
378 key = SDLK_BREAK;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
379 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
380 case VK_APPS:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
381 key = SDLK_MENU;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
382 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
383 default:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
384 key = SDLK_UNKNOWN;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
385 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
386 }
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
387 return key;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
388 }
1718
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
389
1719
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
390 LRESULT CALLBACK
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
391 WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
1718
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
392 {
1719
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
393 SDL_WindowData *data;
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
394
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
395 /* Get the window data for the window */
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
396 data = (SDL_WindowData *) GetProp(hwnd, TEXT("SDL_WindowData"));
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
397 if (!data) {
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
398 return CallWindowProc(DefWindowProc, hwnd, msg, wParam, lParam);
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
399 }
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
400 #ifdef WMMSG_DEBUG
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
401 fprintf(stderr, "Received windows message: ");
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
402 if (msg > MAX_WMMSG) {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
403 fprintf(stderr, "%d", msg);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
404 } else {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
405 fprintf(stderr, "%s", wmtab[msg]);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
406 }
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
407 fprintf(stderr, " -- 0x%X, 0x%X\n", wParam, lParam);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
408 #endif
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
409
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
410 /* Send a SDL_SYSWMEVENT if the application wants them */
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
411 if (SDL_ProcessEvents[SDL_SYSWMEVENT] == SDL_ENABLE) {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
412 SDL_SysWMmsg wmmsg;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
413
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
414 SDL_VERSION(&wmmsg.version);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
415 wmmsg.hwnd = hwnd;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
416 wmmsg.msg = msg;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
417 wmmsg.wParam = wParam;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
418 wmmsg.lParam = lParam;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
419 SDL_SendSysWMEvent(&wmmsg);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
420 }
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
421
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
422 switch (msg) {
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
423
1733
0b1070f2f94d Implemented gamma correction on Windows.
Sam Lantinga <slouken@libsdl.org>
parents: 1732
diff changeset
424 case WM_SHOWWINDOW:
0b1070f2f94d Implemented gamma correction on Windows.
Sam Lantinga <slouken@libsdl.org>
parents: 1732
diff changeset
425 {
0b1070f2f94d Implemented gamma correction on Windows.
Sam Lantinga <slouken@libsdl.org>
parents: 1732
diff changeset
426 if (wParam) {
0b1070f2f94d Implemented gamma correction on Windows.
Sam Lantinga <slouken@libsdl.org>
parents: 1732
diff changeset
427 SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_SHOWN, 0,
0b1070f2f94d Implemented gamma correction on Windows.
Sam Lantinga <slouken@libsdl.org>
parents: 1732
diff changeset
428 0);
0b1070f2f94d Implemented gamma correction on Windows.
Sam Lantinga <slouken@libsdl.org>
parents: 1732
diff changeset
429 } else {
0b1070f2f94d Implemented gamma correction on Windows.
Sam Lantinga <slouken@libsdl.org>
parents: 1732
diff changeset
430 SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_HIDDEN, 0,
0b1070f2f94d Implemented gamma correction on Windows.
Sam Lantinga <slouken@libsdl.org>
parents: 1732
diff changeset
431 0);
0b1070f2f94d Implemented gamma correction on Windows.
Sam Lantinga <slouken@libsdl.org>
parents: 1732
diff changeset
432 }
0b1070f2f94d Implemented gamma correction on Windows.
Sam Lantinga <slouken@libsdl.org>
parents: 1732
diff changeset
433 }
0b1070f2f94d Implemented gamma correction on Windows.
Sam Lantinga <slouken@libsdl.org>
parents: 1732
diff changeset
434 break;
0b1070f2f94d Implemented gamma correction on Windows.
Sam Lantinga <slouken@libsdl.org>
parents: 1732
diff changeset
435
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
436 case WM_ACTIVATE:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
437 {
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
438 int index;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
439 SDL_Keyboard *keyboard;
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
440 BOOL minimized;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
441
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
442 minimized = HIWORD(wParam);
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
443 index = data->videodata->keyboard;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
444 keyboard = SDL_GetKeyboard(index);
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
445 if (!minimized && (LOWORD(wParam) != WA_INACTIVE)) {
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
446 SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_SHOWN,
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
447 0, 0);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
448 SDL_SendWindowEvent(data->windowID,
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
449 SDL_WINDOWEVENT_RESTORED, 0, 0);
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
450 if (IsZoomed(hwnd)) {
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
451 SDL_SendWindowEvent(data->windowID,
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
452 SDL_WINDOWEVENT_MAXIMIZED, 0, 0);
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
453 }
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
454 if (keyboard && keyboard->focus != data->windowID) {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
455 SDL_SetKeyboardFocus(index, data->windowID);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
456 }
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
457 /* FIXME: Update keyboard state */
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
458 } else {
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
459 if (keyboard && keyboard->focus == data->windowID) {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
460 SDL_SetKeyboardFocus(index, 0);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
461 }
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
462 if (minimized) {
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
463 SDL_SendWindowEvent(data->windowID,
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
464 SDL_WINDOWEVENT_MINIMIZED, 0, 0);
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
465 }
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
466 }
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
467 return (0);
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
468 }
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
469 break;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
470
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
471 case WM_MOUSEMOVE:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
472 {
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
473 int index;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
474 SDL_Mouse *mouse;
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
475 int x, y;
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
476
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
477 index = data->videodata->mouse;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
478 mouse = SDL_GetMouse(index);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
479
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
480 if (mouse->focus != data->windowID) {
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
481 TRACKMOUSEEVENT tme;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
482
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
483 tme.cbSize = sizeof(tme);
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
484 tme.dwFlags = TME_LEAVE;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
485 tme.hwndTrack = hwnd;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
486 TrackMouseEvent(&tme);
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
487
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
488 SDL_SetMouseFocus(index, data->windowID);
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
489 }
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
490
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
491 /* mouse has moved within the window */
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
492 x = LOWORD(lParam);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
493 y = HIWORD(lParam);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
494 if (mouse->relative_mode) {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
495 int w, h;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
496 POINT center;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
497 SDL_GetWindowSize(data->windowID, &w, &h);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
498 center.x = (w / 2);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
499 center.y = (h / 2);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
500 x -= center.x;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
501 y -= center.y;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
502 if (x || y) {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
503 ClientToScreen(hwnd, &center);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
504 SetCursorPos(center.x, center.y);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
505 SDL_SendMouseMotion(index, 1, x, y);
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
506 }
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
507 } else {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
508 SDL_SendMouseMotion(index, 0, x, y);
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
509 }
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
510 }
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
511 return (0);
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
512
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
513 case WM_MOUSELEAVE:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
514 {
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
515 int index;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
516 SDL_Mouse *mouse;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
517
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
518 index = data->videodata->mouse;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
519 mouse = SDL_GetMouse(index);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
520
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
521 if (mouse->focus == data->windowID) {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
522 SDL_SetMouseFocus(index, 0);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
523 }
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
524 }
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
525 return (0);
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
526
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
527 case WM_LBUTTONDOWN:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
528 case WM_LBUTTONUP:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
529 case WM_MBUTTONDOWN:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
530 case WM_MBUTTONUP:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
531 case WM_RBUTTONDOWN:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
532 case WM_RBUTTONUP:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
533 {
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
534 int index;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
535 SDL_Mouse *mouse;
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
536 Uint8 button, state;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
537
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
538 /* DJM:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
539 We want the SDL window to take focus so that
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
540 it acts like a normal windows "component"
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
541 (e.g. gains keyboard focus on a mouse click).
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
542 */
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
543 SetFocus(hwnd);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
544
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
545 index = data->videodata->mouse;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
546 mouse = SDL_GetMouse(index);
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
547
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
548 /* Figure out which button to use */
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
549 switch (msg) {
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
550 case WM_LBUTTONDOWN:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
551 button = SDL_BUTTON_LEFT;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
552 state = SDL_PRESSED;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
553 break;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
554 case WM_LBUTTONUP:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
555 button = SDL_BUTTON_LEFT;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
556 state = SDL_RELEASED;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
557 break;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
558 case WM_MBUTTONDOWN:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
559 button = SDL_BUTTON_MIDDLE;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
560 state = SDL_PRESSED;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
561 break;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
562 case WM_MBUTTONUP:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
563 button = SDL_BUTTON_MIDDLE;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
564 state = SDL_RELEASED;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
565 break;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
566 case WM_RBUTTONDOWN:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
567 button = SDL_BUTTON_RIGHT;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
568 state = SDL_PRESSED;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
569 break;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
570 case WM_RBUTTONUP:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
571 button = SDL_BUTTON_RIGHT;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
572 state = SDL_RELEASED;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
573 break;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
574 default:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
575 /* Eh? Unknown button? */
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
576 return (0);
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
577 }
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
578 if (state == SDL_PRESSED) {
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
579 /* Grab mouse so we get up events */
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
580 if (++data->mouse_pressed > 0) {
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
581 SetCapture(hwnd);
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
582 }
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
583 } else {
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
584 /* Release mouse after all up events */
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
585 if (--data->mouse_pressed <= 0) {
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
586 ReleaseCapture();
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
587 data->mouse_pressed = 0;
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
588 }
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
589 }
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
590
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
591 if (!mouse->relative_mode) {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
592 int x, y;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
593 x = LOWORD(lParam);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
594 y = HIWORD(lParam);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
595 SDL_SendMouseMotion(index, 0, x, y);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
596 }
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
597 SDL_SendMouseButton(index, state, button);
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
598 }
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
599 return (0);
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
600
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
601 case WM_MOUSEWHEEL:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
602 {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
603 int index;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
604 int motion = (short) HIWORD(wParam);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
605
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
606 index = data->videodata->mouse;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
607 SDL_SendMouseWheel(index, motion);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
608 }
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
609 return (0);
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
610
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
611 case WM_SYSKEYDOWN:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
612 case WM_KEYDOWN:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
613 {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
614 int index;
1719
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
615
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
616 /* Ignore repeated keys */
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
617 if (lParam & REPEATED_KEYMASK) {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
618 return (0);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
619 }
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
620
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
621 index = data->videodata->keyboard;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
622 switch (wParam) {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
623 case VK_CONTROL:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
624 if (lParam & EXTENDED_KEYMASK)
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
625 wParam = VK_RCONTROL;
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
626 else
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
627 wParam = VK_LCONTROL;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
628 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
629 case VK_SHIFT:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
630 /* EXTENDED trick doesn't work here */
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
631 {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
632 Uint8 *state = SDL_GetKeyState(NULL);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
633 if (state[SDLK_LSHIFT] == SDL_RELEASED
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
634 && (GetKeyState(VK_LSHIFT) & 0x8000)) {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
635 wParam = VK_LSHIFT;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
636 } else if (state[SDLK_RSHIFT] == SDL_RELEASED
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
637 && (GetKeyState(VK_RSHIFT) & 0x8000)) {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
638 wParam = VK_RSHIFT;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
639 } else {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
640 /* Probably a key repeat */
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
641 return (0);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
642 }
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
643 }
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
644 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
645 case VK_MENU:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
646 if (lParam & EXTENDED_KEYMASK)
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
647 wParam = VK_RMENU;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
648 else
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
649 wParam = VK_LMENU;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
650 break;
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
651 }
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
652 SDL_SendKeyboardKey(index, SDL_PRESSED, (Uint8) HIWORD(lParam),
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
653 TranslateKey(wParam));
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
654 }
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
655 return (0);
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
656
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
657 case WM_SYSKEYUP:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
658 case WM_KEYUP:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
659 {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
660 int index;
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
661
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
662 index = data->videodata->keyboard;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
663 switch (wParam) {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
664 case VK_CONTROL:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
665 if (lParam & EXTENDED_KEYMASK)
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
666 wParam = VK_RCONTROL;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
667 else
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
668 wParam = VK_LCONTROL;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
669 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
670 case VK_SHIFT:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
671 /* EXTENDED trick doesn't work here */
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
672 {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
673 Uint8 *state = SDL_GetKeyState(NULL);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
674 if (state[SDLK_LSHIFT] == SDL_PRESSED
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
675 && !(GetKeyState(VK_LSHIFT) & 0x8000)) {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
676 wParam = VK_LSHIFT;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
677 } else if (state[SDLK_RSHIFT] == SDL_PRESSED
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
678 && !(GetKeyState(VK_RSHIFT) & 0x8000)) {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
679 wParam = VK_RSHIFT;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
680 } else {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
681 /* Probably a key repeat */
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
682 return (0);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
683 }
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
684 }
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
685 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
686 case VK_MENU:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
687 if (lParam & EXTENDED_KEYMASK)
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
688 wParam = VK_RMENU;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
689 else
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
690 wParam = VK_LMENU;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
691 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
692 }
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
693 /* Windows only reports keyup for print screen */
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
694 if (wParam == VK_SNAPSHOT
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
695 && SDL_GetKeyState(NULL)[SDLK_PRINT] == SDL_RELEASED) {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
696 SDL_SendKeyboardKey(index, SDL_PRESSED,
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
697 (Uint8) HIWORD(lParam),
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
698 TranslateKey(wParam));
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
699 }
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
700 SDL_SendKeyboardKey(index, SDL_RELEASED, (Uint8) HIWORD(lParam),
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
701 TranslateKey(wParam));
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
702 }
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
703 return (0);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
704
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
705 case WM_GETMINMAXINFO:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
706 {
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
707 MINMAXINFO *info;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
708 RECT size;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
709 int x, y;
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
710 int w, h;
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
711 int style;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
712
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
713 /* If we allow resizing, let the resize happen naturally */
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
714 if (SDL_GetWindowFlags(data->windowID) & SDL_WINDOW_RESIZABLE) {
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
715 return (0);
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
716 }
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
717
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
718 /* Get the current position of our window */
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
719 GetWindowRect(hwnd, &size);
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
720 x = size.left;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
721 y = size.top;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
722
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
723 /* Calculate current size of our window */
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
724 SDL_GetWindowSize(data->windowID, &w, &h);
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
725 size.top = 0;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
726 size.left = 0;
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
727 size.bottom = h;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
728 size.right = w;
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
729
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
730 /* DJM - according to the docs for GetMenu(), the
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
731 return value is undefined if hwnd is a child window.
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
732 Aparently it's too difficult for MS to check
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
733 inside their function, so I have to do it here.
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
734 */
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
735 style = GetWindowLong(hwnd, GWL_STYLE);
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
736 AdjustWindowRect(&size,
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
737 style,
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
738 style & WS_CHILDWINDOW ? FALSE : GetMenu(hwnd) !=
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
739 NULL);
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
740
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
741 w = size.right - size.left;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
742 h = size.bottom - size.top;
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
743
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
744 /* Fix our size to the current size */
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
745 info = (MINMAXINFO *) lParam;
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
746 info->ptMaxSize.x = w;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
747 info->ptMaxSize.y = h;
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
748 info->ptMaxPosition.x = x;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
749 info->ptMaxPosition.y = y;
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
750 info->ptMinTrackSize.x = w;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
751 info->ptMinTrackSize.y = h;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
752 info->ptMaxTrackSize.x = w;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
753 info->ptMaxTrackSize.y = h;
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
754 }
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
755 return (0);
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
756
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
757 case WM_WINDOWPOSCHANGED:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
758 {
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
759 RECT rect;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
760 int x, y;
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
761 int w, h;
1732
fd65f12b6de6 Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents: 1727
diff changeset
762 Uint32 window_flags;
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
763
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
764 GetClientRect(hwnd, &rect);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
765 ClientToScreen(hwnd, (LPPOINT) & rect);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
766 ClientToScreen(hwnd, (LPPOINT) & rect + 1);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
767
1732
fd65f12b6de6 Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents: 1727
diff changeset
768 window_flags = SDL_GetWindowFlags(data->windowID);
fd65f12b6de6 Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents: 1727
diff changeset
769 if ((window_flags & SDL_WINDOW_INPUT_GRABBED) &&
1734
f7c667ded87d The general code handles restoring video mode/gamma/etc. when the window loses focus.
Sam Lantinga <slouken@libsdl.org>
parents: 1733
diff changeset
770 (window_flags & SDL_WINDOW_INPUT_FOCUS)) {
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
771 ClipCursor(&rect);
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
772 }
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
773
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
774 x = rect.left;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
775 y = rect.top;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
776 SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_MOVED, x, y);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
777
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
778 w = rect.right - rect.left;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
779 h = rect.bottom - rect.top;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
780 SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_RESIZED, w,
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
781 h);
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
782 }
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
783 break;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
784
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
785 case WM_SETCURSOR:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
786 {
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
787 /*
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
788 Uint16 hittest;
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
789
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
790 hittest = LOWORD(lParam);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
791 if (hittest == HTCLIENT) {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
792 SetCursor(SDL_hcursor);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
793 return (TRUE);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
794 }
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
795 */
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
796 }
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
797 break;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
798
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
799 /* We are about to get palette focus! */
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
800 case WM_QUERYNEWPALETTE:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
801 {
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
802 /*
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
803 WIN_RealizePalette(current_video);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
804 return (TRUE);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
805 */
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
806 }
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
807 break;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
808
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
809 /* Another application changed the palette */
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
810 case WM_PALETTECHANGED:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
811 {
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
812 /*
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
813 WIN_PaletteChanged(current_video, (HWND) wParam);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
814 */
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
815 }
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
816 break;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
817
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
818 /* We were occluded, refresh our display */
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
819 case WM_PAINT:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
820 {
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
821 RECT rect;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
822 if (GetUpdateRect(hwnd, &rect, FALSE)) {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
823 ValidateRect(hwnd, &rect);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
824 SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_EXPOSED,
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
825 0, 0);
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
826 }
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
827 }
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
828 return (0);
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
829
1727
90a3e0fccb88 Started on the OpenGL API revamp.
Sam Lantinga <slouken@libsdl.org>
parents: 1724
diff changeset
830 /* We'll do our own drawing, prevent flicker */
90a3e0fccb88 Started on the OpenGL API revamp.
Sam Lantinga <slouken@libsdl.org>
parents: 1724
diff changeset
831 case WM_ERASEBKGND:
90a3e0fccb88 Started on the OpenGL API revamp.
Sam Lantinga <slouken@libsdl.org>
parents: 1724
diff changeset
832 {
90a3e0fccb88 Started on the OpenGL API revamp.
Sam Lantinga <slouken@libsdl.org>
parents: 1724
diff changeset
833 }
90a3e0fccb88 Started on the OpenGL API revamp.
Sam Lantinga <slouken@libsdl.org>
parents: 1724
diff changeset
834 return (1);
90a3e0fccb88 Started on the OpenGL API revamp.
Sam Lantinga <slouken@libsdl.org>
parents: 1724
diff changeset
835
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
836 case WM_SYSCOMMAND:
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
837 {
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
838 /* Don't start the screensaver or blank the monitor in fullscreen apps */
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
839 if ((wParam & 0xFFF0) == SC_SCREENSAVE ||
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
840 (wParam & 0xFFF0) == SC_MONITORPOWER) {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
841 if (SDL_GetWindowFlags(data->windowID) &
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
842 SDL_WINDOW_FULLSCREEN) {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
843 return (0);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
844 }
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
845 }
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
846 }
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
847 break;
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
848
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
849 case WM_CLOSE:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
850 {
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
851 SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_CLOSE, 0, 0);
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
852 }
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
853 return (0);
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
854 }
1719
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
855 return CallWindowProc(data->wndproc, hwnd, msg, wParam, lParam);
1718
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
856 }
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
857
1712
931d111e737a Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
858 void
1718
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
859 WIN_PumpEvents(_THIS)
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
860 {
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
861 MSG msg;
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
862 while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
863 TranslateMessage(&msg);
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
864 DispatchMessage(&msg);
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
865 }
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
866 }
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
867
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
868 static int app_registered = 0;
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
869 LPTSTR SDL_Appname = NULL;
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
870 Uint32 SDL_Appstyle = 0;
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
871 HINSTANCE SDL_Instance = NULL;
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
872
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
873 /* Register the class for this application */
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
874 int
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
875 SDL_RegisterApp(char *name, Uint32 style, void *hInst)
1712
931d111e737a Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
876 {
1718
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
877 WNDCLASS class;
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
878
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
879 /* Only do this once... */
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
880 if (app_registered) {
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
881 ++app_registered;
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
882 return (0);
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
883 }
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
884 if (!name && !SDL_Appname) {
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
885 name = "SDL_app";
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
886 SDL_Appstyle = (CS_BYTEALIGNCLIENT | CS_OWNDC);
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
887 SDL_Instance = hInst ? hInst : GetModuleHandle(NULL);
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
888 }
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
889
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
890 if (name) {
1719
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
891 SDL_Appname = WIN_UTF8ToString(name);
1718
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
892 SDL_Appstyle = style;
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
893 SDL_Instance = hInst ? hInst : GetModuleHandle(NULL);
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
894 }
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
895
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
896 /* Register the application class */
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
897 class.hCursor = NULL;
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
898 class.hIcon = LoadImage(SDL_Instance, SDL_Appname,
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
899 IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR);
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
900 class.lpszMenuName = NULL;
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
901 class.lpszClassName = SDL_Appname;
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
902 class.hbrBackground = NULL;
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
903 class.hInstance = SDL_Instance;
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
904 class.style = SDL_Appstyle;
1719
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
905 class.lpfnWndProc = DefWindowProc;
1718
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
906 class.cbWndExtra = 0;
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
907 class.cbClsExtra = 0;
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
908 if (!RegisterClass(&class)) {
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
909 SDL_SetError("Couldn't register application class");
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
910 return (-1);
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
911 }
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
912
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
913 app_registered = 1;
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
914 return (0);
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
915 }
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
916
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
917 /* Unregisters the windowclass registered in SDL_RegisterApp above. */
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
918 void
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
919 SDL_UnregisterApp()
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
920 {
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
921 WNDCLASS class;
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
922
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
923 /* SDL_RegisterApp might not have been called before */
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
924 if (!app_registered) {
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
925 return;
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
926 }
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
927 --app_registered;
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
928 if (app_registered == 0) {
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
929 /* Check for any registered window classes. */
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
930 if (GetClassInfo(SDL_Instance, SDL_Appname, &class)) {
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
931 UnregisterClass(SDL_Appname, SDL_Instance);
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
932 }
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
933 SDL_free(SDL_Appname);
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
934 SDL_Appname = NULL;
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
935 }
1712
931d111e737a Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
936 }
931d111e737a Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
937
1719
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
938 /* Sets an error message based on GetLastError() */
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
939 void
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
940 WIN_SetError(const char *prefix)
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
941 {
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
942 TCHAR buffer[1024];
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
943 char *message;
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
944
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
945 FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
946 NULL,
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
947 GetLastError(), 0, buffer, SDL_arraysize(buffer), NULL);
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
948
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
949 message = WIN_StringToUTF8(buffer);
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
950 SDL_SetError("%s%s%s", prefix ? prefix : "", prefix ? ":" : "", message);
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
951 SDL_free(message);
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
952 }
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
953
1712
931d111e737a Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
954 /* vi: set ts=4 sw=4 expandtab: */