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