Mercurial > sdl-ios-xcode
comparison src/video/gem/SDL_gemevents.c @ 1668:4da1ee79c9af SDL-1.3
more tweaking indent options
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 29 May 2006 04:04:35 +0000 |
parents | 782fd950bd46 |
children |
comparison
equal
deleted
inserted
replaced
1667:1fddae038bc8 | 1668:4da1ee79c9af |
---|---|
54 /* The translation tables from a console scancode to a SDL keysym */ | 54 /* The translation tables from a console scancode to a SDL keysym */ |
55 static SDLKey keymap[ATARIBIOS_MAXKEYS]; | 55 static SDLKey keymap[ATARIBIOS_MAXKEYS]; |
56 | 56 |
57 /* Functions prototypes */ | 57 /* Functions prototypes */ |
58 | 58 |
59 static SDL_keysym *TranslateKey (int scancode, int asciicode, | 59 static SDL_keysym *TranslateKey(int scancode, int asciicode, |
60 SDL_keysym * keysym, SDL_bool pressed); | 60 SDL_keysym * keysym, SDL_bool pressed); |
61 static int do_messages (_THIS, short *message); | 61 static int do_messages(_THIS, short *message); |
62 static void do_keyboard (short kc, short ks); | 62 static void do_keyboard(short kc, short ks); |
63 static void do_mouse (_THIS, short mx, short my, short mb, short ks); | 63 static void do_mouse(_THIS, short mx, short my, short mb, short ks); |
64 | 64 |
65 /* Functions */ | 65 /* Functions */ |
66 | 66 |
67 static SDL_keysym * | 67 static SDL_keysym * |
68 TranslateKey (int scancode, int asciicode, SDL_keysym * keysym, | 68 TranslateKey(int scancode, int asciicode, SDL_keysym * keysym, |
69 SDL_bool pressed) | 69 SDL_bool pressed) |
70 { | 70 { |
71 /* Set the keysym information */ | 71 /* Set the keysym information */ |
72 keysym->scancode = scancode; | 72 keysym->scancode = scancode; |
73 | 73 |
74 if (asciicode) | 74 if (asciicode) |
84 | 84 |
85 return (keysym); | 85 return (keysym); |
86 } | 86 } |
87 | 87 |
88 void | 88 void |
89 GEM_InitOSKeymap (_THIS) | 89 GEM_InitOSKeymap(_THIS) |
90 { | 90 { |
91 int i; | 91 int i; |
92 | 92 |
93 SDL_memset (gem_currentkeyboard, 0, sizeof (gem_currentkeyboard)); | 93 SDL_memset(gem_currentkeyboard, 0, sizeof(gem_currentkeyboard)); |
94 SDL_memset (gem_previouskeyboard, 0, sizeof (gem_previouskeyboard)); | 94 SDL_memset(gem_previouskeyboard, 0, sizeof(gem_previouskeyboard)); |
95 SDL_memset (gem_currentascii, 0, sizeof (gem_currentascii)); | 95 SDL_memset(gem_currentascii, 0, sizeof(gem_currentascii)); |
96 | 96 |
97 /* Initialize keymap */ | 97 /* Initialize keymap */ |
98 for (i = 0; i < sizeof (keymap); i++) | 98 for (i = 0; i < sizeof(keymap); i++) |
99 keymap[i] = SDLK_UNKNOWN; | 99 keymap[i] = SDLK_UNKNOWN; |
100 | 100 |
101 /* Functions keys */ | 101 /* Functions keys */ |
102 for (i = 0; i < 10; i++) | 102 for (i = 0; i < 10; i++) |
103 keymap[SCANCODE_F1 + i] = SDLK_F1 + i; | 103 keymap[SCANCODE_F1 + i] = SDLK_F1 + i; |
127 /* Mouse init */ | 127 /* Mouse init */ |
128 GEM_mouse_relative = SDL_FALSE; | 128 GEM_mouse_relative = SDL_FALSE; |
129 } | 129 } |
130 | 130 |
131 void | 131 void |
132 GEM_PumpEvents (_THIS) | 132 GEM_PumpEvents(_THIS) |
133 { | 133 { |
134 short mousex, mousey, mouseb, dummy; | 134 short mousex, mousey, mouseb, dummy; |
135 short kstate, prevkc, prevks; | 135 short kstate, prevkc, prevks; |
136 int i; | 136 int i; |
137 SDL_keysym keysym; | 137 SDL_keysym keysym; |
138 | 138 |
139 SDL_memset (gem_currentkeyboard, 0, sizeof (gem_currentkeyboard)); | 139 SDL_memset(gem_currentkeyboard, 0, sizeof(gem_currentkeyboard)); |
140 prevkc = prevks = 0; | 140 prevkc = prevks = 0; |
141 | 141 |
142 for (;;) { | 142 for (;;) { |
143 int quit, resultat, event_mask, mouse_event; | 143 int quit, resultat, event_mask, mouse_event; |
144 short buffer[8], kc; | 144 short buffer[8], kc; |
146 | 146 |
147 quit = mouse_event = x2 = y2 = w2 = h2 = 0; | 147 quit = mouse_event = x2 = y2 = w2 = h2 = 0; |
148 | 148 |
149 event_mask = MU_MESAG | MU_TIMER | MU_KEYBD; | 149 event_mask = MU_MESAG | MU_TIMER | MU_KEYBD; |
150 if (!GEM_fullscreen && (GEM_handle >= 0)) { | 150 if (!GEM_fullscreen && (GEM_handle >= 0)) { |
151 wind_get (GEM_handle, WF_WORKXYWH, &x2, &y2, &w2, &h2); | 151 wind_get(GEM_handle, WF_WORKXYWH, &x2, &y2, &w2, &h2); |
152 event_mask |= MU_M1; | 152 event_mask |= MU_M1; |
153 if ((SDL_GetAppState () & SDL_APPMOUSEFOCUS)) { | 153 if ((SDL_GetAppState() & SDL_APPMOUSEFOCUS)) { |
154 mouse_event = MO_LEAVE; | 154 mouse_event = MO_LEAVE; |
155 } else { | 155 } else { |
156 mouse_event = MO_ENTER; | 156 mouse_event = MO_ENTER; |
157 } | 157 } |
158 } | 158 } |
159 | 159 |
160 resultat = evnt_multi (event_mask, | 160 resultat = evnt_multi(event_mask, |
161 0, 0, 0, | 161 0, 0, 0, |
162 mouse_event, x2, y2, w2, h2, | 162 mouse_event, x2, y2, w2, h2, |
163 0, 0, 0, 0, 0, | 163 0, 0, 0, 0, 0, |
164 buffer, | 164 buffer, |
165 10, | 165 10, |
166 &dummy, &dummy, &dummy, &kstate, &kc, &dummy); | 166 &dummy, &dummy, &dummy, &kstate, &kc, &dummy); |
167 | 167 |
168 /* Message event ? */ | 168 /* Message event ? */ |
169 if (resultat & MU_MESAG) | 169 if (resultat & MU_MESAG) |
170 quit = do_messages (this, buffer); | 170 quit = do_messages(this, buffer); |
171 | 171 |
172 /* Keyboard event ? */ | 172 /* Keyboard event ? */ |
173 if (resultat & MU_KEYBD) { | 173 if (resultat & MU_KEYBD) { |
174 if ((prevkc != kc) || (prevks != kstate)) { | 174 if ((prevkc != kc) || (prevks != kstate)) { |
175 do_keyboard (kc, kstate); | 175 do_keyboard(kc, kstate); |
176 } else { | 176 } else { |
177 /* Avoid looping, if repeating same key */ | 177 /* Avoid looping, if repeating same key */ |
178 break; | 178 break; |
179 } | 179 } |
180 } | 180 } |
181 | 181 |
182 /* Mouse entering/leaving window */ | 182 /* Mouse entering/leaving window */ |
183 if (resultat & MU_M1) { | 183 if (resultat & MU_M1) { |
184 if (this->input_grab == SDL_GRAB_OFF) { | 184 if (this->input_grab == SDL_GRAB_OFF) { |
185 if (SDL_GetAppState () & SDL_APPMOUSEFOCUS) { | 185 if (SDL_GetAppState() & SDL_APPMOUSEFOCUS) { |
186 SDL_PrivateAppActive (0, SDL_APPMOUSEFOCUS); | 186 SDL_PrivateAppActive(0, SDL_APPMOUSEFOCUS); |
187 } else { | 187 } else { |
188 SDL_PrivateAppActive (1, SDL_APPMOUSEFOCUS); | 188 SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS); |
189 } | 189 } |
190 } | 190 } |
191 } | 191 } |
192 | 192 |
193 /* Timer event ? */ | 193 /* Timer event ? */ |
194 if ((resultat & MU_TIMER) || quit) | 194 if ((resultat & MU_TIMER) || quit) |
195 break; | 195 break; |
196 } | 196 } |
197 | 197 |
198 /* Update mouse */ | 198 /* Update mouse */ |
199 graf_mkstate (&mousex, &mousey, &mouseb, &kstate); | 199 graf_mkstate(&mousex, &mousey, &mouseb, &kstate); |
200 do_mouse (this, mousex, mousey, mouseb, kstate); | 200 do_mouse(this, mousex, mousey, mouseb, kstate); |
201 | 201 |
202 /* Now generate keyboard events */ | 202 /* Now generate keyboard events */ |
203 for (i = 0; i < ATARIBIOS_MAXKEYS; i++) { | 203 for (i = 0; i < ATARIBIOS_MAXKEYS; i++) { |
204 /* Key pressed ? */ | 204 /* Key pressed ? */ |
205 if (gem_currentkeyboard[i] && !gem_previouskeyboard[i]) | 205 if (gem_currentkeyboard[i] && !gem_previouskeyboard[i]) |
206 SDL_PrivateKeyboard (SDL_PRESSED, | 206 SDL_PrivateKeyboard(SDL_PRESSED, |
207 TranslateKey (i, gem_currentascii[i], | 207 TranslateKey(i, gem_currentascii[i], |
208 &keysym, SDL_TRUE)); | 208 &keysym, SDL_TRUE)); |
209 | 209 |
210 /* Key unpressed ? */ | 210 /* Key unpressed ? */ |
211 if (gem_previouskeyboard[i] && !gem_currentkeyboard[i]) | 211 if (gem_previouskeyboard[i] && !gem_currentkeyboard[i]) |
212 SDL_PrivateKeyboard (SDL_RELEASED, | 212 SDL_PrivateKeyboard(SDL_RELEASED, |
213 TranslateKey (i, gem_currentascii[i], | 213 TranslateKey(i, gem_currentascii[i], |
214 &keysym, SDL_FALSE)); | 214 &keysym, SDL_FALSE)); |
215 } | 215 } |
216 | 216 |
217 SDL_memcpy (gem_previouskeyboard, gem_currentkeyboard, | 217 SDL_memcpy(gem_previouskeyboard, gem_currentkeyboard, |
218 sizeof (gem_previouskeyboard)); | 218 sizeof(gem_previouskeyboard)); |
219 | 219 |
220 /* Refresh window name ? */ | 220 /* Refresh window name ? */ |
221 if (GEM_refresh_name) { | 221 if (GEM_refresh_name) { |
222 if (SDL_GetAppState () & SDL_APPACTIVE) { | 222 if (SDL_GetAppState() & SDL_APPACTIVE) { |
223 /* Fullscreen/windowed */ | 223 /* Fullscreen/windowed */ |
224 if (GEM_title_name) { | 224 if (GEM_title_name) { |
225 wind_set (GEM_handle, WF_NAME, | 225 wind_set(GEM_handle, WF_NAME, |
226 (short) (((unsigned long) GEM_title_name) >> | 226 (short) (((unsigned long) GEM_title_name) >> |
227 16), | 227 16), |
228 (short) (((unsigned long) GEM_title_name) & | 228 (short) (((unsigned long) GEM_title_name) & |
229 0xffff), 0, 0); | 229 0xffff), 0, 0); |
230 } | 230 } |
231 } else { | 231 } else { |
232 /* Iconified */ | 232 /* Iconified */ |
233 if (GEM_icon_name) { | 233 if (GEM_icon_name) { |
234 wind_set (GEM_handle, WF_NAME, | 234 wind_set(GEM_handle, WF_NAME, |
235 (short) (((unsigned long) GEM_icon_name) >> | 235 (short) (((unsigned long) GEM_icon_name) >> |
236 16), | 236 16), |
237 (short) (((unsigned long) GEM_icon_name) & | 237 (short) (((unsigned long) GEM_icon_name) & |
238 0xffff), 0, 0); | 238 0xffff), 0, 0); |
239 } | 239 } |
240 } | 240 } |
241 GEM_refresh_name = SDL_FALSE; | 241 GEM_refresh_name = SDL_FALSE; |
242 } | 242 } |
243 } | 243 } |
244 | 244 |
245 static int | 245 static int |
246 do_messages (_THIS, short *message) | 246 do_messages(_THIS, short *message) |
247 { | 247 { |
248 int quit, posted; | 248 int quit, posted; |
249 short x2, y2, w2, h2; | 249 short x2, y2, w2, h2; |
250 | 250 |
251 quit = 0; | 251 quit = 0; |
252 switch (message[0]) { | 252 switch (message[0]) { |
253 case WM_CLOSED: | 253 case WM_CLOSED: |
254 case AP_TERM: | 254 case AP_TERM: |
255 posted = SDL_PrivateQuit (); | 255 posted = SDL_PrivateQuit(); |
256 quit = 1; | 256 quit = 1; |
257 break; | 257 break; |
258 case WM_MOVED: | 258 case WM_MOVED: |
259 wind_set (message[3], WF_CURRXYWH, message[4], message[5], | 259 wind_set(message[3], WF_CURRXYWH, message[4], message[5], |
260 message[6], message[7]); | 260 message[6], message[7]); |
261 break; | 261 break; |
262 case WM_TOPPED: | 262 case WM_TOPPED: |
263 wind_set (message[3], WF_TOP, message[4], 0, 0, 0); | 263 wind_set(message[3], WF_TOP, message[4], 0, 0, 0); |
264 /* Continue with TOP event processing */ | 264 /* Continue with TOP event processing */ |
265 case WM_ONTOP: | 265 case WM_ONTOP: |
266 SDL_PrivateAppActive (1, SDL_APPINPUTFOCUS); | 266 SDL_PrivateAppActive(1, SDL_APPINPUTFOCUS); |
267 if (VDI_setpalette) { | 267 if (VDI_setpalette) { |
268 VDI_setpalette (this, VDI_curpalette); | 268 VDI_setpalette(this, VDI_curpalette); |
269 } | 269 } |
270 break; | 270 break; |
271 case WM_REDRAW: | 271 case WM_REDRAW: |
272 if (!GEM_lock_redraw) { | 272 if (!GEM_lock_redraw) { |
273 GEM_wind_redraw (this, message[3], &message[4]); | 273 GEM_wind_redraw(this, message[3], &message[4]); |
274 } | 274 } |
275 break; | 275 break; |
276 case WM_ICONIFY: | 276 case WM_ICONIFY: |
277 case WM_ALLICONIFY: | 277 case WM_ALLICONIFY: |
278 wind_set (message[3], WF_ICONIFY, message[4], message[5], | 278 wind_set(message[3], WF_ICONIFY, message[4], message[5], |
279 message[6], message[7]); | 279 message[6], message[7]); |
280 /* If we're active, make ourselves inactive */ | 280 /* If we're active, make ourselves inactive */ |
281 if (SDL_GetAppState () & SDL_APPACTIVE) { | 281 if (SDL_GetAppState() & SDL_APPACTIVE) { |
282 /* Send an internal deactivate event */ | 282 /* Send an internal deactivate event */ |
283 SDL_PrivateAppActive (0, SDL_APPACTIVE); | 283 SDL_PrivateAppActive(0, SDL_APPACTIVE); |
284 } | 284 } |
285 /* Update window title */ | 285 /* Update window title */ |
286 if (GEM_refresh_name && GEM_icon_name) { | 286 if (GEM_refresh_name && GEM_icon_name) { |
287 wind_set (GEM_handle, WF_NAME, | 287 wind_set(GEM_handle, WF_NAME, |
288 (short) (((unsigned long) GEM_icon_name) >> 16), | 288 (short) (((unsigned long) GEM_icon_name) >> 16), |
289 (short) (((unsigned long) GEM_icon_name) & 0xffff), | 289 (short) (((unsigned long) GEM_icon_name) & 0xffff), |
290 0, 0); | 290 0, 0); |
291 GEM_refresh_name = SDL_FALSE; | 291 GEM_refresh_name = SDL_FALSE; |
292 } | 292 } |
293 break; | 293 break; |
294 case WM_UNICONIFY: | 294 case WM_UNICONIFY: |
295 wind_set (message[3], WF_UNICONIFY, message[4], message[5], | 295 wind_set(message[3], WF_UNICONIFY, message[4], message[5], |
296 message[6], message[7]); | 296 message[6], message[7]); |
297 /* If we're not active, make ourselves active */ | 297 /* If we're not active, make ourselves active */ |
298 if (!(SDL_GetAppState () & SDL_APPACTIVE)) { | 298 if (!(SDL_GetAppState() & SDL_APPACTIVE)) { |
299 /* Send an internal activate event */ | 299 /* Send an internal activate event */ |
300 SDL_PrivateAppActive (1, SDL_APPACTIVE); | 300 SDL_PrivateAppActive(1, SDL_APPACTIVE); |
301 } | 301 } |
302 if (GEM_refresh_name && GEM_title_name) { | 302 if (GEM_refresh_name && GEM_title_name) { |
303 wind_set (GEM_handle, WF_NAME, | 303 wind_set(GEM_handle, WF_NAME, |
304 (short) (((unsigned long) GEM_title_name) >> 16), | 304 (short) (((unsigned long) GEM_title_name) >> 16), |
305 (short) (((unsigned long) GEM_title_name) & 0xffff), | 305 (short) (((unsigned long) GEM_title_name) & 0xffff), |
306 0, 0); | 306 0, 0); |
307 GEM_refresh_name = SDL_FALSE; | 307 GEM_refresh_name = SDL_FALSE; |
308 } | 308 } |
309 break; | 309 break; |
310 case WM_SIZED: | 310 case WM_SIZED: |
311 wind_set (message[3], WF_CURRXYWH, message[4], message[5], | 311 wind_set(message[3], WF_CURRXYWH, message[4], message[5], |
312 message[6], message[7]); | 312 message[6], message[7]); |
313 wind_get (message[3], WF_WORKXYWH, &x2, &y2, &w2, &h2); | 313 wind_get(message[3], WF_WORKXYWH, &x2, &y2, &w2, &h2); |
314 GEM_win_fulled = SDL_FALSE; /* Cancel maximized flag */ | 314 GEM_win_fulled = SDL_FALSE; /* Cancel maximized flag */ |
315 GEM_lock_redraw = SDL_TRUE; /* Prevent redraw till buffers resized */ | 315 GEM_lock_redraw = SDL_TRUE; /* Prevent redraw till buffers resized */ |
316 SDL_PrivateResize (w2, h2); | 316 SDL_PrivateResize(w2, h2); |
317 break; | 317 break; |
318 case WM_FULLED: | 318 case WM_FULLED: |
319 { | 319 { |
320 short x, y, w, h; | 320 short x, y, w, h; |
321 | 321 |
322 if (GEM_win_fulled) { | 322 if (GEM_win_fulled) { |
323 wind_get (message[3], WF_PREVXYWH, &x, &y, &w, &h); | 323 wind_get(message[3], WF_PREVXYWH, &x, &y, &w, &h); |
324 GEM_win_fulled = SDL_FALSE; | 324 GEM_win_fulled = SDL_FALSE; |
325 } else { | 325 } else { |
326 x = GEM_desk_x; | 326 x = GEM_desk_x; |
327 y = GEM_desk_y; | 327 y = GEM_desk_y; |
328 w = GEM_desk_w; | 328 w = GEM_desk_w; |
329 h = GEM_desk_h; | 329 h = GEM_desk_h; |
330 GEM_win_fulled = SDL_TRUE; | 330 GEM_win_fulled = SDL_TRUE; |
331 } | 331 } |
332 wind_set (message[3], WF_CURRXYWH, x, y, w, h); | 332 wind_set(message[3], WF_CURRXYWH, x, y, w, h); |
333 wind_get (message[3], WF_WORKXYWH, &x2, &y2, &w2, &h2); | 333 wind_get(message[3], WF_WORKXYWH, &x2, &y2, &w2, &h2); |
334 GEM_lock_redraw = SDL_TRUE; /* Prevent redraw till buffers resized */ | 334 GEM_lock_redraw = SDL_TRUE; /* Prevent redraw till buffers resized */ |
335 SDL_PrivateResize (w2, h2); | 335 SDL_PrivateResize(w2, h2); |
336 } | 336 } |
337 break; | 337 break; |
338 case WM_BOTTOMED: | 338 case WM_BOTTOMED: |
339 wind_set (message[3], WF_BOTTOM, 0, 0, 0, 0); | 339 wind_set(message[3], WF_BOTTOM, 0, 0, 0, 0); |
340 /* Continue with BOTTOM event processing */ | 340 /* Continue with BOTTOM event processing */ |
341 case WM_UNTOPPED: | 341 case WM_UNTOPPED: |
342 SDL_PrivateAppActive (0, SDL_APPINPUTFOCUS); | 342 SDL_PrivateAppActive(0, SDL_APPINPUTFOCUS); |
343 if (VDI_setpalette) { | 343 if (VDI_setpalette) { |
344 VDI_setpalette (this, VDI_oldpalette); | 344 VDI_setpalette(this, VDI_oldpalette); |
345 } | 345 } |
346 break; | 346 break; |
347 } | 347 } |
348 | 348 |
349 return quit; | 349 return quit; |
350 } | 350 } |
351 | 351 |
352 static void | 352 static void |
353 do_keyboard (short kc, short ks) | 353 do_keyboard(short kc, short ks) |
354 { | 354 { |
355 int scancode, asciicode; | 355 int scancode, asciicode; |
356 | 356 |
357 if (kc) { | 357 if (kc) { |
358 scancode = (kc >> 8) & 127; | 358 scancode = (kc >> 8) & 127; |
372 if (ks & K_ALT) | 372 if (ks & K_ALT) |
373 gem_currentkeyboard[SCANCODE_LEFTALT] = 0xFF; | 373 gem_currentkeyboard[SCANCODE_LEFTALT] = 0xFF; |
374 } | 374 } |
375 | 375 |
376 static void | 376 static void |
377 do_mouse (_THIS, short mx, short my, short mb, short ks) | 377 do_mouse(_THIS, short mx, short my, short mb, short ks) |
378 { | 378 { |
379 static short prevmousex = 0, prevmousey = 0, prevmouseb = 0; | 379 static short prevmousex = 0, prevmousey = 0, prevmouseb = 0; |
380 short x2, y2, w2, h2; | 380 short x2, y2, w2, h2; |
381 | 381 |
382 /* Don't return mouse events if out of window */ | 382 /* Don't return mouse events if out of window */ |
383 if ((SDL_GetAppState () & SDL_APPMOUSEFOCUS) == 0) { | 383 if ((SDL_GetAppState() & SDL_APPMOUSEFOCUS) == 0) { |
384 return; | 384 return; |
385 } | 385 } |
386 | 386 |
387 /* Retrieve window coords, and generate mouse events accordingly */ | 387 /* Retrieve window coords, and generate mouse events accordingly */ |
388 x2 = y2 = 0; | 388 x2 = y2 = 0; |
389 w2 = VDI_w; | 389 w2 = VDI_w; |
390 h2 = VDI_h; | 390 h2 = VDI_h; |
391 if ((!GEM_fullscreen) && (GEM_handle >= 0)) { | 391 if ((!GEM_fullscreen) && (GEM_handle >= 0)) { |
392 wind_get (GEM_handle, WF_WORKXYWH, &x2, &y2, &w2, &h2); | 392 wind_get(GEM_handle, WF_WORKXYWH, &x2, &y2, &w2, &h2); |
393 | 393 |
394 /* Do not generate mouse button event if out of window working area */ | 394 /* Do not generate mouse button event if out of window working area */ |
395 if ((mx < x2) || (mx >= x2 + w2) || (my < y2) || (my >= y2 + h2)) { | 395 if ((mx < x2) || (mx >= x2 + w2) || (my < y2) || (my >= y2 + h2)) { |
396 mb = prevmouseb; | 396 mb = prevmouseb; |
397 } | 397 } |
398 } | 398 } |
399 | 399 |
400 /* Mouse motion ? */ | 400 /* Mouse motion ? */ |
401 if (GEM_mouse_relative) { | 401 if (GEM_mouse_relative) { |
402 if (GEM_usedevmouse) { | 402 if (GEM_usedevmouse) { |
403 SDL_AtariDevMouse_PostMouseEvents (this, SDL_FALSE); | 403 SDL_AtariDevMouse_PostMouseEvents(this, SDL_FALSE); |
404 } else { | 404 } else { |
405 SDL_AtariXbios_PostMouseEvents (this, SDL_FALSE); | 405 SDL_AtariXbios_PostMouseEvents(this, SDL_FALSE); |
406 } | 406 } |
407 } else { | 407 } else { |
408 if ((prevmousex != mx) || (prevmousey != my)) { | 408 if ((prevmousex != mx) || (prevmousey != my)) { |
409 int posx, posy; | 409 int posx, posy; |
410 | 410 |
418 if (posy < 0) | 418 if (posy < 0) |
419 posy = 0; | 419 posy = 0; |
420 if (posy > h2) | 420 if (posy > h2) |
421 posy = h2 - 1; | 421 posy = h2 - 1; |
422 | 422 |
423 SDL_PrivateMouseMotion (0, 0, posx, posy); | 423 SDL_PrivateMouseMotion(0, 0, posx, posy); |
424 } | 424 } |
425 prevmousex = mx; | 425 prevmousex = mx; |
426 prevmousey = my; | 426 prevmousey = my; |
427 } | 427 } |
428 | 428 |
435 | 435 |
436 curbutton = mb & (1 << i); | 436 curbutton = mb & (1 << i); |
437 prevbutton = prevmouseb & (1 << i); | 437 prevbutton = prevmouseb & (1 << i); |
438 | 438 |
439 if (curbutton && !prevbutton) { | 439 if (curbutton && !prevbutton) { |
440 SDL_PrivateMouseButton (SDL_PRESSED, i + 1, 0, 0); | 440 SDL_PrivateMouseButton(SDL_PRESSED, i + 1, 0, 0); |
441 } | 441 } |
442 if (!curbutton && prevbutton) { | 442 if (!curbutton && prevbutton) { |
443 SDL_PrivateMouseButton (SDL_RELEASED, i + 1, 0, 0); | 443 SDL_PrivateMouseButton(SDL_RELEASED, i + 1, 0, 0); |
444 } | 444 } |
445 } | 445 } |
446 prevmouseb = mb; | 446 prevmouseb = mb; |
447 } | 447 } |
448 | 448 |