Mercurial > sdl-ios-xcode
annotate docs/html/event.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 >Events</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 Reference" | |
14 HREF="reference.html"><LINK | |
15 REL="PREVIOUS" | |
16 TITLE="SDL_WM_GrabInput" | |
17 HREF="sdlwmgrabinput.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="SDL Event Structures." | |
20 HREF="eventstructures.html"><META | |
21 NAME="KEYWORD" | |
22 CONTENT="events"><META | |
23 NAME="KEYWORD" | |
24 CONTENT="function"></HEAD | |
25 ><BODY | |
26 CLASS="CHAPTER" | |
27 BGCOLOR="#FFF8DC" | |
28 TEXT="#000000" | |
29 LINK="#0000ee" | |
30 VLINK="#551a8b" | |
31 ALINK="#ff0000" | |
32 ><DIV | |
33 CLASS="NAVHEADER" | |
34 ><TABLE | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
35 SUMMARY="Header navigation table" |
0 | 36 WIDTH="100%" |
37 BORDER="0" | |
38 CELLPADDING="0" | |
39 CELLSPACING="0" | |
40 ><TR | |
41 ><TH | |
42 COLSPAN="3" | |
43 ALIGN="center" | |
44 >SDL Library Documentation</TH | |
45 ></TR | |
46 ><TR | |
47 ><TD | |
48 WIDTH="10%" | |
49 ALIGN="left" | |
50 VALIGN="bottom" | |
51 ><A | |
52 HREF="sdlwmgrabinput.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
53 ACCESSKEY="P" |
0 | 54 >Prev</A |
55 ></TD | |
56 ><TD | |
57 WIDTH="80%" | |
58 ALIGN="center" | |
59 VALIGN="bottom" | |
60 ></TD | |
61 ><TD | |
62 WIDTH="10%" | |
63 ALIGN="right" | |
64 VALIGN="bottom" | |
65 ><A | |
66 HREF="eventstructures.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
67 ACCESSKEY="N" |
0 | 68 >Next</A |
69 ></TD | |
70 ></TR | |
71 ></TABLE | |
72 ><HR | |
73 ALIGN="LEFT" | |
74 WIDTH="100%"></DIV | |
75 ><DIV | |
76 CLASS="CHAPTER" | |
77 ><H1 | |
78 ><A | |
79 NAME="EVENT" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
80 ></A |
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
81 >Chapter 8. Events</H1 |
0 | 82 ><DIV |
83 CLASS="TOC" | |
84 ><DL | |
85 ><DT | |
86 ><B | |
87 >Table of Contents</B | |
88 ></DT | |
89 ><DT | |
90 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
91 HREF="event.html#AEN3691" |
0 | 92 >Introduction</A |
93 ></DT | |
94 ><DT | |
95 ><A | |
96 HREF="eventstructures.html" | |
97 >SDL Event Structures.</A | |
98 ></DT | |
99 ><DT | |
100 ><A | |
101 HREF="eventfunctions.html" | |
102 >Event Functions.</A | |
103 ></DT | |
104 ></DL | |
105 ></DIV | |
106 ><DIV | |
107 CLASS="SECT1" | |
108 ><H1 | |
109 CLASS="SECT1" | |
110 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
111 NAME="AEN3691" |
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
112 ></A |
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
113 >Introduction</H1 |
0 | 114 ><P |
115 >Event handling allows your application to receive input from the user. Event handling is initalised (along with video) with a call to: | |
116 <PRE | |
117 CLASS="PROGRAMLISTING" | |
118 >SDL_Init(SDL_INIT_VIDEO);</PRE | |
119 > | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
120 Internally, SDL stores all the events waiting to be handled in an event queue. Using functions like <A |
0 | 121 HREF="sdlpollevent.html" |
122 ><TT | |
123 CLASS="FUNCTION" | |
124 >SDL_PollEvent</TT | |
125 ></A | |
126 > and <A | |
127 HREF="sdlpeepevents.html" | |
128 ><TT | |
129 CLASS="FUNCTION" | |
130 >SDL_PeepEvents</TT | |
131 ></A | |
132 > you can observe and handle waiting input events.</P | |
133 ><P | |
134 >The key to event handling in SDL is the <A | |
135 HREF="sdlevent.html" | |
136 ><SPAN | |
137 CLASS="STRUCTNAME" | |
138 >SDL_Event</SPAN | |
139 ></A | |
140 > union. The event queue itself is composed of a series of <SPAN | |
141 CLASS="STRUCTNAME" | |
142 >SDL_Event</SPAN | |
143 > unions, one for each waiting event. <SPAN | |
144 CLASS="STRUCTNAME" | |
145 >SDL_Event</SPAN | |
146 > unions are read from the queue with the <TT | |
147 CLASS="FUNCTION" | |
148 >SDL_PollEvent</TT | |
149 > function and it is then up to the application to process the information stored with them.</P | |
150 ></DIV | |
151 ></DIV | |
152 ><DIV | |
153 CLASS="NAVFOOTER" | |
154 ><HR | |
155 ALIGN="LEFT" | |
156 WIDTH="100%"><TABLE | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
157 SUMMARY="Footer navigation table" |
0 | 158 WIDTH="100%" |
159 BORDER="0" | |
160 CELLPADDING="0" | |
161 CELLSPACING="0" | |
162 ><TR | |
163 ><TD | |
164 WIDTH="33%" | |
165 ALIGN="left" | |
166 VALIGN="top" | |
167 ><A | |
168 HREF="sdlwmgrabinput.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
169 ACCESSKEY="P" |
0 | 170 >Prev</A |
171 ></TD | |
172 ><TD | |
173 WIDTH="34%" | |
174 ALIGN="center" | |
175 VALIGN="top" | |
176 ><A | |
177 HREF="index.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
178 ACCESSKEY="H" |
0 | 179 >Home</A |
180 ></TD | |
181 ><TD | |
182 WIDTH="33%" | |
183 ALIGN="right" | |
184 VALIGN="top" | |
185 ><A | |
186 HREF="eventstructures.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
187 ACCESSKEY="N" |
0 | 188 >Next</A |
189 ></TD | |
190 ></TR | |
191 ><TR | |
192 ><TD | |
193 WIDTH="33%" | |
194 ALIGN="left" | |
195 VALIGN="top" | |
196 >SDL_WM_GrabInput</TD | |
197 ><TD | |
198 WIDTH="34%" | |
199 ALIGN="center" | |
200 VALIGN="top" | |
201 ><A | |
202 HREF="reference.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
203 ACCESSKEY="U" |
0 | 204 >Up</A |
205 ></TD | |
206 ><TD | |
207 WIDTH="33%" | |
208 ALIGN="right" | |
209 VALIGN="top" | |
210 >SDL Event Structures.</TD | |
211 ></TR | |
212 ></TABLE | |
213 ></DIV | |
214 ></BODY | |
215 ></HTML | |
216 > |