Mercurial > sdl-ios-xcode
annotate docs/html/sdlsempost.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_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 > |