Mercurial > sdl-ios-xcode
annotate docs/html/sdlmousebuttonevent.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_MouseButtonEvent</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="SDL Event Structures." | |
14 HREF="eventstructures.html"><LINK | |
15 REL="PREVIOUS" | |
16 TITLE="SDL_MouseMotionEvent" | |
17 HREF="sdlmousemotionevent.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="SDL_JoyAxisEvent" | |
20 HREF="sdljoyaxisevent.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="sdlmousemotionevent.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="sdljoyaxisevent.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="SDLMOUSEBUTTONEVENT" | |
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_MouseButtonEvent</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="AEN4144" |
0 | 80 ></A |
81 ><H2 | |
82 >Name</H2 | |
83 >SDL_MouseButtonEvent -- Mouse button event structure</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="AEN4147" |
0 | 88 ></A |
89 ><H2 | |
90 >Structure Definition</H2 | |
91 ><PRE | |
92 CLASS="PROGRAMLISTING" | |
93 >typedef struct{ | |
94 Uint8 type; | |
95 Uint8 button; | |
96 Uint8 state; | |
97 Uint16 x, y; | |
98 } SDL_MouseButtonEvent;</PRE | |
99 ></DIV | |
100 ><DIV | |
101 CLASS="REFSECT1" | |
102 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
103 NAME="AEN4150" |
0 | 104 ></A |
105 ><H2 | |
106 >Structure Data</H2 | |
107 ><DIV | |
108 CLASS="INFORMALTABLE" | |
109 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
110 NAME="AEN4152" |
0 | 111 ></A |
112 ><P | |
113 ></P | |
114 ><TABLE | |
115 BORDER="0" | |
116 CLASS="CALSTABLE" | |
117 ><TBODY | |
118 ><TR | |
119 ><TD | |
120 ALIGN="LEFT" | |
121 VALIGN="TOP" | |
122 ><TT | |
123 CLASS="STRUCTFIELD" | |
124 ><I | |
125 >type</I | |
126 ></TT | |
127 ></TD | |
128 ><TD | |
129 ALIGN="LEFT" | |
130 VALIGN="TOP" | |
131 ><TT | |
132 CLASS="LITERAL" | |
133 >SDL_MOUSEBUTTONDOWN</TT | |
134 > or <TT | |
135 CLASS="LITERAL" | |
136 >SDL_MOUSEBUTTONUP</TT | |
137 ></TD | |
138 ></TR | |
139 ><TR | |
140 ><TD | |
141 ALIGN="LEFT" | |
142 VALIGN="TOP" | |
143 ><TT | |
144 CLASS="STRUCTFIELD" | |
145 ><I | |
146 >button</I | |
147 ></TT | |
148 ></TD | |
149 ><TD | |
150 ALIGN="LEFT" | |
151 VALIGN="TOP" | |
152 >The mouse button index (SDL_BUTTON_LEFT, SDL_BUTTON_MIDDLE, SDL_BUTTON_RIGHT)</TD | |
153 ></TR | |
154 ><TR | |
155 ><TD | |
156 ALIGN="LEFT" | |
157 VALIGN="TOP" | |
158 ><TT | |
159 CLASS="STRUCTFIELD" | |
160 ><I | |
161 >state</I | |
162 ></TT | |
163 ></TD | |
164 ><TD | |
165 ALIGN="LEFT" | |
166 VALIGN="TOP" | |
167 ><TT | |
168 CLASS="LITERAL" | |
169 >SDL_PRESSED</TT | |
170 > or <TT | |
171 CLASS="LITERAL" | |
172 >SDL_RELEASED</TT | |
173 ></TD | |
174 ></TR | |
175 ><TR | |
176 ><TD | |
177 ALIGN="LEFT" | |
178 VALIGN="TOP" | |
179 ><TT | |
180 CLASS="STRUCTFIELD" | |
181 ><I | |
182 >x</I | |
183 ></TT | |
184 >, <TT | |
185 CLASS="STRUCTFIELD" | |
186 ><I | |
187 >y</I | |
188 ></TT | |
189 ></TD | |
190 ><TD | |
191 ALIGN="LEFT" | |
192 VALIGN="TOP" | |
193 >The X/Y coordinates of the mouse at press/release time</TD | |
194 ></TR | |
195 ></TBODY | |
196 ></TABLE | |
197 ><P | |
198 ></P | |
199 ></DIV | |
200 ></DIV | |
201 ><DIV | |
202 CLASS="REFSECT1" | |
203 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
204 NAME="AEN4176" |
0 | 205 ></A |
206 ><H2 | |
207 >Description</H2 | |
208 ><P | |
209 ><SPAN | |
210 CLASS="STRUCTNAME" | |
211 >SDL_MouseButtonEvent</SPAN | |
212 > is a member of the <A | |
213 HREF="sdlevent.html" | |
214 ><SPAN | |
215 CLASS="STRUCTNAME" | |
216 >SDL_Event</SPAN | |
217 ></A | |
218 > union and is used when an event of type <TT | |
219 CLASS="LITERAL" | |
220 >SDL_MOUSEBUTTONDOWN</TT | |
221 > or <TT | |
222 CLASS="LITERAL" | |
223 >SDL_MOUSEBUTTONUP</TT | |
224 > is reported.</P | |
225 ><P | |
226 >When a mouse button press or release is detected then number of the button pressed (from 1 to 255, with 1 usually being the left button and 2 the right) is placed into <TT | |
227 CLASS="STRUCTFIELD" | |
228 ><I | |
229 >button</I | |
230 ></TT | |
231 >, the position of the mouse when this event occured is stored in the <TT | |
232 CLASS="STRUCTFIELD" | |
233 ><I | |
234 >x</I | |
235 ></TT | |
236 > and the <TT | |
237 CLASS="STRUCTFIELD" | |
238 ><I | |
239 >y</I | |
240 ></TT | |
241 > fields. Like <A | |
242 HREF="sdlkeyboardevent.html" | |
243 ><SPAN | |
244 CLASS="STRUCTNAME" | |
245 >SDL_KeyboardEvent</SPAN | |
246 ></A | |
247 >, information on whether the event was a press or a release event is stored in both the <TT | |
248 CLASS="STRUCTFIELD" | |
249 ><I | |
250 >type</I | |
251 ></TT | |
252 > and <TT | |
253 CLASS="STRUCTFIELD" | |
254 ><I | |
255 >state</I | |
256 ></TT | |
257 > fields, but this should be obvious.</P | |
258 ></DIV | |
259 ><DIV | |
260 CLASS="REFSECT1" | |
261 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
262 NAME="AEN4192" |
0 | 263 ></A |
264 ><H2 | |
265 >See Also</H2 | |
266 ><P | |
267 ><A | |
268 HREF="sdlevent.html" | |
269 ><SPAN | |
270 CLASS="STRUCTNAME" | |
271 >SDL_Event</SPAN | |
272 ></A | |
273 >, | |
274 <A | |
275 HREF="sdlmousemotionevent.html" | |
276 ><SPAN | |
277 CLASS="STRUCTNAME" | |
278 >SDL_MouseMotionEvent</SPAN | |
279 ></A | |
280 ></P | |
281 ></DIV | |
282 ><DIV | |
283 CLASS="NAVFOOTER" | |
284 ><HR | |
285 ALIGN="LEFT" | |
286 WIDTH="100%"><TABLE | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
287 SUMMARY="Footer navigation table" |
0 | 288 WIDTH="100%" |
289 BORDER="0" | |
290 CELLPADDING="0" | |
291 CELLSPACING="0" | |
292 ><TR | |
293 ><TD | |
294 WIDTH="33%" | |
295 ALIGN="left" | |
296 VALIGN="top" | |
297 ><A | |
298 HREF="sdlmousemotionevent.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
299 ACCESSKEY="P" |
0 | 300 >Prev</A |
301 ></TD | |
302 ><TD | |
303 WIDTH="34%" | |
304 ALIGN="center" | |
305 VALIGN="top" | |
306 ><A | |
307 HREF="index.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
308 ACCESSKEY="H" |
0 | 309 >Home</A |
310 ></TD | |
311 ><TD | |
312 WIDTH="33%" | |
313 ALIGN="right" | |
314 VALIGN="top" | |
315 ><A | |
316 HREF="sdljoyaxisevent.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
317 ACCESSKEY="N" |
0 | 318 >Next</A |
319 ></TD | |
320 ></TR | |
321 ><TR | |
322 ><TD | |
323 WIDTH="33%" | |
324 ALIGN="left" | |
325 VALIGN="top" | |
326 >SDL_MouseMotionEvent</TD | |
327 ><TD | |
328 WIDTH="34%" | |
329 ALIGN="center" | |
330 VALIGN="top" | |
331 ><A | |
332 HREF="eventstructures.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
333 ACCESSKEY="U" |
0 | 334 >Up</A |
335 ></TD | |
336 ><TD | |
337 WIDTH="33%" | |
338 ALIGN="right" | |
339 VALIGN="top" | |
340 >SDL_JoyAxisEvent</TD | |
341 ></TR | |
342 ></TABLE | |
343 ></DIV | |
344 ></BODY | |
345 ></HTML | |
346 > |