Mercurial > sdl-ios-xcode
annotate docs/html/eventstructures.html @ 1212:7663bb0f52c7
To: sdl@libsdl.org
From: Christian Walther <cwalther@gmx.ch>
Date: Thu, 15 Dec 2005 21:19:53 +0100
Subject: [SDL] More mouse enhancements for Mac OS X
The attached patch brings two more enhancements to mouse handling on Mac
OS X (Quartz):
1. Currently, after launching an SDL application, SDL's notion of the
mouse position is stuck in the top left corner (0,0) until the first
time the mouse is moved. That's because the UpdateMouse() function isn't
implemented in the Quartz driver. This patch adds it.
2. When grabbing input while the mouse cursor is hidden, the function
CGAssociateMouseAndMouseCursorPosition(0) is called, which prevents the
system's notion of the mouse location from moving (and therefore leaving
the SDL window) even when the mouse is moved. However, apparently the
Wacom tablet driver (and maybe other special pointing device drivers)
doesn't care about that setting and still allows the mouse location to
go outside of the window. Interestingly, the system cursor, which is
made visible by the existing code in SDL in that case, does not follow
the mouse location, but appears in the middle of the SDL window. The
mouse location being outside of the window however means that mouse
button events go to background applications (or the dock or whatever is
there), which is very confusing to the user who sees no cursor outside
of the SDL window.
I have not found any way of intercepting these events (and that's
probably by design, as "normal" applications shouldn't prevent the user
from bringing other applications' windows to the front by clicking on
them). An idea would be placing a fully transparent, screen-filling
window in front of everything, but I fear that this might affect
rendering performance (by doing unnecessary compositing, using up
memory, or whatever).
The deluxe solution to the problem would be talking to the tablet
driver using AppleEvents to tell it to constrain its mapped area to the
window (see Wacom's "TabletEventDemo" sample app,
http://www.wacomeng.com/devsupport/mac/downloads.html), but I think that
the bloat that solution would add to SDL would outweigh its usefulness.
What I did instead in my patch is reassociating mouse and cursor when
the mouse leaves the window while an invisible grab is in effect, and
restoring the grab when the window is entered. That way, the grab can
still be effectively broken by a tablet, but at least it's obvious to
the user that it is broken. That change is minimal - it doesn't affect
operation with a mouse (or a trackpad), and the code that it adds is not
executed on every PumpEvents() call, only when entering and leaving the
window.
Unless there are any concerns about the patch, please apply. Feel free
to shorten the lengthy comment in SDL_QuartzEvents.m if you think it's
too verbose.
Thanks
-Christian
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Mon, 02 Jan 2006 00:31:00 +0000 |
parents | 355632dca928 |
children |
rev | line source |
---|---|
0 | 1 <HTML |
2 ><HEAD | |
3 ><TITLE | |
4 >SDL Event Structures.</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="Events" | |
14 HREF="event.html"><LINK | |
15 REL="PREVIOUS" | |
16 TITLE="Events" | |
17 HREF="event.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="SDL_Event" | |
20 HREF="sdlevent.html"></HEAD | |
21 ><BODY | |
22 CLASS="SECT1" | |
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="event.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 >Chapter 8. Events</TD | |
57 ><TD | |
58 WIDTH="10%" | |
59 ALIGN="right" | |
60 VALIGN="bottom" | |
61 ><A | |
62 HREF="sdlevent.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 ><DIV | |
72 CLASS="SECT1" | |
73 ><H1 | |
74 CLASS="SECT1" | |
75 ><A | |
76 NAME="EVENTSTRUCTURES" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
77 ></A |
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
78 >SDL Event Structures.</H1 |
0 | 79 ><DIV |
80 CLASS="TOC" | |
81 ><DL | |
82 ><DT | |
83 ><B | |
84 >Table of Contents</B | |
85 ></DT | |
86 ><DT | |
87 ><A | |
88 HREF="sdlevent.html" | |
89 >SDL_Event</A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
90 > -- General event structure</DT |
0 | 91 ><DT |
92 ><A | |
93 HREF="sdlactiveevent.html" | |
94 >SDL_ActiveEvent</A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
95 > -- Application visibility event structure</DT |
0 | 96 ><DT |
97 ><A | |
98 HREF="sdlkeyboardevent.html" | |
99 >SDL_KeyboardEvent</A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
100 > -- Keyboard event structure</DT |
0 | 101 ><DT |
102 ><A | |
103 HREF="sdlmousemotionevent.html" | |
104 >SDL_MouseMotionEvent</A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
105 > -- Mouse motion event structure</DT |
0 | 106 ><DT |
107 ><A | |
108 HREF="sdlmousebuttonevent.html" | |
109 >SDL_MouseButtonEvent</A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
110 > -- Mouse button event structure</DT |
0 | 111 ><DT |
112 ><A | |
113 HREF="sdljoyaxisevent.html" | |
114 >SDL_JoyAxisEvent</A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
115 > -- Joystick axis motion event structure</DT |
0 | 116 ><DT |
117 ><A | |
118 HREF="sdljoybuttonevent.html" | |
119 >SDL_JoyButtonEvent</A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
120 > -- Joystick button event structure</DT |
0 | 121 ><DT |
122 ><A | |
123 HREF="sdljoyhatevent.html" | |
124 >SDL_JoyHatEvent</A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
125 > -- Joystick hat position change event structure</DT |
0 | 126 ><DT |
127 ><A | |
128 HREF="sdljoyballevent.html" | |
129 >SDL_JoyBallEvent</A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
130 > -- Joystick trackball motion event structure</DT |
0 | 131 ><DT |
132 ><A | |
133 HREF="sdlresizeevent.html" | |
134 >SDL_ResizeEvent</A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
135 > -- Window resize event structure</DT |
0 | 136 ><DT |
137 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
138 HREF="sdlexposeevent.html" |
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
139 >SDL_ExposeEvent</A |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
140 > -- Quit requested event</DT |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
141 ><DT |
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
142 ><A |
0 | 143 HREF="sdlsyswmevent.html" |
144 >SDL_SysWMEvent</A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
145 > -- Platform-dependent window manager event.</DT |
0 | 146 ><DT |
147 ><A | |
148 HREF="sdluserevent.html" | |
149 >SDL_UserEvent</A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
150 > -- A user-defined event type</DT |
0 | 151 ><DT |
152 ><A | |
153 HREF="sdlquitevent.html" | |
154 >SDL_QuitEvent</A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
155 > -- Quit requested event</DT |
0 | 156 ><DT |
157 ><A | |
158 HREF="sdlkeysym.html" | |
159 >SDL_keysym</A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
160 > -- Keysym structure</DT |
0 | 161 ><DT |
162 ><A | |
163 HREF="sdlkey.html" | |
164 >SDLKey</A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
165 > -- Keysym definitions.</DT |
0 | 166 ></DL |
167 ></DIV | |
168 ></DIV | |
169 ><DIV | |
170 CLASS="NAVFOOTER" | |
171 ><HR | |
172 ALIGN="LEFT" | |
173 WIDTH="100%"><TABLE | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
174 SUMMARY="Footer navigation table" |
0 | 175 WIDTH="100%" |
176 BORDER="0" | |
177 CELLPADDING="0" | |
178 CELLSPACING="0" | |
179 ><TR | |
180 ><TD | |
181 WIDTH="33%" | |
182 ALIGN="left" | |
183 VALIGN="top" | |
184 ><A | |
185 HREF="event.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
186 ACCESSKEY="P" |
0 | 187 >Prev</A |
188 ></TD | |
189 ><TD | |
190 WIDTH="34%" | |
191 ALIGN="center" | |
192 VALIGN="top" | |
193 ><A | |
194 HREF="index.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
195 ACCESSKEY="H" |
0 | 196 >Home</A |
197 ></TD | |
198 ><TD | |
199 WIDTH="33%" | |
200 ALIGN="right" | |
201 VALIGN="top" | |
202 ><A | |
203 HREF="sdlevent.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
204 ACCESSKEY="N" |
0 | 205 >Next</A |
206 ></TD | |
207 ></TR | |
208 ><TR | |
209 ><TD | |
210 WIDTH="33%" | |
211 ALIGN="left" | |
212 VALIGN="top" | |
213 >Events</TD | |
214 ><TD | |
215 WIDTH="34%" | |
216 ALIGN="center" | |
217 VALIGN="top" | |
218 ><A | |
219 HREF="event.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
220 ACCESSKEY="U" |
0 | 221 >Up</A |
222 ></TD | |
223 ><TD | |
224 WIDTH="33%" | |
225 ALIGN="right" | |
226 VALIGN="top" | |
227 >SDL_Event</TD | |
228 ></TR | |
229 ></TABLE | |
230 ></DIV | |
231 ></BODY | |
232 ></HTML | |
233 > |