Mercurial > sdl-ios-xcode
annotate docs/html/sdlmousemotionevent.html @ 934:af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
From: Eric Wing <ewing2121@yahoo.com>
Subject: New OS X patch (was Re: [SDL] Bug with inverted mouse coordinates in
I have a new patch for OS X I would like to submit.
First, it appears no further action has been taken on
my fix from Apple on the OpenGL windowed mode mouse
inversion problem. The fix would reunify the code, and
no longer require case checking for which version of
the OS you are running. This is probably a good fix
because the behavior with the old code could change
again with future versions of the OS, so those fixes
are included in this new patch.
But in addition, when I was at Apple, I asked them
about the ability to distinguish between the modifier
keys on the left and right sides of the keyboard (e.g.
Left Shift, Right Shift, Left/Right Alt, L/R Cmd, L/R
Ctrl). They told me that starting with Panther, the OS
began supporting this feature. This has always been a
source of annoyance for me when bringing a program
that comes from Windows or Linux to OS X when the
keybindings happened to need distinguishable left-side
and right-side keys. So the rest of the patch I am
submitting contains new code to support this feature
on Panther (and presumably later versions of the OS).
So after removing the OS version checks for the mouse
inversion problem, I reused the OS version checks to
activate the Left/Right detection of modifier keys. If
you are running Panther (or above), the new code will
attempt to distinguish between sides. For the older
OS's, the code path reverts to the original code.
I've tested with Panther on a G4 Cube, G5 dual
processor, and Powerbook Rev C. The Cube and G5
keyboards demonstrated the ability to distinguish
between sides. The Powerbook seems to only have
left-side keys, but the patch was still able to handle
it by producing the same results as before the patch.
I also wanted to test a non-Apple keyboard.
Unfortunately, I don't have any PC USB keyboards.
However, I was able to borrow a Sun Microsystems USB
keyboard, so I tried that out on the G5, and I got the
correct behavior for left and right sides. I'm
expecting that if it worked with a Sun keyboard, most
other keyboards should work with no problems.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Fri, 20 Aug 2004 22:35:23 +0000 |
parents | 355632dca928 |
children |
rev | line source |
---|---|
0 | 1 <HTML |
2 ><HEAD | |
3 ><TITLE | |
4 >SDL_MouseMotionEvent</TITLE | |
5 ><META | |
6 NAME="GENERATOR" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+ |
0 | 8 "><LINK |
9 REL="HOME" | |
10 TITLE="SDL Library Documentation" | |
11 HREF="index.html"><LINK | |
12 REL="UP" | |
13 TITLE="SDL Event Structures." | |
14 HREF="eventstructures.html"><LINK | |
15 REL="PREVIOUS" | |
16 TITLE="SDL_KeyboardEvent" | |
17 HREF="sdlkeyboardevent.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="SDL_MouseButtonEvent" | |
20 HREF="sdlmousebuttonevent.html"></HEAD | |
21 ><BODY | |
22 CLASS="REFENTRY" | |
23 BGCOLOR="#FFF8DC" | |
24 TEXT="#000000" | |
25 LINK="#0000ee" | |
26 VLINK="#551a8b" | |
27 ALINK="#ff0000" | |
28 ><DIV | |
29 CLASS="NAVHEADER" | |
30 ><TABLE | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
31 SUMMARY="Header navigation table" |
0 | 32 WIDTH="100%" |
33 BORDER="0" | |
34 CELLPADDING="0" | |
35 CELLSPACING="0" | |
36 ><TR | |
37 ><TH | |
38 COLSPAN="3" | |
39 ALIGN="center" | |
40 >SDL Library Documentation</TH | |
41 ></TR | |
42 ><TR | |
43 ><TD | |
44 WIDTH="10%" | |
45 ALIGN="left" | |
46 VALIGN="bottom" | |
47 ><A | |
48 HREF="sdlkeyboardevent.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
49 ACCESSKEY="P" |
0 | 50 >Prev</A |
51 ></TD | |
52 ><TD | |
53 WIDTH="80%" | |
54 ALIGN="center" | |
55 VALIGN="bottom" | |
56 ></TD | |
57 ><TD | |
58 WIDTH="10%" | |
59 ALIGN="right" | |
60 VALIGN="bottom" | |
61 ><A | |
62 HREF="sdlmousebuttonevent.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
63 ACCESSKEY="N" |
0 | 64 >Next</A |
65 ></TD | |
66 ></TR | |
67 ></TABLE | |
68 ><HR | |
69 ALIGN="LEFT" | |
70 WIDTH="100%"></DIV | |
71 ><H1 | |
72 ><A | |
73 NAME="SDLMOUSEMOTIONEVENT" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
74 ></A |
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
75 >SDL_MouseMotionEvent</H1 |
0 | 76 ><DIV |
77 CLASS="REFNAMEDIV" | |
78 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
79 NAME="AEN4079" |
0 | 80 ></A |
81 ><H2 | |
82 >Name</H2 | |
83 >SDL_MouseMotionEvent -- Mouse motion event structure</DIV | |
84 ><DIV | |
85 CLASS="REFSECT1" | |
86 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
87 NAME="AEN4082" |
0 | 88 ></A |
89 ><H2 | |
90 >Structure Definition</H2 | |
91 ><PRE | |
92 CLASS="PROGRAMLISTING" | |
93 >typedef struct{ | |
94 Uint8 type; | |
95 Uint8 state; | |
96 Uint16 x, y; | |
97 Sint16 xrel, yrel; | |
98 } SDL_MouseMotionEvent;</PRE | |
99 ></DIV | |
100 ><DIV | |
101 CLASS="REFSECT1" | |
102 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
103 NAME="AEN4085" |
0 | 104 ></A |
105 ><H2 | |
106 >Structure Data</H2 | |
107 ><DIV | |
108 CLASS="INFORMALTABLE" | |
109 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
110 NAME="AEN4087" |
0 | 111 ></A |
112 ><P | |
113 ></P | |
114 ><TABLE | |
115 BORDER="0" | |
116 CLASS="CALSTABLE" | |
117 ><TBODY | |
118 ><TR | |
119 ><TD | |
120 ALIGN="LEFT" | |
121 VALIGN="TOP" | |
122 ><TT | |
123 CLASS="STRUCTFIELD" | |
124 ><I | |
125 >type</I | |
126 ></TT | |
127 ></TD | |
128 ><TD | |
129 ALIGN="LEFT" | |
130 VALIGN="TOP" | |
131 ><TT | |
132 CLASS="LITERAL" | |
133 >SDL_MOUSEMOTION</TT | |
134 ></TD | |
135 ></TR | |
136 ><TR | |
137 ><TD | |
138 ALIGN="LEFT" | |
139 VALIGN="TOP" | |
140 ><TT | |
141 CLASS="STRUCTFIELD" | |
142 ><I | |
143 >state</I | |
144 ></TT | |
145 ></TD | |
146 ><TD | |
147 ALIGN="LEFT" | |
148 VALIGN="TOP" | |
149 >The current button state</TD | |
150 ></TR | |
151 ><TR | |
152 ><TD | |
153 ALIGN="LEFT" | |
154 VALIGN="TOP" | |
155 ><TT | |
156 CLASS="STRUCTFIELD" | |
157 ><I | |
158 >x</I | |
159 ></TT | |
160 >, <TT | |
161 CLASS="STRUCTFIELD" | |
162 ><I | |
163 >y</I | |
164 ></TT | |
165 ></TD | |
166 ><TD | |
167 ALIGN="LEFT" | |
168 VALIGN="TOP" | |
169 >The X/Y coordinates of the mouse</TD | |
170 ></TR | |
171 ><TR | |
172 ><TD | |
173 ALIGN="LEFT" | |
174 VALIGN="TOP" | |
175 ><TT | |
176 CLASS="STRUCTFIELD" | |
177 ><I | |
178 >xrel</I | |
179 ></TT | |
180 >, <TT | |
181 CLASS="STRUCTFIELD" | |
182 ><I | |
183 >yrel</I | |
184 ></TT | |
185 ></TD | |
186 ><TD | |
187 ALIGN="LEFT" | |
188 VALIGN="TOP" | |
189 >Relative motion in the X/Y direction</TD | |
190 ></TR | |
191 ></TBODY | |
192 ></TABLE | |
193 ><P | |
194 ></P | |
195 ></DIV | |
196 ></DIV | |
197 ><DIV | |
198 CLASS="REFSECT1" | |
199 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
200 NAME="AEN4109" |
0 | 201 ></A |
202 ><H2 | |
203 >Description</H2 | |
204 ><P | |
205 ><SPAN | |
206 CLASS="STRUCTNAME" | |
207 >SDL_MouseMotionEvent</SPAN | |
208 > is a member of the <A | |
209 HREF="sdlevent.html" | |
210 ><SPAN | |
211 CLASS="STRUCTNAME" | |
212 >SDL_Event</SPAN | |
213 ></A | |
214 > union and is used when an event of type <TT | |
215 CLASS="LITERAL" | |
216 >SDL_MOUSEMOTION</TT | |
217 > is reported.</P | |
218 ><P | |
219 >Simply put, a <TT | |
220 CLASS="LITERAL" | |
221 >SDL_MOUSEMOTION</TT | |
222 > type event occurs when a user moves the mouse within the application window or when <A | |
223 HREF="sdlwarpmouse.html" | |
224 ><TT | |
225 CLASS="FUNCTION" | |
226 >SDL_WarpMouse</TT | |
227 ></A | |
228 > is called. Both the absolute (<TT | |
229 CLASS="STRUCTFIELD" | |
230 ><I | |
231 >x</I | |
232 ></TT | |
233 > and <TT | |
234 CLASS="STRUCTFIELD" | |
235 ><I | |
236 >y</I | |
237 ></TT | |
238 >) and relative (<TT | |
239 CLASS="STRUCTFIELD" | |
240 ><I | |
241 >xrel</I | |
242 ></TT | |
243 > and <TT | |
244 CLASS="STRUCTFIELD" | |
245 ><I | |
246 >yrel</I | |
247 ></TT | |
248 >) coordinates are reported along with the current button states (<TT | |
249 CLASS="STRUCTFIELD" | |
250 ><I | |
251 >state</I | |
252 ></TT | |
253 >). The button state can be interpreted using the <TT | |
254 CLASS="LITERAL" | |
255 >SDL_BUTTON</TT | |
256 > macro (see <A | |
257 HREF="sdlgetmousestate.html" | |
258 ><TT | |
259 CLASS="FUNCTION" | |
260 >SDL_GetMouseState</TT | |
261 ></A | |
262 >).</P | |
263 ><P | |
264 >If the cursor is hidden (<A | |
265 HREF="sdlshowcursor.html" | |
266 ><TT | |
267 CLASS="FUNCTION" | |
268 >SDL_ShowCursor</TT | |
269 >(0)</A | |
270 >) and the input is grabbed (<A | |
271 HREF="sdlwmgrabinput.html" | |
272 ><TT | |
273 CLASS="FUNCTION" | |
274 >SDL_WM_GrabInput</TT | |
275 >(SDL_GRAB_ON)</A | |
276 >), then the mouse will give relative motion events even when the cursor reaches the edge fo the screen. This is currently only implemented on Windows and Linux/Unix-a-likes.</P | |
277 ></DIV | |
278 ><DIV | |
279 CLASS="REFSECT1" | |
280 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
281 NAME="AEN4133" |
0 | 282 ></A |
283 ><H2 | |
284 >See Also</H2 | |
285 ><P | |
286 ><A | |
287 HREF="sdlevent.html" | |
288 ><SPAN | |
289 CLASS="STRUCTNAME" | |
290 >SDL_Event</SPAN | |
291 ></A | |
292 >, | |
293 <A | |
294 HREF="sdlmousebuttonevent.html" | |
295 ><SPAN | |
296 CLASS="STRUCTNAME" | |
297 >SDL_MouseButtonEvent</SPAN | |
298 ></A | |
299 ></P | |
300 ></DIV | |
301 ><DIV | |
302 CLASS="NAVFOOTER" | |
303 ><HR | |
304 ALIGN="LEFT" | |
305 WIDTH="100%"><TABLE | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
306 SUMMARY="Footer navigation table" |
0 | 307 WIDTH="100%" |
308 BORDER="0" | |
309 CELLPADDING="0" | |
310 CELLSPACING="0" | |
311 ><TR | |
312 ><TD | |
313 WIDTH="33%" | |
314 ALIGN="left" | |
315 VALIGN="top" | |
316 ><A | |
317 HREF="sdlkeyboardevent.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
318 ACCESSKEY="P" |
0 | 319 >Prev</A |
320 ></TD | |
321 ><TD | |
322 WIDTH="34%" | |
323 ALIGN="center" | |
324 VALIGN="top" | |
325 ><A | |
326 HREF="index.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
327 ACCESSKEY="H" |
0 | 328 >Home</A |
329 ></TD | |
330 ><TD | |
331 WIDTH="33%" | |
332 ALIGN="right" | |
333 VALIGN="top" | |
334 ><A | |
335 HREF="sdlmousebuttonevent.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
336 ACCESSKEY="N" |
0 | 337 >Next</A |
338 ></TD | |
339 ></TR | |
340 ><TR | |
341 ><TD | |
342 WIDTH="33%" | |
343 ALIGN="left" | |
344 VALIGN="top" | |
345 >SDL_KeyboardEvent</TD | |
346 ><TD | |
347 WIDTH="34%" | |
348 ALIGN="center" | |
349 VALIGN="top" | |
350 ><A | |
351 HREF="eventstructures.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
352 ACCESSKEY="U" |
0 | 353 >Up</A |
354 ></TD | |
355 ><TD | |
356 WIDTH="33%" | |
357 ALIGN="right" | |
358 VALIGN="top" | |
359 >SDL_MouseButtonEvent</TD | |
360 ></TR | |
361 ></TABLE | |
362 ></DIV | |
363 ></BODY | |
364 ></HTML | |
365 > |