Mercurial > sdl-ios-xcode
annotate docs/html/sdlcdstatus.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_CDStatus</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="CD-ROM" | |
14 HREF="cdrom.html"><LINK | |
15 REL="PREVIOUS" | |
16 TITLE="SDL_CDOpen" | |
17 HREF="sdlcdopen.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="SDL_CDPlay" | |
20 HREF="sdlcdplay.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="sdlcdopen.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="sdlcdplay.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="SDLCDSTATUS" | |
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_CDStatus</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="AEN7308" |
0 | 80 ></A |
81 ><H2 | |
82 >Name</H2 | |
83 >SDL_CDStatus -- Returns the current status of the given drive.</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="AEN7311" |
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="AEN7312" |
0 | 95 ></A |
96 ><P | |
97 ></P | |
98 ><PRE | |
99 CLASS="FUNCSYNOPSISINFO" | |
100 >#include "SDL.h"</PRE | |
101 ><P | |
102 ><CODE | |
103 ><CODE | |
104 CLASS="FUNCDEF" | |
105 >CDstatus <B | |
106 CLASS="FSFUNC" | |
107 >SDL_CDStatus</B | |
108 ></CODE | |
109 >(SDL_CD *cdrom);</CODE | |
110 ></P | |
111 ><PRE | |
112 CLASS="FUNCSYNOPSISINFO" | |
113 >/* Given a status, returns true if there's a disk in the drive */ | |
114 #define CD_INDRIVE(status) ((int)status > 0)</PRE | |
115 ><P | |
116 ></P | |
117 ></DIV | |
118 ></DIV | |
119 ><DIV | |
120 CLASS="REFSECT1" | |
121 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
122 NAME="AEN7319" |
0 | 123 ></A |
124 ><H2 | |
125 >Description</H2 | |
126 ><P | |
127 >This function returns the current status of the given drive. Status is described like so: | |
128 <PRE | |
129 CLASS="PROGRAMLISTING" | |
130 >typedef enum { | |
131 CD_TRAYEMPTY, | |
132 CD_STOPPED, | |
133 CD_PLAYING, | |
134 CD_PAUSED, | |
135 CD_ERROR = -1 | |
136 } CDstatus;</PRE | |
137 ></P | |
138 ><P | |
139 >If the drive has a CD in it, the table of contents of the CD and current | |
140 play position of the CD will be stored in the SDL_CD structure.</P | |
141 ><P | |
142 >The macro <TT | |
143 CLASS="LITERAL" | |
144 >CD_INDRIVE</TT | |
145 > is provided for convenience, | |
146 and given a status returns true if there's a disk in the drive.</P | |
147 ><DIV | |
148 CLASS="NOTE" | |
149 ><BLOCKQUOTE | |
150 CLASS="NOTE" | |
151 ><P | |
152 ><B | |
153 >Note: </B | |
154 ><TT | |
155 CLASS="FUNCTION" | |
156 >SDL_CDStatus</TT | |
157 > also updates the <A | |
158 HREF="sdlcd.html" | |
159 ><SPAN | |
160 CLASS="STRUCTNAME" | |
161 >SDL_CD</SPAN | |
162 ></A | |
163 > structure passed to it.</P | |
164 ></BLOCKQUOTE | |
165 ></DIV | |
166 ></DIV | |
167 ><DIV | |
168 CLASS="REFSECT1" | |
169 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
170 NAME="AEN7331" |
0 | 171 ></A |
172 ><H2 | |
173 >Example</H2 | |
174 ><PRE | |
175 CLASS="PROGRAMLISTING" | |
176 >int playTrack(int track) | |
177 { | |
178 int playing = 0; | |
179 | |
180 if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) { | |
181 /* clamp to the actual number of tracks on the CD */ | |
182 if (track >= cdrom->numtracks) { | |
183 track = cdrom->numtracks-1; | |
184 } | |
185 | |
186 if ( SDL_CDPlayTracks(cdrom, track, 0, 1, 0) == 0 ) { | |
187 playing = 1; | |
188 } | |
189 } | |
190 return playing; | |
191 }</PRE | |
192 ></DIV | |
193 ><DIV | |
194 CLASS="REFSECT1" | |
195 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
196 NAME="AEN7334" |
0 | 197 ></A |
198 ><H2 | |
199 >See Also</H2 | |
200 ><P | |
201 ><A | |
202 HREF="sdlcd.html" | |
203 ><TT | |
204 CLASS="FUNCTION" | |
205 >SDL_CD</TT | |
206 ></A | |
207 ></P | |
208 ></DIV | |
209 ><DIV | |
210 CLASS="NAVFOOTER" | |
211 ><HR | |
212 ALIGN="LEFT" | |
213 WIDTH="100%"><TABLE | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
214 SUMMARY="Footer navigation table" |
0 | 215 WIDTH="100%" |
216 BORDER="0" | |
217 CELLPADDING="0" | |
218 CELLSPACING="0" | |
219 ><TR | |
220 ><TD | |
221 WIDTH="33%" | |
222 ALIGN="left" | |
223 VALIGN="top" | |
224 ><A | |
225 HREF="sdlcdopen.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
226 ACCESSKEY="P" |
0 | 227 >Prev</A |
228 ></TD | |
229 ><TD | |
230 WIDTH="34%" | |
231 ALIGN="center" | |
232 VALIGN="top" | |
233 ><A | |
234 HREF="index.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
235 ACCESSKEY="H" |
0 | 236 >Home</A |
237 ></TD | |
238 ><TD | |
239 WIDTH="33%" | |
240 ALIGN="right" | |
241 VALIGN="top" | |
242 ><A | |
243 HREF="sdlcdplay.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
244 ACCESSKEY="N" |
0 | 245 >Next</A |
246 ></TD | |
247 ></TR | |
248 ><TR | |
249 ><TD | |
250 WIDTH="33%" | |
251 ALIGN="left" | |
252 VALIGN="top" | |
253 >SDL_CDOpen</TD | |
254 ><TD | |
255 WIDTH="34%" | |
256 ALIGN="center" | |
257 VALIGN="top" | |
258 ><A | |
259 HREF="cdrom.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
260 ACCESSKEY="U" |
0 | 261 >Up</A |
262 ></TD | |
263 ><TD | |
264 WIDTH="33%" | |
265 ALIGN="right" | |
266 VALIGN="top" | |
267 >SDL_CDPlay</TD | |
268 ></TR | |
269 ></TABLE | |
270 ></DIV | |
271 ></BODY | |
272 ></HTML | |
273 > |