Mercurial > sdl-ios-xcode
annotate docs/html/sdlactiveevent.html @ 615:7ec821f3cbd0
Date: Thu, 17 Apr 2003 23:27:34 -0400
From: Darrell Walisser
Subject: Yet another OS X cursor bug
The synopsis:
1. Call SDL_ShowCursor(0);
2. Call SDL_SetVideoMode();
3. Call SDL_GetEvent();
3. Call SDL_ShowCursor(1);
The result: Sometimes the cursor doesn't come back! Ack! Oddly enough,
it does come back when mousing over the dock or clicking in the menu
bar. But that's besides the point.
The reason why this is happening is a flaw in the handling of
activation/deactivation events. The short explanation is that the
HideCursor() and ShowCursor() calls must be balanced, but if the cursor
was initially hidden, HideCursor() was called again on the activate
event - so now the next ShowCursor() fails (as does the next, and the
next, for some reason).
So, here's the patch. All it does is keep track of the
HideCursor()/ShowCursor() calls so that they will always be balanced.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 20 Apr 2003 05:41:16 +0000 |
parents | e5bc29de3f0a |
children | 355632dca928 |
rev | line source |
---|---|
0 | 1 <HTML |
2 ><HEAD | |
3 ><TITLE | |
4 >SDL_ActiveEvent</TITLE | |
5 ><META | |
6 NAME="GENERATOR" | |
55
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.64 |
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 | |
31 WIDTH="100%" | |
32 BORDER="0" | |
33 CELLPADDING="0" | |
34 CELLSPACING="0" | |
35 ><TR | |
36 ><TH | |
37 COLSPAN="3" | |
38 ALIGN="center" | |
39 >SDL Library Documentation</TH | |
40 ></TR | |
41 ><TR | |
42 ><TD | |
43 WIDTH="10%" | |
44 ALIGN="left" | |
45 VALIGN="bottom" | |
46 ><A | |
47 HREF="sdlevent.html" | |
48 >Prev</A | |
49 ></TD | |
50 ><TD | |
51 WIDTH="80%" | |
52 ALIGN="center" | |
53 VALIGN="bottom" | |
54 ></TD | |
55 ><TD | |
56 WIDTH="10%" | |
57 ALIGN="right" | |
58 VALIGN="bottom" | |
59 ><A | |
60 HREF="sdlkeyboardevent.html" | |
61 >Next</A | |
62 ></TD | |
63 ></TR | |
64 ></TABLE | |
65 ><HR | |
66 ALIGN="LEFT" | |
67 WIDTH="100%"></DIV | |
68 ><H1 | |
69 ><A | |
70 NAME="SDLACTIVEEVENT" | |
71 >SDL_ActiveEvent</A | |
72 ></H1 | |
73 ><DIV | |
74 CLASS="REFNAMEDIV" | |
75 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
76 NAME="AEN3571" |
0 | 77 ></A |
78 ><H2 | |
79 >Name</H2 | |
80 >SDL_ActiveEvent -- Application visibility event structure</DIV | |
81 ><DIV | |
82 CLASS="REFSECT1" | |
83 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
84 NAME="AEN3574" |
0 | 85 ></A |
86 ><H2 | |
87 >Structure Definition</H2 | |
88 ><PRE | |
89 CLASS="PROGRAMLISTING" | |
90 >typedef struct{ | |
91 Uint8 type; | |
92 Uint8 gain; | |
93 Uint8 state; | |
94 } SDL_ActiveEvent;</PRE | |
95 ></DIV | |
96 ><DIV | |
97 CLASS="REFSECT1" | |
98 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
99 NAME="AEN3577" |
0 | 100 ></A |
101 ><H2 | |
102 >Structure Data</H2 | |
103 ><DIV | |
104 CLASS="INFORMALTABLE" | |
105 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
106 NAME="AEN3579" |
0 | 107 ></A |
108 ><P | |
109 ></P | |
110 ><TABLE | |
111 BORDER="0" | |
112 CLASS="CALSTABLE" | |
113 ><TBODY | |
114 ><TR | |
115 ><TD | |
116 ALIGN="LEFT" | |
117 VALIGN="TOP" | |
118 ><TT | |
119 CLASS="STRUCTFIELD" | |
120 ><I | |
121 >type</I | |
122 ></TT | |
123 ></TD | |
124 ><TD | |
125 ALIGN="LEFT" | |
126 VALIGN="TOP" | |
127 ><TT | |
128 CLASS="LITERAL" | |
129 >SDL_ACTIVEEVENT.</TT | |
130 ></TD | |
131 ></TR | |
132 ><TR | |
133 ><TD | |
134 ALIGN="LEFT" | |
135 VALIGN="TOP" | |
136 ><TT | |
137 CLASS="STRUCTFIELD" | |
138 ><I | |
139 >gain</I | |
140 ></TT | |
141 ></TD | |
142 ><TD | |
143 ALIGN="LEFT" | |
144 VALIGN="TOP" | |
145 >0 if the event is a loss or 1 if it is a gain.</TD | |
146 ></TR | |
147 ><TR | |
148 ><TD | |
149 ALIGN="LEFT" | |
150 VALIGN="TOP" | |
151 ><TT | |
152 CLASS="STRUCTFIELD" | |
153 ><I | |
154 >state</I | |
155 ></TT | |
156 ></TD | |
157 ><TD | |
158 ALIGN="LEFT" | |
159 VALIGN="TOP" | |
160 ><TT | |
161 CLASS="LITERAL" | |
162 >SDL_APPMOUSEFOCUS</TT | |
163 > if mouse focus was gained or lost, <TT | |
164 CLASS="LITERAL" | |
165 >SDL_APPINPUTFOCUS</TT | |
166 > if input focus was gained or lost, or <TT | |
167 CLASS="LITERAL" | |
168 >SDL_APPACTIVE</TT | |
169 > if the application was iconified (<TT | |
170 CLASS="STRUCTFIELD" | |
171 ><I | |
172 >gain</I | |
173 ></TT | |
174 >=0) or restored(<TT | |
175 CLASS="STRUCTFIELD" | |
176 ><I | |
177 >gain</I | |
178 ></TT | |
179 >=1).</TD | |
180 ></TR | |
181 ></TBODY | |
182 ></TABLE | |
183 ><P | |
184 ></P | |
185 ></DIV | |
186 ></DIV | |
187 ><DIV | |
188 CLASS="REFSECT1" | |
189 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
190 NAME="AEN3600" |
0 | 191 ></A |
192 ><H2 | |
193 >Description</H2 | |
194 ><P | |
195 ><SPAN | |
196 CLASS="STRUCTNAME" | |
197 >SDL_ActiveEvent</SPAN | |
198 > is a member of the <A | |
199 HREF="sdlevent.html" | |
200 ><SPAN | |
201 CLASS="STRUCTNAME" | |
202 >SDL_Event</SPAN | |
203 ></A | |
204 > union and is used when an event of type <TT | |
205 CLASS="LITERAL" | |
206 >SDL_ACTIVEEVENT</TT | |
207 > is reported.</P | |
208 ><P | |
209 >When the mouse leaves or enters the window area a <TT | |
210 CLASS="LITERAL" | |
211 >SDL_APPMOUSEFOCUS</TT | |
212 > type activation event occurs, if the mouse entered the window then <TT | |
213 CLASS="STRUCTFIELD" | |
214 ><I | |
215 >gain</I | |
216 ></TT | |
217 > will be 1, otherwise <TT | |
218 CLASS="STRUCTFIELD" | |
219 ><I | |
220 >gain</I | |
221 ></TT | |
222 > will be 0. A <TT | |
223 CLASS="LITERAL" | |
224 >SDL_APPINPUTFOCUS</TT | |
225 > type activation event occurs when the application loses or gains keyboard focus. This usually occurs when another application is made active. Finally, a <TT | |
226 CLASS="LITERAL" | |
227 >SDL_APPACTIVE</TT | |
228 > type event occurs when the application is either minimised/iconified (<TT | |
229 CLASS="STRUCTFIELD" | |
230 ><I | |
231 >gain</I | |
232 ></TT | |
233 >=0) or restored.</P | |
234 ><DIV | |
235 CLASS="NOTE" | |
236 ><BLOCKQUOTE | |
237 CLASS="NOTE" | |
238 ><P | |
239 ><B | |
240 >Note: </B | |
241 >This event does not occur when an application window is first created.</P | |
242 ></BLOCKQUOTE | |
243 ></DIV | |
244 ></DIV | |
245 ><DIV | |
246 CLASS="REFSECT1" | |
247 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
248 NAME="AEN3616" |
0 | 249 ></A |
250 ><H2 | |
251 >See Also</H2 | |
252 ><P | |
253 ><A | |
254 HREF="sdlevent.html" | |
255 ><SPAN | |
256 CLASS="STRUCTNAME" | |
257 >SDL_Event</SPAN | |
258 ></A | |
259 >, | |
260 <A | |
261 HREF="sdlgetappstate.html" | |
262 ><TT | |
263 CLASS="FUNCTION" | |
264 >SDL_GetAppState</TT | |
265 ></A | |
266 ></P | |
267 ></DIV | |
268 ><DIV | |
269 CLASS="NAVFOOTER" | |
270 ><HR | |
271 ALIGN="LEFT" | |
272 WIDTH="100%"><TABLE | |
273 WIDTH="100%" | |
274 BORDER="0" | |
275 CELLPADDING="0" | |
276 CELLSPACING="0" | |
277 ><TR | |
278 ><TD | |
279 WIDTH="33%" | |
280 ALIGN="left" | |
281 VALIGN="top" | |
282 ><A | |
283 HREF="sdlevent.html" | |
284 >Prev</A | |
285 ></TD | |
286 ><TD | |
287 WIDTH="34%" | |
288 ALIGN="center" | |
289 VALIGN="top" | |
290 ><A | |
291 HREF="index.html" | |
292 >Home</A | |
293 ></TD | |
294 ><TD | |
295 WIDTH="33%" | |
296 ALIGN="right" | |
297 VALIGN="top" | |
298 ><A | |
299 HREF="sdlkeyboardevent.html" | |
300 >Next</A | |
301 ></TD | |
302 ></TR | |
303 ><TR | |
304 ><TD | |
305 WIDTH="33%" | |
306 ALIGN="left" | |
307 VALIGN="top" | |
308 >SDL_Event</TD | |
309 ><TD | |
310 WIDTH="34%" | |
311 ALIGN="center" | |
312 VALIGN="top" | |
313 ><A | |
314 HREF="eventstructures.html" | |
315 >Up</A | |
316 ></TD | |
317 ><TD | |
318 WIDTH="33%" | |
319 ALIGN="right" | |
320 VALIGN="top" | |
321 >SDL_KeyboardEvent</TD | |
322 ></TR | |
323 ></TABLE | |
324 ></DIV | |
325 ></BODY | |
326 ></HTML | |
327 > |