Mercurial > sdl-ios-xcode
annotate docs/html/sdlpalette.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_Palette</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="Video" | |
14 HREF="video.html"><LINK | |
15 REL="PREVIOUS" | |
16 TITLE="SDL_Color" | |
17 HREF="sdlcolor.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="SDL_PixelFormat" | |
20 HREF="sdlpixelformat.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="sdlcolor.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="sdlpixelformat.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="SDLPALETTE" | |
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_Palette</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="AEN3129" |
0 | 80 ></A |
81 ><H2 | |
82 >Name</H2 | |
83 >SDL_Palette -- Color palette for 8-bit pixel formats</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="AEN3132" |
0 | 88 ></A |
89 ><H2 | |
90 >Structure Definition</H2 | |
91 ><PRE | |
92 CLASS="PROGRAMLISTING" | |
93 >typedef struct{ | |
94 int ncolors; | |
95 SDL_Color *colors; | |
96 } SDL_Palette;</PRE | |
97 ></DIV | |
98 ><DIV | |
99 CLASS="REFSECT1" | |
100 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
101 NAME="AEN3135" |
0 | 102 ></A |
103 ><H2 | |
104 >Structure Data</H2 | |
105 ><DIV | |
106 CLASS="INFORMALTABLE" | |
107 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
108 NAME="AEN3137" |
0 | 109 ></A |
110 ><P | |
111 ></P | |
112 ><TABLE | |
113 BORDER="0" | |
114 CLASS="CALSTABLE" | |
115 ><TBODY | |
116 ><TR | |
117 ><TD | |
118 ALIGN="LEFT" | |
119 VALIGN="TOP" | |
120 ><TT | |
121 CLASS="STRUCTFIELD" | |
122 ><I | |
123 >ncolors</I | |
124 ></TT | |
125 ></TD | |
126 ><TD | |
127 ALIGN="LEFT" | |
128 VALIGN="TOP" | |
129 >Number of colors used in this palette</TD | |
130 ></TR | |
131 ><TR | |
132 ><TD | |
133 ALIGN="LEFT" | |
134 VALIGN="TOP" | |
135 ><TT | |
136 CLASS="STRUCTFIELD" | |
137 ><I | |
138 >colors</I | |
139 ></TT | |
140 ></TD | |
141 ><TD | |
142 ALIGN="LEFT" | |
143 VALIGN="TOP" | |
144 >Pointer to <A | |
145 HREF="sdlcolor.html" | |
146 ><SPAN | |
147 CLASS="STRUCTNAME" | |
148 >SDL_Color</SPAN | |
149 ></A | |
150 > structures that make up the palette.</TD | |
151 ></TR | |
152 ></TBODY | |
153 ></TABLE | |
154 ><P | |
155 ></P | |
156 ></DIV | |
157 ></DIV | |
158 ><DIV | |
159 CLASS="REFSECT1" | |
160 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
161 NAME="AEN3150" |
0 | 162 ></A |
163 ><H2 | |
164 >Description</H2 | |
165 ><P | |
166 >Each pixel in an 8-bit surface is an index into the <TT | |
167 CLASS="STRUCTFIELD" | |
168 ><I | |
169 >colors</I | |
170 ></TT | |
171 > field of the <SPAN | |
172 CLASS="STRUCTNAME" | |
173 >SDL_Palette</SPAN | |
174 > structure store in <A | |
175 HREF="sdlpixelformat.html" | |
176 ><SPAN | |
177 CLASS="STRUCTNAME" | |
178 >SDL_PixelFormat</SPAN | |
179 ></A | |
180 >. A <SPAN | |
181 CLASS="STRUCTNAME" | |
182 >SDL_Palette</SPAN | |
183 > should never need to be created manually. It is automatically created when SDL allocates a <SPAN | |
184 CLASS="STRUCTNAME" | |
185 >SDL_PixelFormat</SPAN | |
186 > for a surface. The colors values of a <A | |
187 HREF="sdlsurface.html" | |
188 ><SPAN | |
189 CLASS="STRUCTNAME" | |
190 >SDL_Surface</SPAN | |
191 ></A | |
192 >s palette can be set with the <A | |
193 HREF="sdlsetcolors.html" | |
194 ><TT | |
195 CLASS="FUNCTION" | |
196 >SDL_SetColors</TT | |
197 ></A | |
198 >.</P | |
199 ></DIV | |
200 ><DIV | |
201 CLASS="REFSECT1" | |
202 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
203 NAME="AEN3163" |
0 | 204 ></A |
205 ><H2 | |
206 >See Also</H2 | |
207 ><P | |
208 ><A | |
209 HREF="sdlcolor.html" | |
210 ><SPAN | |
211 CLASS="STRUCTNAME" | |
212 >SDL_Color</SPAN | |
213 ></A | |
214 >, | |
215 <A | |
216 HREF="sdlsurface.html" | |
217 ><SPAN | |
218 CLASS="STRUCTNAME" | |
219 >SDL_Surface</SPAN | |
220 ></A | |
221 >, | |
222 <A | |
223 HREF="sdlsetcolors.html" | |
224 ><TT | |
225 CLASS="FUNCTION" | |
226 >SDL_SetColors</TT | |
227 ></A | |
228 > | |
229 <A | |
230 HREF="sdlsetpalette.html" | |
231 ><TT | |
232 CLASS="FUNCTION" | |
233 >SDL_SetPalette</TT | |
234 ></A | |
235 ></P | |
236 ></DIV | |
237 ><DIV | |
238 CLASS="NAVFOOTER" | |
239 ><HR | |
240 ALIGN="LEFT" | |
241 WIDTH="100%"><TABLE | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
242 SUMMARY="Footer navigation table" |
0 | 243 WIDTH="100%" |
244 BORDER="0" | |
245 CELLPADDING="0" | |
246 CELLSPACING="0" | |
247 ><TR | |
248 ><TD | |
249 WIDTH="33%" | |
250 ALIGN="left" | |
251 VALIGN="top" | |
252 ><A | |
253 HREF="sdlcolor.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
254 ACCESSKEY="P" |
0 | 255 >Prev</A |
256 ></TD | |
257 ><TD | |
258 WIDTH="34%" | |
259 ALIGN="center" | |
260 VALIGN="top" | |
261 ><A | |
262 HREF="index.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
263 ACCESSKEY="H" |
0 | 264 >Home</A |
265 ></TD | |
266 ><TD | |
267 WIDTH="33%" | |
268 ALIGN="right" | |
269 VALIGN="top" | |
270 ><A | |
271 HREF="sdlpixelformat.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
272 ACCESSKEY="N" |
0 | 273 >Next</A |
274 ></TD | |
275 ></TR | |
276 ><TR | |
277 ><TD | |
278 WIDTH="33%" | |
279 ALIGN="left" | |
280 VALIGN="top" | |
281 >SDL_Color</TD | |
282 ><TD | |
283 WIDTH="34%" | |
284 ALIGN="center" | |
285 VALIGN="top" | |
286 ><A | |
287 HREF="video.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
288 ACCESSKEY="U" |
0 | 289 >Up</A |
290 ></TD | |
291 ><TD | |
292 WIDTH="33%" | |
293 ALIGN="right" | |
294 VALIGN="top" | |
295 >SDL_PixelFormat</TD | |
296 ></TR | |
297 ></TABLE | |
298 ></DIV | |
299 ></BODY | |
300 ></HTML | |
301 > |