Mercurial > sdl-ios-xcode
annotate docs/html/sdlkeyboardevent.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_KeyboardEvent</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_ActiveEvent" | |
17 HREF="sdlactiveevent.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="SDL_MouseMotionEvent" | |
20 HREF="sdlmousemotionevent.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="sdlactiveevent.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="sdlmousemotionevent.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="SDLKEYBOARDEVENT" | |
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_KeyboardEvent</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="AEN4011" |
0 | 80 ></A |
81 ><H2 | |
82 >Name</H2 | |
83 >SDL_KeyboardEvent -- Keyboard 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="AEN4014" |
0 | 88 ></A |
89 ><H2 | |
90 >Structure Definition</H2 | |
91 ><PRE | |
92 CLASS="PROGRAMLISTING" | |
93 >typedef struct{ | |
94 Uint8 type; | |
95 Uint8 state; | |
96 SDL_keysym keysym; | |
97 } SDL_KeyboardEvent;</PRE | |
98 ></DIV | |
99 ><DIV | |
100 CLASS="REFSECT1" | |
101 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
102 NAME="AEN4017" |
0 | 103 ></A |
104 ><H2 | |
105 >Structure Data</H2 | |
106 ><DIV | |
107 CLASS="INFORMALTABLE" | |
108 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
109 NAME="AEN4019" |
0 | 110 ></A |
111 ><P | |
112 ></P | |
113 ><TABLE | |
114 BORDER="0" | |
115 CLASS="CALSTABLE" | |
116 ><TBODY | |
117 ><TR | |
118 ><TD | |
119 ALIGN="LEFT" | |
120 VALIGN="TOP" | |
121 ><TT | |
122 CLASS="STRUCTFIELD" | |
123 ><I | |
124 >type</I | |
125 ></TT | |
126 ></TD | |
127 ><TD | |
128 ALIGN="LEFT" | |
129 VALIGN="TOP" | |
130 ><TT | |
131 CLASS="LITERAL" | |
132 >SDL_KEYDOWN</TT | |
133 > or <TT | |
134 CLASS="LITERAL" | |
135 >SDL_KEYUP</TT | |
136 ></TD | |
137 ></TR | |
138 ><TR | |
139 ><TD | |
140 ALIGN="LEFT" | |
141 VALIGN="TOP" | |
142 ><TT | |
143 CLASS="STRUCTFIELD" | |
144 ><I | |
145 >state</I | |
146 ></TT | |
147 ></TD | |
148 ><TD | |
149 ALIGN="LEFT" | |
150 VALIGN="TOP" | |
151 ><TT | |
152 CLASS="LITERAL" | |
153 >SDL_PRESSED</TT | |
154 > or <TT | |
155 CLASS="LITERAL" | |
156 >SDL_RELEASED</TT | |
157 ></TD | |
158 ></TR | |
159 ><TR | |
160 ><TD | |
161 ALIGN="LEFT" | |
162 VALIGN="TOP" | |
163 ><TT | |
164 CLASS="STRUCTFIELD" | |
165 ><I | |
166 >keysym</I | |
167 ></TT | |
168 ></TD | |
169 ><TD | |
170 ALIGN="LEFT" | |
171 VALIGN="TOP" | |
172 >Contains key press information</TD | |
173 ></TR | |
174 ></TBODY | |
175 ></TABLE | |
176 ><P | |
177 ></P | |
178 ></DIV | |
179 ></DIV | |
180 ><DIV | |
181 CLASS="REFSECT1" | |
182 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
183 NAME="AEN4038" |
0 | 184 ></A |
185 ><H2 | |
186 >Description</H2 | |
187 ><P | |
188 ><SPAN | |
189 CLASS="STRUCTNAME" | |
190 >SDL_KeyboardEvent</SPAN | |
191 > is a member of the <A | |
192 HREF="sdlevent.html" | |
193 ><SPAN | |
194 CLASS="STRUCTNAME" | |
195 >SDL_Event</SPAN | |
196 ></A | |
197 > union and is used when an event of type <TT | |
198 CLASS="LITERAL" | |
199 >SDL_KEYDOWN</TT | |
200 > or <TT | |
201 CLASS="LITERAL" | |
202 >SDL_KEYUP</TT | |
203 > is reported.</P | |
204 ><P | |
205 >The <TT | |
206 CLASS="STRUCTFIELD" | |
207 ><I | |
208 >type</I | |
209 ></TT | |
210 > and <TT | |
211 CLASS="STRUCTFIELD" | |
212 ><I | |
213 >state</I | |
214 ></TT | |
215 > actually report the same information, they just use different values to do it! A keyboard event occurs when a key is released (<TT | |
216 CLASS="STRUCTFIELD" | |
217 ><I | |
218 >type</I | |
219 ></TT | |
220 >=<TT | |
221 CLASS="LITERAL" | |
222 >SDK_KEYUP</TT | |
223 > or <TT | |
224 CLASS="STRUCTFIELD" | |
225 ><I | |
226 >state</I | |
227 ></TT | |
228 >=<TT | |
229 CLASS="LITERAL" | |
230 >SDL_RELEASED</TT | |
231 >) and when a key is pressed (<TT | |
232 CLASS="STRUCTFIELD" | |
233 ><I | |
234 >type</I | |
235 ></TT | |
236 >=<TT | |
237 CLASS="LITERAL" | |
238 >SDL_KEYDOWN</TT | |
239 > or <TT | |
240 CLASS="STRUCTFIELD" | |
241 ><I | |
242 >state</I | |
243 ></TT | |
244 >=<TT | |
245 CLASS="LITERAL" | |
246 >SDL_PRESSED</TT | |
247 >). The information on what key was pressed or released is in the <A | |
248 HREF="sdlkeysym.html" | |
249 ><SPAN | |
250 CLASS="STRUCTNAME" | |
251 >keysym</SPAN | |
252 ></A | |
253 > structure.</P | |
254 ><DIV | |
255 CLASS="NOTE" | |
256 ><BLOCKQUOTE | |
257 CLASS="NOTE" | |
258 ><P | |
259 ><B | |
260 >Note: </B | |
261 >Repeating <TT | |
262 CLASS="LITERAL" | |
263 >SDL_KEYDOWN</TT | |
264 > events will occur if key repeat is enabled (see <A | |
265 HREF="sdlenablekeyrepeat.html" | |
266 ><TT | |
267 CLASS="FUNCTION" | |
268 >SDL_EnableKeyRepeat</TT | |
269 ></A | |
270 >).</P | |
271 ></BLOCKQUOTE | |
272 ></DIV | |
273 ></DIV | |
274 ><DIV | |
275 CLASS="REFSECT1" | |
276 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
277 NAME="AEN4064" |
0 | 278 ></A |
279 ><H2 | |
280 >See Also</H2 | |
281 ><P | |
282 ><A | |
283 HREF="sdlevent.html" | |
284 ><SPAN | |
285 CLASS="STRUCTNAME" | |
286 >SDL_Event</SPAN | |
287 ></A | |
288 >, | |
289 <A | |
290 HREF="sdlkeysym.html" | |
291 ><SPAN | |
292 CLASS="STRUCTNAME" | |
293 >SDL_keysym</SPAN | |
294 ></A | |
295 >, | |
296 <A | |
297 HREF="sdlenablekeyrepeat.html" | |
298 ><TT | |
299 CLASS="FUNCTION" | |
300 >SDL_EnableKeyRepeat</TT | |
301 ></A | |
302 >, | |
303 <A | |
304 HREF="sdlenableunicode.html" | |
305 ><TT | |
306 CLASS="FUNCTION" | |
307 >SDL_EnableUNICODE</TT | |
308 ></A | |
309 ></P | |
310 ></DIV | |
311 ><DIV | |
312 CLASS="NAVFOOTER" | |
313 ><HR | |
314 ALIGN="LEFT" | |
315 WIDTH="100%"><TABLE | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
316 SUMMARY="Footer navigation table" |
0 | 317 WIDTH="100%" |
318 BORDER="0" | |
319 CELLPADDING="0" | |
320 CELLSPACING="0" | |
321 ><TR | |
322 ><TD | |
323 WIDTH="33%" | |
324 ALIGN="left" | |
325 VALIGN="top" | |
326 ><A | |
327 HREF="sdlactiveevent.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
328 ACCESSKEY="P" |
0 | 329 >Prev</A |
330 ></TD | |
331 ><TD | |
332 WIDTH="34%" | |
333 ALIGN="center" | |
334 VALIGN="top" | |
335 ><A | |
336 HREF="index.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
337 ACCESSKEY="H" |
0 | 338 >Home</A |
339 ></TD | |
340 ><TD | |
341 WIDTH="33%" | |
342 ALIGN="right" | |
343 VALIGN="top" | |
344 ><A | |
345 HREF="sdlmousemotionevent.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
346 ACCESSKEY="N" |
0 | 347 >Next</A |
348 ></TD | |
349 ></TR | |
350 ><TR | |
351 ><TD | |
352 WIDTH="33%" | |
353 ALIGN="left" | |
354 VALIGN="top" | |
355 >SDL_ActiveEvent</TD | |
356 ><TD | |
357 WIDTH="34%" | |
358 ALIGN="center" | |
359 VALIGN="top" | |
360 ><A | |
361 HREF="eventstructures.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
362 ACCESSKEY="U" |
0 | 363 >Up</A |
364 ></TD | |
365 ><TD | |
366 WIDTH="33%" | |
367 ALIGN="right" | |
368 VALIGN="top" | |
369 >SDL_MouseMotionEvent</TD | |
370 ></TR | |
371 ></TABLE | |
372 ></DIV | |
373 ></BODY | |
374 ></HTML | |
375 > |