Mercurial > sdl-ios-xcode
annotate src/video/windib/SDL_dibevents.c @ 4404:b8de86ee2ad6 SDL-1.2-olpc
First shot at GTK+ video target for the OLPC laptops. Seriously incomplete,
but it's enough to get some bits to a window...
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Thu, 19 Apr 2007 07:12:30 +0000 |
parents | b2f59aadec0d |
children | b0d021cf41b6 |
rev | line source |
---|---|
0 | 1 /* |
2 SDL - Simple DirectMedia Layer | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1303
diff
changeset
|
3 Copyright (C) 1997-2006 Sam Lantinga |
0 | 4 |
5 This library is free software; you can redistribute it and/or | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1303
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
0 | 7 License as published by the Free Software Foundation; either |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1303
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
0 | 9 |
10 This library is distributed in the hope that it will be useful, | |
11 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1303
diff
changeset
|
13 Lesser General Public License for more details. |
0 | 14 |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1303
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1303
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1303
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
0 | 18 |
19 Sam Lantinga | |
252
e8157fcb3114
Updated the source with the correct e-mail address
Sam Lantinga <slouken@libsdl.org>
parents:
145
diff
changeset
|
20 slouken@libsdl.org |
0 | 21 */ |
1402
d910939febfa
Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents:
1379
diff
changeset
|
22 #include "SDL_config.h" |
0 | 23 |
1433
bb6839704ed6
SDL_windows.h is no longer necessary
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
24 #define WIN32_LEAN_AND_MEAN |
bb6839704ed6
SDL_windows.h is no longer necessary
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
25 #include <windows.h> |
0 | 26 |
1358
c71e05b4dc2e
More header massaging... works great on Windows. ;-)
Sam Lantinga <slouken@libsdl.org>
parents:
1338
diff
changeset
|
27 #include "SDL_main.h" |
0 | 28 #include "SDL_events.h" |
29 #include "SDL_syswm.h" | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
30 #include "../../events/SDL_sysevents.h" |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
31 #include "../../events/SDL_events_c.h" |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
32 #include "../wincommon/SDL_lowvideo.h" |
0 | 33 #include "SDL_dibvideo.h" |
34 #include "SDL_vkeys.h" | |
35 | |
36 #ifndef WM_APP | |
37 #define WM_APP 0x8000 | |
38 #endif | |
39 | |
40 #ifdef _WIN32_WCE | |
41 #define NO_GETKEYBOARDSTATE | |
42 #endif | |
43 | |
44 /* The translation table from a Microsoft VK keysym to a SDL keysym */ | |
45 static SDLKey VK_keymap[SDLK_LAST]; | |
1472
4aac8563c296
Fixed more Win64 portability issues
Sam Lantinga <slouken@libsdl.org>
parents:
1456
diff
changeset
|
46 static SDL_keysym *TranslateKey(WPARAM vkey, UINT scancode, SDL_keysym *keysym, int pressed); |
0 | 47 |
48 /* Masks for processing the windows KEYDOWN and KEYUP messages */ | |
49 #define REPEATED_KEYMASK (1<<30) | |
50 #define EXTENDED_KEYMASK (1<<24) | |
51 | |
145
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
140
diff
changeset
|
52 /* DJM: If the user setup the window for us, we want to save his window proc, |
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
140
diff
changeset
|
53 and give him a chance to handle some messages. */ |
1303
52b5afd7ecee
Date: Tue, 05 Jul 2005 21:43:26 +1000
Sam Lantinga <slouken@libsdl.org>
parents:
1288
diff
changeset
|
54 #ifdef STRICT |
52b5afd7ecee
Date: Tue, 05 Jul 2005 21:43:26 +1000
Sam Lantinga <slouken@libsdl.org>
parents:
1288
diff
changeset
|
55 #define WNDPROCTYPE WNDPROC |
52b5afd7ecee
Date: Tue, 05 Jul 2005 21:43:26 +1000
Sam Lantinga <slouken@libsdl.org>
parents:
1288
diff
changeset
|
56 #else |
52b5afd7ecee
Date: Tue, 05 Jul 2005 21:43:26 +1000
Sam Lantinga <slouken@libsdl.org>
parents:
1288
diff
changeset
|
57 #define WNDPROCTYPE FARPROC |
52b5afd7ecee
Date: Tue, 05 Jul 2005 21:43:26 +1000
Sam Lantinga <slouken@libsdl.org>
parents:
1288
diff
changeset
|
58 #endif |
52b5afd7ecee
Date: Tue, 05 Jul 2005 21:43:26 +1000
Sam Lantinga <slouken@libsdl.org>
parents:
1288
diff
changeset
|
59 static WNDPROCTYPE userWindowProc = NULL; |
145
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
140
diff
changeset
|
60 |
1251
86d0d01290ea
Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode,
Ryan C. Gordon <icculus@icculus.org>
parents:
1152
diff
changeset
|
61 |
86d0d01290ea
Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode,
Ryan C. Gordon <icculus@icculus.org>
parents:
1152
diff
changeset
|
62 #ifdef _WIN32_WCE |
86d0d01290ea
Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode,
Ryan C. Gordon <icculus@icculus.org>
parents:
1152
diff
changeset
|
63 |
86d0d01290ea
Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode,
Ryan C. Gordon <icculus@icculus.org>
parents:
1152
diff
changeset
|
64 WPARAM rotateKey(WPARAM key,SDL_ScreenOrientation direction) |
86d0d01290ea
Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode,
Ryan C. Gordon <icculus@icculus.org>
parents:
1152
diff
changeset
|
65 { |
86d0d01290ea
Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode,
Ryan C. Gordon <icculus@icculus.org>
parents:
1152
diff
changeset
|
66 if (direction != SDL_ORIENTATION_LEFT) |
86d0d01290ea
Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode,
Ryan C. Gordon <icculus@icculus.org>
parents:
1152
diff
changeset
|
67 return key; |
86d0d01290ea
Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode,
Ryan C. Gordon <icculus@icculus.org>
parents:
1152
diff
changeset
|
68 |
86d0d01290ea
Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode,
Ryan C. Gordon <icculus@icculus.org>
parents:
1152
diff
changeset
|
69 switch (key) { |
86d0d01290ea
Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode,
Ryan C. Gordon <icculus@icculus.org>
parents:
1152
diff
changeset
|
70 case 0x26: /* up */ |
86d0d01290ea
Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode,
Ryan C. Gordon <icculus@icculus.org>
parents:
1152
diff
changeset
|
71 return 0x27; |
86d0d01290ea
Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode,
Ryan C. Gordon <icculus@icculus.org>
parents:
1152
diff
changeset
|
72 case 0x27: /* right */ |
86d0d01290ea
Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode,
Ryan C. Gordon <icculus@icculus.org>
parents:
1152
diff
changeset
|
73 return 0x28; |
86d0d01290ea
Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode,
Ryan C. Gordon <icculus@icculus.org>
parents:
1152
diff
changeset
|
74 case 0x28: /* down */ |
86d0d01290ea
Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode,
Ryan C. Gordon <icculus@icculus.org>
parents:
1152
diff
changeset
|
75 return 0x25; |
86d0d01290ea
Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode,
Ryan C. Gordon <icculus@icculus.org>
parents:
1152
diff
changeset
|
76 case 0x25: /* left */ |
86d0d01290ea
Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode,
Ryan C. Gordon <icculus@icculus.org>
parents:
1152
diff
changeset
|
77 return 0x26; |
86d0d01290ea
Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode,
Ryan C. Gordon <icculus@icculus.org>
parents:
1152
diff
changeset
|
78 } |
86d0d01290ea
Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode,
Ryan C. Gordon <icculus@icculus.org>
parents:
1152
diff
changeset
|
79 |
86d0d01290ea
Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode,
Ryan C. Gordon <icculus@icculus.org>
parents:
1152
diff
changeset
|
80 return key; |
86d0d01290ea
Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode,
Ryan C. Gordon <icculus@icculus.org>
parents:
1152
diff
changeset
|
81 } |
86d0d01290ea
Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode,
Ryan C. Gordon <icculus@icculus.org>
parents:
1152
diff
changeset
|
82 |
86d0d01290ea
Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode,
Ryan C. Gordon <icculus@icculus.org>
parents:
1152
diff
changeset
|
83 #endif |
86d0d01290ea
Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode,
Ryan C. Gordon <icculus@icculus.org>
parents:
1152
diff
changeset
|
84 |
86d0d01290ea
Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode,
Ryan C. Gordon <icculus@icculus.org>
parents:
1152
diff
changeset
|
85 |
0 | 86 /* The main Win32 event handler */ |
1456
84de7511f79f
Fixed a bunch of 64-bit compatibility problems
Sam Lantinga <slouken@libsdl.org>
parents:
1433
diff
changeset
|
87 LRESULT DIB_HandleMessage(_THIS, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) |
0 | 88 { |
89 extern int posted; | |
90 | |
91 switch (msg) { | |
92 case WM_SYSKEYDOWN: | |
93 case WM_KEYDOWN: { | |
94 SDL_keysym keysym; | |
95 | |
1251
86d0d01290ea
Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode,
Ryan C. Gordon <icculus@icculus.org>
parents:
1152
diff
changeset
|
96 #ifdef _WIN32_WCE |
86d0d01290ea
Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode,
Ryan C. Gordon <icculus@icculus.org>
parents:
1152
diff
changeset
|
97 // Drop GAPI artefacts |
86d0d01290ea
Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode,
Ryan C. Gordon <icculus@icculus.org>
parents:
1152
diff
changeset
|
98 if (wParam == 0x84 || wParam == 0x5B) |
86d0d01290ea
Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode,
Ryan C. Gordon <icculus@icculus.org>
parents:
1152
diff
changeset
|
99 return 0; |
86d0d01290ea
Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode,
Ryan C. Gordon <icculus@icculus.org>
parents:
1152
diff
changeset
|
100 |
86d0d01290ea
Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode,
Ryan C. Gordon <icculus@icculus.org>
parents:
1152
diff
changeset
|
101 // Rotate key if necessary |
86d0d01290ea
Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode,
Ryan C. Gordon <icculus@icculus.org>
parents:
1152
diff
changeset
|
102 if (this->hidden->orientation != SDL_ORIENTATION_UP) |
86d0d01290ea
Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode,
Ryan C. Gordon <icculus@icculus.org>
parents:
1152
diff
changeset
|
103 wParam = rotateKey(wParam, this->hidden->orientation); |
86d0d01290ea
Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode,
Ryan C. Gordon <icculus@icculus.org>
parents:
1152
diff
changeset
|
104 #endif |
0 | 105 /* Ignore repeated keys */ |
106 if ( lParam&REPEATED_KEYMASK ) { | |
107 return(0); | |
108 } | |
109 switch (wParam) { | |
110 case VK_CONTROL: | |
111 if ( lParam&EXTENDED_KEYMASK ) | |
112 wParam = VK_RCONTROL; | |
113 else | |
114 wParam = VK_LCONTROL; | |
115 break; | |
116 case VK_SHIFT: | |
117 /* EXTENDED trick doesn't work here */ | |
1282
217f5d5a49e5
Date: Sat, 15 Jan 2005 02:01:51 +0000 (UTC)
Sam Lantinga <slouken@libsdl.org>
parents:
1280
diff
changeset
|
118 { |
217f5d5a49e5
Date: Sat, 15 Jan 2005 02:01:51 +0000 (UTC)
Sam Lantinga <slouken@libsdl.org>
parents:
1280
diff
changeset
|
119 Uint8 *state = SDL_GetKeyState(NULL); |
217f5d5a49e5
Date: Sat, 15 Jan 2005 02:01:51 +0000 (UTC)
Sam Lantinga <slouken@libsdl.org>
parents:
1280
diff
changeset
|
120 if (state[SDLK_LSHIFT] == SDL_RELEASED && (GetKeyState(VK_LSHIFT) & 0x8000)) { |
558
2312d983e1fe
Fixed left/right shift detection on Windows (thanks Mike!)
Sam Lantinga <slouken@libsdl.org>
parents:
523
diff
changeset
|
121 wParam = VK_LSHIFT; |
1282
217f5d5a49e5
Date: Sat, 15 Jan 2005 02:01:51 +0000 (UTC)
Sam Lantinga <slouken@libsdl.org>
parents:
1280
diff
changeset
|
122 } else if (state[SDLK_RSHIFT] == SDL_RELEASED && (GetKeyState(VK_RSHIFT) & 0x8000)) { |
558
2312d983e1fe
Fixed left/right shift detection on Windows (thanks Mike!)
Sam Lantinga <slouken@libsdl.org>
parents:
523
diff
changeset
|
123 wParam = VK_RSHIFT; |
2312d983e1fe
Fixed left/right shift detection on Windows (thanks Mike!)
Sam Lantinga <slouken@libsdl.org>
parents:
523
diff
changeset
|
124 } else { |
1852
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
125 /* Win9x */ |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
126 int sc = HIWORD(lParam) & 0xFF; |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
127 |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
128 if (sc == 0x2A) |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
129 wParam = VK_LSHIFT; |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
130 else |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
131 if (sc == 0x36) |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
132 wParam = VK_RSHIFT; |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
133 else |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
134 wParam = VK_LSHIFT; |
1282
217f5d5a49e5
Date: Sat, 15 Jan 2005 02:01:51 +0000 (UTC)
Sam Lantinga <slouken@libsdl.org>
parents:
1280
diff
changeset
|
135 } |
558
2312d983e1fe
Fixed left/right shift detection on Windows (thanks Mike!)
Sam Lantinga <slouken@libsdl.org>
parents:
523
diff
changeset
|
136 } |
0 | 137 break; |
138 case VK_MENU: | |
139 if ( lParam&EXTENDED_KEYMASK ) | |
140 wParam = VK_RMENU; | |
141 else | |
142 wParam = VK_LMENU; | |
143 break; | |
144 } | |
112
9ef74357a5fb
Incorporated slightly modified version of Rainer's WinCE patch
Sam Lantinga <slouken@lokigames.com>
parents:
36
diff
changeset
|
145 #ifdef NO_GETKEYBOARDSTATE |
9ef74357a5fb
Incorporated slightly modified version of Rainer's WinCE patch
Sam Lantinga <slouken@lokigames.com>
parents:
36
diff
changeset
|
146 /* this is the workaround for the missing ToAscii() and ToUnicode() in CE (not necessary at KEYUP!) */ |
9ef74357a5fb
Incorporated slightly modified version of Rainer's WinCE patch
Sam Lantinga <slouken@lokigames.com>
parents:
36
diff
changeset
|
147 if ( SDL_TranslateUNICODE ) { |
140
3c35d8f160bd
Fixed compiling on Windows CE
Sam Lantinga <slouken@libsdl.org>
parents:
112
diff
changeset
|
148 MSG m; |
112
9ef74357a5fb
Incorporated slightly modified version of Rainer's WinCE patch
Sam Lantinga <slouken@lokigames.com>
parents:
36
diff
changeset
|
149 |
140
3c35d8f160bd
Fixed compiling on Windows CE
Sam Lantinga <slouken@libsdl.org>
parents:
112
diff
changeset
|
150 m.hwnd = hwnd; |
3c35d8f160bd
Fixed compiling on Windows CE
Sam Lantinga <slouken@libsdl.org>
parents:
112
diff
changeset
|
151 m.message = msg; |
3c35d8f160bd
Fixed compiling on Windows CE
Sam Lantinga <slouken@libsdl.org>
parents:
112
diff
changeset
|
152 m.wParam = wParam; |
3c35d8f160bd
Fixed compiling on Windows CE
Sam Lantinga <slouken@libsdl.org>
parents:
112
diff
changeset
|
153 m.lParam = lParam; |
3c35d8f160bd
Fixed compiling on Windows CE
Sam Lantinga <slouken@libsdl.org>
parents:
112
diff
changeset
|
154 m.time = 0; |
3c35d8f160bd
Fixed compiling on Windows CE
Sam Lantinga <slouken@libsdl.org>
parents:
112
diff
changeset
|
155 if ( TranslateMessage(&m) && PeekMessage(&m, hwnd, 0, WM_USER, PM_NOREMOVE) && (m.message == WM_CHAR) ) { |
112
9ef74357a5fb
Incorporated slightly modified version of Rainer's WinCE patch
Sam Lantinga <slouken@lokigames.com>
parents:
36
diff
changeset
|
156 GetMessage(&m, hwnd, 0, WM_USER); |
9ef74357a5fb
Incorporated slightly modified version of Rainer's WinCE patch
Sam Lantinga <slouken@lokigames.com>
parents:
36
diff
changeset
|
157 wParam = m.wParam; |
9ef74357a5fb
Incorporated slightly modified version of Rainer's WinCE patch
Sam Lantinga <slouken@lokigames.com>
parents:
36
diff
changeset
|
158 } |
9ef74357a5fb
Incorporated slightly modified version of Rainer's WinCE patch
Sam Lantinga <slouken@lokigames.com>
parents:
36
diff
changeset
|
159 } |
9ef74357a5fb
Incorporated slightly modified version of Rainer's WinCE patch
Sam Lantinga <slouken@lokigames.com>
parents:
36
diff
changeset
|
160 #endif /* NO_GETKEYBOARDSTATE */ |
0 | 161 posted = SDL_PrivateKeyboard(SDL_PRESSED, |
162 TranslateKey(wParam,HIWORD(lParam),&keysym,1)); | |
163 } | |
164 return(0); | |
165 | |
166 case WM_SYSKEYUP: | |
167 case WM_KEYUP: { | |
168 SDL_keysym keysym; | |
169 | |
1251
86d0d01290ea
Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode,
Ryan C. Gordon <icculus@icculus.org>
parents:
1152
diff
changeset
|
170 #ifdef _WIN32_WCE |
1526 | 171 // Drop GAPI artifacts |
1251
86d0d01290ea
Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode,
Ryan C. Gordon <icculus@icculus.org>
parents:
1152
diff
changeset
|
172 if (wParam == 0x84 || wParam == 0x5B) |
86d0d01290ea
Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode,
Ryan C. Gordon <icculus@icculus.org>
parents:
1152
diff
changeset
|
173 return 0; |
86d0d01290ea
Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode,
Ryan C. Gordon <icculus@icculus.org>
parents:
1152
diff
changeset
|
174 |
86d0d01290ea
Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode,
Ryan C. Gordon <icculus@icculus.org>
parents:
1152
diff
changeset
|
175 // Rotate key if necessary |
86d0d01290ea
Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode,
Ryan C. Gordon <icculus@icculus.org>
parents:
1152
diff
changeset
|
176 if (this->hidden->orientation != SDL_ORIENTATION_UP) |
86d0d01290ea
Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode,
Ryan C. Gordon <icculus@icculus.org>
parents:
1152
diff
changeset
|
177 wParam = rotateKey(wParam, this->hidden->orientation); |
86d0d01290ea
Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode,
Ryan C. Gordon <icculus@icculus.org>
parents:
1152
diff
changeset
|
178 #endif |
86d0d01290ea
Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode,
Ryan C. Gordon <icculus@icculus.org>
parents:
1152
diff
changeset
|
179 |
0 | 180 switch (wParam) { |
181 case VK_CONTROL: | |
182 if ( lParam&EXTENDED_KEYMASK ) | |
183 wParam = VK_RCONTROL; | |
184 else | |
185 wParam = VK_LCONTROL; | |
186 break; | |
187 case VK_SHIFT: | |
188 /* EXTENDED trick doesn't work here */ | |
1282
217f5d5a49e5
Date: Sat, 15 Jan 2005 02:01:51 +0000 (UTC)
Sam Lantinga <slouken@libsdl.org>
parents:
1280
diff
changeset
|
189 { |
217f5d5a49e5
Date: Sat, 15 Jan 2005 02:01:51 +0000 (UTC)
Sam Lantinga <slouken@libsdl.org>
parents:
1280
diff
changeset
|
190 Uint8 *state = SDL_GetKeyState(NULL); |
217f5d5a49e5
Date: Sat, 15 Jan 2005 02:01:51 +0000 (UTC)
Sam Lantinga <slouken@libsdl.org>
parents:
1280
diff
changeset
|
191 if (state[SDLK_LSHIFT] == SDL_PRESSED && !(GetKeyState(VK_LSHIFT) & 0x8000)) { |
572
4c740ee76027
Mike Nordell _really_ fixed Win32 windib shift state handling this time. :)
Sam Lantinga <slouken@libsdl.org>
parents:
558
diff
changeset
|
192 wParam = VK_LSHIFT; |
1282
217f5d5a49e5
Date: Sat, 15 Jan 2005 02:01:51 +0000 (UTC)
Sam Lantinga <slouken@libsdl.org>
parents:
1280
diff
changeset
|
193 } else if (state[SDLK_RSHIFT] == SDL_PRESSED && !(GetKeyState(VK_RSHIFT) & 0x8000)) { |
572
4c740ee76027
Mike Nordell _really_ fixed Win32 windib shift state handling this time. :)
Sam Lantinga <slouken@libsdl.org>
parents:
558
diff
changeset
|
194 wParam = VK_RSHIFT; |
4c740ee76027
Mike Nordell _really_ fixed Win32 windib shift state handling this time. :)
Sam Lantinga <slouken@libsdl.org>
parents:
558
diff
changeset
|
195 } else { |
1852
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
196 /* Win9x */ |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
197 int sc = HIWORD(lParam) & 0xFF; |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
198 |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
199 if (sc == 0x2A) |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
200 wParam = VK_LSHIFT; |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
201 else |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
202 if (sc == 0x36) |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
203 wParam = VK_RSHIFT; |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
204 else |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
205 wParam = VK_LSHIFT; |
1282
217f5d5a49e5
Date: Sat, 15 Jan 2005 02:01:51 +0000 (UTC)
Sam Lantinga <slouken@libsdl.org>
parents:
1280
diff
changeset
|
206 } |
572
4c740ee76027
Mike Nordell _really_ fixed Win32 windib shift state handling this time. :)
Sam Lantinga <slouken@libsdl.org>
parents:
558
diff
changeset
|
207 } |
0 | 208 break; |
209 case VK_MENU: | |
210 if ( lParam&EXTENDED_KEYMASK ) | |
211 wParam = VK_RMENU; | |
212 else | |
213 wParam = VK_LMENU; | |
214 break; | |
215 } | |
1526 | 216 /* Windows only reports keyup for print screen */ |
217 if ( wParam == VK_SNAPSHOT && SDL_GetKeyState(NULL)[SDLK_PRINT] == SDL_RELEASED ) { | |
218 posted = SDL_PrivateKeyboard(SDL_PRESSED, | |
219 TranslateKey(wParam,HIWORD(lParam),&keysym,1)); | |
220 } | |
0 | 221 posted = SDL_PrivateKeyboard(SDL_RELEASED, |
222 TranslateKey(wParam,HIWORD(lParam),&keysym,0)); | |
223 } | |
224 return(0); | |
225 | |
726
5429a06aa816
SDL12: Disable screensaver in windib driver.
Ryan C. Gordon <icculus@icculus.org>
parents:
721
diff
changeset
|
226 #if defined(SC_SCREENSAVE) && defined(SC_MONITORPOWER) |
5429a06aa816
SDL12: Disable screensaver in windib driver.
Ryan C. Gordon <icculus@icculus.org>
parents:
721
diff
changeset
|
227 case WM_SYSCOMMAND: { |
5429a06aa816
SDL12: Disable screensaver in windib driver.
Ryan C. Gordon <icculus@icculus.org>
parents:
721
diff
changeset
|
228 if ((wParam&0xFFF0)==SC_SCREENSAVE || |
5429a06aa816
SDL12: Disable screensaver in windib driver.
Ryan C. Gordon <icculus@icculus.org>
parents:
721
diff
changeset
|
229 (wParam&0xFFF0)==SC_MONITORPOWER) |
5429a06aa816
SDL12: Disable screensaver in windib driver.
Ryan C. Gordon <icculus@icculus.org>
parents:
721
diff
changeset
|
230 return(0); |
5429a06aa816
SDL12: Disable screensaver in windib driver.
Ryan C. Gordon <icculus@icculus.org>
parents:
721
diff
changeset
|
231 } |
5429a06aa816
SDL12: Disable screensaver in windib driver.
Ryan C. Gordon <icculus@icculus.org>
parents:
721
diff
changeset
|
232 /* Fall through to default processing */ |
5429a06aa816
SDL12: Disable screensaver in windib driver.
Ryan C. Gordon <icculus@icculus.org>
parents:
721
diff
changeset
|
233 #endif /* SC_SCREENSAVE && SC_MONITORPOWER */ |
5429a06aa816
SDL12: Disable screensaver in windib driver.
Ryan C. Gordon <icculus@icculus.org>
parents:
721
diff
changeset
|
234 |
0 | 235 default: { |
236 /* Only post the event if we're watching for it */ | |
237 if ( SDL_ProcessEvents[SDL_SYSWMEVENT] == SDL_ENABLE ) { | |
238 SDL_SysWMmsg wmmsg; | |
239 | |
240 SDL_VERSION(&wmmsg.version); | |
241 wmmsg.hwnd = hwnd; | |
242 wmmsg.msg = msg; | |
243 wmmsg.wParam = wParam; | |
244 wmmsg.lParam = lParam; | |
245 posted = SDL_PrivateSysWMEvent(&wmmsg); | |
145
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
140
diff
changeset
|
246 |
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
140
diff
changeset
|
247 /* DJM: If the user isn't watching for private |
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
140
diff
changeset
|
248 messages in her SDL event loop, then pass it |
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
140
diff
changeset
|
249 along to any win32 specific window proc. |
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
140
diff
changeset
|
250 */ |
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
140
diff
changeset
|
251 } else if (userWindowProc) { |
721
ab0656314eef
Date: Thu, 18 Sep 2003 14:24:35 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
572
diff
changeset
|
252 return CallWindowProc(userWindowProc, hwnd, msg, wParam, lParam); |
0 | 253 } |
254 } | |
255 break; | |
256 } | |
257 return(DefWindowProc(hwnd, msg, wParam, lParam)); | |
258 } | |
259 | |
260 void DIB_PumpEvents(_THIS) | |
261 { | |
262 MSG msg; | |
263 | |
523
c210010f50f4
Fixed windows event handling for ActiveX controls (thanks Huib-Jan!)
Sam Lantinga <slouken@libsdl.org>
parents:
515
diff
changeset
|
264 while ( PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) ) { |
c210010f50f4
Fixed windows event handling for ActiveX controls (thanks Huib-Jan!)
Sam Lantinga <slouken@libsdl.org>
parents:
515
diff
changeset
|
265 if ( GetMessage(&msg, NULL, 0, 0) > 0 ) { |
0 | 266 DispatchMessage(&msg); |
267 } | |
268 } | |
269 } | |
270 | |
1852
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
271 static HKL hLayoutUS = NULL; |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
272 |
0 | 273 void DIB_InitOSKeymap(_THIS) |
274 { | |
1852
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
275 int i; |
3868 | 276 #ifndef _WIN32_WCE |
277 char current_layout[KL_NAMELENGTH]; | |
1852
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
278 |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
279 GetKeyboardLayoutName(current_layout); |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
280 //printf("Initial Keyboard Layout Name: '%s'\n", current_layout); |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
281 |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
282 hLayoutUS = LoadKeyboardLayout("00000409", KLF_NOTELLSHELL); |
3868 | 283 |
1852
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
284 if (!hLayoutUS) { |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
285 //printf("Failed to load US keyboard layout. Using current.\n"); |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
286 hLayoutUS = GetKeyboardLayout(0); |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
287 } |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
288 LoadKeyboardLayout(current_layout, KLF_ACTIVATE); |
3868 | 289 #else |
290 #if _WIN32_WCE >=420 | |
291 TCHAR current_layout[KL_NAMELENGTH]; | |
0 | 292 |
3868 | 293 GetKeyboardLayoutName(current_layout); |
294 //printf("Initial Keyboard Layout Name: '%s'\n", current_layout); | |
295 | |
296 hLayoutUS = LoadKeyboardLayout(L"00000409", 0); | |
297 | |
298 if (!hLayoutUS) { | |
299 //printf("Failed to load US keyboard layout. Using current.\n"); | |
300 hLayoutUS = GetKeyboardLayout(0); | |
301 } | |
302 LoadKeyboardLayout(current_layout, 0); | |
303 #endif // _WIN32_WCE >=420 | |
304 #endif | |
0 | 305 /* Map the VK keysyms */ |
1379
c0a74f199ecf
Use only safe string functions
Sam Lantinga <slouken@libsdl.org>
parents:
1361
diff
changeset
|
306 for ( i=0; i<SDL_arraysize(VK_keymap); ++i ) |
0 | 307 VK_keymap[i] = SDLK_UNKNOWN; |
308 | |
309 VK_keymap[VK_BACK] = SDLK_BACKSPACE; | |
310 VK_keymap[VK_TAB] = SDLK_TAB; | |
311 VK_keymap[VK_CLEAR] = SDLK_CLEAR; | |
312 VK_keymap[VK_RETURN] = SDLK_RETURN; | |
313 VK_keymap[VK_PAUSE] = SDLK_PAUSE; | |
314 VK_keymap[VK_ESCAPE] = SDLK_ESCAPE; | |
315 VK_keymap[VK_SPACE] = SDLK_SPACE; | |
316 VK_keymap[VK_APOSTROPHE] = SDLK_QUOTE; | |
317 VK_keymap[VK_COMMA] = SDLK_COMMA; | |
318 VK_keymap[VK_MINUS] = SDLK_MINUS; | |
319 VK_keymap[VK_PERIOD] = SDLK_PERIOD; | |
320 VK_keymap[VK_SLASH] = SDLK_SLASH; | |
321 VK_keymap[VK_0] = SDLK_0; | |
322 VK_keymap[VK_1] = SDLK_1; | |
323 VK_keymap[VK_2] = SDLK_2; | |
324 VK_keymap[VK_3] = SDLK_3; | |
325 VK_keymap[VK_4] = SDLK_4; | |
326 VK_keymap[VK_5] = SDLK_5; | |
327 VK_keymap[VK_6] = SDLK_6; | |
328 VK_keymap[VK_7] = SDLK_7; | |
329 VK_keymap[VK_8] = SDLK_8; | |
330 VK_keymap[VK_9] = SDLK_9; | |
331 VK_keymap[VK_SEMICOLON] = SDLK_SEMICOLON; | |
332 VK_keymap[VK_EQUALS] = SDLK_EQUALS; | |
333 VK_keymap[VK_LBRACKET] = SDLK_LEFTBRACKET; | |
334 VK_keymap[VK_BACKSLASH] = SDLK_BACKSLASH; | |
1253
7c7ddaf195bf
Implemented ToUnicode() support on Windows 95/98/ME/NT/2000/XP
Sam Lantinga <slouken@libsdl.org>
parents:
1251
diff
changeset
|
335 VK_keymap[VK_OEM_102] = SDLK_LESS; |
0 | 336 VK_keymap[VK_RBRACKET] = SDLK_RIGHTBRACKET; |
337 VK_keymap[VK_GRAVE] = SDLK_BACKQUOTE; | |
327
13fc64213765
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
338 VK_keymap[VK_BACKTICK] = SDLK_BACKQUOTE; |
0 | 339 VK_keymap[VK_A] = SDLK_a; |
340 VK_keymap[VK_B] = SDLK_b; | |
341 VK_keymap[VK_C] = SDLK_c; | |
342 VK_keymap[VK_D] = SDLK_d; | |
343 VK_keymap[VK_E] = SDLK_e; | |
344 VK_keymap[VK_F] = SDLK_f; | |
345 VK_keymap[VK_G] = SDLK_g; | |
346 VK_keymap[VK_H] = SDLK_h; | |
347 VK_keymap[VK_I] = SDLK_i; | |
348 VK_keymap[VK_J] = SDLK_j; | |
349 VK_keymap[VK_K] = SDLK_k; | |
350 VK_keymap[VK_L] = SDLK_l; | |
351 VK_keymap[VK_M] = SDLK_m; | |
352 VK_keymap[VK_N] = SDLK_n; | |
353 VK_keymap[VK_O] = SDLK_o; | |
354 VK_keymap[VK_P] = SDLK_p; | |
355 VK_keymap[VK_Q] = SDLK_q; | |
356 VK_keymap[VK_R] = SDLK_r; | |
357 VK_keymap[VK_S] = SDLK_s; | |
358 VK_keymap[VK_T] = SDLK_t; | |
359 VK_keymap[VK_U] = SDLK_u; | |
360 VK_keymap[VK_V] = SDLK_v; | |
361 VK_keymap[VK_W] = SDLK_w; | |
362 VK_keymap[VK_X] = SDLK_x; | |
363 VK_keymap[VK_Y] = SDLK_y; | |
364 VK_keymap[VK_Z] = SDLK_z; | |
365 VK_keymap[VK_DELETE] = SDLK_DELETE; | |
366 | |
367 VK_keymap[VK_NUMPAD0] = SDLK_KP0; | |
368 VK_keymap[VK_NUMPAD1] = SDLK_KP1; | |
369 VK_keymap[VK_NUMPAD2] = SDLK_KP2; | |
370 VK_keymap[VK_NUMPAD3] = SDLK_KP3; | |
371 VK_keymap[VK_NUMPAD4] = SDLK_KP4; | |
372 VK_keymap[VK_NUMPAD5] = SDLK_KP5; | |
373 VK_keymap[VK_NUMPAD6] = SDLK_KP6; | |
374 VK_keymap[VK_NUMPAD7] = SDLK_KP7; | |
375 VK_keymap[VK_NUMPAD8] = SDLK_KP8; | |
376 VK_keymap[VK_NUMPAD9] = SDLK_KP9; | |
377 VK_keymap[VK_DECIMAL] = SDLK_KP_PERIOD; | |
378 VK_keymap[VK_DIVIDE] = SDLK_KP_DIVIDE; | |
379 VK_keymap[VK_MULTIPLY] = SDLK_KP_MULTIPLY; | |
380 VK_keymap[VK_SUBTRACT] = SDLK_KP_MINUS; | |
381 VK_keymap[VK_ADD] = SDLK_KP_PLUS; | |
382 | |
383 VK_keymap[VK_UP] = SDLK_UP; | |
384 VK_keymap[VK_DOWN] = SDLK_DOWN; | |
385 VK_keymap[VK_RIGHT] = SDLK_RIGHT; | |
386 VK_keymap[VK_LEFT] = SDLK_LEFT; | |
387 VK_keymap[VK_INSERT] = SDLK_INSERT; | |
388 VK_keymap[VK_HOME] = SDLK_HOME; | |
389 VK_keymap[VK_END] = SDLK_END; | |
390 VK_keymap[VK_PRIOR] = SDLK_PAGEUP; | |
391 VK_keymap[VK_NEXT] = SDLK_PAGEDOWN; | |
392 | |
393 VK_keymap[VK_F1] = SDLK_F1; | |
394 VK_keymap[VK_F2] = SDLK_F2; | |
395 VK_keymap[VK_F3] = SDLK_F3; | |
396 VK_keymap[VK_F4] = SDLK_F4; | |
397 VK_keymap[VK_F5] = SDLK_F5; | |
398 VK_keymap[VK_F6] = SDLK_F6; | |
399 VK_keymap[VK_F7] = SDLK_F7; | |
400 VK_keymap[VK_F8] = SDLK_F8; | |
401 VK_keymap[VK_F9] = SDLK_F9; | |
402 VK_keymap[VK_F10] = SDLK_F10; | |
403 VK_keymap[VK_F11] = SDLK_F11; | |
404 VK_keymap[VK_F12] = SDLK_F12; | |
405 VK_keymap[VK_F13] = SDLK_F13; | |
406 VK_keymap[VK_F14] = SDLK_F14; | |
407 VK_keymap[VK_F15] = SDLK_F15; | |
408 | |
409 VK_keymap[VK_NUMLOCK] = SDLK_NUMLOCK; | |
410 VK_keymap[VK_CAPITAL] = SDLK_CAPSLOCK; | |
411 VK_keymap[VK_SCROLL] = SDLK_SCROLLOCK; | |
412 VK_keymap[VK_RSHIFT] = SDLK_RSHIFT; | |
413 VK_keymap[VK_LSHIFT] = SDLK_LSHIFT; | |
414 VK_keymap[VK_RCONTROL] = SDLK_RCTRL; | |
415 VK_keymap[VK_LCONTROL] = SDLK_LCTRL; | |
416 VK_keymap[VK_RMENU] = SDLK_RALT; | |
417 VK_keymap[VK_LMENU] = SDLK_LALT; | |
418 VK_keymap[VK_RWIN] = SDLK_RSUPER; | |
419 VK_keymap[VK_LWIN] = SDLK_LSUPER; | |
420 | |
421 VK_keymap[VK_HELP] = SDLK_HELP; | |
422 #ifdef VK_PRINT | |
423 VK_keymap[VK_PRINT] = SDLK_PRINT; | |
424 #endif | |
425 VK_keymap[VK_SNAPSHOT] = SDLK_PRINT; | |
426 VK_keymap[VK_CANCEL] = SDLK_BREAK; | |
427 VK_keymap[VK_APPS] = SDLK_MENU; | |
428 } | |
429 | |
1852
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
430 #define EXTKEYPAD(keypad) ((scancode & 0x100)?(mvke):(keypad)) |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
431 |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
432 static int SDL_MapVirtualKey(int scancode, int vkey) |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
433 { |
3868 | 434 #ifndef _WIN32_WCE |
1852
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
435 int mvke = MapVirtualKeyEx(scancode & 0xFF, 1, hLayoutUS); |
3868 | 436 #else |
437 int mvke = MapVirtualKey(scancode & 0xFF, 1); | |
438 #endif | |
1852
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
439 |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
440 switch(vkey) { |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
441 /* These are always correct */ |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
442 case VK_DIVIDE: |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
443 case VK_MULTIPLY: |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
444 case VK_SUBTRACT: |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
445 case VK_ADD: |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
446 case VK_LWIN: |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
447 case VK_RWIN: |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
448 case VK_APPS: |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
449 /* These are already handled */ |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
450 case VK_LCONTROL: |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
451 case VK_RCONTROL: |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
452 case VK_LSHIFT: |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
453 case VK_RSHIFT: |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
454 case VK_LMENU: |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
455 case VK_RMENU: |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
456 case VK_SNAPSHOT: |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
457 case VK_PAUSE: |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
458 return vkey; |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
459 } |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
460 switch(mvke) { |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
461 /* Distinguish between keypad and extended keys */ |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
462 case VK_INSERT: return EXTKEYPAD(VK_NUMPAD0); |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
463 case VK_DELETE: return EXTKEYPAD(VK_DECIMAL); |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
464 case VK_END: return EXTKEYPAD(VK_NUMPAD1); |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
465 case VK_DOWN: return EXTKEYPAD(VK_NUMPAD2); |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
466 case VK_NEXT: return EXTKEYPAD(VK_NUMPAD3); |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
467 case VK_LEFT: return EXTKEYPAD(VK_NUMPAD4); |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
468 case VK_CLEAR: return EXTKEYPAD(VK_NUMPAD5); |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
469 case VK_RIGHT: return EXTKEYPAD(VK_NUMPAD6); |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
470 case VK_HOME: return EXTKEYPAD(VK_NUMPAD7); |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
471 case VK_UP: return EXTKEYPAD(VK_NUMPAD8); |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
472 case VK_PRIOR: return EXTKEYPAD(VK_NUMPAD9); |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
473 } |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
474 return mvke?mvke:vkey; |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
475 } |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
476 |
1472
4aac8563c296
Fixed more Win64 portability issues
Sam Lantinga <slouken@libsdl.org>
parents:
1456
diff
changeset
|
477 static SDL_keysym *TranslateKey(WPARAM vkey, UINT scancode, SDL_keysym *keysym, int pressed) |
0 | 478 { |
479 /* Set the keysym information */ | |
480 keysym->scancode = (unsigned char) scancode; | |
481 keysym->mod = KMOD_NONE; | |
482 keysym->unicode = 0; | |
1253
7c7ddaf195bf
Implemented ToUnicode() support on Windows 95/98/ME/NT/2000/XP
Sam Lantinga <slouken@libsdl.org>
parents:
1251
diff
changeset
|
483 if ( pressed && SDL_TranslateUNICODE ) { |
0 | 484 #ifdef NO_GETKEYBOARDSTATE |
485 /* Uh oh, better hope the vkey is close enough.. */ | |
486 keysym->unicode = vkey; | |
487 #else | |
1253
7c7ddaf195bf
Implemented ToUnicode() support on Windows 95/98/ME/NT/2000/XP
Sam Lantinga <slouken@libsdl.org>
parents:
1251
diff
changeset
|
488 BYTE keystate[256]; |
7c7ddaf195bf
Implemented ToUnicode() support on Windows 95/98/ME/NT/2000/XP
Sam Lantinga <slouken@libsdl.org>
parents:
1251
diff
changeset
|
489 Uint16 wchars[2]; |
0 | 490 |
491 GetKeyboardState(keystate); | |
1480 | 492 if (SDL_ToUnicode((UINT)vkey, scancode, keystate, wchars, sizeof(wchars)/sizeof(wchars[0]), 0) == 1) |
1253
7c7ddaf195bf
Implemented ToUnicode() support on Windows 95/98/ME/NT/2000/XP
Sam Lantinga <slouken@libsdl.org>
parents:
1251
diff
changeset
|
493 { |
7c7ddaf195bf
Implemented ToUnicode() support on Windows 95/98/ME/NT/2000/XP
Sam Lantinga <slouken@libsdl.org>
parents:
1251
diff
changeset
|
494 keysym->unicode = wchars[0]; |
0 | 495 } |
496 #endif /* NO_GETKEYBOARDSTATE */ | |
497 } | |
1852
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
498 |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
499 if ((vkey == VK_RETURN) && (scancode & 0x100)) { |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
500 /* No VK_ code for the keypad enter key */ |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
501 keysym->sym = SDLK_KP_ENTER; |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
502 } |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
503 else { |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
504 keysym->sym = VK_keymap[SDL_MapVirtualKey(scancode, vkey)]; |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
505 } |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
506 |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
507 #if 0 |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
508 { |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
509 HKL hLayoutCurrent = GetKeyboardLayout(0); |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
510 int sc = scancode & 0xFF; |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
511 |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
512 printf("SYM:%d, VK:0x%02X, SC:0x%04X, US:(1:0x%02X, 3:0x%02X), " |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
513 "Current:(1:0x%02X, 3:0x%02X)\n", |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
514 keysym->sym, vkey, scancode, |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
515 MapVirtualKeyEx(sc, 1, hLayoutUS), |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
516 MapVirtualKeyEx(sc, 3, hLayoutUS), |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
517 MapVirtualKeyEx(sc, 1, hLayoutCurrent), |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
518 MapVirtualKeyEx(sc, 3, hLayoutCurrent) |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
519 ); |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
520 } |
eb2d5480ae95
Try to keep SDL keysyms sane regardless of keyboard layout in windib target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1526
diff
changeset
|
521 #endif |
0 | 522 return(keysym); |
523 } | |
524 | |
525 int DIB_CreateWindow(_THIS) | |
526 { | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1330
diff
changeset
|
527 char *windowid = SDL_getenv("SDL_WINDOWID"); |
1152
51a8702d8ecd
Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at
Ryan C. Gordon <icculus@icculus.org>
parents:
1048
diff
changeset
|
528 |
1288
ea3888b472bf
Cleaned up the app registration stuff a bit
Sam Lantinga <slouken@libsdl.org>
parents:
1282
diff
changeset
|
529 SDL_RegisterApp(NULL, 0, 0); |
1280
f61f045343d3
Re-query the SDL_WINDOWID each time we initialize the video
Sam Lantinga <slouken@libsdl.org>
parents:
1264
diff
changeset
|
530 |
f61f045343d3
Re-query the SDL_WINDOWID each time we initialize the video
Sam Lantinga <slouken@libsdl.org>
parents:
1264
diff
changeset
|
531 SDL_windowid = (windowid != NULL); |
0 | 532 if ( SDL_windowid ) { |
1152
51a8702d8ecd
Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at
Ryan C. Gordon <icculus@icculus.org>
parents:
1048
diff
changeset
|
533 #if defined(_WIN32_WCE) && (_WIN32_WCE < 300) |
1280
f61f045343d3
Re-query the SDL_WINDOWID each time we initialize the video
Sam Lantinga <slouken@libsdl.org>
parents:
1264
diff
changeset
|
534 /* wince 2.1 does not have strtol */ |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1330
diff
changeset
|
535 wchar_t *windowid_t = SDL_malloc((SDL_strlen(windowid) + 1) * sizeof(wchar_t)); |
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1330
diff
changeset
|
536 MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, windowid, -1, windowid_t, SDL_strlen(windowid) + 1); |
1280
f61f045343d3
Re-query the SDL_WINDOWID each time we initialize the video
Sam Lantinga <slouken@libsdl.org>
parents:
1264
diff
changeset
|
537 SDL_Window = (HWND)wcstol(windowid_t, NULL, 0); |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1330
diff
changeset
|
538 SDL_free(windowid_t); |
1152
51a8702d8ecd
Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at
Ryan C. Gordon <icculus@icculus.org>
parents:
1048
diff
changeset
|
539 #else |
1456
84de7511f79f
Fixed a bunch of 64-bit compatibility problems
Sam Lantinga <slouken@libsdl.org>
parents:
1433
diff
changeset
|
540 SDL_Window = (HWND)SDL_strtoull(windowid, NULL, 0); |
1152
51a8702d8ecd
Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at
Ryan C. Gordon <icculus@icculus.org>
parents:
1048
diff
changeset
|
541 #endif |
974
b8427b5151ed
Restore the user specified window proc after shutdown
Sam Lantinga <slouken@libsdl.org>
parents:
833
diff
changeset
|
542 if ( SDL_Window == NULL ) { |
b8427b5151ed
Restore the user specified window proc after shutdown
Sam Lantinga <slouken@libsdl.org>
parents:
833
diff
changeset
|
543 SDL_SetError("Couldn't get user specified window"); |
b8427b5151ed
Restore the user specified window proc after shutdown
Sam Lantinga <slouken@libsdl.org>
parents:
833
diff
changeset
|
544 return(-1); |
b8427b5151ed
Restore the user specified window proc after shutdown
Sam Lantinga <slouken@libsdl.org>
parents:
833
diff
changeset
|
545 } |
b8427b5151ed
Restore the user specified window proc after shutdown
Sam Lantinga <slouken@libsdl.org>
parents:
833
diff
changeset
|
546 |
b8427b5151ed
Restore the user specified window proc after shutdown
Sam Lantinga <slouken@libsdl.org>
parents:
833
diff
changeset
|
547 /* DJM: we want all event's for the user specified |
b8427b5151ed
Restore the user specified window proc after shutdown
Sam Lantinga <slouken@libsdl.org>
parents:
833
diff
changeset
|
548 window to be handled by SDL. |
b8427b5151ed
Restore the user specified window proc after shutdown
Sam Lantinga <slouken@libsdl.org>
parents:
833
diff
changeset
|
549 */ |
1472
4aac8563c296
Fixed more Win64 portability issues
Sam Lantinga <slouken@libsdl.org>
parents:
1456
diff
changeset
|
550 userWindowProc = (WNDPROCTYPE)GetWindowLongPtr(SDL_Window, GWLP_WNDPROC); |
4aac8563c296
Fixed more Win64 portability issues
Sam Lantinga <slouken@libsdl.org>
parents:
1456
diff
changeset
|
551 SetWindowLongPtr(SDL_Window, GWLP_WNDPROC, (LONG_PTR)WinMessage); |
0 | 552 } else { |
553 SDL_Window = CreateWindow(SDL_Appname, SDL_Appname, | |
554 (WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX), | |
833
31fa08b36380
Added support for SDL_VIDEO_WINDOW_POS and SDL_VIDEO_CENTERED on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
555 CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, NULL, NULL, SDL_Instance, NULL); |
0 | 556 if ( SDL_Window == NULL ) { |
557 SDL_SetError("Couldn't create window"); | |
558 return(-1); | |
559 } | |
560 ShowWindow(SDL_Window, SW_HIDE); | |
561 } | |
1523 | 562 |
563 /* JC 14 Mar 2006 | |
564 Flush the message loop or this can cause big problems later | |
565 Especially if the user decides to use dialog boxes or assert()! | |
566 */ | |
567 WIN_FlushMessageQueue(); | |
568 | |
0 | 569 return(0); |
570 } | |
571 | |
572 void DIB_DestroyWindow(_THIS) | |
573 { | |
974
b8427b5151ed
Restore the user specified window proc after shutdown
Sam Lantinga <slouken@libsdl.org>
parents:
833
diff
changeset
|
574 if ( SDL_windowid ) { |
1472
4aac8563c296
Fixed more Win64 portability issues
Sam Lantinga <slouken@libsdl.org>
parents:
1456
diff
changeset
|
575 SetWindowLongPtr(SDL_Window, GWLP_WNDPROC, (LONG_PTR)userWindowProc); |
974
b8427b5151ed
Restore the user specified window proc after shutdown
Sam Lantinga <slouken@libsdl.org>
parents:
833
diff
changeset
|
576 } else { |
0 | 577 DestroyWindow(SDL_Window); |
578 } | |
1288
ea3888b472bf
Cleaned up the app registration stuff a bit
Sam Lantinga <slouken@libsdl.org>
parents:
1282
diff
changeset
|
579 SDL_UnregisterApp(); |
1523 | 580 |
581 /* JC 14 Mar 2006 | |
582 Flush the message loop or this can cause big problems later | |
583 Especially if the user decides to use dialog boxes or assert()! | |
584 */ | |
585 WIN_FlushMessageQueue(); | |
0 | 586 } |