Mercurial > sdl-ios-xcode
annotate docs/html/sdlseteventfilter.html @ 172:37e3ca9254c7
Date: Sat, 8 Sep 2001 04:42:23 +0200
From: Max Horn <max@quendi.de>
Subject: SDL/OSX: Joystick; Better key handling
I just finished implementing improved keyhandling for OS X (in fact
the code should be easily ported to the "normal" MacOS part of SDL, I
just had no chance yet). Works like this:
First init the mapping table statically like before. Them, it queries
the OS for the "official" key table, then iterates over all 127
scancode and gets the associates ascii code. It ignores everythng
below 32 (has to, as it would lead to many problems if we did not...
e.g. both ESC and NUM LOCk produce an ascii code 27 on my keyboard),
and all stuff above 127 is mapped to SDLK_WORLD_* simply in the order
it is encountered.
In addition, caps lock is now working, too.
The code work flawless for me, but since I only have one keyboard, I
may have not encountered some serious problem... but I am pretty
confident that it is better than the old code in most cases.
The joystick driver works fine for me, too. I think it can be added
to CVS already. It would simply be helpful if more people would test
it. Hm, I wonder if Maelstrom or GLTron has Joystick support? That
would be a wonderful test application :)
I also took the liberty of modifying some text files like BUGS,
README.CVS, README.MacOSX (which now contains the OS X docs I long
promised)
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 11 Sep 2001 19:00:18 +0000 |
parents | 55f1f1b3e27d |
children | e5bc29de3f0a |
rev | line source |
---|---|
0 | 1 <HTML |
2 ><HEAD | |
3 ><TITLE | |
4 >SDL_SetEventFilter</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="Event Functions." | |
14 HREF="eventfunctions.html"><LINK | |
15 REL="PREVIOUS" | |
16 TITLE="SDL_PushEvent" | |
17 HREF="sdlpushevent.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="SDL_GetEventFilter" | |
20 HREF="sdlgeteventfilter.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="sdlpushevent.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="sdlgeteventfilter.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="SDLSETEVENTFILTER" | |
71 >SDL_SetEventFilter</A | |
72 ></H1 | |
73 ><DIV | |
74 CLASS="REFNAMEDIV" | |
75 ><A | |
55
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
76 NAME="AEN5032" |
0 | 77 ></A |
78 ><H2 | |
79 >Name</H2 | |
80 >SDL_SetEventFilter -- Sets up a filter to process all events before they are posted | |
81 to the event queue.</DIV | |
82 ><DIV | |
83 CLASS="REFSYNOPSISDIV" | |
84 ><A | |
55
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
85 NAME="AEN5035" |
0 | 86 ></A |
87 ><H2 | |
88 >Synopsis</H2 | |
89 ><DIV | |
90 CLASS="FUNCSYNOPSIS" | |
91 ><A | |
55
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
92 NAME="AEN5036" |
0 | 93 ></A |
94 ><P | |
95 ></P | |
96 ><PRE | |
97 CLASS="FUNCSYNOPSISINFO" | |
98 >#include "SDL.h"</PRE | |
99 ><P | |
100 ><CODE | |
101 ><CODE | |
102 CLASS="FUNCDEF" | |
103 >void <B | |
104 CLASS="FSFUNC" | |
105 >SDL_SetEventFilter</B | |
106 ></CODE | |
107 >(SDL_EventFilter filter);</CODE | |
108 ></P | |
109 ><P | |
110 ></P | |
111 ></DIV | |
112 ></DIV | |
113 ><DIV | |
114 CLASS="REFSECT1" | |
115 ><A | |
55
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
116 NAME="AEN5042" |
0 | 117 ></A |
118 ><H2 | |
119 >Description</H2 | |
120 ><P | |
121 >This function sets up a filter to process all events before they are posted | |
122 to the event queue. This is a very powerful and flexible feature. The filter | |
123 is prototyped as: | |
124 <PRE | |
125 CLASS="PROGRAMLISTING" | |
126 >typedef int (*SDL_EventFilter)(const SDL_Event *event);</PRE | |
127 > | |
128 If the filter returns <SPAN | |
129 CLASS="RETURNVALUE" | |
130 >1</SPAN | |
131 >, then the event will be | |
132 added to the internal queue. If it returns <SPAN | |
133 CLASS="RETURNVALUE" | |
134 >0</SPAN | |
135 >, | |
136 then the event will be dropped from the queue. This allows selective | |
137 filtering of dynamically.</P | |
138 ><P | |
139 >There is one caveat when dealing with the <TT | |
140 CLASS="LITERAL" | |
141 >SDL_QUITEVENT</TT | |
142 > event type. The | |
143 event filter is only called when the window manager desires to close the | |
144 application window. If the event filter returns 1, then the window will | |
145 be closed, otherwise the window will remain open if possible. | |
146 If the quit event is generated by an interrupt signal, it will bypass the | |
147 internal queue and be delivered to the application at the next event poll.</P | |
148 ><DIV | |
149 CLASS="NOTE" | |
150 ><BLOCKQUOTE | |
151 CLASS="NOTE" | |
152 ><P | |
153 ><B | |
154 >Note: </B | |
155 >Events pushed onto the queue with <A | |
156 HREF="sdlpushevent.html" | |
157 ><TT | |
158 CLASS="FUNCTION" | |
159 >SDL_PushEvent</TT | |
160 ></A | |
161 > or <A | |
162 HREF="sdlpeepevents.html" | |
163 ><TT | |
164 CLASS="FUNCTION" | |
165 >SDL_PeepEvents</TT | |
166 ></A | |
167 > do not get passed through the event filter.</P | |
168 ></BLOCKQUOTE | |
169 ></DIV | |
170 ><DIV | |
171 CLASS="NOTE" | |
172 ><BLOCKQUOTE | |
173 CLASS="NOTE" | |
174 ><P | |
175 ><B | |
176 >Note: </B | |
177 ><I | |
178 CLASS="EMPHASIS" | |
179 >Be Careful!</I | |
180 > The event filter function may run in a different thread so be careful what you do within it.</P | |
181 ></BLOCKQUOTE | |
182 ></DIV | |
183 ></DIV | |
184 ><DIV | |
185 CLASS="REFSECT1" | |
186 ><A | |
55
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
187 NAME="AEN5059" |
0 | 188 ></A |
189 ><H2 | |
190 >See Also</H2 | |
191 ><P | |
192 ><A | |
193 HREF="sdlevent.html" | |
194 ><SPAN | |
195 CLASS="STRUCTNAME" | |
196 >SDL_Event</SPAN | |
197 ></A | |
198 >, | |
199 <A | |
200 HREF="sdlgeteventfilter.html" | |
201 ><TT | |
202 CLASS="FUNCTION" | |
203 >SDL_GetEventFilter</TT | |
204 ></A | |
205 >, | |
206 <A | |
207 HREF="sdlpushevent.html" | |
208 ><TT | |
209 CLASS="FUNCTION" | |
210 >SDL_PushEvent</TT | |
211 ></A | |
212 ></P | |
213 ></DIV | |
214 ><DIV | |
215 CLASS="NAVFOOTER" | |
216 ><HR | |
217 ALIGN="LEFT" | |
218 WIDTH="100%"><TABLE | |
219 WIDTH="100%" | |
220 BORDER="0" | |
221 CELLPADDING="0" | |
222 CELLSPACING="0" | |
223 ><TR | |
224 ><TD | |
225 WIDTH="33%" | |
226 ALIGN="left" | |
227 VALIGN="top" | |
228 ><A | |
229 HREF="sdlpushevent.html" | |
230 >Prev</A | |
231 ></TD | |
232 ><TD | |
233 WIDTH="34%" | |
234 ALIGN="center" | |
235 VALIGN="top" | |
236 ><A | |
237 HREF="index.html" | |
238 >Home</A | |
239 ></TD | |
240 ><TD | |
241 WIDTH="33%" | |
242 ALIGN="right" | |
243 VALIGN="top" | |
244 ><A | |
245 HREF="sdlgeteventfilter.html" | |
246 >Next</A | |
247 ></TD | |
248 ></TR | |
249 ><TR | |
250 ><TD | |
251 WIDTH="33%" | |
252 ALIGN="left" | |
253 VALIGN="top" | |
254 >SDL_PushEvent</TD | |
255 ><TD | |
256 WIDTH="34%" | |
257 ALIGN="center" | |
258 VALIGN="top" | |
259 ><A | |
260 HREF="eventfunctions.html" | |
261 >Up</A | |
262 ></TD | |
263 ><TD | |
264 WIDTH="33%" | |
265 ALIGN="right" | |
266 VALIGN="top" | |
267 >SDL_GetEventFilter</TD | |
268 ></TR | |
269 ></TABLE | |
270 ></DIV | |
271 ></BODY | |
272 ></HTML | |
273 > |