Mercurial > sdl-ios-xcode
annotate docs/html/sdlsempost.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_SemPost</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="Multi-threaded Programming" | |
14 HREF="thread.html"><LINK | |
15 REL="PREVIOUS" | |
16 TITLE="SDL_SemWaitTimeout" | |
17 HREF="sdlsemwaittimeout.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="SDL_SemValue" | |
20 HREF="sdlsemvalue.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="sdlsemwaittimeout.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="sdlsemvalue.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="SDLSEMPOST" | |
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_SemPost</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="AEN8170" |
0 | 80 ></A |
81 ><H2 | |
82 >Name</H2 | |
83 >SDL_SemPost -- Unlock a semaphore.</DIV | |
84 ><DIV | |
85 CLASS="REFSYNOPSISDIV" | |
86 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
87 NAME="AEN8173" |
0 | 88 ></A |
89 ><H2 | |
90 >Synopsis</H2 | |
91 ><DIV | |
92 CLASS="FUNCSYNOPSIS" | |
93 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
94 NAME="AEN8174" |
0 | 95 ></A |
96 ><P | |
97 ></P | |
98 ><PRE | |
99 CLASS="FUNCSYNOPSISINFO" | |
100 >#include "SDL.h" | |
101 #include "SDL_thread.h"</PRE | |
102 ><P | |
103 ><CODE | |
104 ><CODE | |
105 CLASS="FUNCDEF" | |
106 >int <B | |
107 CLASS="FSFUNC" | |
108 >SDL_SemPost</B | |
109 ></CODE | |
110 >(SDL_sem *sem);</CODE | |
111 ></P | |
112 ><P | |
113 ></P | |
114 ></DIV | |
115 ></DIV | |
116 ><DIV | |
117 CLASS="REFSECT1" | |
118 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
119 NAME="AEN8180" |
0 | 120 ></A |
121 ><H2 | |
122 >Description</H2 | |
123 ><P | |
124 ><TT | |
125 CLASS="FUNCTION" | |
126 >SDL_SemPost</TT | |
127 > unlocks the semaphore pointed to by | |
128 <TT | |
129 CLASS="PARAMETER" | |
130 ><I | |
131 >sem</I | |
132 ></TT | |
133 > and atomically increments the semaphores value. | |
134 Threads that were blocking on the semaphore may be scheduled after this call | |
135 succeeds.</P | |
136 ><P | |
137 ><TT | |
138 CLASS="FUNCTION" | |
139 >SDL_SemPost</TT | |
140 > should be called after a semaphore is locked by a successful call to | |
141 <A | |
142 HREF="sdlsemwait.html" | |
143 >SDL_SemWait</A | |
144 >, | |
145 <A | |
146 HREF="sdlsemtrywait.html" | |
147 >SDL_SemTryWait</A | |
148 > or | |
149 <A | |
150 HREF="sdlsemwaittimeout.html" | |
151 >SDL_SemWaitTimeout</A | |
152 >.</P | |
153 ></DIV | |
154 ><DIV | |
155 CLASS="REFSECT1" | |
156 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
157 NAME="AEN8190" |
0 | 158 ></A |
159 ><H2 | |
160 >Return Value</H2 | |
161 ><P | |
162 >Returns <SPAN | |
163 CLASS="RETURNVALUE" | |
164 >0</SPAN | |
165 > if successful or | |
166 <SPAN | |
167 CLASS="RETURNVALUE" | |
168 >-1</SPAN | |
169 > if there was an error (leaving the semaphore unchanged).</P | |
170 ></DIV | |
171 ><DIV | |
172 CLASS="REFSECT1" | |
173 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
174 NAME="AEN8195" |
0 | 175 ></A |
176 ><H2 | |
177 >Examples</H2 | |
178 ><P | |
179 ><PRE | |
180 CLASS="PROGRAMLISTING" | |
181 >SDL_SemPost(my_sem);</PRE | |
182 ></P | |
183 ></DIV | |
184 ><DIV | |
185 CLASS="REFSECT1" | |
186 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
187 NAME="AEN8199" |
0 | 188 ></A |
189 ><H2 | |
190 >See Also</H2 | |
191 ><P | |
192 ><A | |
193 HREF="sdlcreatesemaphore.html" | |
194 ><TT | |
195 CLASS="FUNCTION" | |
196 >SDL_CreateSemaphore</TT | |
197 ></A | |
198 >, | |
199 <A | |
200 HREF="sdldestroysemaphore.html" | |
201 ><TT | |
202 CLASS="FUNCTION" | |
203 >SDL_DestroySemaphore</TT | |
204 ></A | |
205 >, | |
206 <A | |
207 HREF="sdlsemwait.html" | |
208 ><TT | |
209 CLASS="FUNCTION" | |
210 >SDL_SemWait</TT | |
211 ></A | |
212 >, | |
213 <A | |
214 HREF="sdlsemtrywait.html" | |
215 ><TT | |
216 CLASS="FUNCTION" | |
217 >SDL_SemTryWait</TT | |
218 ></A | |
219 >, | |
220 <A | |
221 HREF="sdlsemwaittimeout.html" | |
222 ><TT | |
223 CLASS="FUNCTION" | |
224 >SDL_SemWaitTimeout</TT | |
225 ></A | |
226 >, | |
227 <A | |
228 HREF="sdlsemvalue.html" | |
229 ><TT | |
230 CLASS="FUNCTION" | |
231 >SDL_SemValue</TT | |
232 ></A | |
233 ></P | |
234 ></DIV | |
235 ><DIV | |
236 CLASS="NAVFOOTER" | |
237 ><HR | |
238 ALIGN="LEFT" | |
239 WIDTH="100%"><TABLE | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
240 SUMMARY="Footer navigation table" |
0 | 241 WIDTH="100%" |
242 BORDER="0" | |
243 CELLPADDING="0" | |
244 CELLSPACING="0" | |
245 ><TR | |
246 ><TD | |
247 WIDTH="33%" | |
248 ALIGN="left" | |
249 VALIGN="top" | |
250 ><A | |
251 HREF="sdlsemwaittimeout.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
252 ACCESSKEY="P" |
0 | 253 >Prev</A |
254 ></TD | |
255 ><TD | |
256 WIDTH="34%" | |
257 ALIGN="center" | |
258 VALIGN="top" | |
259 ><A | |
260 HREF="index.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
261 ACCESSKEY="H" |
0 | 262 >Home</A |
263 ></TD | |
264 ><TD | |
265 WIDTH="33%" | |
266 ALIGN="right" | |
267 VALIGN="top" | |
268 ><A | |
269 HREF="sdlsemvalue.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
270 ACCESSKEY="N" |
0 | 271 >Next</A |
272 ></TD | |
273 ></TR | |
274 ><TR | |
275 ><TD | |
276 WIDTH="33%" | |
277 ALIGN="left" | |
278 VALIGN="top" | |
279 >SDL_SemWaitTimeout</TD | |
280 ><TD | |
281 WIDTH="34%" | |
282 ALIGN="center" | |
283 VALIGN="top" | |
284 ><A | |
285 HREF="thread.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
286 ACCESSKEY="U" |
0 | 287 >Up</A |
288 ></TD | |
289 ><TD | |
290 WIDTH="33%" | |
291 ALIGN="right" | |
292 VALIGN="top" | |
293 >SDL_SemValue</TD | |
294 ></TR | |
295 ></TABLE | |
296 ></DIV | |
297 ></BODY | |
298 ></HTML | |
299 > |