Mercurial > sdl-ios-xcode
annotate docs/html/sdlactiveevent.html @ 1629:ef4a796e7f24
Fixed bug #55
From Christian Walther:
When writing my patch for #12, I ended up doing all sorts of changes to the way
application/window activating/deactivating is handled in the Quartz backend,
resulting in the attached patch. It does make the code a bit cleaner IMHO, but
as it might be regarded as a case of "if it ain't broken, don't fix it" I'd
like to hear other people's opinion about it. Please shout if some change
strikes you as unnecessary or wrong, and I'll explain the reasons behind it. As
far as I tested it, it does not introduce any new bugs, but I may well have
missed some.
- The most fundamental change (that triggered most of the others) is irrelevant
for the usual single-window SDL applications, it only affects the people who
are crazy enough to display other Cocoa windows alongside the SDL window (I'm
actually doing this currently, although the additional window only displays
debugging info and won't be present in the final product): Before, some things
were done on the application becoming active, some on the window becoming key,
and some on the window becoming main. Conceptually, all these actions belong to
the window becoming key, so that's what I implemented. However, since in a
single-window application these three events always happen together, the
previous implementation "ain't broken".
- This slightly changed the meaning of the SDL_APPMOUSEFOCUS flag from
SDL_GetAppState(): Before, it meant "window is main and mouse is inside window
(or mode is fullscreen)". Now, it means "window is key and mouse is inside
window (or mode is fullscreen)". It makes more sense to me that way. (See
http://developer.apple.com/documentation/Cocoa/Conceptual/WinPanel/Concepts/ChangingMainKeyWindow.html
for a discussion of what key and main windows are.) The other two flags are
unchanged: SDL_APPACTIVE = application is not hidden and window is not
minimized, SDL_APPINPUTFOCUS = window is key (or mode is fullscreen).
- As a side effect, the reorganization fixes the following two issues (and
maybe others) (but they could also be fixed in less invasive ways):
* A regression that was introduced in revision 1.42 of SDL_QuartzVideo.m
(http://libsdl.org/cgi/cvsweb.cgi/SDL12/src/video/quartz/SDL_QuartzVideo.m.diff?r1=1.41&r2=1.42)
(from half-desirable to undesirable behavior):
Situation: While in windowed mode, hide the cursor using
SDL_ShowCursor(SDL_DISABLE), move the mouse outside of the window so that the
cursor becomes visible again, and SDL_SetVideoMode() to a fullscreen mode.
What happened before revision 1.42: The cursor is visible, but becomes
invisible as soon as the mouse is moved (half-desirable).
What happens in revision 1.42 and after (including current CVS): The cursor is
visible and stays visible (undesirable).
What happens after my patch: The cursor is invisible from the beginning
(desirable).
* When the cursor is hidden and grabbed, switch away from the application using
cmd-tab (which ungrabs and makes the cursor visible), move the cursor outside
of the SDL window, then cmd-tab back to the application. In 1.2.8 and in the
current CVS, the cursor is re-grabbed, but it stays visible (immovable in the
middle of the window). With my patch, the cursor is correctly re-grabbed and
hidden. (For some reason, it still doesn't work correctly if you switch back to
the application using the dock instead of cmd-tab. I haven't been able to
figure out why. I can step over [NSCursor hide] being called in the debugger,
but it seems to have no effect.)
- The patch includes my patch for #12 (it was easier to obtain using cvs diff
that way). If you apply both of them, you will end up with 6 duplicate lines in
SDL_QuartzEvents.m.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 13 Apr 2006 14:17:48 +0000 |
parents | 355632dca928 |
children |
rev | line source |
---|---|
0 | 1 <HTML |
2 ><HEAD | |
3 ><TITLE | |
4 >SDL_ActiveEvent</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_Event" | |
17 HREF="sdlevent.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="SDL_KeyboardEvent" | |
20 HREF="sdlkeyboardevent.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="sdlevent.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="sdlkeyboardevent.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="SDLACTIVEEVENT" | |
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_ActiveEvent</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="AEN3955" |
0 | 80 ></A |
81 ><H2 | |
82 >Name</H2 | |
83 >SDL_ActiveEvent -- Application visibility 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="AEN3958" |
0 | 88 ></A |
89 ><H2 | |
90 >Structure Definition</H2 | |
91 ><PRE | |
92 CLASS="PROGRAMLISTING" | |
93 >typedef struct{ | |
94 Uint8 type; | |
95 Uint8 gain; | |
96 Uint8 state; | |
97 } SDL_ActiveEvent;</PRE | |
98 ></DIV | |
99 ><DIV | |
100 CLASS="REFSECT1" | |
101 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
102 NAME="AEN3961" |
0 | 103 ></A |
104 ><H2 | |
105 >Structure Data</H2 | |
106 ><DIV | |
107 CLASS="INFORMALTABLE" | |
108 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
109 NAME="AEN3963" |
0 | 110 ></A |
111 ><P | |
112 ></P | |
113 ><TABLE | |
114 BORDER="0" | |
115 CLASS="CALSTABLE" | |
116 ><TBODY | |
117 ><TR | |
118 ><TD | |
119 ALIGN="LEFT" | |
120 VALIGN="TOP" | |
121 ><TT | |
122 CLASS="STRUCTFIELD" | |
123 ><I | |
124 >type</I | |
125 ></TT | |
126 ></TD | |
127 ><TD | |
128 ALIGN="LEFT" | |
129 VALIGN="TOP" | |
130 ><TT | |
131 CLASS="LITERAL" | |
132 >SDL_ACTIVEEVENT.</TT | |
133 ></TD | |
134 ></TR | |
135 ><TR | |
136 ><TD | |
137 ALIGN="LEFT" | |
138 VALIGN="TOP" | |
139 ><TT | |
140 CLASS="STRUCTFIELD" | |
141 ><I | |
142 >gain</I | |
143 ></TT | |
144 ></TD | |
145 ><TD | |
146 ALIGN="LEFT" | |
147 VALIGN="TOP" | |
148 >0 if the event is a loss or 1 if it is a gain.</TD | |
149 ></TR | |
150 ><TR | |
151 ><TD | |
152 ALIGN="LEFT" | |
153 VALIGN="TOP" | |
154 ><TT | |
155 CLASS="STRUCTFIELD" | |
156 ><I | |
157 >state</I | |
158 ></TT | |
159 ></TD | |
160 ><TD | |
161 ALIGN="LEFT" | |
162 VALIGN="TOP" | |
163 ><TT | |
164 CLASS="LITERAL" | |
165 >SDL_APPMOUSEFOCUS</TT | |
166 > if mouse focus was gained or lost, <TT | |
167 CLASS="LITERAL" | |
168 >SDL_APPINPUTFOCUS</TT | |
169 > if input focus was gained or lost, or <TT | |
170 CLASS="LITERAL" | |
171 >SDL_APPACTIVE</TT | |
172 > if the application was iconified (<TT | |
173 CLASS="STRUCTFIELD" | |
174 ><I | |
175 >gain</I | |
176 ></TT | |
177 >=0) or restored(<TT | |
178 CLASS="STRUCTFIELD" | |
179 ><I | |
180 >gain</I | |
181 ></TT | |
182 >=1).</TD | |
183 ></TR | |
184 ></TBODY | |
185 ></TABLE | |
186 ><P | |
187 ></P | |
188 ></DIV | |
189 ></DIV | |
190 ><DIV | |
191 CLASS="REFSECT1" | |
192 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
193 NAME="AEN3984" |
0 | 194 ></A |
195 ><H2 | |
196 >Description</H2 | |
197 ><P | |
198 ><SPAN | |
199 CLASS="STRUCTNAME" | |
200 >SDL_ActiveEvent</SPAN | |
201 > is a member of the <A | |
202 HREF="sdlevent.html" | |
203 ><SPAN | |
204 CLASS="STRUCTNAME" | |
205 >SDL_Event</SPAN | |
206 ></A | |
207 > union and is used when an event of type <TT | |
208 CLASS="LITERAL" | |
209 >SDL_ACTIVEEVENT</TT | |
210 > is reported.</P | |
211 ><P | |
212 >When the mouse leaves or enters the window area a <TT | |
213 CLASS="LITERAL" | |
214 >SDL_APPMOUSEFOCUS</TT | |
215 > type activation event occurs, if the mouse entered the window then <TT | |
216 CLASS="STRUCTFIELD" | |
217 ><I | |
218 >gain</I | |
219 ></TT | |
220 > will be 1, otherwise <TT | |
221 CLASS="STRUCTFIELD" | |
222 ><I | |
223 >gain</I | |
224 ></TT | |
225 > will be 0. A <TT | |
226 CLASS="LITERAL" | |
227 >SDL_APPINPUTFOCUS</TT | |
228 > type activation event occurs when the application loses or gains keyboard focus. This usually occurs when another application is made active. Finally, a <TT | |
229 CLASS="LITERAL" | |
230 >SDL_APPACTIVE</TT | |
231 > type event occurs when the application is either minimised/iconified (<TT | |
232 CLASS="STRUCTFIELD" | |
233 ><I | |
234 >gain</I | |
235 ></TT | |
236 >=0) or restored.</P | |
237 ><DIV | |
238 CLASS="NOTE" | |
239 ><BLOCKQUOTE | |
240 CLASS="NOTE" | |
241 ><P | |
242 ><B | |
243 >Note: </B | |
244 >This event does not occur when an application window is first created.</P | |
245 ></BLOCKQUOTE | |
246 ></DIV | |
247 ></DIV | |
248 ><DIV | |
249 CLASS="REFSECT1" | |
250 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
251 NAME="AEN4000" |
0 | 252 ></A |
253 ><H2 | |
254 >See Also</H2 | |
255 ><P | |
256 ><A | |
257 HREF="sdlevent.html" | |
258 ><SPAN | |
259 CLASS="STRUCTNAME" | |
260 >SDL_Event</SPAN | |
261 ></A | |
262 >, | |
263 <A | |
264 HREF="sdlgetappstate.html" | |
265 ><TT | |
266 CLASS="FUNCTION" | |
267 >SDL_GetAppState</TT | |
268 ></A | |
269 ></P | |
270 ></DIV | |
271 ><DIV | |
272 CLASS="NAVFOOTER" | |
273 ><HR | |
274 ALIGN="LEFT" | |
275 WIDTH="100%"><TABLE | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
276 SUMMARY="Footer navigation table" |
0 | 277 WIDTH="100%" |
278 BORDER="0" | |
279 CELLPADDING="0" | |
280 CELLSPACING="0" | |
281 ><TR | |
282 ><TD | |
283 WIDTH="33%" | |
284 ALIGN="left" | |
285 VALIGN="top" | |
286 ><A | |
287 HREF="sdlevent.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
288 ACCESSKEY="P" |
0 | 289 >Prev</A |
290 ></TD | |
291 ><TD | |
292 WIDTH="34%" | |
293 ALIGN="center" | |
294 VALIGN="top" | |
295 ><A | |
296 HREF="index.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
297 ACCESSKEY="H" |
0 | 298 >Home</A |
299 ></TD | |
300 ><TD | |
301 WIDTH="33%" | |
302 ALIGN="right" | |
303 VALIGN="top" | |
304 ><A | |
305 HREF="sdlkeyboardevent.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
306 ACCESSKEY="N" |
0 | 307 >Next</A |
308 ></TD | |
309 ></TR | |
310 ><TR | |
311 ><TD | |
312 WIDTH="33%" | |
313 ALIGN="left" | |
314 VALIGN="top" | |
315 >SDL_Event</TD | |
316 ><TD | |
317 WIDTH="34%" | |
318 ALIGN="center" | |
319 VALIGN="top" | |
320 ><A | |
321 HREF="eventstructures.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
322 ACCESSKEY="U" |
0 | 323 >Up</A |
324 ></TD | |
325 ><TD | |
326 WIDTH="33%" | |
327 ALIGN="right" | |
328 VALIGN="top" | |
329 >SDL_KeyboardEvent</TD | |
330 ></TR | |
331 ></TABLE | |
332 ></DIV | |
333 ></BODY | |
334 ></HTML | |
335 > |