annotate src/video/windows/SDL_windowsevents.c @ 5088:c2539ff054c8

Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
author Sam Lantinga <slouken@libsdl.org>
date Mon, 24 Jan 2011 15:46:11 -0800
parents e8916fe9cfc8
children 57851a238c8f
rev   line source
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1 /*
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
3697
f7b03b6838cb Fixed bug #926
Sam Lantinga <slouken@libsdl.org>
parents: 3685
diff changeset
3 Copyright (C) 1997-2010 Sam Lantinga
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
4
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
6 modify it under the terms of the GNU Lesser General Public
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
9
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
13 Lesser General Public License for more details.
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
14
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
15 You should have received a copy of the GNU Lesser General Public
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
16 License along with this library; if not, write to the Free Software
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
18
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
19 Sam Lantinga
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
20 slouken@libsdl.org
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
21 */
2710
44e49d3fa6cf Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents: 2324
diff changeset
22
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
23 #include "SDL_config.h"
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
24
5062
e8916fe9cfc8 Fixed bug #925
Sam Lantinga <slouken@libsdl.org>
parents: 5056
diff changeset
25 #include "SDL_windowsvideo.h"
e8916fe9cfc8 Fixed bug #925
Sam Lantinga <slouken@libsdl.org>
parents: 5056
diff changeset
26 #include "SDL_windowsshape.h"
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
27 #include "SDL_syswm.h"
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
28 #include "SDL_vkeys.h"
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
29 #include "../../events/SDL_events_c.h"
4919
716b2cbf4c9e First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents: 4902
diff changeset
30 #include "../../events/SDL_touch_c.h"
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
31
4650
7ad7a473b086 More fixes for windows. Disabled tablet code.
jimtla
parents: 4429
diff changeset
32
7ad7a473b086 More fixes for windows. Disabled tablet code.
jimtla
parents: 4429
diff changeset
33
4868
d6adaafcfb10 Fixed compiling with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents: 4862
diff changeset
34 /*#define WMMSG_DEBUG*/
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
35 #ifdef WMMSG_DEBUG
4650
7ad7a473b086 More fixes for windows. Disabled tablet code.
jimtla
parents: 4429
diff changeset
36 #include <stdio.h>
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
37 #include "wmmsg.h"
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
38 #endif
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
39
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
40 /* Masks for processing the windows KEYDOWN and KEYUP messages */
2317
f537a293b3da Windows also remaps the numeric keypad... grrr
Sam Lantinga <slouken@libsdl.org>
parents: 2313
diff changeset
41 #define REPEATED_KEYMASK (1<<30)
f537a293b3da Windows also remaps the numeric keypad... grrr
Sam Lantinga <slouken@libsdl.org>
parents: 2313
diff changeset
42 #define EXTENDED_KEYMASK (1<<24)
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
43
2324
3202e4826c57 more valgrind errors fixed. Plus I ran make indent which changed a few files.
Bob Pendleton <bob@pendleton.com>
parents: 2317
diff changeset
44 #define VK_ENTER 10 /* Keypad Enter ... no VKEY defined? */
2313
012ec5192dfa Added support for keypad enter
Sam Lantinga <slouken@libsdl.org>
parents: 2312
diff changeset
45
2127
3bcc26b74e42 Merged r3087:3089 from branches/SDL-1.2: WM_XBUTTON support.
Ryan C. Gordon <icculus@icculus.org>
parents: 1951
diff changeset
46 /* Make sure XBUTTON stuff is defined that isn't in older Platform SDKs... */
3bcc26b74e42 Merged r3087:3089 from branches/SDL-1.2: WM_XBUTTON support.
Ryan C. Gordon <icculus@icculus.org>
parents: 1951
diff changeset
47 #ifndef WM_XBUTTONDOWN
3bcc26b74e42 Merged r3087:3089 from branches/SDL-1.2: WM_XBUTTON support.
Ryan C. Gordon <icculus@icculus.org>
parents: 1951
diff changeset
48 #define WM_XBUTTONDOWN 0x020B
3bcc26b74e42 Merged r3087:3089 from branches/SDL-1.2: WM_XBUTTON support.
Ryan C. Gordon <icculus@icculus.org>
parents: 1951
diff changeset
49 #endif
3bcc26b74e42 Merged r3087:3089 from branches/SDL-1.2: WM_XBUTTON support.
Ryan C. Gordon <icculus@icculus.org>
parents: 1951
diff changeset
50 #ifndef WM_XBUTTONUP
3bcc26b74e42 Merged r3087:3089 from branches/SDL-1.2: WM_XBUTTON support.
Ryan C. Gordon <icculus@icculus.org>
parents: 1951
diff changeset
51 #define WM_XBUTTONUP 0x020C
3bcc26b74e42 Merged r3087:3089 from branches/SDL-1.2: WM_XBUTTON support.
Ryan C. Gordon <icculus@icculus.org>
parents: 1951
diff changeset
52 #endif
3bcc26b74e42 Merged r3087:3089 from branches/SDL-1.2: WM_XBUTTON support.
Ryan C. Gordon <icculus@icculus.org>
parents: 1951
diff changeset
53 #ifndef GET_XBUTTON_WPARAM
3bcc26b74e42 Merged r3087:3089 from branches/SDL-1.2: WM_XBUTTON support.
Ryan C. Gordon <icculus@icculus.org>
parents: 1951
diff changeset
54 #define GET_XBUTTON_WPARAM(w) (HIWORD(w))
3bcc26b74e42 Merged r3087:3089 from branches/SDL-1.2: WM_XBUTTON support.
Ryan C. Gordon <icculus@icculus.org>
parents: 1951
diff changeset
55 #endif
2733
264037dd3c7a Fix for mingw compilation by Alam.
Edgar Simo <bobbens@gmail.com>
parents: 2726
diff changeset
56 #ifndef WM_INPUT
264037dd3c7a Fix for mingw compilation by Alam.
Edgar Simo <bobbens@gmail.com>
parents: 2726
diff changeset
57 #define WM_INPUT 0x00ff
264037dd3c7a Fix for mingw compilation by Alam.
Edgar Simo <bobbens@gmail.com>
parents: 2726
diff changeset
58 #endif
4932
0d1bb1ce9d15 Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4919
diff changeset
59 #ifndef WM_TOUCH
4868
d6adaafcfb10 Fixed compiling with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents: 4862
diff changeset
60 #define WM_TOUCH 0x0240
4932
0d1bb1ce9d15 Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4919
diff changeset
61 #endif
4919
716b2cbf4c9e First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents: 4902
diff changeset
62
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
63
2310
2f31ce8f1149 Undo keyboard layout based alphabetic key mapping. Grr.... HACK HACK HACK...
Sam Lantinga <slouken@libsdl.org>
parents: 2309
diff changeset
64 static WPARAM
2f31ce8f1149 Undo keyboard layout based alphabetic key mapping. Grr.... HACK HACK HACK...
Sam Lantinga <slouken@libsdl.org>
parents: 2309
diff changeset
65 RemapVKEY(WPARAM wParam, LPARAM lParam)
2f31ce8f1149 Undo keyboard layout based alphabetic key mapping. Grr.... HACK HACK HACK...
Sam Lantinga <slouken@libsdl.org>
parents: 2309
diff changeset
66 {
2317
f537a293b3da Windows also remaps the numeric keypad... grrr
Sam Lantinga <slouken@libsdl.org>
parents: 2313
diff changeset
67 int i;
2324
3202e4826c57 more valgrind errors fixed. Plus I ran make indent which changed a few files.
Bob Pendleton <bob@pendleton.com>
parents: 2317
diff changeset
68 BYTE scancode = (BYTE) ((lParam >> 16) & 0xFF);
2317
f537a293b3da Windows also remaps the numeric keypad... grrr
Sam Lantinga <slouken@libsdl.org>
parents: 2313
diff changeset
69
2310
2f31ce8f1149 Undo keyboard layout based alphabetic key mapping. Grr.... HACK HACK HACK...
Sam Lantinga <slouken@libsdl.org>
parents: 2309
diff changeset
70 /* Windows remaps alphabetic keys based on current layout.
2f31ce8f1149 Undo keyboard layout based alphabetic key mapping. Grr.... HACK HACK HACK...
Sam Lantinga <slouken@libsdl.org>
parents: 2309
diff changeset
71 We try to provide USB scancodes, so undo this mapping.
2f31ce8f1149 Undo keyboard layout based alphabetic key mapping. Grr.... HACK HACK HACK...
Sam Lantinga <slouken@libsdl.org>
parents: 2309
diff changeset
72 */
2f31ce8f1149 Undo keyboard layout based alphabetic key mapping. Grr.... HACK HACK HACK...
Sam Lantinga <slouken@libsdl.org>
parents: 2309
diff changeset
73 if (wParam >= 'A' && wParam <= 'Z') {
2311
54e21acfec5a Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents: 2310
diff changeset
74 if (scancode != alpha_scancodes[wParam - 'A']) {
54e21acfec5a Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents: 2310
diff changeset
75 for (i = 0; i < SDL_arraysize(alpha_scancodes); ++i) {
54e21acfec5a Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents: 2310
diff changeset
76 if (scancode == alpha_scancodes[i]) {
2310
2f31ce8f1149 Undo keyboard layout based alphabetic key mapping. Grr.... HACK HACK HACK...
Sam Lantinga <slouken@libsdl.org>
parents: 2309
diff changeset
77 wParam = 'A' + i;
2f31ce8f1149 Undo keyboard layout based alphabetic key mapping. Grr.... HACK HACK HACK...
Sam Lantinga <slouken@libsdl.org>
parents: 2309
diff changeset
78 break;
2f31ce8f1149 Undo keyboard layout based alphabetic key mapping. Grr.... HACK HACK HACK...
Sam Lantinga <slouken@libsdl.org>
parents: 2309
diff changeset
79 }
2f31ce8f1149 Undo keyboard layout based alphabetic key mapping. Grr.... HACK HACK HACK...
Sam Lantinga <slouken@libsdl.org>
parents: 2309
diff changeset
80 }
2f31ce8f1149 Undo keyboard layout based alphabetic key mapping. Grr.... HACK HACK HACK...
Sam Lantinga <slouken@libsdl.org>
parents: 2309
diff changeset
81 }
2f31ce8f1149 Undo keyboard layout based alphabetic key mapping. Grr.... HACK HACK HACK...
Sam Lantinga <slouken@libsdl.org>
parents: 2309
diff changeset
82 }
2317
f537a293b3da Windows also remaps the numeric keypad... grrr
Sam Lantinga <slouken@libsdl.org>
parents: 2313
diff changeset
83
3700
076c12750bc4 Fixed bug #743
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
84 /* Keypad keys are a little trickier, we always scan for them.
076c12750bc4 Fixed bug #743
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
85 Keypad arrow keys have the same scancode as normal arrow keys,
076c12750bc4 Fixed bug #743
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
86 except they don't have the extended bit (0x1000000) set.
076c12750bc4 Fixed bug #743
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
87 */
076c12750bc4 Fixed bug #743
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
88 if (!(lParam & 0x1000000)) {
4561
e4b2b7207f79 Fixed remapping the Delete key and detecting the keypad Delete key.
Sam Lantinga <slouken@libsdl.org>
parents: 4560
diff changeset
89 if (wParam == VK_DELETE) {
e4b2b7207f79 Fixed remapping the Delete key and detecting the keypad Delete key.
Sam Lantinga <slouken@libsdl.org>
parents: 4560
diff changeset
90 wParam = VK_DECIMAL;
e4b2b7207f79 Fixed remapping the Delete key and detecting the keypad Delete key.
Sam Lantinga <slouken@libsdl.org>
parents: 4560
diff changeset
91 } else {
e4b2b7207f79 Fixed remapping the Delete key and detecting the keypad Delete key.
Sam Lantinga <slouken@libsdl.org>
parents: 4560
diff changeset
92 for (i = 0; i < SDL_arraysize(keypad_scancodes); ++i) {
e4b2b7207f79 Fixed remapping the Delete key and detecting the keypad Delete key.
Sam Lantinga <slouken@libsdl.org>
parents: 4560
diff changeset
93 if (scancode == keypad_scancodes[i]) {
e4b2b7207f79 Fixed remapping the Delete key and detecting the keypad Delete key.
Sam Lantinga <slouken@libsdl.org>
parents: 4560
diff changeset
94 wParam = VK_NUMPAD0 + i;
e4b2b7207f79 Fixed remapping the Delete key and detecting the keypad Delete key.
Sam Lantinga <slouken@libsdl.org>
parents: 4560
diff changeset
95 break;
e4b2b7207f79 Fixed remapping the Delete key and detecting the keypad Delete key.
Sam Lantinga <slouken@libsdl.org>
parents: 4560
diff changeset
96 }
3700
076c12750bc4 Fixed bug #743
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
97 }
2317
f537a293b3da Windows also remaps the numeric keypad... grrr
Sam Lantinga <slouken@libsdl.org>
parents: 2313
diff changeset
98 }
f537a293b3da Windows also remaps the numeric keypad... grrr
Sam Lantinga <slouken@libsdl.org>
parents: 2313
diff changeset
99 }
f537a293b3da Windows also remaps the numeric keypad... grrr
Sam Lantinga <slouken@libsdl.org>
parents: 2313
diff changeset
100
2310
2f31ce8f1149 Undo keyboard layout based alphabetic key mapping. Grr.... HACK HACK HACK...
Sam Lantinga <slouken@libsdl.org>
parents: 2309
diff changeset
101 return wParam;
2f31ce8f1149 Undo keyboard layout based alphabetic key mapping. Grr.... HACK HACK HACK...
Sam Lantinga <slouken@libsdl.org>
parents: 2309
diff changeset
102 }
2f31ce8f1149 Undo keyboard layout based alphabetic key mapping. Grr.... HACK HACK HACK...
Sam Lantinga <slouken@libsdl.org>
parents: 2309
diff changeset
103
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
104 LRESULT CALLBACK
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
105 WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
106 {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
107 SDL_WindowData *data;
3566
07c8339c95c6 Fixed bug #905
Sam Lantinga <slouken@libsdl.org>
parents: 3565
diff changeset
108 LRESULT returnCode = -1;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
109
1951
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1913
diff changeset
110 /* Send a SDL_SYSWMEVENT if the application wants them */
4429
faa9fc8e7f67 General improvements for user custom event registration
Sam Lantinga <slouken@libsdl.org>
parents: 3700
diff changeset
111 if (SDL_GetEventState(SDL_SYSWMEVENT) == SDL_ENABLE) {
1951
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1913
diff changeset
112 SDL_SysWMmsg wmmsg;
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1913
diff changeset
113
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1913
diff changeset
114 SDL_VERSION(&wmmsg.version);
4900
69d9db65f248 Merged the Windows custom window system hooks into the union used by X11.
Sam Lantinga <slouken@libsdl.org>
parents: 4868
diff changeset
115 wmmsg.subsystem = SDL_SYSWM_WINDOWS;
5056
8b7988f42fcb Added the ability to get the UIKit window through the SDL API.
Sam Lantinga <slouken@libsdl.org>
parents: 5049
diff changeset
116 wmmsg.msg.win.hwnd = hwnd;
8b7988f42fcb Added the ability to get the UIKit window through the SDL API.
Sam Lantinga <slouken@libsdl.org>
parents: 5049
diff changeset
117 wmmsg.msg.win.msg = msg;
8b7988f42fcb Added the ability to get the UIKit window through the SDL API.
Sam Lantinga <slouken@libsdl.org>
parents: 5049
diff changeset
118 wmmsg.msg.win.wParam = wParam;
8b7988f42fcb Added the ability to get the UIKit window through the SDL API.
Sam Lantinga <slouken@libsdl.org>
parents: 5049
diff changeset
119 wmmsg.msg.win.lParam = lParam;
1951
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1913
diff changeset
120 SDL_SendSysWMEvent(&wmmsg);
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1913
diff changeset
121 }
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1913
diff changeset
122
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
123 /* Get the window data for the window */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
124 data = (SDL_WindowData *) GetProp(hwnd, TEXT("SDL_WindowData"));
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
125 if (!data) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
126 return CallWindowProc(DefWindowProc, hwnd, msg, wParam, lParam);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
127 }
4650
7ad7a473b086 More fixes for windows. Disabled tablet code.
jimtla
parents: 4429
diff changeset
128
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
129 #ifdef WMMSG_DEBUG
4650
7ad7a473b086 More fixes for windows. Disabled tablet code.
jimtla
parents: 4429
diff changeset
130 {
7ad7a473b086 More fixes for windows. Disabled tablet code.
jimtla
parents: 4429
diff changeset
131 FILE *log = fopen("wmmsg.txt", "a");
1913
83420da906a5 Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
132 fprintf(log, "Received windows message: %p ", hwnd);
83420da906a5 Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
133 if (msg > MAX_WMMSG) {
83420da906a5 Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
134 fprintf(log, "%d", msg);
83420da906a5 Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
135 } else {
83420da906a5 Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
136 fprintf(log, "%s", wmtab[msg]);
83420da906a5 Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
137 }
83420da906a5 Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
138 fprintf(log, " -- 0x%X, 0x%X\n", wParam, lParam);
83420da906a5 Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
139 fclose(log);
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
140 }
4868
d6adaafcfb10 Fixed compiling with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents: 4862
diff changeset
141 #endif
2710
44e49d3fa6cf Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents: 2324
diff changeset
142
4752
dc7bdcf06367 Initial IMM implementation.
dewyatt
parents: 4746
diff changeset
143 if (IME_HandleMessage(hwnd, msg, wParam, &lParam, data->videodata))
dc7bdcf06367 Initial IMM implementation.
dewyatt
parents: 4746
diff changeset
144 return 0;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
145
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
146 switch (msg) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
147
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
148 case WM_SHOWWINDOW:
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
149 {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
150 if (wParam) {
3685
64ce267332c6 Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents: 3566
diff changeset
151 SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_SHOWN, 0, 0);
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
152 } else {
3685
64ce267332c6 Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents: 3566
diff changeset
153 SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_HIDDEN, 0, 0);
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
154 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
155 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
156 break;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
157
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
158 case WM_ACTIVATE:
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
159 {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
160 BOOL minimized;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
161
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
162 minimized = HIWORD(wParam);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
163 if (!minimized && (LOWORD(wParam) != WA_INACTIVE)) {
3685
64ce267332c6 Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents: 3566
diff changeset
164 SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_SHOWN, 0, 0);
64ce267332c6 Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents: 3566
diff changeset
165 SDL_SendWindowEvent(data->window,
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
166 SDL_WINDOWEVENT_RESTORED, 0, 0);
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3102
diff changeset
167 #ifndef _WIN32_WCE /* WinCE misses IsZoomed() */
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
168 if (IsZoomed(hwnd)) {
3685
64ce267332c6 Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents: 3566
diff changeset
169 SDL_SendWindowEvent(data->window,
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
170 SDL_WINDOWEVENT_MAXIMIZED, 0, 0);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
171 }
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3102
diff changeset
172 #endif
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4429
diff changeset
173 if (SDL_GetKeyboardFocus() != data->window) {
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4429
diff changeset
174 SDL_SetKeyboardFocus(data->window);
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
175 }
4504
9faebccfefb3 Amazingly the Windows code is almost identical to the Mac OS X code. :)
Sam Lantinga <slouken@libsdl.org>
parents: 4500
diff changeset
176 /*
9faebccfefb3 Amazingly the Windows code is almost identical to the Mac OS X code. :)
Sam Lantinga <slouken@libsdl.org>
parents: 4500
diff changeset
177 * FIXME: Update keyboard state
9faebccfefb3 Amazingly the Windows code is almost identical to the Mac OS X code. :)
Sam Lantinga <slouken@libsdl.org>
parents: 4500
diff changeset
178 */
9faebccfefb3 Amazingly the Windows code is almost identical to the Mac OS X code. :)
Sam Lantinga <slouken@libsdl.org>
parents: 4500
diff changeset
179 WIN_CheckClipboardUpdate(data->videodata);
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
180 } else {
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4429
diff changeset
181 if (SDL_GetKeyboardFocus() == data->window) {
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4429
diff changeset
182 SDL_SetKeyboardFocus(NULL);
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
183 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
184 if (minimized) {
3685
64ce267332c6 Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents: 3566
diff changeset
185 SDL_SendWindowEvent(data->window,
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
186 SDL_WINDOWEVENT_MINIMIZED, 0, 0);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
187 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
188 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
189 }
3566
07c8339c95c6 Fixed bug #905
Sam Lantinga <slouken@libsdl.org>
parents: 3565
diff changeset
190 returnCode = 0;
07c8339c95c6 Fixed bug #905
Sam Lantinga <slouken@libsdl.org>
parents: 3565
diff changeset
191 break;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
192
4470
a5878b271b74 Fixed mouse focus window reporting
Sam Lantinga <slouken@libsdl.org>
parents: 4465
diff changeset
193 case WM_MOUSEMOVE:
3097
0d12e8f1de3c Date: Thu, 05 Feb 2009 18:07:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 3095
diff changeset
194 #ifdef _WIN32_WCE
5088
c2539ff054c8 Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents: 5062
diff changeset
195 /* transform coords for VGA, WVGA... */
c2539ff054c8 Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents: 5062
diff changeset
196 {
c2539ff054c8 Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents: 5062
diff changeset
197 SDL_VideoData *videodata = data->videodata;
c2539ff054c8 Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents: 5062
diff changeset
198 if(videodata->CoordTransform &&
c2539ff054c8 Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents: 5062
diff changeset
199 (videodata->render == RENDER_GAPI || videodata->render == RENDER_RAW))
c2539ff054c8 Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents: 5062
diff changeset
200 {
c2539ff054c8 Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents: 5062
diff changeset
201 POINT pt;
c2539ff054c8 Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents: 5062
diff changeset
202 pt.x = LOWORD(lParam);
c2539ff054c8 Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents: 5062
diff changeset
203 pt.y = HIWORD(lParam);
c2539ff054c8 Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents: 5062
diff changeset
204 videodata->CoordTransform(data->window, &pt);
c2539ff054c8 Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents: 5062
diff changeset
205 SDL_SendMouseMotion(data->window, 0, pt.x, pt.y);
c2539ff054c8 Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents: 5062
diff changeset
206 break;
c2539ff054c8 Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents: 5062
diff changeset
207 }
c2539ff054c8 Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents: 5062
diff changeset
208 }
4569
e1664f94f026 Andrey A.
Sam Lantinga <slouken@libsdl.org>
parents: 4565
diff changeset
209 #endif
4484
9322f7db8603 Cleaned up the mouse window focus handling: you always pass in the relative window when sending a mouse event.
Sam Lantinga <slouken@libsdl.org>
parents: 4470
diff changeset
210 SDL_SendMouseMotion(data->window, 0, LOWORD(lParam), HIWORD(lParam));
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3102
diff changeset
211 break;
Sam Lantinga <slouken@libsdl.org>
parents: 3102
diff changeset
212
3097
0d12e8f1de3c Date: Thu, 05 Feb 2009 18:07:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 3095
diff changeset
213 case WM_LBUTTONDOWN:
4484
9322f7db8603 Cleaned up the mouse window focus handling: you always pass in the relative window when sending a mouse event.
Sam Lantinga <slouken@libsdl.org>
parents: 4470
diff changeset
214 SDL_SendMouseButton(data->window, SDL_PRESSED, SDL_BUTTON_LEFT);
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3102
diff changeset
215 break;
Sam Lantinga <slouken@libsdl.org>
parents: 3102
diff changeset
216
3097
0d12e8f1de3c Date: Thu, 05 Feb 2009 18:07:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 3095
diff changeset
217 case WM_LBUTTONUP:
4484
9322f7db8603 Cleaned up the mouse window focus handling: you always pass in the relative window when sending a mouse event.
Sam Lantinga <slouken@libsdl.org>
parents: 4470
diff changeset
218 SDL_SendMouseButton(data->window, SDL_RELEASED, SDL_BUTTON_LEFT);
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3102
diff changeset
219 break;
Sam Lantinga <slouken@libsdl.org>
parents: 3102
diff changeset
220
5049
28003ba91f57 John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents: 4932
diff changeset
221 case WM_RBUTTONDOWN:
28003ba91f57 John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents: 4932
diff changeset
222 SDL_SendMouseButton(data->window, SDL_PRESSED, SDL_BUTTON_RIGHT);
28003ba91f57 John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents: 4932
diff changeset
223 break;
28003ba91f57 John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents: 4932
diff changeset
224
28003ba91f57 John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents: 4932
diff changeset
225 case WM_RBUTTONUP:
28003ba91f57 John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents: 4932
diff changeset
226 SDL_SendMouseButton(data->window, SDL_RELEASED, SDL_BUTTON_RIGHT);
28003ba91f57 John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents: 4932
diff changeset
227 break;
28003ba91f57 John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents: 4932
diff changeset
228
28003ba91f57 John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents: 4932
diff changeset
229 case WM_MBUTTONDOWN:
28003ba91f57 John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents: 4932
diff changeset
230 SDL_SendMouseButton(data->window, SDL_PRESSED, SDL_BUTTON_MIDDLE);
28003ba91f57 John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents: 4932
diff changeset
231 break;
28003ba91f57 John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents: 4932
diff changeset
232
28003ba91f57 John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents: 4932
diff changeset
233 case WM_MBUTTONUP:
28003ba91f57 John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents: 4932
diff changeset
234 SDL_SendMouseButton(data->window, SDL_RELEASED, SDL_BUTTON_MIDDLE);
28003ba91f57 John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents: 4932
diff changeset
235 break;
28003ba91f57 John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents: 4932
diff changeset
236
28003ba91f57 John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents: 4932
diff changeset
237 case WM_XBUTTONDOWN:
28003ba91f57 John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents: 4932
diff changeset
238 SDL_SendMouseButton(data->window, SDL_PRESSED, SDL_BUTTON_X1 + GET_XBUTTON_WPARAM(wParam) - 1);
28003ba91f57 John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents: 4932
diff changeset
239 returnCode = TRUE;
28003ba91f57 John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents: 4932
diff changeset
240 break;
28003ba91f57 John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents: 4932
diff changeset
241
28003ba91f57 John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents: 4932
diff changeset
242 case WM_XBUTTONUP:
28003ba91f57 John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents: 4932
diff changeset
243 SDL_SendMouseButton(data->window, SDL_RELEASED, SDL_BUTTON_X1 + GET_XBUTTON_WPARAM(wParam) - 1);
28003ba91f57 John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents: 4932
diff changeset
244 returnCode = TRUE;
28003ba91f57 John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents: 4932
diff changeset
245 break;
28003ba91f57 John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents: 4932
diff changeset
246
28003ba91f57 John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents: 4932
diff changeset
247 case WM_MOUSEWHEEL:
28003ba91f57 John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents: 4932
diff changeset
248 {
28003ba91f57 John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents: 4932
diff changeset
249 int motion = (short) HIWORD(wParam);
28003ba91f57 John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents: 4932
diff changeset
250
28003ba91f57 John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents: 4932
diff changeset
251 SDL_SendMouseWheel(data->window, 0, motion);
28003ba91f57 John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents: 4932
diff changeset
252 break;
28003ba91f57 John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents: 4932
diff changeset
253 }
28003ba91f57 John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents: 4932
diff changeset
254
5088
c2539ff054c8 Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents: 5062
diff changeset
255 #ifdef WM_MOUSELEAVE
c2539ff054c8 Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents: 5062
diff changeset
256 /* FIXME: Do we need the SDL 1.2 hack to generate WM_MOUSELEAVE now? */
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
257 case WM_MOUSELEAVE:
4470
a5878b271b74 Fixed mouse focus window reporting
Sam Lantinga <slouken@libsdl.org>
parents: 4465
diff changeset
258 if (SDL_GetMouseFocus() == data->window) {
a5878b271b74 Fixed mouse focus window reporting
Sam Lantinga <slouken@libsdl.org>
parents: 4465
diff changeset
259 SDL_SetMouseFocus(NULL);
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
260 }
3566
07c8339c95c6 Fixed bug #905
Sam Lantinga <slouken@libsdl.org>
parents: 3565
diff changeset
261 returnCode = 0;
07c8339c95c6 Fixed bug #905
Sam Lantinga <slouken@libsdl.org>
parents: 3565
diff changeset
262 break;
5088
c2539ff054c8 Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents: 5062
diff changeset
263 #endif /* WM_MOUSELEAVE */
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
264
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
265 case WM_SYSKEYDOWN:
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
266 case WM_KEYDOWN:
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
267 {
2310
2f31ce8f1149 Undo keyboard layout based alphabetic key mapping. Grr.... HACK HACK HACK...
Sam Lantinga <slouken@libsdl.org>
parents: 2309
diff changeset
268 wParam = RemapVKEY(wParam, lParam);
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
269 switch (wParam) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
270 case VK_CONTROL:
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
271 if (lParam & EXTENDED_KEYMASK)
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
272 wParam = VK_RCONTROL;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
273 else
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
274 wParam = VK_LCONTROL;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
275 break;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
276 case VK_SHIFT:
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
277 /* EXTENDED trick doesn't work here */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
278 {
2308
514f7c1651fc Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents: 2284
diff changeset
279 Uint8 *state = SDL_GetKeyboardState(NULL);
514f7c1651fc Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents: 2284
diff changeset
280 if (state[SDL_SCANCODE_LSHIFT] == SDL_RELEASED
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
281 && (GetKeyState(VK_LSHIFT) & 0x8000)) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
282 wParam = VK_LSHIFT;
2308
514f7c1651fc Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents: 2284
diff changeset
283 } else if (state[SDL_SCANCODE_RSHIFT] == SDL_RELEASED
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
284 && (GetKeyState(VK_RSHIFT) & 0x8000)) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
285 wParam = VK_RSHIFT;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
286 } else {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
287 /* Probably a key repeat */
3566
07c8339c95c6 Fixed bug #905
Sam Lantinga <slouken@libsdl.org>
parents: 3565
diff changeset
288 wParam = 256;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
289 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
290 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
291 break;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
292 case VK_MENU:
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
293 if (lParam & EXTENDED_KEYMASK)
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
294 wParam = VK_RMENU;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
295 else
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
296 wParam = VK_LMENU;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
297 break;
2313
012ec5192dfa Added support for keypad enter
Sam Lantinga <slouken@libsdl.org>
parents: 2312
diff changeset
298 case VK_RETURN:
012ec5192dfa Added support for keypad enter
Sam Lantinga <slouken@libsdl.org>
parents: 2312
diff changeset
299 if (lParam & EXTENDED_KEYMASK)
012ec5192dfa Added support for keypad enter
Sam Lantinga <slouken@libsdl.org>
parents: 2312
diff changeset
300 wParam = VK_ENTER;
012ec5192dfa Added support for keypad enter
Sam Lantinga <slouken@libsdl.org>
parents: 2312
diff changeset
301 break;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
302 }
2308
514f7c1651fc Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents: 2284
diff changeset
303 if (wParam < 256) {
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4429
diff changeset
304 SDL_SendKeyboardKey(SDL_PRESSED,
2308
514f7c1651fc Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents: 2284
diff changeset
305 data->videodata->key_layout[wParam]);
514f7c1651fc Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents: 2284
diff changeset
306 }
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
307 }
3566
07c8339c95c6 Fixed bug #905
Sam Lantinga <slouken@libsdl.org>
parents: 3565
diff changeset
308 returnCode = 0;
07c8339c95c6 Fixed bug #905
Sam Lantinga <slouken@libsdl.org>
parents: 3565
diff changeset
309 break;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
310
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
311 case WM_SYSKEYUP:
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
312 case WM_KEYUP:
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
313 {
2310
2f31ce8f1149 Undo keyboard layout based alphabetic key mapping. Grr.... HACK HACK HACK...
Sam Lantinga <slouken@libsdl.org>
parents: 2309
diff changeset
314 wParam = RemapVKEY(wParam, lParam);
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
315 switch (wParam) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
316 case VK_CONTROL:
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
317 if (lParam & EXTENDED_KEYMASK)
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
318 wParam = VK_RCONTROL;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
319 else
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
320 wParam = VK_LCONTROL;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
321 break;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
322 case VK_SHIFT:
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
323 /* EXTENDED trick doesn't work here */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
324 {
2308
514f7c1651fc Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents: 2284
diff changeset
325 Uint8 *state = SDL_GetKeyboardState(NULL);
514f7c1651fc Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents: 2284
diff changeset
326 if (state[SDL_SCANCODE_LSHIFT] == SDL_PRESSED
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
327 && !(GetKeyState(VK_LSHIFT) & 0x8000)) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
328 wParam = VK_LSHIFT;
2308
514f7c1651fc Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents: 2284
diff changeset
329 } else if (state[SDL_SCANCODE_RSHIFT] == SDL_PRESSED
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
330 && !(GetKeyState(VK_RSHIFT) & 0x8000)) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
331 wParam = VK_RSHIFT;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
332 } else {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
333 /* Probably a key repeat */
3566
07c8339c95c6 Fixed bug #905
Sam Lantinga <slouken@libsdl.org>
parents: 3565
diff changeset
334 wParam = 256;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
335 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
336 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
337 break;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
338 case VK_MENU:
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
339 if (lParam & EXTENDED_KEYMASK)
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
340 wParam = VK_RMENU;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
341 else
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
342 wParam = VK_LMENU;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
343 break;
2313
012ec5192dfa Added support for keypad enter
Sam Lantinga <slouken@libsdl.org>
parents: 2312
diff changeset
344 case VK_RETURN:
012ec5192dfa Added support for keypad enter
Sam Lantinga <slouken@libsdl.org>
parents: 2312
diff changeset
345 if (lParam & EXTENDED_KEYMASK)
012ec5192dfa Added support for keypad enter
Sam Lantinga <slouken@libsdl.org>
parents: 2312
diff changeset
346 wParam = VK_ENTER;
012ec5192dfa Added support for keypad enter
Sam Lantinga <slouken@libsdl.org>
parents: 2312
diff changeset
347 break;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
348 }
2710
44e49d3fa6cf Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents: 2324
diff changeset
349
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
350 /* Windows only reports keyup for print screen */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
351 if (wParam == VK_SNAPSHOT
2308
514f7c1651fc Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents: 2284
diff changeset
352 && SDL_GetKeyboardState(NULL)[SDL_SCANCODE_PRINTSCREEN] ==
514f7c1651fc Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents: 2284
diff changeset
353 SDL_RELEASED) {
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4429
diff changeset
354 SDL_SendKeyboardKey(SDL_PRESSED,
2308
514f7c1651fc Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents: 2284
diff changeset
355 data->videodata->key_layout[wParam]);
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
356 }
2308
514f7c1651fc Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents: 2284
diff changeset
357 if (wParam < 256) {
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4429
diff changeset
358 SDL_SendKeyboardKey(SDL_RELEASED,
2308
514f7c1651fc Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents: 2284
diff changeset
359 data->videodata->key_layout[wParam]);
514f7c1651fc Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents: 2284
diff changeset
360 }
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
361 }
3566
07c8339c95c6 Fixed bug #905
Sam Lantinga <slouken@libsdl.org>
parents: 3565
diff changeset
362 returnCode = 0;
07c8339c95c6 Fixed bug #905
Sam Lantinga <slouken@libsdl.org>
parents: 3565
diff changeset
363 break;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
364
2309
21591ae7355d Implemented text input event for Win32
Sam Lantinga <slouken@libsdl.org>
parents: 2308
diff changeset
365 case WM_CHAR:
21591ae7355d Implemented text input event for Win32
Sam Lantinga <slouken@libsdl.org>
parents: 2308
diff changeset
366 {
21591ae7355d Implemented text input event for Win32
Sam Lantinga <slouken@libsdl.org>
parents: 2308
diff changeset
367 char text[4];
21591ae7355d Implemented text input event for Win32
Sam Lantinga <slouken@libsdl.org>
parents: 2308
diff changeset
368
21591ae7355d Implemented text input event for Win32
Sam Lantinga <slouken@libsdl.org>
parents: 2308
diff changeset
369 /* Convert to UTF-8 and send it on... */
21591ae7355d Implemented text input event for Win32
Sam Lantinga <slouken@libsdl.org>
parents: 2308
diff changeset
370 if (wParam <= 0x7F) {
21591ae7355d Implemented text input event for Win32
Sam Lantinga <slouken@libsdl.org>
parents: 2308
diff changeset
371 text[0] = (char) wParam;
21591ae7355d Implemented text input event for Win32
Sam Lantinga <slouken@libsdl.org>
parents: 2308
diff changeset
372 text[1] = '\0';
21591ae7355d Implemented text input event for Win32
Sam Lantinga <slouken@libsdl.org>
parents: 2308
diff changeset
373 } else if (wParam <= 0x7FF) {
21591ae7355d Implemented text input event for Win32
Sam Lantinga <slouken@libsdl.org>
parents: 2308
diff changeset
374 text[0] = 0xC0 | (char) ((wParam >> 6) & 0x1F);
21591ae7355d Implemented text input event for Win32
Sam Lantinga <slouken@libsdl.org>
parents: 2308
diff changeset
375 text[1] = 0x80 | (char) (wParam & 0x3F);
21591ae7355d Implemented text input event for Win32
Sam Lantinga <slouken@libsdl.org>
parents: 2308
diff changeset
376 text[2] = '\0';
21591ae7355d Implemented text input event for Win32
Sam Lantinga <slouken@libsdl.org>
parents: 2308
diff changeset
377 } else {
21591ae7355d Implemented text input event for Win32
Sam Lantinga <slouken@libsdl.org>
parents: 2308
diff changeset
378 text[0] = 0xE0 | (char) ((wParam >> 12) & 0x0F);
21591ae7355d Implemented text input event for Win32
Sam Lantinga <slouken@libsdl.org>
parents: 2308
diff changeset
379 text[1] = 0x80 | (char) ((wParam >> 6) & 0x3F);
21591ae7355d Implemented text input event for Win32
Sam Lantinga <slouken@libsdl.org>
parents: 2308
diff changeset
380 text[2] = 0x80 | (char) (wParam & 0x3F);
21591ae7355d Implemented text input event for Win32
Sam Lantinga <slouken@libsdl.org>
parents: 2308
diff changeset
381 text[3] = '\0';
21591ae7355d Implemented text input event for Win32
Sam Lantinga <slouken@libsdl.org>
parents: 2308
diff changeset
382 }
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4429
diff changeset
383 SDL_SendKeyboardText(text);
2309
21591ae7355d Implemented text input event for Win32
Sam Lantinga <slouken@libsdl.org>
parents: 2308
diff changeset
384 }
3566
07c8339c95c6 Fixed bug #905
Sam Lantinga <slouken@libsdl.org>
parents: 3565
diff changeset
385 returnCode = 0;
07c8339c95c6 Fixed bug #905
Sam Lantinga <slouken@libsdl.org>
parents: 3565
diff changeset
386 break;
2309
21591ae7355d Implemented text input event for Win32
Sam Lantinga <slouken@libsdl.org>
parents: 2308
diff changeset
387
5088
c2539ff054c8 Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents: 5062
diff changeset
388 #ifdef WM_INPUTLANGCHANGE
2311
54e21acfec5a Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents: 2310
diff changeset
389 case WM_INPUTLANGCHANGE:
54e21acfec5a Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents: 2310
diff changeset
390 {
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4429
diff changeset
391 WIN_UpdateKeymap();
2311
54e21acfec5a Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents: 2310
diff changeset
392 }
3566
07c8339c95c6 Fixed bug #905
Sam Lantinga <slouken@libsdl.org>
parents: 3565
diff changeset
393 returnCode = 1;
07c8339c95c6 Fixed bug #905
Sam Lantinga <slouken@libsdl.org>
parents: 3565
diff changeset
394 break;
5088
c2539ff054c8 Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents: 5062
diff changeset
395 #endif /* WM_INPUTLANGCHANGE */
2311
54e21acfec5a Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents: 2310
diff changeset
396
5088
c2539ff054c8 Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents: 5062
diff changeset
397 #ifdef WM_GETMINMAXINFO
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
398 case WM_GETMINMAXINFO:
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
399 {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
400 MINMAXINFO *info;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
401 RECT size;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
402 int x, y;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
403 int w, h;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
404 int style;
3168
Sam Lantinga <slouken@libsdl.org>
parents: 3139
diff changeset
405 BOOL menu;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
406
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
407 /* If we allow resizing, let the resize happen naturally */
4788
0bfda420c936 Put in a couple of fixes that I realized hadn't gotten done when I wrote out the SCRUM stuff in TODO. Added SCRUM listings in TODO.
Eli Gottlieb <eligottlieb@gmail.com>
parents: 4429
diff changeset
408 if(SDL_IsShapedWindow(data->window))
4815
93402b9dd20c Added Andreas's patch to fix my silly C++-style errors.
Eli Gottlieb <eligottlieb@gmail.com>
parents: 4788
diff changeset
409 Win32_ResizeWindowShape(data->window);
3685
64ce267332c6 Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents: 3566
diff changeset
410 if (SDL_GetWindowFlags(data->window) & SDL_WINDOW_RESIZABLE) {
3566
07c8339c95c6 Fixed bug #905
Sam Lantinga <slouken@libsdl.org>
parents: 3565
diff changeset
411 returnCode = 0;
07c8339c95c6 Fixed bug #905
Sam Lantinga <slouken@libsdl.org>
parents: 3565
diff changeset
412 break;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
413 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
414
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
415 /* Get the current position of our window */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
416 GetWindowRect(hwnd, &size);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
417 x = size.left;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
418 y = size.top;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
419
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
420 /* Calculate current size of our window */
3685
64ce267332c6 Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents: 3566
diff changeset
421 SDL_GetWindowSize(data->window, &w, &h);
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
422 size.top = 0;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
423 size.left = 0;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
424 size.bottom = h;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
425 size.right = w;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
426
3168
Sam Lantinga <slouken@libsdl.org>
parents: 3139
diff changeset
427
Sam Lantinga <slouken@libsdl.org>
parents: 3139
diff changeset
428 style = GetWindowLong(hwnd, GWL_STYLE);
Sam Lantinga <slouken@libsdl.org>
parents: 3139
diff changeset
429 #ifdef _WIN32_WCE
Sam Lantinga <slouken@libsdl.org>
parents: 3139
diff changeset
430 menu = FALSE;
Sam Lantinga <slouken@libsdl.org>
parents: 3139
diff changeset
431 #else
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
432 /* DJM - according to the docs for GetMenu(), the
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
433 return value is undefined if hwnd is a child window.
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
434 Aparently it's too difficult for MS to check
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
435 inside their function, so I have to do it here.
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
436 */
3168
Sam Lantinga <slouken@libsdl.org>
parents: 3139
diff changeset
437 menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL);
Sam Lantinga <slouken@libsdl.org>
parents: 3139
diff changeset
438 #endif
Sam Lantinga <slouken@libsdl.org>
parents: 3139
diff changeset
439 AdjustWindowRectEx(&size, style, menu, 0);
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
440 w = size.right - size.left;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
441 h = size.bottom - size.top;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
442
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
443 /* Fix our size to the current size */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
444 info = (MINMAXINFO *) lParam;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
445 info->ptMaxSize.x = w;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
446 info->ptMaxSize.y = h;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
447 info->ptMaxPosition.x = x;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
448 info->ptMaxPosition.y = y;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
449 info->ptMinTrackSize.x = w;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
450 info->ptMinTrackSize.y = h;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
451 info->ptMaxTrackSize.x = w;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
452 info->ptMaxTrackSize.y = h;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
453 }
3566
07c8339c95c6 Fixed bug #905
Sam Lantinga <slouken@libsdl.org>
parents: 3565
diff changeset
454 returnCode = 0;
07c8339c95c6 Fixed bug #905
Sam Lantinga <slouken@libsdl.org>
parents: 3565
diff changeset
455 break;
5088
c2539ff054c8 Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents: 5062
diff changeset
456 #endif /* WM_GETMINMAXINFO */
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
457
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
458 case WM_WINDOWPOSCHANGED:
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
459 {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
460 RECT rect;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
461 int x, y;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
462 int w, h;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
463 Uint32 window_flags;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
464
3256
83c87f2b2aab Fixed bug where minimized windows get zero width/height
Sam Lantinga <slouken@libsdl.org>
parents: 3253
diff changeset
465 if (!GetClientRect(hwnd, &rect) ||
83c87f2b2aab Fixed bug where minimized windows get zero width/height
Sam Lantinga <slouken@libsdl.org>
parents: 3253
diff changeset
466 (rect.right == rect.left && rect.bottom == rect.top)) {
83c87f2b2aab Fixed bug where minimized windows get zero width/height
Sam Lantinga <slouken@libsdl.org>
parents: 3253
diff changeset
467 break;
83c87f2b2aab Fixed bug where minimized windows get zero width/height
Sam Lantinga <slouken@libsdl.org>
parents: 3253
diff changeset
468 }
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
469 ClientToScreen(hwnd, (LPPOINT) & rect);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
470 ClientToScreen(hwnd, (LPPOINT) & rect + 1);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
471
3685
64ce267332c6 Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents: 3566
diff changeset
472 window_flags = SDL_GetWindowFlags(data->window);
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
473 if ((window_flags & SDL_WINDOW_INPUT_GRABBED) &&
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
474 (window_flags & SDL_WINDOW_INPUT_FOCUS)) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
475 ClipCursor(&rect);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
476 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
477
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
478 x = rect.left;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
479 y = rect.top;
3685
64ce267332c6 Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents: 3566
diff changeset
480 SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MOVED, x, y);
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
481
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
482 w = rect.right - rect.left;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
483 h = rect.bottom - rect.top;
3685
64ce267332c6 Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents: 3566
diff changeset
484 SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_RESIZED, w,
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
485 h);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
486 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
487 break;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
488
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
489 case WM_SETCURSOR:
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
490 {
3076
085e46423377 Use the default arrow cursor until we implement the cursor API
Sam Lantinga <slouken@libsdl.org>
parents: 3032
diff changeset
491 Uint16 hittest;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
492
3076
085e46423377 Use the default arrow cursor until we implement the cursor API
Sam Lantinga <slouken@libsdl.org>
parents: 3032
diff changeset
493 hittest = LOWORD(lParam);
085e46423377 Use the default arrow cursor until we implement the cursor API
Sam Lantinga <slouken@libsdl.org>
parents: 3032
diff changeset
494 if (hittest == HTCLIENT) {
085e46423377 Use the default arrow cursor until we implement the cursor API
Sam Lantinga <slouken@libsdl.org>
parents: 3032
diff changeset
495 /* FIXME: Implement the cursor API */
085e46423377 Use the default arrow cursor until we implement the cursor API
Sam Lantinga <slouken@libsdl.org>
parents: 3032
diff changeset
496 static HCURSOR cursor;
085e46423377 Use the default arrow cursor until we implement the cursor API
Sam Lantinga <slouken@libsdl.org>
parents: 3032
diff changeset
497 if (!cursor) {
085e46423377 Use the default arrow cursor until we implement the cursor API
Sam Lantinga <slouken@libsdl.org>
parents: 3032
diff changeset
498 cursor = LoadCursor(NULL, IDC_ARROW);
085e46423377 Use the default arrow cursor until we implement the cursor API
Sam Lantinga <slouken@libsdl.org>
parents: 3032
diff changeset
499 }
085e46423377 Use the default arrow cursor until we implement the cursor API
Sam Lantinga <slouken@libsdl.org>
parents: 3032
diff changeset
500 SetCursor(cursor);
3566
07c8339c95c6 Fixed bug #905
Sam Lantinga <slouken@libsdl.org>
parents: 3565
diff changeset
501 returnCode = TRUE;
3076
085e46423377 Use the default arrow cursor until we implement the cursor API
Sam Lantinga <slouken@libsdl.org>
parents: 3032
diff changeset
502 }
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
503 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
504 break;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
505
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
506 /* We are about to get palette focus! */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
507 case WM_QUERYNEWPALETTE:
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
508 {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
509 /*
3566
07c8339c95c6 Fixed bug #905
Sam Lantinga <slouken@libsdl.org>
parents: 3565
diff changeset
510 WIN_RealizePalette(current_video);
07c8339c95c6 Fixed bug #905
Sam Lantinga <slouken@libsdl.org>
parents: 3565
diff changeset
511 returnCode = TRUE;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
512 */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
513 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
514 break;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
515
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
516 /* Another application changed the palette */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
517 case WM_PALETTECHANGED:
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
518 {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
519 /*
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
520 WIN_PaletteChanged(current_video, (HWND) wParam);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
521 */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
522 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
523 break;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
524
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
525 /* We were occluded, refresh our display */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
526 case WM_PAINT:
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
527 {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
528 RECT rect;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
529 if (GetUpdateRect(hwnd, &rect, FALSE)) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
530 ValidateRect(hwnd, &rect);
3685
64ce267332c6 Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents: 3566
diff changeset
531 SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_EXPOSED,
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
532 0, 0);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
533 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
534 }
3566
07c8339c95c6 Fixed bug #905
Sam Lantinga <slouken@libsdl.org>
parents: 3565
diff changeset
535 returnCode = 0;
07c8339c95c6 Fixed bug #905
Sam Lantinga <slouken@libsdl.org>
parents: 3565
diff changeset
536 break;
3095
75483112b97f Date: Sat, 21 Mar 2009 19:41:52 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents: 3076
diff changeset
537
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
538 /* We'll do our own drawing, prevent flicker */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
539 case WM_ERASEBKGND:
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
540 {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
541 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
542 return (1);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
543
5088
c2539ff054c8 Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents: 5062
diff changeset
544 #if defined(SC_SCREENSAVE) || defined(SC_MONITORPOWER)
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
545 case WM_SYSCOMMAND:
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
546 {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
547 /* Don't start the screensaver or blank the monitor in fullscreen apps */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
548 if ((wParam & 0xFFF0) == SC_SCREENSAVE ||
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
549 (wParam & 0xFFF0) == SC_MONITORPOWER) {
3032
77c3e67f0740 Fixed Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 3025
diff changeset
550 if (SDL_GetVideoDevice()->suspend_screensaver) {
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
551 return (0);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
552 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
553 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
554 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
555 break;
5088
c2539ff054c8 Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents: 5062
diff changeset
556 #endif /* System has screensaver support */
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
557
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
558 case WM_CLOSE:
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
559 {
3685
64ce267332c6 Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents: 3566
diff changeset
560 SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_CLOSE, 0, 0);
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
561 }
3566
07c8339c95c6 Fixed bug #905
Sam Lantinga <slouken@libsdl.org>
parents: 3565
diff changeset
562 returnCode = 0;
07c8339c95c6 Fixed bug #905
Sam Lantinga <slouken@libsdl.org>
parents: 3565
diff changeset
563 break;
4919
716b2cbf4c9e First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents: 4902
diff changeset
564
4650
7ad7a473b086 More fixes for windows. Disabled tablet code.
jimtla
parents: 4429
diff changeset
565 case WM_TOUCH:
4932
0d1bb1ce9d15 Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4919
diff changeset
566 {
0d1bb1ce9d15 Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4919
diff changeset
567 UINT i, num_inputs = LOWORD(wParam);
0d1bb1ce9d15 Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4919
diff changeset
568 PTOUCHINPUT inputs = SDL_stack_alloc(TOUCHINPUT, num_inputs);
4919
716b2cbf4c9e First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents: 4902
diff changeset
569 if (data->videodata->GetTouchInputInfo((HTOUCHINPUT)lParam, num_inputs, inputs, sizeof(TOUCHINPUT))) {
4932
0d1bb1ce9d15 Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4919
diff changeset
570 RECT rect;
4919
716b2cbf4c9e First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents: 4902
diff changeset
571 float x, y;
716b2cbf4c9e First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents: 4902
diff changeset
572
716b2cbf4c9e First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents: 4902
diff changeset
573 if (!GetClientRect(hwnd, &rect) ||
716b2cbf4c9e First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents: 4902
diff changeset
574 (rect.right == rect.left && rect.bottom == rect.top)) {
716b2cbf4c9e First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents: 4902
diff changeset
575 break;
716b2cbf4c9e First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents: 4902
diff changeset
576 }
716b2cbf4c9e First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents: 4902
diff changeset
577 ClientToScreen(hwnd, (LPPOINT) & rect);
4932
0d1bb1ce9d15 Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4919
diff changeset
578 ClientToScreen(hwnd, (LPPOINT) & rect + 1);
0d1bb1ce9d15 Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4919
diff changeset
579 rect.top *= 100;
0d1bb1ce9d15 Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4919
diff changeset
580 rect.left *= 100;
0d1bb1ce9d15 Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4919
diff changeset
581 rect.bottom *= 100;
0d1bb1ce9d15 Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4919
diff changeset
582 rect.right *= 100;
0d1bb1ce9d15 Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4919
diff changeset
583
0d1bb1ce9d15 Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4919
diff changeset
584 for (i = 0; i < num_inputs; ++i) {
0d1bb1ce9d15 Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4919
diff changeset
585 PTOUCHINPUT input = &inputs[i];
4919
716b2cbf4c9e First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents: 4902
diff changeset
586
716b2cbf4c9e First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents: 4902
diff changeset
587 SDL_TouchID touchId = (SDL_TouchID)input->hSource;
716b2cbf4c9e First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents: 4902
diff changeset
588 if (!SDL_GetTouch(touchId)) {
716b2cbf4c9e First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents: 4902
diff changeset
589 SDL_Touch touch;
716b2cbf4c9e First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents: 4902
diff changeset
590
716b2cbf4c9e First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents: 4902
diff changeset
591 touch.id = touchId;
716b2cbf4c9e First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents: 4902
diff changeset
592 touch.x_min = 0;
716b2cbf4c9e First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents: 4902
diff changeset
593 touch.x_max = 1;
716b2cbf4c9e First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents: 4902
diff changeset
594 touch.native_xres = touch.x_max - touch.x_min;
716b2cbf4c9e First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents: 4902
diff changeset
595 touch.y_min = 0;
716b2cbf4c9e First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents: 4902
diff changeset
596 touch.y_max = 1;
716b2cbf4c9e First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents: 4902
diff changeset
597 touch.native_yres = touch.y_max - touch.y_min;
716b2cbf4c9e First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents: 4902
diff changeset
598 touch.pressure_min = 0;
716b2cbf4c9e First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents: 4902
diff changeset
599 touch.pressure_max = 1;
716b2cbf4c9e First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents: 4902
diff changeset
600 touch.native_pressureres = touch.pressure_max - touch.pressure_min;
716b2cbf4c9e First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents: 4902
diff changeset
601
716b2cbf4c9e First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents: 4902
diff changeset
602 if (SDL_AddTouch(&touch, "") < 0) {
716b2cbf4c9e First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents: 4902
diff changeset
603 continue;
716b2cbf4c9e First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents: 4902
diff changeset
604 }
4932
0d1bb1ce9d15 Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4919
diff changeset
605 }
0d1bb1ce9d15 Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4919
diff changeset
606
0d1bb1ce9d15 Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4919
diff changeset
607 // Get the normalized coordinates for the window
0d1bb1ce9d15 Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4919
diff changeset
608 x = (float)(input->x - rect.left)/(rect.right - rect.left);
0d1bb1ce9d15 Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4919
diff changeset
609 y = (float)(input->y - rect.top)/(rect.bottom - rect.top);
0d1bb1ce9d15 Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4919
diff changeset
610
4919
716b2cbf4c9e First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents: 4902
diff changeset
611 if (input->dwFlags & TOUCHEVENTF_DOWN) {
4932
0d1bb1ce9d15 Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4919
diff changeset
612 SDL_SendFingerDown(touchId, input->dwID, SDL_TRUE, x, y, 1);
0d1bb1ce9d15 Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4919
diff changeset
613 }
4919
716b2cbf4c9e First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents: 4902
diff changeset
614 if (input->dwFlags & TOUCHEVENTF_MOVE) {
4932
0d1bb1ce9d15 Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4919
diff changeset
615 SDL_SendTouchMotion(touchId, input->dwID, SDL_FALSE, x, y, 1);
0d1bb1ce9d15 Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4919
diff changeset
616 }
4919
716b2cbf4c9e First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents: 4902
diff changeset
617 if (input->dwFlags & TOUCHEVENTF_UP) {
4932
0d1bb1ce9d15 Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4919
diff changeset
618 SDL_SendFingerDown(touchId, input->dwID, SDL_FALSE, x, y, 1);
0d1bb1ce9d15 Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4919
diff changeset
619 }
0d1bb1ce9d15 Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4919
diff changeset
620 }
0d1bb1ce9d15 Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4919
diff changeset
621 }
0d1bb1ce9d15 Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4919
diff changeset
622 SDL_stack_free(inputs);
0d1bb1ce9d15 Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4919
diff changeset
623
0d1bb1ce9d15 Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4919
diff changeset
624 data->videodata->CloseTouchInputHandle((HTOUCHINPUT)lParam);
4919
716b2cbf4c9e First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents: 4902
diff changeset
625 return 0;
4650
7ad7a473b086 More fixes for windows. Disabled tablet code.
jimtla
parents: 4429
diff changeset
626 }
7ad7a473b086 More fixes for windows. Disabled tablet code.
jimtla
parents: 4429
diff changeset
627 break;
7ad7a473b086 More fixes for windows. Disabled tablet code.
jimtla
parents: 4429
diff changeset
628 }
3566
07c8339c95c6 Fixed bug #905
Sam Lantinga <slouken@libsdl.org>
parents: 3565
diff changeset
629
07c8339c95c6 Fixed bug #905
Sam Lantinga <slouken@libsdl.org>
parents: 3565
diff changeset
630 /* If there's a window proc, assume it's going to handle messages */
07c8339c95c6 Fixed bug #905
Sam Lantinga <slouken@libsdl.org>
parents: 3565
diff changeset
631 if (data->wndproc) {
07c8339c95c6 Fixed bug #905
Sam Lantinga <slouken@libsdl.org>
parents: 3565
diff changeset
632 return CallWindowProc(data->wndproc, hwnd, msg, wParam, lParam);
07c8339c95c6 Fixed bug #905
Sam Lantinga <slouken@libsdl.org>
parents: 3565
diff changeset
633 } else if (returnCode >= 0) {
07c8339c95c6 Fixed bug #905
Sam Lantinga <slouken@libsdl.org>
parents: 3565
diff changeset
634 return returnCode;
07c8339c95c6 Fixed bug #905
Sam Lantinga <slouken@libsdl.org>
parents: 3565
diff changeset
635 } else {
07c8339c95c6 Fixed bug #905
Sam Lantinga <slouken@libsdl.org>
parents: 3565
diff changeset
636 return CallWindowProc(DefWindowProc, hwnd, msg, wParam, lParam);
07c8339c95c6 Fixed bug #905
Sam Lantinga <slouken@libsdl.org>
parents: 3565
diff changeset
637 }
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
638 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
639
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
640 void
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
641 WIN_PumpEvents(_THIS)
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
642 {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
643 MSG msg;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
644 while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
645 TranslateMessage(&msg);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
646 DispatchMessage(&msg);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
647 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
648 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
649
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
650 static int app_registered = 0;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
651 LPTSTR SDL_Appname = NULL;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
652 Uint32 SDL_Appstyle = 0;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
653 HINSTANCE SDL_Instance = NULL;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
654
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
655 /* Register the class for this application */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
656 int
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
657 SDL_RegisterApp(char *name, Uint32 style, void *hInst)
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
658 {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
659 WNDCLASS class;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
660
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
661 /* Only do this once... */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
662 if (app_registered) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
663 ++app_registered;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
664 return (0);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
665 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
666 if (!name && !SDL_Appname) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
667 name = "SDL_app";
5088
c2539ff054c8 Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents: 5062
diff changeset
668 #if defined(CS_BYTEALIGNCLIENT) || defined(CS_OWNDC)
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
669 SDL_Appstyle = (CS_BYTEALIGNCLIENT | CS_OWNDC);
5088
c2539ff054c8 Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents: 5062
diff changeset
670 #endif
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
671 SDL_Instance = hInst ? hInst : GetModuleHandle(NULL);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
672 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
673
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
674 if (name) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
675 SDL_Appname = WIN_UTF8ToString(name);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
676 SDL_Appstyle = style;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
677 SDL_Instance = hInst ? hInst : GetModuleHandle(NULL);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
678 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
679
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
680 /* Register the application class */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
681 class.hCursor = NULL;
2710
44e49d3fa6cf Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents: 2324
diff changeset
682 class.hIcon =
44e49d3fa6cf Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents: 2324
diff changeset
683 LoadImage(SDL_Instance, SDL_Appname, IMAGE_ICON, 0, 0,
44e49d3fa6cf Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents: 2324
diff changeset
684 LR_DEFAULTCOLOR);
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
685 class.lpszMenuName = NULL;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
686 class.lpszClassName = SDL_Appname;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
687 class.hbrBackground = NULL;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
688 class.hInstance = SDL_Instance;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
689 class.style = SDL_Appstyle;
4733
983eb9d5ed31 Change SDL to not use DefWindowProc as the window class' window procedure.
dewyatt
parents: 4429
diff changeset
690 class.lpfnWndProc = WIN_WindowProc;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
691 class.cbWndExtra = 0;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
692 class.cbClsExtra = 0;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
693 if (!RegisterClass(&class)) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
694 SDL_SetError("Couldn't register application class");
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
695 return (-1);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
696 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
697
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
698 app_registered = 1;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
699 return (0);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
700 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
701
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
702 /* Unregisters the windowclass registered in SDL_RegisterApp above. */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
703 void
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
704 SDL_UnregisterApp()
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
705 {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
706 WNDCLASS class;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
707
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
708 /* SDL_RegisterApp might not have been called before */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
709 if (!app_registered) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
710 return;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
711 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
712 --app_registered;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
713 if (app_registered == 0) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
714 /* Check for any registered window classes. */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
715 if (GetClassInfo(SDL_Instance, SDL_Appname, &class)) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
716 UnregisterClass(SDL_Appname, SDL_Instance);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
717 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
718 SDL_free(SDL_Appname);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
719 SDL_Appname = NULL;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
720 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
721 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
722
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
723 /* vi: set ts=4 sw=4 expandtab: */