annotate src/video/win32/SDL_win32events.c @ 1733:0b1070f2f94d SDL-1.3

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