author | Sam Lantinga <slouken@libsdl.org> |
Fri, 08 Feb 2013 01:04:07 -0800 | |
changeset 6837 | a69e10925a58 |
parent 6788 | 036f53f2f5aa |
child 6861 | c1c9eab3bd20 |
permissions | -rw-r--r-- |
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 |
/* |
5535
96594ac5fd1a
SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents:
5421
diff
changeset
|
2 |
Simple DirectMedia Layer |
6138 | 3 |
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> |
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 |
|
5535
96594ac5fd1a
SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents:
5421
diff
changeset
|
5 |
This software is provided 'as-is', without any express or implied |
96594ac5fd1a
SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents:
5421
diff
changeset
|
6 |
warranty. In no event will the authors be held liable for any damages |
96594ac5fd1a
SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents:
5421
diff
changeset
|
7 |
arising from the use of this software. |
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
|
8 |
|
5535
96594ac5fd1a
SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents:
5421
diff
changeset
|
9 |
Permission is granted to anyone to use this software for any purpose, |
96594ac5fd1a
SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents:
5421
diff
changeset
|
10 |
including commercial applications, and to alter it and redistribute it |
96594ac5fd1a
SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents:
5421
diff
changeset
|
11 |
freely, subject to the following restrictions: |
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
|
12 |
|
5535
96594ac5fd1a
SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents:
5421
diff
changeset
|
13 |
1. The origin of this software must not be misrepresented; you must not |
96594ac5fd1a
SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents:
5421
diff
changeset
|
14 |
claim that you wrote the original software. If you use this software |
96594ac5fd1a
SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents:
5421
diff
changeset
|
15 |
in a product, an acknowledgment in the product documentation would be |
96594ac5fd1a
SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents:
5421
diff
changeset
|
16 |
appreciated but is not required. |
96594ac5fd1a
SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents:
5421
diff
changeset
|
17 |
2. Altered source versions must be plainly marked as such, and must not be |
96594ac5fd1a
SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents:
5421
diff
changeset
|
18 |
misrepresented as being the original software. |
96594ac5fd1a
SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents:
5421
diff
changeset
|
19 |
3. This notice may not be removed or altered from any source distribution. |
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
|
20 |
*/ |
6044
35448a5ea044
Lots of fixes importing SDL source wholesale into a new iOS project
Sam Lantinga <slouken@libsdl.org>
parents:
5889
diff
changeset
|
21 |
#include "SDL_config.h" |
2710
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2324
diff
changeset
|
22 |
|
6044
35448a5ea044
Lots of fixes importing SDL source wholesale into a new iOS project
Sam Lantinga <slouken@libsdl.org>
parents:
5889
diff
changeset
|
23 |
#if SDL_VIDEO_DRIVER_WINDOWS |
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
|
24 |
|
5062 | 25 |
#include "SDL_windowsvideo.h" |
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 |
|
6523
62d0193a7a02
Fixed bug 1593 - SDL_DROPFILE event doesn't work on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
6430
diff
changeset
|
32 |
/* Dropfile support */ |
62d0193a7a02
Fixed bug 1593 - SDL_DROPFILE event doesn't work on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
6430
diff
changeset
|
33 |
#include <shellapi.h> |
62d0193a7a02
Fixed bug 1593 - SDL_DROPFILE event doesn't work on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
6430
diff
changeset
|
34 |
|
62d0193a7a02
Fixed bug 1593 - SDL_DROPFILE event doesn't work on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
6430
diff
changeset
|
35 |
|
4650 | 36 |
|
37 |
||
4868
d6adaafcfb10
Fixed compiling with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
4862
diff
changeset
|
38 |
/*#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
|
39 |
#ifdef WMMSG_DEBUG |
4650 | 40 |
#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
|
41 |
#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
|
42 |
#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
|
43 |
|
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
44 |
/* 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
|
45 |
#define REPEATED_KEYMASK (1<<30) |
f537a293b3da
Windows also remaps the numeric keypad... grrr
Sam Lantinga <slouken@libsdl.org>
parents:
2313
diff
changeset
|
46 |
#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
|
47 |
|
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
|
48 |
#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
|
49 |
|
2127
3bcc26b74e42
Merged r3087:3089 from branches/SDL-1.2: WM_XBUTTON support.
Ryan C. Gordon <icculus@icculus.org>
parents:
1951
diff
changeset
|
50 |
/* 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
|
51 |
#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
|
52 |
#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
|
53 |
#endif |
3bcc26b74e42
Merged r3087:3089 from branches/SDL-1.2: WM_XBUTTON support.
Ryan C. Gordon <icculus@icculus.org>
parents:
1951
diff
changeset
|
54 |
#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
|
55 |
#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
|
56 |
#endif |
3bcc26b74e42
Merged r3087:3089 from branches/SDL-1.2: WM_XBUTTON support.
Ryan C. Gordon <icculus@icculus.org>
parents:
1951
diff
changeset
|
57 |
#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
|
58 |
#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
|
59 |
#endif |
2733
264037dd3c7a
Fix for mingw compilation by Alam.
Edgar Simo <bobbens@gmail.com>
parents:
2726
diff
changeset
|
60 |
#ifndef WM_INPUT |
264037dd3c7a
Fix for mingw compilation by Alam.
Edgar Simo <bobbens@gmail.com>
parents:
2726
diff
changeset
|
61 |
#define WM_INPUT 0x00ff |
264037dd3c7a
Fix for mingw compilation by Alam.
Edgar Simo <bobbens@gmail.com>
parents:
2726
diff
changeset
|
62 |
#endif |
4932
0d1bb1ce9d15
Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4919
diff
changeset
|
63 |
#ifndef WM_TOUCH |
4868
d6adaafcfb10
Fixed compiling with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
4862
diff
changeset
|
64 |
#define WM_TOUCH 0x0240 |
4932
0d1bb1ce9d15
Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4919
diff
changeset
|
65 |
#endif |
4919
716b2cbf4c9e
First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents:
4902
diff
changeset
|
66 |
|
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
|
67 |
|
2310
2f31ce8f1149
Undo keyboard layout based alphabetic key mapping. Grr.... HACK HACK HACK...
Sam Lantinga <slouken@libsdl.org>
parents:
2309
diff
changeset
|
68 |
static WPARAM |
2f31ce8f1149
Undo keyboard layout based alphabetic key mapping. Grr.... HACK HACK HACK...
Sam Lantinga <slouken@libsdl.org>
parents:
2309
diff
changeset
|
69 |
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
|
70 |
{ |
2317
f537a293b3da
Windows also remaps the numeric keypad... grrr
Sam Lantinga <slouken@libsdl.org>
parents:
2313
diff
changeset
|
71 |
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
|
72 |
BYTE scancode = (BYTE) ((lParam >> 16) & 0xFF); |
2317
f537a293b3da
Windows also remaps the numeric keypad... grrr
Sam Lantinga <slouken@libsdl.org>
parents:
2313
diff
changeset
|
73 |
|
2310
2f31ce8f1149
Undo keyboard layout based alphabetic key mapping. Grr.... HACK HACK HACK...
Sam Lantinga <slouken@libsdl.org>
parents:
2309
diff
changeset
|
74 |
/* 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
|
75 |
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
|
76 |
*/ |
2f31ce8f1149
Undo keyboard layout based alphabetic key mapping. Grr.... HACK HACK HACK...
Sam Lantinga <slouken@libsdl.org>
parents:
2309
diff
changeset
|
77 |
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
|
78 |
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
|
79 |
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
|
80 |
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
|
81 |
wParam = 'A' + i; |
2f31ce8f1149
Undo keyboard layout based alphabetic key mapping. Grr.... HACK HACK HACK...
Sam Lantinga <slouken@libsdl.org>
parents:
2309
diff
changeset
|
82 |
break; |
2f31ce8f1149
Undo keyboard layout based alphabetic key mapping. Grr.... HACK HACK HACK...
Sam Lantinga <slouken@libsdl.org>
parents:
2309
diff
changeset
|
83 |
} |
2f31ce8f1149
Undo keyboard layout based alphabetic key mapping. Grr.... HACK HACK HACK...
Sam Lantinga <slouken@libsdl.org>
parents:
2309
diff
changeset
|
84 |
} |
2f31ce8f1149
Undo keyboard layout based alphabetic key mapping. Grr.... HACK HACK HACK...
Sam Lantinga <slouken@libsdl.org>
parents:
2309
diff
changeset
|
85 |
} |
2f31ce8f1149
Undo keyboard layout based alphabetic key mapping. Grr.... HACK HACK HACK...
Sam Lantinga <slouken@libsdl.org>
parents:
2309
diff
changeset
|
86 |
} |
2317
f537a293b3da
Windows also remaps the numeric keypad... grrr
Sam Lantinga <slouken@libsdl.org>
parents:
2313
diff
changeset
|
87 |
|
3700 | 88 |
/* Keypad keys are a little trickier, we always scan for them. |
89 |
Keypad arrow keys have the same scancode as normal arrow keys, |
|
90 |
except they don't have the extended bit (0x1000000) set. |
|
91 |
*/ |
|
92 |
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
|
93 |
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
|
94 |
wParam = VK_DECIMAL; |
e4b2b7207f79
Fixed remapping the Delete key and detecting the keypad Delete key.
Sam Lantinga <slouken@libsdl.org>
parents:
4560
diff
changeset
|
95 |
} else { |
e4b2b7207f79
Fixed remapping the Delete key and detecting the keypad Delete key.
Sam Lantinga <slouken@libsdl.org>
parents:
4560
diff
changeset
|
96 |
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
|
97 |
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
|
98 |
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
|
99 |
break; |
e4b2b7207f79
Fixed remapping the Delete key and detecting the keypad Delete key.
Sam Lantinga <slouken@libsdl.org>
parents:
4560
diff
changeset
|
100 |
} |
3700 | 101 |
} |
2317
f537a293b3da
Windows also remaps the numeric keypad... grrr
Sam Lantinga <slouken@libsdl.org>
parents:
2313
diff
changeset
|
102 |
} |
f537a293b3da
Windows also remaps the numeric keypad... grrr
Sam Lantinga <slouken@libsdl.org>
parents:
2313
diff
changeset
|
103 |
} |
f537a293b3da
Windows also remaps the numeric keypad... grrr
Sam Lantinga <slouken@libsdl.org>
parents:
2313
diff
changeset
|
104 |
|
2310
2f31ce8f1149
Undo keyboard layout based alphabetic key mapping. Grr.... HACK HACK HACK...
Sam Lantinga <slouken@libsdl.org>
parents:
2309
diff
changeset
|
105 |
return wParam; |
2f31ce8f1149
Undo keyboard layout based alphabetic key mapping. Grr.... HACK HACK HACK...
Sam Lantinga <slouken@libsdl.org>
parents:
2309
diff
changeset
|
106 |
} |
2f31ce8f1149
Undo keyboard layout based alphabetic key mapping. Grr.... HACK HACK HACK...
Sam Lantinga <slouken@libsdl.org>
parents:
2309
diff
changeset
|
107 |
|
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
|
108 |
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
|
109 |
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
|
110 |
{ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
111 |
SDL_WindowData *data; |
3566 | 112 |
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
|
113 |
|
1951
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
1913
diff
changeset
|
114 |
/* 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
|
115 |
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
|
116 |
SDL_SysWMmsg wmmsg; |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
1913
diff
changeset
|
117 |
|
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
1913
diff
changeset
|
118 |
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
|
119 |
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
|
120 |
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
|
121 |
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
|
122 |
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
|
123 |
wmmsg.msg.win.lParam = lParam; |
1951
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
1913
diff
changeset
|
124 |
SDL_SendSysWMEvent(&wmmsg); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
1913
diff
changeset
|
125 |
} |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
1913
diff
changeset
|
126 |
|
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
|
127 |
/* 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
|
128 |
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
|
129 |
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
|
130 |
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
|
131 |
} |
4650 | 132 |
|
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
|
133 |
#ifdef WMMSG_DEBUG |
4650 | 134 |
{ |
135 |
FILE *log = fopen("wmmsg.txt", "a"); |
|
1913
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
136 |
fprintf(log, "Received windows message: %p ", hwnd); |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
137 |
if (msg > MAX_WMMSG) { |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
138 |
fprintf(log, "%d", msg); |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
139 |
} else { |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
140 |
fprintf(log, "%s", wmtab[msg]); |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
141 |
} |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
142 |
fprintf(log, " -- 0x%X, 0x%X\n", wParam, lParam); |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
143 |
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
|
144 |
} |
4868
d6adaafcfb10
Fixed compiling with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
4862
diff
changeset
|
145 |
#endif |
2710
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2324
diff
changeset
|
146 |
|
4752 | 147 |
if (IME_HandleMessage(hwnd, msg, wParam, &lParam, data->videodata)) |
148 |
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
|
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 |
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
|
151 |
|
c121d94672cb
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 |
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
|
153 |
{ |
c121d94672cb
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 |
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
|
155 |
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
|
156 |
} 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
|
157 |
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
|
158 |
} |
c121d94672cb
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 |
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
|
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 |
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
|
163 |
{ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
164 |
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
|
165 |
|
c121d94672cb
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 |
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
|
167 |
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
|
168 |
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
|
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_RESTORED, 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 |
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
|
172 |
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
|
173 |
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
|
174 |
} |
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
|
175 |
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
|
176 |
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
|
177 |
} |
6350
19545983ac76
Patrick Baggett implemented relative mouse mode on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
6138
diff
changeset
|
178 |
|
19545983ac76
Patrick Baggett implemented relative mouse mode on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
6138
diff
changeset
|
179 |
if(SDL_GetMouse()->relative_mode) { |
19545983ac76
Patrick Baggett implemented relative mouse mode on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
6138
diff
changeset
|
180 |
LONG cx, cy; |
19545983ac76
Patrick Baggett implemented relative mouse mode on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
6138
diff
changeset
|
181 |
RECT rect; |
19545983ac76
Patrick Baggett implemented relative mouse mode on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
6138
diff
changeset
|
182 |
GetWindowRect(hwnd, &rect); |
19545983ac76
Patrick Baggett implemented relative mouse mode on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
6138
diff
changeset
|
183 |
|
19545983ac76
Patrick Baggett implemented relative mouse mode on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
6138
diff
changeset
|
184 |
cx = (rect.left + rect.right) / 2; |
19545983ac76
Patrick Baggett implemented relative mouse mode on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
6138
diff
changeset
|
185 |
cy = (rect.top + rect.bottom) / 2; |
19545983ac76
Patrick Baggett implemented relative mouse mode on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
6138
diff
changeset
|
186 |
|
19545983ac76
Patrick Baggett implemented relative mouse mode on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
6138
diff
changeset
|
187 |
/* Make an absurdly small clip rect */ |
19545983ac76
Patrick Baggett implemented relative mouse mode on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
6138
diff
changeset
|
188 |
rect.left = cx-1; |
19545983ac76
Patrick Baggett implemented relative mouse mode on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
6138
diff
changeset
|
189 |
rect.right = cx+1; |
19545983ac76
Patrick Baggett implemented relative mouse mode on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
6138
diff
changeset
|
190 |
rect.top = cy-1; |
19545983ac76
Patrick Baggett implemented relative mouse mode on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
6138
diff
changeset
|
191 |
rect.bottom = cy+1; |
19545983ac76
Patrick Baggett implemented relative mouse mode on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
6138
diff
changeset
|
192 |
|
19545983ac76
Patrick Baggett implemented relative mouse mode on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
6138
diff
changeset
|
193 |
ClipCursor(&rect); |
19545983ac76
Patrick Baggett implemented relative mouse mode on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
6138
diff
changeset
|
194 |
} |
19545983ac76
Patrick Baggett implemented relative mouse mode on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
6138
diff
changeset
|
195 |
|
4504
9faebccfefb3
Amazingly the Windows code is almost identical to the Mac OS X code. :)
Sam Lantinga <slouken@libsdl.org>
parents:
4500
diff
changeset
|
196 |
/* |
9faebccfefb3
Amazingly the Windows code is almost identical to the Mac OS X code. :)
Sam Lantinga <slouken@libsdl.org>
parents:
4500
diff
changeset
|
197 |
* 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
|
198 |
*/ |
9faebccfefb3
Amazingly the Windows code is almost identical to the Mac OS X code. :)
Sam Lantinga <slouken@libsdl.org>
parents:
4500
diff
changeset
|
199 |
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
|
200 |
} 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
|
201 |
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
|
202 |
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
|
203 |
} |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
204 |
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
|
205 |
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
|
206 |
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
|
207 |
} |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
208 |
} |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
209 |
} |
3566 | 210 |
returnCode = 0; |
211 |
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
|
212 |
|
4470
a5878b271b74
Fixed mouse focus window reporting
Sam Lantinga <slouken@libsdl.org>
parents:
4465
diff
changeset
|
213 |
case WM_MOUSEMOVE: |
6350
19545983ac76
Patrick Baggett implemented relative mouse mode on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
6138
diff
changeset
|
214 |
if(SDL_GetMouse()->relative_mode) |
19545983ac76
Patrick Baggett implemented relative mouse mode on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
6138
diff
changeset
|
215 |
break; |
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
|
216 |
SDL_SendMouseMotion(data->window, 0, LOWORD(lParam), HIWORD(lParam)); |
3139 | 217 |
break; |
218 |
||
6350
19545983ac76
Patrick Baggett implemented relative mouse mode on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
6138
diff
changeset
|
219 |
case WM_INPUT: |
19545983ac76
Patrick Baggett implemented relative mouse mode on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
6138
diff
changeset
|
220 |
{ |
19545983ac76
Patrick Baggett implemented relative mouse mode on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
6138
diff
changeset
|
221 |
HRAWINPUT hRawInput = (HRAWINPUT)lParam; |
19545983ac76
Patrick Baggett implemented relative mouse mode on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
6138
diff
changeset
|
222 |
RAWINPUT inp; |
19545983ac76
Patrick Baggett implemented relative mouse mode on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
6138
diff
changeset
|
223 |
UINT size = sizeof(inp); |
6782
582d35419e8a
Improvements from Alfred:
Sam Lantinga <slouken@libsdl.org>
parents:
6682
diff
changeset
|
224 |
|
582d35419e8a
Improvements from Alfred:
Sam Lantinga <slouken@libsdl.org>
parents:
6682
diff
changeset
|
225 |
if(!SDL_GetMouse()->relative_mode) |
582d35419e8a
Improvements from Alfred:
Sam Lantinga <slouken@libsdl.org>
parents:
6682
diff
changeset
|
226 |
break; |
582d35419e8a
Improvements from Alfred:
Sam Lantinga <slouken@libsdl.org>
parents:
6682
diff
changeset
|
227 |
|
6350
19545983ac76
Patrick Baggett implemented relative mouse mode on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
6138
diff
changeset
|
228 |
GetRawInputData(hRawInput, RID_INPUT, &inp, &size, sizeof(RAWINPUTHEADER)); |
19545983ac76
Patrick Baggett implemented relative mouse mode on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
6138
diff
changeset
|
229 |
|
19545983ac76
Patrick Baggett implemented relative mouse mode on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
6138
diff
changeset
|
230 |
/* Mouse data */ |
19545983ac76
Patrick Baggett implemented relative mouse mode on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
6138
diff
changeset
|
231 |
if(inp.header.dwType == RIM_TYPEMOUSE) |
19545983ac76
Patrick Baggett implemented relative mouse mode on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
6138
diff
changeset
|
232 |
{ |
19545983ac76
Patrick Baggett implemented relative mouse mode on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
6138
diff
changeset
|
233 |
RAWMOUSE* mouse = &inp.data.mouse; |
19545983ac76
Patrick Baggett implemented relative mouse mode on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
6138
diff
changeset
|
234 |
|
19545983ac76
Patrick Baggett implemented relative mouse mode on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
6138
diff
changeset
|
235 |
if((mouse->usFlags & 0x01) == MOUSE_MOVE_RELATIVE) |
6782
582d35419e8a
Improvements from Alfred:
Sam Lantinga <slouken@libsdl.org>
parents:
6682
diff
changeset
|
236 |
{ |
6350
19545983ac76
Patrick Baggett implemented relative mouse mode on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
6138
diff
changeset
|
237 |
SDL_SendMouseMotion(data->window, 1, (int)mouse->lLastX, (int)mouse->lLastY); |
6782
582d35419e8a
Improvements from Alfred:
Sam Lantinga <slouken@libsdl.org>
parents:
6682
diff
changeset
|
238 |
} |
582d35419e8a
Improvements from Alfred:
Sam Lantinga <slouken@libsdl.org>
parents:
6682
diff
changeset
|
239 |
else |
582d35419e8a
Improvements from Alfred:
Sam Lantinga <slouken@libsdl.org>
parents:
6682
diff
changeset
|
240 |
{ |
582d35419e8a
Improvements from Alfred:
Sam Lantinga <slouken@libsdl.org>
parents:
6682
diff
changeset
|
241 |
// synthesize relative moves from the abs position |
582d35419e8a
Improvements from Alfred:
Sam Lantinga <slouken@libsdl.org>
parents:
6682
diff
changeset
|
242 |
static SDL_Point initialMousePoint; |
582d35419e8a
Improvements from Alfred:
Sam Lantinga <slouken@libsdl.org>
parents:
6682
diff
changeset
|
243 |
if ( initialMousePoint.x == 0 && initialMousePoint.y == 0 ) |
582d35419e8a
Improvements from Alfred:
Sam Lantinga <slouken@libsdl.org>
parents:
6682
diff
changeset
|
244 |
{ |
582d35419e8a
Improvements from Alfred:
Sam Lantinga <slouken@libsdl.org>
parents:
6682
diff
changeset
|
245 |
initialMousePoint.x = mouse->lLastX; |
582d35419e8a
Improvements from Alfred:
Sam Lantinga <slouken@libsdl.org>
parents:
6682
diff
changeset
|
246 |
initialMousePoint.y = mouse->lLastY; |
582d35419e8a
Improvements from Alfred:
Sam Lantinga <slouken@libsdl.org>
parents:
6682
diff
changeset
|
247 |
} |
6350
19545983ac76
Patrick Baggett implemented relative mouse mode on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
6138
diff
changeset
|
248 |
|
6782
582d35419e8a
Improvements from Alfred:
Sam Lantinga <slouken@libsdl.org>
parents:
6682
diff
changeset
|
249 |
SDL_SendMouseMotion(data->window, 1, (int)(mouse->lLastX-initialMousePoint.x), (int)(mouse->lLastY-initialMousePoint.y) ); |
582d35419e8a
Improvements from Alfred:
Sam Lantinga <slouken@libsdl.org>
parents:
6682
diff
changeset
|
250 |
|
582d35419e8a
Improvements from Alfred:
Sam Lantinga <slouken@libsdl.org>
parents:
6682
diff
changeset
|
251 |
initialMousePoint.x = mouse->lLastX; |
582d35419e8a
Improvements from Alfred:
Sam Lantinga <slouken@libsdl.org>
parents:
6682
diff
changeset
|
252 |
initialMousePoint.y = mouse->lLastY; |
582d35419e8a
Improvements from Alfred:
Sam Lantinga <slouken@libsdl.org>
parents:
6682
diff
changeset
|
253 |
} |
6350
19545983ac76
Patrick Baggett implemented relative mouse mode on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
6138
diff
changeset
|
254 |
} |
19545983ac76
Patrick Baggett implemented relative mouse mode on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
6138
diff
changeset
|
255 |
break; |
19545983ac76
Patrick Baggett implemented relative mouse mode on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
6138
diff
changeset
|
256 |
} |
19545983ac76
Patrick Baggett implemented relative mouse mode on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
6138
diff
changeset
|
257 |
|
3097
0d12e8f1de3c
Date: Thu, 05 Feb 2009 18:07:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
3095
diff
changeset
|
258 |
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
|
259 |
SDL_SendMouseButton(data->window, SDL_PRESSED, SDL_BUTTON_LEFT); |
3139 | 260 |
break; |
261 |
||
3097
0d12e8f1de3c
Date: Thu, 05 Feb 2009 18:07:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
3095
diff
changeset
|
262 |
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
|
263 |
SDL_SendMouseButton(data->window, SDL_RELEASED, SDL_BUTTON_LEFT); |
3139 | 264 |
break; |
265 |
||
5049
28003ba91f57
John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents:
4932
diff
changeset
|
266 |
case WM_RBUTTONDOWN: |
28003ba91f57
John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents:
4932
diff
changeset
|
267 |
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
|
268 |
break; |
28003ba91f57
John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents:
4932
diff
changeset
|
269 |
|
28003ba91f57
John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents:
4932
diff
changeset
|
270 |
case WM_RBUTTONUP: |
28003ba91f57
John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents:
4932
diff
changeset
|
271 |
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
|
272 |
break; |
28003ba91f57
John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents:
4932
diff
changeset
|
273 |
|
28003ba91f57
John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents:
4932
diff
changeset
|
274 |
case WM_MBUTTONDOWN: |
28003ba91f57
John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents:
4932
diff
changeset
|
275 |
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
|
276 |
break; |
28003ba91f57
John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents:
4932
diff
changeset
|
277 |
|
28003ba91f57
John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents:
4932
diff
changeset
|
278 |
case WM_MBUTTONUP: |
28003ba91f57
John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents:
4932
diff
changeset
|
279 |
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
|
280 |
break; |
28003ba91f57
John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents:
4932
diff
changeset
|
281 |
|
28003ba91f57
John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents:
4932
diff
changeset
|
282 |
case WM_XBUTTONDOWN: |
28003ba91f57
John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents:
4932
diff
changeset
|
283 |
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
|
284 |
returnCode = TRUE; |
28003ba91f57
John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents:
4932
diff
changeset
|
285 |
break; |
28003ba91f57
John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents:
4932
diff
changeset
|
286 |
|
28003ba91f57
John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents:
4932
diff
changeset
|
287 |
case WM_XBUTTONUP: |
28003ba91f57
John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents:
4932
diff
changeset
|
288 |
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
|
289 |
returnCode = TRUE; |
28003ba91f57
John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents:
4932
diff
changeset
|
290 |
break; |
28003ba91f57
John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents:
4932
diff
changeset
|
291 |
|
28003ba91f57
John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents:
4932
diff
changeset
|
292 |
case WM_MOUSEWHEEL: |
28003ba91f57
John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents:
4932
diff
changeset
|
293 |
{ |
28003ba91f57
John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents:
4932
diff
changeset
|
294 |
int motion = (short) HIWORD(wParam); |
28003ba91f57
John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents:
4932
diff
changeset
|
295 |
|
28003ba91f57
John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents:
4932
diff
changeset
|
296 |
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
|
297 |
break; |
28003ba91f57
John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents:
4932
diff
changeset
|
298 |
} |
28003ba91f57
John Wilson 2010-08-17 17:09:16 PDT
Sam Lantinga <slouken@libsdl.org>
parents:
4932
diff
changeset
|
299 |
|
5086
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
300 |
#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
|
301 |
/* 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
|
302 |
case WM_MOUSELEAVE: |
4470
a5878b271b74
Fixed mouse focus window reporting
Sam Lantinga <slouken@libsdl.org>
parents:
4465
diff
changeset
|
303 |
if (SDL_GetMouseFocus() == data->window) { |
a5878b271b74
Fixed mouse focus window reporting
Sam Lantinga <slouken@libsdl.org>
parents:
4465
diff
changeset
|
304 |
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
|
305 |
} |
3566 | 306 |
returnCode = 0; |
307 |
break; |
|
5086
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
308 |
#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
|
309 |
|
c121d94672cb
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 |
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
|
311 |
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
|
312 |
{ |
2310
2f31ce8f1149
Undo keyboard layout based alphabetic key mapping. Grr.... HACK HACK HACK...
Sam Lantinga <slouken@libsdl.org>
parents:
2309
diff
changeset
|
313 |
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
|
314 |
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
|
315 |
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
|
316 |
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
|
317 |
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
|
318 |
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
|
319 |
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
|
320 |
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
|
321 |
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
|
322 |
/* 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
|
323 |
{ |
2308
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
2284
diff
changeset
|
324 |
Uint8 *state = SDL_GetKeyboardState(NULL); |
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
2284
diff
changeset
|
325 |
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
|
326 |
&& (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
|
327 |
wParam = VK_LSHIFT; |
2308
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
2284
diff
changeset
|
328 |
} 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
|
329 |
&& (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
|
330 |
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
|
331 |
} 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
|
332 |
/* Probably a key repeat */ |
3566 | 333 |
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
|
334 |
} |
c121d94672cb
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 |
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
|
337 |
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
|
338 |
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
|
339 |
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
|
340 |
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
|
341 |
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
|
342 |
break; |
2313
012ec5192dfa
Added support for keypad enter
Sam Lantinga <slouken@libsdl.org>
parents:
2312
diff
changeset
|
343 |
case VK_RETURN: |
012ec5192dfa
Added support for keypad enter
Sam Lantinga <slouken@libsdl.org>
parents:
2312
diff
changeset
|
344 |
if (lParam & EXTENDED_KEYMASK) |
012ec5192dfa
Added support for keypad enter
Sam Lantinga <slouken@libsdl.org>
parents:
2312
diff
changeset
|
345 |
wParam = VK_ENTER; |
012ec5192dfa
Added support for keypad enter
Sam Lantinga <slouken@libsdl.org>
parents:
2312
diff
changeset
|
346 |
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
|
347 |
} |
2308
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
2284
diff
changeset
|
348 |
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
|
349 |
SDL_SendKeyboardKey(SDL_PRESSED, |
2308
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
2284
diff
changeset
|
350 |
data->videodata->key_layout[wParam]); |
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
2284
diff
changeset
|
351 |
} |
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
|
352 |
} |
3566 | 353 |
returnCode = 0; |
354 |
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
|
355 |
|
c121d94672cb
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 |
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
|
357 |
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
|
358 |
{ |
2310
2f31ce8f1149
Undo keyboard layout based alphabetic key mapping. Grr.... HACK HACK HACK...
Sam Lantinga <slouken@libsdl.org>
parents:
2309
diff
changeset
|
359 |
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
|
360 |
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
|
361 |
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
|
362 |
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
|
363 |
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
|
364 |
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
|
365 |
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
|
366 |
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
|
367 |
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
|
368 |
/* 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
|
369 |
{ |
2308
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
2284
diff
changeset
|
370 |
Uint8 *state = SDL_GetKeyboardState(NULL); |
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
2284
diff
changeset
|
371 |
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
|
372 |
&& !(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
|
373 |
wParam = VK_LSHIFT; |
2308
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
2284
diff
changeset
|
374 |
} 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
|
375 |
&& !(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
|
376 |
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
|
377 |
} 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
|
378 |
/* Probably a key repeat */ |
3566 | 379 |
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
|
380 |
} |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
381 |
} |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
382 |
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
|
383 |
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
|
384 |
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
|
385 |
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
|
386 |
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
|
387 |
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
|
388 |
break; |
2313
012ec5192dfa
Added support for keypad enter
Sam Lantinga <slouken@libsdl.org>
parents:
2312
diff
changeset
|
389 |
case VK_RETURN: |
012ec5192dfa
Added support for keypad enter
Sam Lantinga <slouken@libsdl.org>
parents:
2312
diff
changeset
|
390 |
if (lParam & EXTENDED_KEYMASK) |
012ec5192dfa
Added support for keypad enter
Sam Lantinga <slouken@libsdl.org>
parents:
2312
diff
changeset
|
391 |
wParam = VK_ENTER; |
012ec5192dfa
Added support for keypad enter
Sam Lantinga <slouken@libsdl.org>
parents:
2312
diff
changeset
|
392 |
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
|
393 |
} |
2710
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2324
diff
changeset
|
394 |
|
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
|
395 |
/* 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
|
396 |
if (wParam == VK_SNAPSHOT |
2308
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
2284
diff
changeset
|
397 |
&& SDL_GetKeyboardState(NULL)[SDL_SCANCODE_PRINTSCREEN] == |
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
2284
diff
changeset
|
398 |
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
|
399 |
SDL_SendKeyboardKey(SDL_PRESSED, |
2308
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
2284
diff
changeset
|
400 |
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
|
401 |
} |
2308
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
2284
diff
changeset
|
402 |
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
|
403 |
SDL_SendKeyboardKey(SDL_RELEASED, |
2308
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
2284
diff
changeset
|
404 |
data->videodata->key_layout[wParam]); |
514f7c1651fc
Untested Win32 keyboard scancode code.
Sam Lantinga <slouken@libsdl.org>
parents:
2284
diff
changeset
|
405 |
} |
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 |
} |
3566 | 407 |
returnCode = 0; |
408 |
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
|
409 |
|
2309
21591ae7355d
Implemented text input event for Win32
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
410 |
case WM_CHAR: |
21591ae7355d
Implemented text input event for Win32
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
411 |
{ |
21591ae7355d
Implemented text input event for Win32
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
412 |
char text[4]; |
21591ae7355d
Implemented text input event for Win32
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
413 |
|
21591ae7355d
Implemented text input event for Win32
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
414 |
/* Convert to UTF-8 and send it on... */ |
21591ae7355d
Implemented text input event for Win32
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
415 |
if (wParam <= 0x7F) { |
21591ae7355d
Implemented text input event for Win32
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
416 |
text[0] = (char) wParam; |
21591ae7355d
Implemented text input event for Win32
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
417 |
text[1] = '\0'; |
21591ae7355d
Implemented text input event for Win32
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
418 |
} else if (wParam <= 0x7FF) { |
21591ae7355d
Implemented text input event for Win32
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
419 |
text[0] = 0xC0 | (char) ((wParam >> 6) & 0x1F); |
21591ae7355d
Implemented text input event for Win32
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
420 |
text[1] = 0x80 | (char) (wParam & 0x3F); |
21591ae7355d
Implemented text input event for Win32
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
421 |
text[2] = '\0'; |
21591ae7355d
Implemented text input event for Win32
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
422 |
} else { |
21591ae7355d
Implemented text input event for Win32
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
423 |
text[0] = 0xE0 | (char) ((wParam >> 12) & 0x0F); |
21591ae7355d
Implemented text input event for Win32
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
424 |
text[1] = 0x80 | (char) ((wParam >> 6) & 0x3F); |
21591ae7355d
Implemented text input event for Win32
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
425 |
text[2] = 0x80 | (char) (wParam & 0x3F); |
21591ae7355d
Implemented text input event for Win32
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
426 |
text[3] = '\0'; |
21591ae7355d
Implemented text input event for Win32
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
427 |
} |
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
|
428 |
SDL_SendKeyboardText(text); |
2309
21591ae7355d
Implemented text input event for Win32
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
429 |
} |
3566 | 430 |
returnCode = 0; |
431 |
break; |
|
2309
21591ae7355d
Implemented text input event for Win32
Sam Lantinga <slouken@libsdl.org>
parents:
2308
diff
changeset
|
432 |
|
5086
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
433 |
#ifdef WM_INPUTLANGCHANGE |
2311
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2310
diff
changeset
|
434 |
case WM_INPUTLANGCHANGE: |
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2310
diff
changeset
|
435 |
{ |
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
|
436 |
WIN_UpdateKeymap(); |
2311
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2310
diff
changeset
|
437 |
} |
3566 | 438 |
returnCode = 1; |
439 |
break; |
|
5086
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
440 |
#endif /* WM_INPUTLANGCHANGE */ |
2311
54e21acfec5a
Friggin' Windows remaps alphabetic keys based on keyboard layout.
Sam Lantinga <slouken@libsdl.org>
parents:
2310
diff
changeset
|
441 |
|
5086
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
442 |
#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
|
443 |
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
|
444 |
{ |
c121d94672cb
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 |
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
|
446 |
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
|
447 |
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
|
448 |
int w, h; |
6682 | 449 |
int min_w, min_h; |
6788
036f53f2f5aa
Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents:
6782
diff
changeset
|
450 |
int max_w, max_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
|
451 |
int style; |
3168 | 452 |
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
|
453 |
|
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
454 |
/* If we allow resizing, let the resize happen naturally */ |
6682 | 455 |
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
|
456 |
Win32_ResizeWindowShape(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
|
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 |
/* 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
|
459 |
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
|
460 |
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
|
461 |
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
|
462 |
|
c121d94672cb
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 |
/* 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
|
464 |
SDL_GetWindowSize(data->window, &w, &h); |
6682 | 465 |
SDL_GetWindowMinimumSize(data->window, &min_w, &min_h); |
6788
036f53f2f5aa
Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents:
6782
diff
changeset
|
466 |
SDL_GetWindowMaximumSize(data->window, &max_w, &max_h); |
6682 | 467 |
|
468 |
/* Store in min_w and min_h difference between current size and minimal |
|
469 |
size so we don't need to call AdjustWindowRectEx twice */ |
|
470 |
min_w -= w; |
|
471 |
min_h -= h; |
|
6837
a69e10925a58
Fixed bug 1682 - Resize collapses window instantly to a size of 0 x 124.
Sam Lantinga <slouken@libsdl.org>
parents:
6788
diff
changeset
|
472 |
if (max_w && max_h) { |
a69e10925a58
Fixed bug 1682 - Resize collapses window instantly to a size of 0 x 124.
Sam Lantinga <slouken@libsdl.org>
parents:
6788
diff
changeset
|
473 |
max_w -= w; |
a69e10925a58
Fixed bug 1682 - Resize collapses window instantly to a size of 0 x 124.
Sam Lantinga <slouken@libsdl.org>
parents:
6788
diff
changeset
|
474 |
max_h -= h; |
a69e10925a58
Fixed bug 1682 - Resize collapses window instantly to a size of 0 x 124.
Sam Lantinga <slouken@libsdl.org>
parents:
6788
diff
changeset
|
475 |
} |
6682 | 476 |
|
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
|
477 |
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
|
478 |
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
|
479 |
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
|
480 |
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
|
481 |
|
3168 | 482 |
style = GetWindowLong(hwnd, GWL_STYLE); |
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
|
483 |
/* 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
|
484 |
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
|
485 |
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
|
486 |
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
|
487 |
*/ |
3168 | 488 |
menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL); |
489 |
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
|
490 |
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
|
491 |
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
|
492 |
|
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
493 |
/* 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
|
494 |
info = (MINMAXINFO *) lParam; |
6682 | 495 |
if (SDL_GetWindowFlags(data->window) & SDL_WINDOW_RESIZABLE) { |
496 |
info->ptMinTrackSize.x = w + min_w; |
|
497 |
info->ptMinTrackSize.y = h + min_h; |
|
6788
036f53f2f5aa
Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents:
6782
diff
changeset
|
498 |
info->ptMaxTrackSize.x = w + max_w; |
036f53f2f5aa
Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents:
6782
diff
changeset
|
499 |
info->ptMaxTrackSize.y = h + max_h; |
6682 | 500 |
} else { |
501 |
info->ptMaxSize.x = w; |
|
502 |
info->ptMaxSize.y = h; |
|
503 |
info->ptMaxPosition.x = x; |
|
504 |
info->ptMaxPosition.y = y; |
|
505 |
info->ptMinTrackSize.x = w; |
|
506 |
info->ptMinTrackSize.y = h; |
|
507 |
info->ptMaxTrackSize.x = w; |
|
508 |
info->ptMaxTrackSize.y = h; |
|
509 |
} |
|
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
|
510 |
} |
3566 | 511 |
returnCode = 0; |
512 |
break; |
|
5086
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
513 |
#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
|
514 |
|
c121d94672cb
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 |
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
|
516 |
{ |
c121d94672cb
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 |
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
|
518 |
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
|
519 |
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
|
520 |
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
|
521 |
|
3256
83c87f2b2aab
Fixed bug where minimized windows get zero width/height
Sam Lantinga <slouken@libsdl.org>
parents:
3253
diff
changeset
|
522 |
if (!GetClientRect(hwnd, &rect) || |
83c87f2b2aab
Fixed bug where minimized windows get zero width/height
Sam Lantinga <slouken@libsdl.org>
parents:
3253
diff
changeset
|
523 |
(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
|
524 |
break; |
83c87f2b2aab
Fixed bug where minimized windows get zero width/height
Sam Lantinga <slouken@libsdl.org>
parents:
3253
diff
changeset
|
525 |
} |
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
|
526 |
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
|
527 |
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
|
528 |
|
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
|
529 |
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
|
530 |
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
|
531 |
(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
|
532 |
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
|
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 |
|
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
535 |
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
|
536 |
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
|
537 |
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
|
538 |
|
c121d94672cb
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 |
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
|
540 |
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
|
541 |
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
|
542 |
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
|
543 |
} |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
544 |
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
|
545 |
|
c121d94672cb
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 |
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
|
547 |
{ |
3076
085e46423377
Use the default arrow cursor until we implement the cursor API
Sam Lantinga <slouken@libsdl.org>
parents:
3032
diff
changeset
|
548 |
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
|
549 |
|
3076
085e46423377
Use the default arrow cursor until we implement the cursor API
Sam Lantinga <slouken@libsdl.org>
parents:
3032
diff
changeset
|
550 |
hittest = LOWORD(lParam); |
085e46423377
Use the default arrow cursor until we implement the cursor API
Sam Lantinga <slouken@libsdl.org>
parents:
3032
diff
changeset
|
551 |
if (hittest == HTCLIENT) { |
5421
f8588afb6486
Added support for Windows cursors
Sam Lantinga <slouken@libsdl.org>
parents:
5262
diff
changeset
|
552 |
SetCursor(SDL_cursor); |
3566 | 553 |
returnCode = TRUE; |
3076
085e46423377
Use the default arrow cursor until we implement the cursor API
Sam Lantinga <slouken@libsdl.org>
parents:
3032
diff
changeset
|
554 |
} |
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
|
555 |
} |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
556 |
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
|
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 |
/* 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
|
559 |
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
|
560 |
{ |
c121d94672cb
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 |
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
|
562 |
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
|
563 |
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
|
564 |
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
|
565 |
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
|
566 |
} |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
567 |
} |
3566 | 568 |
returnCode = 0; |
569 |
break; |
|
3095
75483112b97f
Date: Sat, 21 Mar 2009 19:41:52 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
3076
diff
changeset
|
570 |
|
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
|
571 |
/* 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
|
572 |
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
|
573 |
{ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
574 |
} |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
575 |
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
|
576 |
|
5086
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
577 |
#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
|
578 |
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
|
579 |
{ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
580 |
/* 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
|
581 |
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
|
582 |
(wParam & 0xFFF0) == SC_MONITORPOWER) { |
3032 | 583 |
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
|
584 |
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
|
585 |
} |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
586 |
} |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
587 |
} |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
588 |
break; |
5086
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
589 |
#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
|
590 |
|
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
591 |
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
|
592 |
{ |
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
|
593 |
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
|
594 |
} |
3566 | 595 |
returnCode = 0; |
596 |
break; |
|
4919
716b2cbf4c9e
First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents:
4902
diff
changeset
|
597 |
|
4650 | 598 |
case WM_TOUCH: |
4932
0d1bb1ce9d15
Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4919
diff
changeset
|
599 |
{ |
0d1bb1ce9d15
Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4919
diff
changeset
|
600 |
UINT i, num_inputs = LOWORD(wParam); |
0d1bb1ce9d15
Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4919
diff
changeset
|
601 |
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
|
602 |
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
|
603 |
RECT rect; |
4919
716b2cbf4c9e
First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents:
4902
diff
changeset
|
604 |
float x, y; |
716b2cbf4c9e
First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents:
4902
diff
changeset
|
605 |
|
716b2cbf4c9e
First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents:
4902
diff
changeset
|
606 |
if (!GetClientRect(hwnd, &rect) || |
716b2cbf4c9e
First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents:
4902
diff
changeset
|
607 |
(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
|
608 |
break; |
716b2cbf4c9e
First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents:
4902
diff
changeset
|
609 |
} |
716b2cbf4c9e
First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents:
4902
diff
changeset
|
610 |
ClientToScreen(hwnd, (LPPOINT) & rect); |
4932
0d1bb1ce9d15
Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4919
diff
changeset
|
611 |
ClientToScreen(hwnd, (LPPOINT) & rect + 1); |
0d1bb1ce9d15
Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4919
diff
changeset
|
612 |
rect.top *= 100; |
0d1bb1ce9d15
Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4919
diff
changeset
|
613 |
rect.left *= 100; |
0d1bb1ce9d15
Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4919
diff
changeset
|
614 |
rect.bottom *= 100; |
0d1bb1ce9d15
Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4919
diff
changeset
|
615 |
rect.right *= 100; |
0d1bb1ce9d15
Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4919
diff
changeset
|
616 |
|
0d1bb1ce9d15
Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4919
diff
changeset
|
617 |
for (i = 0; i < num_inputs; ++i) { |
0d1bb1ce9d15
Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4919
diff
changeset
|
618 |
PTOUCHINPUT input = &inputs[i]; |
4919
716b2cbf4c9e
First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents:
4902
diff
changeset
|
619 |
|
5889
c2059a52efa1
More work on cleaning out compiler warnings.
Ryan C. Gordon <icculus@icculus.org>
parents:
5535
diff
changeset
|
620 |
const SDL_TouchID touchId = (SDL_TouchID) |
c2059a52efa1
More work on cleaning out compiler warnings.
Ryan C. Gordon <icculus@icculus.org>
parents:
5535
diff
changeset
|
621 |
((size_t)input->hSource); |
4919
716b2cbf4c9e
First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents:
4902
diff
changeset
|
622 |
if (!SDL_GetTouch(touchId)) { |
716b2cbf4c9e
First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents:
4902
diff
changeset
|
623 |
SDL_Touch touch; |
716b2cbf4c9e
First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents:
4902
diff
changeset
|
624 |
|
716b2cbf4c9e
First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents:
4902
diff
changeset
|
625 |
touch.id = touchId; |
716b2cbf4c9e
First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents:
4902
diff
changeset
|
626 |
touch.x_min = 0; |
716b2cbf4c9e
First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents:
4902
diff
changeset
|
627 |
touch.x_max = 1; |
716b2cbf4c9e
First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents:
4902
diff
changeset
|
628 |
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
|
629 |
touch.y_min = 0; |
716b2cbf4c9e
First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents:
4902
diff
changeset
|
630 |
touch.y_max = 1; |
716b2cbf4c9e
First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents:
4902
diff
changeset
|
631 |
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
|
632 |
touch.pressure_min = 0; |
716b2cbf4c9e
First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents:
4902
diff
changeset
|
633 |
touch.pressure_max = 1; |
716b2cbf4c9e
First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents:
4902
diff
changeset
|
634 |
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
|
635 |
|
716b2cbf4c9e
First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents:
4902
diff
changeset
|
636 |
if (SDL_AddTouch(&touch, "") < 0) { |
716b2cbf4c9e
First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents:
4902
diff
changeset
|
637 |
continue; |
716b2cbf4c9e
First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents:
4902
diff
changeset
|
638 |
} |
4932
0d1bb1ce9d15
Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4919
diff
changeset
|
639 |
} |
0d1bb1ce9d15
Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4919
diff
changeset
|
640 |
|
0d1bb1ce9d15
Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4919
diff
changeset
|
641 |
// Get the normalized coordinates for the window |
0d1bb1ce9d15
Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4919
diff
changeset
|
642 |
x = (float)(input->x - rect.left)/(rect.right - rect.left); |
0d1bb1ce9d15
Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4919
diff
changeset
|
643 |
y = (float)(input->y - rect.top)/(rect.bottom - rect.top); |
0d1bb1ce9d15
Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4919
diff
changeset
|
644 |
|
4919
716b2cbf4c9e
First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents:
4902
diff
changeset
|
645 |
if (input->dwFlags & TOUCHEVENTF_DOWN) { |
4932
0d1bb1ce9d15
Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4919
diff
changeset
|
646 |
SDL_SendFingerDown(touchId, input->dwID, SDL_TRUE, x, y, 1); |
0d1bb1ce9d15
Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4919
diff
changeset
|
647 |
} |
4919
716b2cbf4c9e
First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents:
4902
diff
changeset
|
648 |
if (input->dwFlags & TOUCHEVENTF_MOVE) { |
4932
0d1bb1ce9d15
Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4919
diff
changeset
|
649 |
SDL_SendTouchMotion(touchId, input->dwID, SDL_FALSE, x, y, 1); |
0d1bb1ce9d15
Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4919
diff
changeset
|
650 |
} |
4919
716b2cbf4c9e
First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents:
4902
diff
changeset
|
651 |
if (input->dwFlags & TOUCHEVENTF_UP) { |
4932
0d1bb1ce9d15
Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4919
diff
changeset
|
652 |
SDL_SendFingerDown(touchId, input->dwID, SDL_FALSE, x, y, 1); |
0d1bb1ce9d15
Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4919
diff
changeset
|
653 |
} |
0d1bb1ce9d15
Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4919
diff
changeset
|
654 |
} |
0d1bb1ce9d15
Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4919
diff
changeset
|
655 |
} |
0d1bb1ce9d15
Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4919
diff
changeset
|
656 |
SDL_stack_free(inputs); |
0d1bb1ce9d15
Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4919
diff
changeset
|
657 |
|
0d1bb1ce9d15
Removed carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4919
diff
changeset
|
658 |
data->videodata->CloseTouchInputHandle((HTOUCHINPUT)lParam); |
4919
716b2cbf4c9e
First pass at Windows multi-touch gesture support
Sam Lantinga <slouken@libsdl.org>
parents:
4902
diff
changeset
|
659 |
return 0; |
4650 | 660 |
} |
661 |
break; |
|
6523
62d0193a7a02
Fixed bug 1593 - SDL_DROPFILE event doesn't work on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
6430
diff
changeset
|
662 |
|
62d0193a7a02
Fixed bug 1593 - SDL_DROPFILE event doesn't work on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
6430
diff
changeset
|
663 |
case WM_DROPFILES: |
62d0193a7a02
Fixed bug 1593 - SDL_DROPFILE event doesn't work on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
6430
diff
changeset
|
664 |
{ |
62d0193a7a02
Fixed bug 1593 - SDL_DROPFILE event doesn't work on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
6430
diff
changeset
|
665 |
UINT i; |
62d0193a7a02
Fixed bug 1593 - SDL_DROPFILE event doesn't work on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
6430
diff
changeset
|
666 |
HDROP drop = (HDROP) wParam; |
62d0193a7a02
Fixed bug 1593 - SDL_DROPFILE event doesn't work on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
6430
diff
changeset
|
667 |
UINT count = DragQueryFile(drop, 0xFFFFFFFF, NULL, 0); |
62d0193a7a02
Fixed bug 1593 - SDL_DROPFILE event doesn't work on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
6430
diff
changeset
|
668 |
for (i = 0; i < count; ++i) { |
62d0193a7a02
Fixed bug 1593 - SDL_DROPFILE event doesn't work on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
6430
diff
changeset
|
669 |
UINT size = DragQueryFile(drop, i, NULL, 0) + 1; |
62d0193a7a02
Fixed bug 1593 - SDL_DROPFILE event doesn't work on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
6430
diff
changeset
|
670 |
LPTSTR buffer = SDL_stack_alloc(TCHAR, size); |
62d0193a7a02
Fixed bug 1593 - SDL_DROPFILE event doesn't work on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
6430
diff
changeset
|
671 |
if (buffer) { |
62d0193a7a02
Fixed bug 1593 - SDL_DROPFILE event doesn't work on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
6430
diff
changeset
|
672 |
if (DragQueryFile(drop, i, buffer, size)) { |
62d0193a7a02
Fixed bug 1593 - SDL_DROPFILE event doesn't work on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
6430
diff
changeset
|
673 |
char *file = WIN_StringToUTF8(buffer); |
62d0193a7a02
Fixed bug 1593 - SDL_DROPFILE event doesn't work on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
6430
diff
changeset
|
674 |
SDL_SendDropFile(file); |
62d0193a7a02
Fixed bug 1593 - SDL_DROPFILE event doesn't work on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
6430
diff
changeset
|
675 |
SDL_free(file); |
62d0193a7a02
Fixed bug 1593 - SDL_DROPFILE event doesn't work on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
6430
diff
changeset
|
676 |
} |
62d0193a7a02
Fixed bug 1593 - SDL_DROPFILE event doesn't work on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
6430
diff
changeset
|
677 |
SDL_stack_free(buffer); |
62d0193a7a02
Fixed bug 1593 - SDL_DROPFILE event doesn't work on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
6430
diff
changeset
|
678 |
} |
62d0193a7a02
Fixed bug 1593 - SDL_DROPFILE event doesn't work on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
6430
diff
changeset
|
679 |
} |
62d0193a7a02
Fixed bug 1593 - SDL_DROPFILE event doesn't work on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
6430
diff
changeset
|
680 |
DragFinish(drop); |
62d0193a7a02
Fixed bug 1593 - SDL_DROPFILE event doesn't work on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
6430
diff
changeset
|
681 |
return 0; |
62d0193a7a02
Fixed bug 1593 - SDL_DROPFILE event doesn't work on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
6430
diff
changeset
|
682 |
} |
62d0193a7a02
Fixed bug 1593 - SDL_DROPFILE event doesn't work on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
6430
diff
changeset
|
683 |
break; |
62d0193a7a02
Fixed bug 1593 - SDL_DROPFILE event doesn't work on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
6430
diff
changeset
|
684 |
} |
3566 | 685 |
|
686 |
/* If there's a window proc, assume it's going to handle messages */ |
|
687 |
if (data->wndproc) { |
|
688 |
return CallWindowProc(data->wndproc, hwnd, msg, wParam, lParam); |
|
689 |
} else if (returnCode >= 0) { |
|
690 |
return returnCode; |
|
691 |
} else { |
|
692 |
return CallWindowProc(DefWindowProc, hwnd, msg, wParam, lParam); |
|
693 |
} |
|
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
|
694 |
} |
c121d94672cb
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 |
|
c121d94672cb
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 |
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
|
697 |
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
|
698 |
{ |
c121d94672cb
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 |
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
|
700 |
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
|
701 |
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
|
702 |
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
|
703 |
} |
c121d94672cb
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 |
} |
c121d94672cb
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 |
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
|
707 |
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
|
708 |
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
|
709 |
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
|
710 |
|
c121d94672cb
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 |
/* 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
|
712 |
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
|
713 |
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
|
714 |
{ |
c121d94672cb
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 |
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
|
716 |
|
c121d94672cb
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 |
/* 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
|
718 |
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
|
719 |
++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
|
720 |
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
|
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 |
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
|
723 |
name = "SDL_app"; |
5086
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
724 |
#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
|
725 |
SDL_Appstyle = (CS_BYTEALIGNCLIENT | CS_OWNDC); |
5086
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
726 |
#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
|
727 |
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
|
728 |
} |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
729 |
|
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
730 |
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
|
731 |
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
|
732 |
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
|
733 |
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
|
734 |
} |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
735 |
|
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
736 |
/* 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
|
737 |
class.hCursor = NULL; |
2710
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2324
diff
changeset
|
738 |
class.hIcon = |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2324
diff
changeset
|
739 |
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
|
740 |
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
|
741 |
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
|
742 |
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
|
743 |
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
|
744 |
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
|
745 |
class.style = SDL_Appstyle; |
4733
983eb9d5ed31
Change SDL to not use DefWindowProc as the window class' window procedure.
dewyatt
parents:
4429
diff
changeset
|
746 |
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
|
747 |
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
|
748 |
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
|
749 |
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
|
750 |
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
|
751 |
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
|
752 |
} |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
753 |
|
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
754 |
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
|
755 |
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
|
756 |
} |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
757 |
|
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
758 |
/* 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
|
759 |
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
|
760 |
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
|
761 |
{ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
762 |
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
|
763 |
|
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
764 |
/* 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
|
765 |
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
|
766 |
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
|
767 |
} |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
768 |
--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
|
769 |
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
|
770 |
/* 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
|
771 |
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
|
772 |
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
|
773 |
} |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
774 |
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
|
775 |
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
|
776 |
} |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
777 |
} |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
778 |
|
6044
35448a5ea044
Lots of fixes importing SDL source wholesale into a new iOS project
Sam Lantinga <slouken@libsdl.org>
parents:
5889
diff
changeset
|
779 |
#endif /* SDL_VIDEO_DRIVER_WINDOWS */ |
35448a5ea044
Lots of fixes importing SDL source wholesale into a new iOS project
Sam Lantinga <slouken@libsdl.org>
parents:
5889
diff
changeset
|
780 |
|
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
|
781 |
/* vi: set ts=4 sw=4 expandtab: */ |