Mercurial > sdl-ios-xcode
annotate docs/html/sdljoyhatevent.html @ 1192:54aa9aa32327
To: sdl@libsdl.org
From: Christian Walther <cwalther@gmx.ch>
Date: Fri, 18 Nov 2005 23:39:02 +0100
Subject: [SDL] Mouse position bugs on Mac OS X
The attached patch fixes a few bugs in SDL related to the mouse position
in windowed mode on Mac OS X, reproduced using the attached minimal test
program - at least here on 10.3.9, with SDL CVS from today. Could anyone
test whether the bugs exist and are fixed by the patch on 10.2 and 10.4?
1. When using OpenGL, the vertical mouse positions obtained through
events or SDL_GetMouseState() are off by one.
2. When using OpenGL, SDL_WarpMouse() inverts the y coordinate.
3. Clicks on the topmost pixel row of the window are not recognized.
1 and 2 do not occur in non-OpenGL mode, while 3 does. All three only
occur in windowed mode, not in fullscreen.
The cause for 1 and 3 is that in Cocoa, "the location of the mouse"
seems to be defined as "the location of the top left corner of the mouse
pointer's hot pixel" (this is not documented, it's just what I found out
here), which together with the fact that Cocoa's usual y coordinates
start at the bottom and increase upwards means that the y coordinate of
the mouse runs from 1 to h, not from 0 to h-1, in a window of height h.
If it does work on 10.2 and 10.4 (I'll try to test it as soon as I can,
but at the moment all I have at hand is 10.3.9), can this be applied to
the CVS?
-Christian
To: sdl@libsdl.org
From: Christian Walther <cwalther@gmx.ch>
Date: Mon, 28 Nov 2005 10:41:51 +0100
Subject: [SDL] Re: Mouse position bugs on Mac OS X
I wrote:
> I'll try to test it as soon as I can, but at the moment all I have at hand is 10.3.9
So, here are the results of my tests (with patched and unpatched
frameworks compiled with Xcode 1.5 (gcc 3.3) on 10.3.9):
On 10.1.5, my test program doesn't run because of "Undefined symbols:
SDL undefined reference to _CGMainDisplayID expected to be defined in
Carbon". I guess not supporting 10.1 was a deliberate decision then and
that's OK with me.
On 10.2.8, 10.3.9, and 10.4.0, the bugs exist as described in my
original post and are fixed by my patch. That is, there is no difference
between pre/post 10.3 and the patched version works correctly in all
combinations of GL/non-GL and windowed/fullscreen.
I therefore recommend the patch for inclusion.
-Christian
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Mon, 28 Nov 2005 13:58:26 +0000 |
parents | 355632dca928 |
children |
rev | line source |
---|---|
0 | 1 <HTML |
2 ><HEAD | |
3 ><TITLE | |
4 >SDL_JoyHatEvent</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_JoyButtonEvent" | |
17 HREF="sdljoybuttonevent.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="SDL_JoyBallEvent" | |
20 HREF="sdljoyballevent.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="sdljoybuttonevent.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="sdljoyballevent.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="SDLJOYHATEVENT" | |
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_JoyHatEvent</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="AEN4320" |
0 | 80 ></A |
81 ><H2 | |
82 >Name</H2 | |
83 >SDL_JoyHatEvent -- Joystick hat position change 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="AEN4323" |
0 | 88 ></A |
89 ><H2 | |
90 >Structure Definition</H2 | |
91 ><PRE | |
92 CLASS="PROGRAMLISTING" | |
93 >typedef struct{ | |
94 Uint8 type; | |
95 Uint8 which; | |
96 Uint8 hat; | |
97 Uint8 value; | |
98 } SDL_JoyHatEvent;</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="AEN4326" |
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="AEN4328" |
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_JOY</TT | |
134 ></TD | |
135 ></TR | |
136 ><TR | |
137 ><TD | |
138 ALIGN="LEFT" | |
139 VALIGN="TOP" | |
140 ><TT | |
141 CLASS="STRUCTFIELD" | |
142 ><I | |
143 >which</I | |
144 ></TT | |
145 ></TD | |
146 ><TD | |
147 ALIGN="LEFT" | |
148 VALIGN="TOP" | |
149 >Joystick device index</TD | |
150 ></TR | |
151 ><TR | |
152 ><TD | |
153 ALIGN="LEFT" | |
154 VALIGN="TOP" | |
155 ><TT | |
156 CLASS="STRUCTFIELD" | |
157 ><I | |
158 >hat</I | |
159 ></TT | |
160 ></TD | |
161 ><TD | |
162 ALIGN="LEFT" | |
163 VALIGN="TOP" | |
164 >Joystick hat index</TD | |
165 ></TR | |
166 ><TR | |
167 ><TD | |
168 ALIGN="LEFT" | |
169 VALIGN="TOP" | |
170 ><TT | |
171 CLASS="STRUCTFIELD" | |
172 ><I | |
173 >value</I | |
174 ></TT | |
175 ></TD | |
176 ><TD | |
177 ALIGN="LEFT" | |
178 VALIGN="TOP" | |
179 >Hat position</TD | |
180 ></TR | |
181 ></TBODY | |
182 ></TABLE | |
183 ><P | |
184 ></P | |
185 ></DIV | |
186 ></DIV | |
187 ><DIV | |
188 CLASS="REFSECT1" | |
189 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
190 NAME="AEN4348" |
0 | 191 ></A |
192 ><H2 | |
193 >Description</H2 | |
194 ><P | |
195 ><SPAN | |
196 CLASS="STRUCTNAME" | |
197 >SDL_JoyHatEvent</SPAN | |
198 > is a member of the <A | |
199 HREF="sdlevent.html" | |
200 ><SPAN | |
201 CLASS="STRUCTNAME" | |
202 >SDL_Event</SPAN | |
203 ></A | |
204 > union and is used when an event of type <TT | |
205 CLASS="LITERAL" | |
206 >SDL_JOYHATMOTION</TT | |
207 > is reported.</P | |
208 ><P | |
209 >A <TT | |
210 CLASS="LITERAL" | |
211 >SDL_JOYHATMOTION</TT | |
212 > event occurs when ever a user moves a hat on the joystick. The field <TT | |
213 CLASS="STRUCTFIELD" | |
214 ><I | |
215 >which</I | |
216 ></TT | |
217 > is the index of the joystick that reported the event and <TT | |
218 CLASS="STRUCTFIELD" | |
219 ><I | |
220 >hat</I | |
221 ></TT | |
222 > is the index of the hat (for a more detailed exlaination see the <A | |
223 HREF="joystick.html" | |
224 >Joystick section</A | |
225 >). <TT | |
226 CLASS="STRUCTFIELD" | |
227 ><I | |
228 >value</I | |
229 ></TT | |
230 > is the current position of the hat. It is a logically OR'd combination of the following values (whose meanings should be pretty obvious:) :</P | |
231 ><P | |
232 ></P | |
233 ><TABLE | |
234 BORDER="0" | |
235 ><TBODY | |
236 ><TR | |
237 ><TD | |
238 ><TT | |
239 CLASS="LITERAL" | |
240 >SDL_HAT_CENTERED</TT | |
241 ></TD | |
242 ></TR | |
243 ><TR | |
244 ><TD | |
245 ><TT | |
246 CLASS="LITERAL" | |
247 >SDL_HAT_UP</TT | |
248 ></TD | |
249 ></TR | |
250 ><TR | |
251 ><TD | |
252 ><TT | |
253 CLASS="LITERAL" | |
254 >SDL_HAT_RIGHT</TT | |
255 ></TD | |
256 ></TR | |
257 ><TR | |
258 ><TD | |
259 ><TT | |
260 CLASS="LITERAL" | |
261 >SDL_HAT_DOWN</TT | |
262 ></TD | |
263 ></TR | |
264 ><TR | |
265 ><TD | |
266 ><TT | |
267 CLASS="LITERAL" | |
268 >SDL_HAT_LEFT</TT | |
269 ></TD | |
270 ></TR | |
271 ></TBODY | |
272 ></TABLE | |
273 ><P | |
274 ></P | |
275 ><P | |
276 >The following defines are also provided:</P | |
277 ><P | |
278 ></P | |
279 ><TABLE | |
280 BORDER="0" | |
281 ><TBODY | |
282 ><TR | |
283 ><TD | |
284 ><TT | |
285 CLASS="LITERAL" | |
286 >SDL_HAT_RIGHTUP</TT | |
287 ></TD | |
288 ></TR | |
289 ><TR | |
290 ><TD | |
291 ><TT | |
292 CLASS="LITERAL" | |
293 >SDL_HAT_RIGHTDOWN</TT | |
294 ></TD | |
295 ></TR | |
296 ><TR | |
297 ><TD | |
298 ><TT | |
299 CLASS="LITERAL" | |
300 >SDL_HAT_LEFTUP</TT | |
301 ></TD | |
302 ></TR | |
303 ><TR | |
304 ><TD | |
305 ><TT | |
306 CLASS="LITERAL" | |
307 >SDL_HAT_LEFTDOWN</TT | |
308 ></TD | |
309 ></TR | |
310 ></TBODY | |
311 ></TABLE | |
312 ><P | |
313 ></P | |
314 ></DIV | |
315 ><DIV | |
316 CLASS="REFSECT1" | |
317 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
318 NAME="AEN4382" |
0 | 319 ></A |
320 ><H2 | |
321 >See Also</H2 | |
322 ><P | |
323 ><A | |
324 HREF="sdlevent.html" | |
325 ><SPAN | |
326 CLASS="STRUCTNAME" | |
327 >SDL_Event</SPAN | |
328 ></A | |
329 >, | |
330 <A | |
331 HREF="joystick.html" | |
332 >Joystick Functions</A | |
333 >, | |
334 <A | |
335 HREF="sdljoystickeventstate.html" | |
336 ><TT | |
337 CLASS="FUNCTION" | |
338 >SDL_JoystickEventState</TT | |
339 ></A | |
340 >, | |
341 <A | |
342 HREF="sdljoystickgetball.html" | |
343 ><TT | |
344 CLASS="FUNCTION" | |
345 >SDL_JoystickGetHat</TT | |
346 ></A | |
347 ></P | |
348 ></DIV | |
349 ><DIV | |
350 CLASS="NAVFOOTER" | |
351 ><HR | |
352 ALIGN="LEFT" | |
353 WIDTH="100%"><TABLE | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
354 SUMMARY="Footer navigation table" |
0 | 355 WIDTH="100%" |
356 BORDER="0" | |
357 CELLPADDING="0" | |
358 CELLSPACING="0" | |
359 ><TR | |
360 ><TD | |
361 WIDTH="33%" | |
362 ALIGN="left" | |
363 VALIGN="top" | |
364 ><A | |
365 HREF="sdljoybuttonevent.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
366 ACCESSKEY="P" |
0 | 367 >Prev</A |
368 ></TD | |
369 ><TD | |
370 WIDTH="34%" | |
371 ALIGN="center" | |
372 VALIGN="top" | |
373 ><A | |
374 HREF="index.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
375 ACCESSKEY="H" |
0 | 376 >Home</A |
377 ></TD | |
378 ><TD | |
379 WIDTH="33%" | |
380 ALIGN="right" | |
381 VALIGN="top" | |
382 ><A | |
383 HREF="sdljoyballevent.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
384 ACCESSKEY="N" |
0 | 385 >Next</A |
386 ></TD | |
387 ></TR | |
388 ><TR | |
389 ><TD | |
390 WIDTH="33%" | |
391 ALIGN="left" | |
392 VALIGN="top" | |
393 >SDL_JoyButtonEvent</TD | |
394 ><TD | |
395 WIDTH="34%" | |
396 ALIGN="center" | |
397 VALIGN="top" | |
398 ><A | |
399 HREF="eventstructures.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
400 ACCESSKEY="U" |
0 | 401 >Up</A |
402 ></TD | |
403 ><TD | |
404 WIDTH="33%" | |
405 ALIGN="right" | |
406 VALIGN="top" | |
407 >SDL_JoyBallEvent</TD | |
408 ></TR | |
409 ></TABLE | |
410 ></DIV | |
411 ></BODY | |
412 ></HTML | |
413 > |