Mercurial > sdl-ios-xcode
annotate docs/html/reference.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 Reference</TITLE | |
5 ><META | |
6 NAME="GENERATOR" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
55
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="PREVIOUS" | |
13 TITLE="Time Examples" | |
14 HREF="guidetimeexamples.html"><LINK | |
15 REL="NEXT" | |
16 TITLE="General" | |
17 HREF="general.html"></HEAD | |
18 ><BODY | |
19 CLASS="PART" | |
20 BGCOLOR="#FFF8DC" | |
21 TEXT="#000000" | |
22 LINK="#0000ee" | |
23 VLINK="#551a8b" | |
24 ALINK="#ff0000" | |
25 ><DIV | |
26 CLASS="NAVHEADER" | |
27 ><TABLE | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
28 SUMMARY="Header navigation table" |
0 | 29 WIDTH="100%" |
30 BORDER="0" | |
31 CELLPADDING="0" | |
32 CELLSPACING="0" | |
33 ><TR | |
34 ><TH | |
35 COLSPAN="3" | |
36 ALIGN="center" | |
37 >SDL Library Documentation</TH | |
38 ></TR | |
39 ><TR | |
40 ><TD | |
41 WIDTH="10%" | |
42 ALIGN="left" | |
43 VALIGN="bottom" | |
44 ><A | |
45 HREF="guidetimeexamples.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
46 ACCESSKEY="P" |
0 | 47 >Prev</A |
48 ></TD | |
49 ><TD | |
50 WIDTH="80%" | |
51 ALIGN="center" | |
52 VALIGN="bottom" | |
53 ></TD | |
54 ><TD | |
55 WIDTH="10%" | |
56 ALIGN="right" | |
57 VALIGN="bottom" | |
58 ><A | |
59 HREF="general.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
60 ACCESSKEY="N" |
0 | 61 >Next</A |
62 ></TD | |
63 ></TR | |
64 ></TABLE | |
65 ><HR | |
66 ALIGN="LEFT" | |
67 WIDTH="100%"></DIV | |
68 ><DIV | |
69 CLASS="PART" | |
70 ><A | |
71 NAME="REFERENCE" | |
72 ></A | |
73 ><DIV | |
74 CLASS="TITLEPAGE" | |
75 ><H1 | |
76 CLASS="TITLE" | |
77 >II. SDL Reference</H1 | |
78 ><DIV | |
79 CLASS="TOC" | |
80 ><DL | |
81 ><DT | |
82 ><B | |
83 >Table of Contents</B | |
84 ></DT | |
85 ><DT | |
86 >5. <A | |
87 HREF="general.html" | |
88 >General</A | |
89 ></DT | |
90 ><DT | |
91 >6. <A | |
92 HREF="video.html" | |
93 >Video</A | |
94 ></DT | |
95 ><DT | |
96 >7. <A | |
97 HREF="wm.html" | |
98 >Window Management</A | |
99 ></DT | |
100 ><DT | |
101 >8. <A | |
102 HREF="event.html" | |
103 >Events</A | |
104 ></DT | |
105 ><DT | |
106 >9. <A | |
107 HREF="joystick.html" | |
108 >Joystick</A | |
109 ></DT | |
110 ><DT | |
111 >10. <A | |
112 HREF="audio.html" | |
113 >Audio</A | |
114 ></DT | |
115 ><DT | |
116 >11. <A | |
117 HREF="cdrom.html" | |
118 >CD-ROM</A | |
119 ></DT | |
120 ><DT | |
121 >12. <A | |
122 HREF="thread.html" | |
123 >Multi-threaded Programming</A | |
124 ></DT | |
125 ><DT | |
126 >13. <A | |
127 HREF="time.html" | |
128 >Time</A | |
129 ></DT | |
130 ></DL | |
131 ></DIV | |
132 ></DIV | |
133 ></DIV | |
134 ><DIV | |
135 CLASS="NAVFOOTER" | |
136 ><HR | |
137 ALIGN="LEFT" | |
138 WIDTH="100%"><TABLE | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
139 SUMMARY="Footer navigation table" |
0 | 140 WIDTH="100%" |
141 BORDER="0" | |
142 CELLPADDING="0" | |
143 CELLSPACING="0" | |
144 ><TR | |
145 ><TD | |
146 WIDTH="33%" | |
147 ALIGN="left" | |
148 VALIGN="top" | |
149 ><A | |
150 HREF="guidetimeexamples.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
151 ACCESSKEY="P" |
0 | 152 >Prev</A |
153 ></TD | |
154 ><TD | |
155 WIDTH="34%" | |
156 ALIGN="center" | |
157 VALIGN="top" | |
158 ><A | |
159 HREF="index.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
160 ACCESSKEY="H" |
0 | 161 >Home</A |
162 ></TD | |
163 ><TD | |
164 WIDTH="33%" | |
165 ALIGN="right" | |
166 VALIGN="top" | |
167 ><A | |
168 HREF="general.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
169 ACCESSKEY="N" |
0 | 170 >Next</A |
171 ></TD | |
172 ></TR | |
173 ><TR | |
174 ><TD | |
175 WIDTH="33%" | |
176 ALIGN="left" | |
177 VALIGN="top" | |
178 >Time Examples</TD | |
179 ><TD | |
180 WIDTH="34%" | |
181 ALIGN="center" | |
182 VALIGN="top" | |
183 > </TD | |
184 ><TD | |
185 WIDTH="33%" | |
186 ALIGN="right" | |
187 VALIGN="top" | |
188 >General</TD | |
189 ></TR | |
190 ></TABLE | |
191 ></DIV | |
192 ></BODY | |
193 ></HTML | |
194 > |