Mercurial > sdl-ios-xcode
annotate src/video/maccommon/SDL_mackeys.h @ 4393:9afe12fb4c41 SDL-1.2
Fixed bug #901
Tim Angus 2009-12-11 11:45:46 PST
Disable mouse event generation when state is not SDL_APPMOUSEFOCUS
If a Windows SDL application is minimised by using alt-tab, SDL_APPMOUSEFOCUS
is lost as part of the minimisation. Unfortunately, the directx driver doesn't
pay any attention to this state when generating mouse button events, so
clicking on the Desktop can cause mouse clicks in the SDL application, while
it's still minimised. The attached patch fixes this. It looks much more
complicated than it actually is due to indentation; here it is ignoring
whitespace:
tma@abraxas:~/sources/SDL-1.2-svn$ svn diff -x -b
Index: src/video/windx5/SDL_dx5events.c
===================================================================
--- src/video/windx5/SDL_dx5events.c (revision 5376)
+++ src/video/windx5/SDL_dx5events.c (working copy)
@@ -374,10 +374,9 @@
if ( !(SDL_GetAppState() & SDL_APPMOUSEFOCUS) ) {
mouse_lost = 1;
ClipCursor(NULL);
- }
-
+ } else {
/* If the mouse was lost, regain some sense of mouse state */
- if ( mouse_lost && (SDL_GetAppState() & SDL_APPMOUSEFOCUS) ) {
+ if ( mouse_lost ) {
POINT mouse_pos;
Uint8 old_state;
Uint8 new_state;
@@ -548,6 +547,7 @@
if ( xrel || yrel ) {
post_mouse_motion(1, xrel, yrel);
}
+ }
}
/* The main Win32 event handler */
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 14 Dec 2009 22:41:31 +0000 |
parents | a1b03ba2fcd0 |
children |
rev | line source |
---|---|
0 | 1 /* |
2 SDL - Simple DirectMedia Layer | |
4159 | 3 Copyright (C) 1997-2009 Sam Lantinga |
0 | 4 |
5 This library is free software; you can redistribute it and/or | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
0 | 7 License as published by the Free Software Foundation; either |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
0 | 9 |
10 This library is distributed in the hope that it will be useful, | |
11 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
13 Lesser General Public License for more details. |
0 | 14 |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
0 | 18 |
19 Sam Lantinga | |
252
e8157fcb3114
Updated the source with the correct e-mail address
Sam Lantinga <slouken@libsdl.org>
parents:
0
diff
changeset
|
20 slouken@libsdl.org |
0 | 21 */ |
22 | |
23 /* These are the Macintosh key scancode constants -- from Inside Macintosh */ | |
24 | |
25 #define MK_ESCAPE 0x35 | |
26 #define MK_F1 0x7A | |
27 #define MK_F2 0x78 | |
28 #define MK_F3 0x63 | |
29 #define MK_F4 0x76 | |
30 #define MK_F5 0x60 | |
31 #define MK_F6 0x61 | |
32 #define MK_F7 0x62 | |
33 #define MK_F8 0x64 | |
34 #define MK_F9 0x65 | |
35 #define MK_F10 0x6D | |
36 #define MK_F11 0x67 | |
37 #define MK_F12 0x6F | |
38 #define MK_PRINT 0x69 | |
39 #define MK_SCROLLOCK 0x6B | |
40 #define MK_PAUSE 0x71 | |
41 #define MK_POWER 0x7F | |
42 #define MK_BACKQUOTE 0x32 | |
43 #define MK_1 0x12 | |
44 #define MK_2 0x13 | |
45 #define MK_3 0x14 | |
46 #define MK_4 0x15 | |
47 #define MK_5 0x17 | |
48 #define MK_6 0x16 | |
49 #define MK_7 0x1A | |
50 #define MK_8 0x1C | |
51 #define MK_9 0x19 | |
52 #define MK_0 0x1D | |
53 #define MK_MINUS 0x1B | |
54 #define MK_EQUALS 0x18 | |
55 #define MK_BACKSPACE 0x33 | |
56 #define MK_INSERT 0x72 | |
57 #define MK_HOME 0x73 | |
58 #define MK_PAGEUP 0x74 | |
59 #define MK_NUMLOCK 0x47 | |
60 #define MK_KP_EQUALS 0x51 | |
61 #define MK_KP_DIVIDE 0x4B | |
62 #define MK_KP_MULTIPLY 0x43 | |
63 #define MK_TAB 0x30 | |
64 #define MK_q 0x0C | |
65 #define MK_w 0x0D | |
66 #define MK_e 0x0E | |
67 #define MK_r 0x0F | |
68 #define MK_t 0x11 | |
69 #define MK_y 0x10 | |
70 #define MK_u 0x20 | |
71 #define MK_i 0x22 | |
72 #define MK_o 0x1F | |
73 #define MK_p 0x23 | |
74 #define MK_LEFTBRACKET 0x21 | |
75 #define MK_RIGHTBRACKET 0x1E | |
76 #define MK_BACKSLASH 0x2A | |
77 #define MK_DELETE 0x75 | |
78 #define MK_END 0x77 | |
79 #define MK_PAGEDOWN 0x79 | |
80 #define MK_KP7 0x59 | |
81 #define MK_KP8 0x5B | |
82 #define MK_KP9 0x5C | |
83 #define MK_KP_MINUS 0x4E | |
84 #define MK_CAPSLOCK 0x39 | |
85 #define MK_a 0x00 | |
86 #define MK_s 0x01 | |
87 #define MK_d 0x02 | |
88 #define MK_f 0x03 | |
89 #define MK_g 0x05 | |
90 #define MK_h 0x04 | |
91 #define MK_j 0x26 | |
92 #define MK_k 0x28 | |
93 #define MK_l 0x25 | |
94 #define MK_SEMICOLON 0x29 | |
95 #define MK_QUOTE 0x27 | |
96 #define MK_RETURN 0x24 | |
97 #define MK_KP4 0x56 | |
98 #define MK_KP5 0x57 | |
99 #define MK_KP6 0x58 | |
100 #define MK_KP_PLUS 0x45 | |
101 #define MK_LSHIFT 0x38 | |
102 #define MK_z 0x06 | |
103 #define MK_x 0x07 | |
104 #define MK_c 0x08 | |
105 #define MK_v 0x09 | |
106 #define MK_b 0x0B | |
107 #define MK_n 0x2D | |
108 #define MK_m 0x2E | |
109 #define MK_COMMA 0x2B | |
110 #define MK_PERIOD 0x2F | |
111 #define MK_SLASH 0x2C | |
112 #if 0 /* These are the same as the left versions - use left by default */ | |
113 #define MK_RSHIFT 0x38 | |
114 #endif | |
115 #define MK_UP 0x7E | |
116 #define MK_KP1 0x53 | |
117 #define MK_KP2 0x54 | |
118 #define MK_KP3 0x55 | |
119 #define MK_KP_ENTER 0x4C | |
120 #define MK_LCTRL 0x3B | |
121 #define MK_LALT 0x3A | |
122 #define MK_LMETA 0x37 | |
123 #define MK_SPACE 0x31 | |
124 #if 0 /* These are the same as the left versions - use left by default */ | |
125 #define MK_RMETA 0x37 | |
126 #define MK_RALT 0x3A | |
127 #define MK_RCTRL 0x3B | |
128 #endif | |
129 #define MK_LEFT 0x7B | |
130 #define MK_DOWN 0x7D | |
131 #define MK_RIGHT 0x7C | |
132 #define MK_KP0 0x52 | |
133 #define MK_KP_PERIOD 0x41 | |
134 | |
1621 | 135 /* Wierd, these keys are on my iBook under Mac OS X */ |
0 | 136 #define MK_IBOOK_ENTER 0x34 |
137 #define MK_IBOOK_LEFT 0x3B | |
138 #define MK_IBOOK_RIGHT 0x3C | |
139 #define MK_IBOOK_DOWN 0x3D | |
140 #define MK_IBOOK_UP 0x3E |