annotate src/video/win32/SDL_win32events.c @ 1732:fd65f12b6de6 SDL-1.3

Implemented Win32 input grab
author Sam Lantinga <slouken@libsdl.org>
date Sat, 08 Jul 2006 20:55:39 +0000
parents 90a3e0fccb88
children 0b1070f2f94d
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
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
424 case WM_ACTIVATE:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
425 {
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
426 int index;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
427 SDL_Keyboard *keyboard;
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
428 BOOL minimized;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
429
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
430 minimized = HIWORD(wParam);
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
431 index = data->videodata->keyboard;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
432 keyboard = SDL_GetKeyboard(index);
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
433 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
434 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
435 0, 0);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
436 SDL_SendWindowEvent(data->windowID,
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
437 SDL_WINDOWEVENT_RESTORED, 0, 0);
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
438 if (IsZoomed(hwnd)) {
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
439 SDL_SendWindowEvent(data->windowID,
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
440 SDL_WINDOWEVENT_MAXIMIZED, 0, 0);
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
441 }
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
442 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
443 SDL_SetKeyboardFocus(index, data->windowID);
1732
fd65f12b6de6 Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents: 1727
diff changeset
444
fd65f12b6de6 Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents: 1727
diff changeset
445 if (SDL_GetWindowFlags(data->windowID) &
fd65f12b6de6 Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents: 1727
diff changeset
446 SDL_WINDOW_INPUT_GRABBED) {
fd65f12b6de6 Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents: 1727
diff changeset
447 RECT rect;
fd65f12b6de6 Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents: 1727
diff changeset
448
fd65f12b6de6 Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents: 1727
diff changeset
449 GetClientRect(hwnd, &rect);
fd65f12b6de6 Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents: 1727
diff changeset
450 ClientToScreen(hwnd, (LPPOINT) & rect);
fd65f12b6de6 Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents: 1727
diff changeset
451 ClientToScreen(hwnd, (LPPOINT) & rect + 1);
fd65f12b6de6 Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents: 1727
diff changeset
452 ClipCursor(&rect);
fd65f12b6de6 Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents: 1727
diff changeset
453 }
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
454 }
1732
fd65f12b6de6 Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents: 1727
diff changeset
455 /* FIXME: Restore mode state (mode, gamma) */
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
456 /* FIXME: Update keyboard state */
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
457 } else {
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
458 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
459 SDL_SetKeyboardFocus(index, 0);
1732
fd65f12b6de6 Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents: 1727
diff changeset
460
fd65f12b6de6 Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents: 1727
diff changeset
461 if (SDL_GetWindowFlags(data->windowID) &
fd65f12b6de6 Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents: 1727
diff changeset
462 SDL_WINDOW_INPUT_GRABBED) {
fd65f12b6de6 Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents: 1727
diff changeset
463 ClipCursor(NULL);
fd65f12b6de6 Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents: 1727
diff changeset
464 }
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
465 }
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
466 if (minimized) {
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
467 SDL_SendWindowEvent(data->windowID,
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
468 SDL_WINDOWEVENT_MINIMIZED, 0, 0);
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
469 }
1732
fd65f12b6de6 Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents: 1727
diff changeset
470 /* FIXME: Restore desktop state (mode, gamma) */
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
471 }
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
472 return (0);
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
473 }
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
474 break;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
475
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
476 case WM_MOUSEMOVE:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
477 {
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
478 int index;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
479 SDL_Mouse *mouse;
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
480 int x, y;
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
481
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
482 index = data->videodata->mouse;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
483 mouse = SDL_GetMouse(index);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
484
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
485 if (mouse->focus != data->windowID) {
1722
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
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
488 tme.cbSize = sizeof(tme);
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
489 tme.dwFlags = TME_LEAVE;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
490 tme.hwndTrack = hwnd;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
491 TrackMouseEvent(&tme);
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
492
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
493 SDL_SetMouseFocus(index, data->windowID);
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
494 }
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
495
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
496 /* 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
497 x = LOWORD(lParam);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
498 y = HIWORD(lParam);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
499 if (mouse->relative_mode) {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
500 int w, h;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
501 POINT center;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
502 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
503 center.x = (w / 2);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
504 center.y = (h / 2);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
505 x -= center.x;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
506 y -= center.y;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
507 if (x || y) {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
508 ClientToScreen(hwnd, &center);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
509 SetCursorPos(center.x, center.y);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
510 SDL_SendMouseMotion(index, 1, x, y);
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
511 }
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
512 } else {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
513 SDL_SendMouseMotion(index, 0, x, y);
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
514 }
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
515 }
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
516 return (0);
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
517
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
518 case WM_MOUSELEAVE:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
519 {
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
520 int index;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
521 SDL_Mouse *mouse;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
522
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
523 index = data->videodata->mouse;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
524 mouse = SDL_GetMouse(index);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
525
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
526 if (mouse->focus == data->windowID) {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
527 SDL_SetMouseFocus(index, 0);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
528 }
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
529 }
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
530 return (0);
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
531
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
532 case WM_LBUTTONDOWN:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
533 case WM_LBUTTONUP:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
534 case WM_MBUTTONDOWN:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
535 case WM_MBUTTONUP:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
536 case WM_RBUTTONDOWN:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
537 case WM_RBUTTONUP:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
538 {
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
539 int index;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
540 SDL_Mouse *mouse;
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
541 Uint8 button, state;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
542
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
543 /* DJM:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
544 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
545 it acts like a normal windows "component"
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
546 (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
547 */
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
548 SetFocus(hwnd);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
549
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
550 index = data->videodata->mouse;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
551 mouse = SDL_GetMouse(index);
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
552
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
553 /* Figure out which button to use */
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
554 switch (msg) {
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
555 case WM_LBUTTONDOWN:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
556 button = SDL_BUTTON_LEFT;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
557 state = SDL_PRESSED;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
558 break;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
559 case WM_LBUTTONUP:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
560 button = SDL_BUTTON_LEFT;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
561 state = SDL_RELEASED;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
562 break;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
563 case WM_MBUTTONDOWN:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
564 button = SDL_BUTTON_MIDDLE;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
565 state = SDL_PRESSED;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
566 break;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
567 case WM_MBUTTONUP:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
568 button = SDL_BUTTON_MIDDLE;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
569 state = SDL_RELEASED;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
570 break;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
571 case WM_RBUTTONDOWN:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
572 button = SDL_BUTTON_RIGHT;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
573 state = SDL_PRESSED;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
574 break;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
575 case WM_RBUTTONUP:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
576 button = SDL_BUTTON_RIGHT;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
577 state = SDL_RELEASED;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
578 break;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
579 default:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
580 /* Eh? Unknown button? */
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
581 return (0);
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 if (state == SDL_PRESSED) {
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
584 /* 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
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 SetCapture(hwnd);
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
587 }
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
588 } else {
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
589 /* 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
590 if (--data->mouse_pressed <= 0) {
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
591 ReleaseCapture();
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
592 data->mouse_pressed = 0;
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
593 }
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
594 }
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
595
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
596 if (!mouse->relative_mode) {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
597 int x, y;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
598 x = LOWORD(lParam);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
599 y = HIWORD(lParam);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
600 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
601 }
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
602 SDL_SendMouseButton(index, state, button);
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
603 }
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
604 return (0);
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
605
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
606 case WM_MOUSEWHEEL:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
607 {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
608 int index;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
609 int motion = (short) HIWORD(wParam);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
610
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
611 index = data->videodata->mouse;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
612 SDL_SendMouseWheel(index, motion);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
613 }
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
614 return (0);
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
615
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
616 case WM_SYSKEYDOWN:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
617 case WM_KEYDOWN:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
618 {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
619 int index;
1719
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
620
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
621 /* Ignore repeated keys */
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
622 if (lParam & REPEATED_KEYMASK) {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
623 return (0);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
624 }
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
625
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
626 index = data->videodata->keyboard;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
627 switch (wParam) {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
628 case VK_CONTROL:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
629 if (lParam & EXTENDED_KEYMASK)
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
630 wParam = VK_RCONTROL;
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
631 else
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
632 wParam = VK_LCONTROL;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
633 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
634 case VK_SHIFT:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
635 /* 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
636 {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
637 Uint8 *state = SDL_GetKeyState(NULL);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
638 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
639 && (GetKeyState(VK_LSHIFT) & 0x8000)) {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
640 wParam = VK_LSHIFT;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
641 } 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
642 && (GetKeyState(VK_RSHIFT) & 0x8000)) {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
643 wParam = VK_RSHIFT;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
644 } else {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
645 /* Probably a key repeat */
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
646 return (0);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
647 }
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
648 }
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
649 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
650 case VK_MENU:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
651 if (lParam & EXTENDED_KEYMASK)
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
652 wParam = VK_RMENU;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
653 else
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
654 wParam = VK_LMENU;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
655 break;
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
656 }
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
657 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
658 TranslateKey(wParam));
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
659 }
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
660 return (0);
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
661
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
662 case WM_SYSKEYUP:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
663 case WM_KEYUP:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
664 {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
665 int index;
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
666
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
667 index = data->videodata->keyboard;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
668 switch (wParam) {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
669 case VK_CONTROL:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
670 if (lParam & EXTENDED_KEYMASK)
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
671 wParam = VK_RCONTROL;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
672 else
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
673 wParam = VK_LCONTROL;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
674 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
675 case VK_SHIFT:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
676 /* 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
677 {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
678 Uint8 *state = SDL_GetKeyState(NULL);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
679 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
680 && !(GetKeyState(VK_LSHIFT) & 0x8000)) {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
681 wParam = VK_LSHIFT;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
682 } 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
683 && !(GetKeyState(VK_RSHIFT) & 0x8000)) {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
684 wParam = VK_RSHIFT;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
685 } else {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
686 /* Probably a key repeat */
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
687 return (0);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
688 }
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
689 }
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
690 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
691 case VK_MENU:
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
692 if (lParam & EXTENDED_KEYMASK)
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
693 wParam = VK_RMENU;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
694 else
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
695 wParam = VK_LMENU;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
696 break;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
697 }
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
698 /* 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
699 if (wParam == VK_SNAPSHOT
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
700 && 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
701 SDL_SendKeyboardKey(index, SDL_PRESSED,
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
702 (Uint8) HIWORD(lParam),
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
703 TranslateKey(wParam));
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
704 }
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
705 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
706 TranslateKey(wParam));
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
707 }
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
708 return (0);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
709
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
710 case WM_GETMINMAXINFO:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
711 {
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
712 MINMAXINFO *info;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
713 RECT size;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
714 int x, y;
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
715 int w, h;
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
716 int style;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
717
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
718 /* 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
719 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
720 return (0);
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
721 }
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
723 /* 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
724 GetWindowRect(hwnd, &size);
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
725 x = size.left;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
726 y = size.top;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
727
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
728 /* 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
729 SDL_GetWindowSize(data->windowID, &w, &h);
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
730 size.top = 0;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
731 size.left = 0;
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
732 size.bottom = h;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
733 size.right = w;
1722
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 /* 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
736 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
737 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
738 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
739 */
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
740 style = GetWindowLong(hwnd, GWL_STYLE);
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
741 AdjustWindowRect(&size,
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
742 style,
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
743 style & WS_CHILDWINDOW ? FALSE : GetMenu(hwnd) !=
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
744 NULL);
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
745
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
746 w = size.right - size.left;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
747 h = size.bottom - size.top;
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
748
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
749 /* Fix our size to the current size */
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
750 info = (MINMAXINFO *) lParam;
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
751 info->ptMaxSize.x = w;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
752 info->ptMaxSize.y = h;
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
753 info->ptMaxPosition.x = x;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
754 info->ptMaxPosition.y = y;
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
755 info->ptMinTrackSize.x = w;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
756 info->ptMinTrackSize.y = h;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
757 info->ptMaxTrackSize.x = w;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
758 info->ptMaxTrackSize.y = h;
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
759 }
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
760 return (0);
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
761
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
762 case WM_WINDOWPOSCHANGED:
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 RECT rect;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
765 int x, y;
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
766 int w, h;
1732
fd65f12b6de6 Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents: 1727
diff changeset
767 Uint32 window_flags;
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
768
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
769 GetClientRect(hwnd, &rect);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
770 ClientToScreen(hwnd, (LPPOINT) & rect);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
771 ClientToScreen(hwnd, (LPPOINT) & rect + 1);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
772
1732
fd65f12b6de6 Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents: 1727
diff changeset
773 window_flags = SDL_GetWindowFlags(data->windowID);
fd65f12b6de6 Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents: 1727
diff changeset
774 if ((window_flags & SDL_WINDOW_INPUT_GRABBED) &&
fd65f12b6de6 Implemented Win32 input grab
Sam Lantinga <slouken@libsdl.org>
parents: 1727
diff changeset
775 (window_flags & SDL_WINDOW_KEYBOARD_FOCUS)) {
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
776 ClipCursor(&rect);
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
777 }
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
778
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
779 x = rect.left;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
780 y = rect.top;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
781 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
782
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
783 w = rect.right - rect.left;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
784 h = rect.bottom - rect.top;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
785 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
786 h);
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
787 }
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
788 break;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
789
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
790 case WM_SETCURSOR:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
791 {
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
792 /*
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
793 Uint16 hittest;
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
794
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
795 hittest = LOWORD(lParam);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
796 if (hittest == HTCLIENT) {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
797 SetCursor(SDL_hcursor);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
798 return (TRUE);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
799 }
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
800 */
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
801 }
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
802 break;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
803
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
804 /* We are about to get palette focus! */
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
805 case WM_QUERYNEWPALETTE:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
806 {
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
807 /*
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
808 WIN_RealizePalette(current_video);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
809 return (TRUE);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
810 */
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
811 }
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
812 break;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
813
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
814 /* Another application changed the palette */
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
815 case WM_PALETTECHANGED:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
816 {
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
817 /*
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
818 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
819 */
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
820 }
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
821 break;
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
822
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
823 /* We were occluded, refresh our display */
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
824 case WM_PAINT:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
825 {
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
826 RECT rect;
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
827 if (GetUpdateRect(hwnd, &rect, FALSE)) {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
828 ValidateRect(hwnd, &rect);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
829 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
830 0, 0);
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
831 }
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
832 }
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
833 return (0);
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
834
1727
90a3e0fccb88 Started on the OpenGL API revamp.
Sam Lantinga <slouken@libsdl.org>
parents: 1724
diff changeset
835 /* We'll do our own drawing, prevent flicker */
90a3e0fccb88 Started on the OpenGL API revamp.
Sam Lantinga <slouken@libsdl.org>
parents: 1724
diff changeset
836 case WM_ERASEBKGND:
90a3e0fccb88 Started on the OpenGL API revamp.
Sam Lantinga <slouken@libsdl.org>
parents: 1724
diff changeset
837 {
90a3e0fccb88 Started on the OpenGL API revamp.
Sam Lantinga <slouken@libsdl.org>
parents: 1724
diff changeset
838 }
90a3e0fccb88 Started on the OpenGL API revamp.
Sam Lantinga <slouken@libsdl.org>
parents: 1724
diff changeset
839 return (1);
90a3e0fccb88 Started on the OpenGL API revamp.
Sam Lantinga <slouken@libsdl.org>
parents: 1724
diff changeset
840
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
841 case WM_SYSCOMMAND:
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
842 {
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
843 /* 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
844 if ((wParam & 0xFFF0) == SC_SCREENSAVE ||
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
845 (wParam & 0xFFF0) == SC_MONITORPOWER) {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
846 if (SDL_GetWindowFlags(data->windowID) &
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
847 SDL_WINDOW_FULLSCREEN) {
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
848 return (0);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
849 }
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
850 }
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
851 }
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
852 break;
1722
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
853
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
854 case WM_CLOSE:
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
855 {
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1722
diff changeset
856 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
857 }
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
858 return (0);
5daa04d862f1 Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents: 1719
diff changeset
859 }
1719
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
860 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
861 }
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
862
1712
931d111e737a Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
863 void
1718
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
864 WIN_PumpEvents(_THIS)
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 MSG msg;
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
867 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
868 TranslateMessage(&msg);
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
869 DispatchMessage(&msg);
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
870 }
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
871 }
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 static int app_registered = 0;
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
874 LPTSTR SDL_Appname = NULL;
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
875 Uint32 SDL_Appstyle = 0;
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
876 HINSTANCE SDL_Instance = NULL;
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
877
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
878 /* Register the class for this application */
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
879 int
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
880 SDL_RegisterApp(char *name, Uint32 style, void *hInst)
1712
931d111e737a Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
881 {
1718
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
882 WNDCLASS class;
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 /* Only do this once... */
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
885 if (app_registered) {
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
886 ++app_registered;
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
887 return (0);
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 if (!name && !SDL_Appname) {
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
890 name = "SDL_app";
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
891 SDL_Appstyle = (CS_BYTEALIGNCLIENT | CS_OWNDC);
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
892 SDL_Instance = hInst ? hInst : GetModuleHandle(NULL);
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
893 }
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 if (name) {
1719
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
896 SDL_Appname = WIN_UTF8ToString(name);
1718
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
897 SDL_Appstyle = style;
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
898 SDL_Instance = hInst ? hInst : GetModuleHandle(NULL);
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
899 }
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
900
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
901 /* Register the application class */
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
902 class.hCursor = NULL;
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
903 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
904 IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR);
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
905 class.lpszMenuName = NULL;
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
906 class.lpszClassName = SDL_Appname;
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
907 class.hbrBackground = NULL;
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
908 class.hInstance = SDL_Instance;
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
909 class.style = SDL_Appstyle;
1719
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
910 class.lpfnWndProc = DefWindowProc;
1718
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
911 class.cbWndExtra = 0;
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
912 class.cbClsExtra = 0;
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
913 if (!RegisterClass(&class)) {
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
914 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
915 return (-1);
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
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
918 app_registered = 1;
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
919 return (0);
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
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
922 /* 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
923 void
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
924 SDL_UnregisterApp()
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
925 {
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
926 WNDCLASS class;
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
927
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
928 /* 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
929 if (!app_registered) {
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
930 return;
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
931 }
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
932 --app_registered;
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
933 if (app_registered == 0) {
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
934 /* Check for any registered window classes. */
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
935 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
936 UnregisterClass(SDL_Appname, SDL_Instance);
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
937 }
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
938 SDL_free(SDL_Appname);
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
939 SDL_Appname = NULL;
ed4d4f1ea201 Further progress on the new Windows video driver:
Sam Lantinga <slouken@libsdl.org>
parents: 1712
diff changeset
940 }
1712
931d111e737a Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
941 }
931d111e737a Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
942
1719
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
943 /* 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
944 void
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
945 WIN_SetError(const char *prefix)
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
946 {
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
947 TCHAR buffer[1024];
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
948 char *message;
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
949
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
950 FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
951 NULL,
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
952 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
953
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
954 message = WIN_StringToUTF8(buffer);
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
955 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
956 SDL_free(message);
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
957 }
5b9f50c957ed You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents: 1718
diff changeset
958
1712
931d111e737a Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
959 /* vi: set ts=4 sw=4 expandtab: */