Mercurial > sdl-ios-xcode
comparison src/video/photon/SDL_ph_events.c @ 821:30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
From: "Mike Gorchak"
Subject: Batch of the QNX6 fixes for the SDL
1. Updated readme.QNX
2. Fixed crashes during intensive window updating under fast machines (got over 200 rectangles for update).
3. Fixed double-buffered fullscreen modes, now it works as needed.
4. Fixed Photon detection algorithm.
5. Fixed HWSURFACE update function.
6. Added SDL_PHOTON_FULLSCREEN_REFRESH environment variable support for control refresh rates under Photon.
7. Added 640x400 fullscreen mode emulation via 640x480 (if videodriver not supports original 640x400 mode of course) shifted by 40 vertical pixels from begin, to center it. It's needed for some old DOS games which ran in doubled 320x200 mode.
8. Added available video ram amount support.
8. Added hardware surface allocation/deallocation support if current videomode and videodriver supports it.
9. Added hardware filling support.
10. Added hardware blits support (simple and colorkeyed).
And I've added to testvidinfo test color-keyed blits benchmark (maybe need to add alpha blits benchmark too ?). Currently Photon not supporting any alpha hardware blittings (all drivers lack of alpha blitting code support, only software alpha blitting exist in photon, which is hundreds times slowest than the SDL's one). So I've not added the alpha support. I suppose new QNX 6.3 will have the hardware alpha support, so when it will be done, I'll add alpha support.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 14 Feb 2004 20:22:21 +0000 |
parents | b8d311d90021 |
children | 05c551e5bc64 |
comparison
equal
deleted
inserted
replaced
820:0b9b4bf3c1e7 | 821:30168104389f |
---|---|
45 #include "SDL_ph_modes_c.h" | 45 #include "SDL_ph_modes_c.h" |
46 #include "SDL_ph_image_c.h" | 46 #include "SDL_ph_image_c.h" |
47 #include "SDL_ph_events_c.h" | 47 #include "SDL_ph_events_c.h" |
48 #include "SDL_phyuv_c.h" | 48 #include "SDL_phyuv_c.h" |
49 | 49 |
50 | |
51 | |
52 /* The translation tables from a photon keysym to a SDL keysym */ | 50 /* The translation tables from a photon keysym to a SDL keysym */ |
53 static SDLKey ODD_keymap[256]; | 51 static SDLKey ODD_keymap[256]; |
54 static SDLKey MISC_keymap[0xFF + 1]; | 52 static SDLKey MISC_keymap[0xFF + 1]; |
55 SDL_keysym *ph_TranslateKey(PhKeyEvent_t *key, SDL_keysym *keysym); | 53 SDL_keysym *ph_TranslateKey(PhKeyEvent_t *key, SDL_keysym *keysym); |
56 | 54 |
57 /* Check to see if this is a repeated key. | 55 /* Check to see if this is a repeated key. |
58 (idea shamelessly lifted from GII -- thanks guys! :) | 56 (idea shamelessly lifted from GII -- thanks guys! :) */ |
59 */ | |
60 | |
61 static int ph_WarpedMotion(_THIS, PhEvent_t *winEvent) | 57 static int ph_WarpedMotion(_THIS, PhEvent_t *winEvent) |
62 { | 58 { |
63 PhRect_t *rect = PhGetRects( winEvent ); | 59 PhRect_t *rect = PhGetRects( winEvent ); |
64 | 60 |
65 int centre_x, centre_y; | 61 int centre_x, centre_y; |
115 mouse_button |= SDL_BUTTON_MIDDLE; | 111 mouse_button |= SDL_BUTTON_MIDDLE; |
116 | 112 |
117 return (mouse_button); | 113 return (mouse_button); |
118 } | 114 } |
119 | 115 |
120 // void* PtAppCreateContext(); | |
121 | |
122 static int ph_DispatchEvent(_THIS) | 116 static int ph_DispatchEvent(_THIS) |
123 { | 117 { |
124 int posted; | 118 int posted; |
125 PhRect_t* rect; | 119 PhRect_t* rect; |
126 PhPointerEvent_t* pointerEvent; | 120 PhPointerEvent_t* pointerEvent; |
127 PhKeyEvent_t* keyEvent; | 121 PhKeyEvent_t* keyEvent; |
128 PhWindowEvent_t* winEvent; | 122 PhWindowEvent_t* winEvent; |
129 int i, buttons; | 123 int i, buttons; |
130 SDL_Rect sdlrects[50]; | 124 SDL_Rect sdlrects[PH_SDL_MAX_RECTS]; |
131 | 125 |
132 posted = 0; | 126 posted = 0; |
133 | 127 |
134 switch (event->type) | 128 switch (event->type) |
135 { | 129 { |
215 else if ((winEvent->event_f==Ph_WM_FOCUS) && (winEvent->event_state==Ph_WM_EVSTATE_FOCUS)) | 209 else if ((winEvent->event_f==Ph_WM_FOCUS) && (winEvent->event_state==Ph_WM_EVSTATE_FOCUS)) |
216 { | 210 { |
217 set_motion_sensitivity(this, -1); | 211 set_motion_sensitivity(this, -1); |
218 posted = SDL_PrivateAppActive(1, SDL_APPINPUTFOCUS); | 212 posted = SDL_PrivateAppActive(1, SDL_APPINPUTFOCUS); |
219 } | 213 } |
220 /* quit request */ | 214 /* request quit */ |
221 else if (winEvent->event_f==Ph_WM_CLOSE) | 215 else if (winEvent->event_f==Ph_WM_CLOSE) |
222 { | 216 { |
223 posted = SDL_PrivateQuit(); | 217 posted = SDL_PrivateQuit(); |
224 } | 218 } |
225 /* hide/unhide request */ | 219 /* request hide/unhide */ |
226 else if (winEvent->event_f==Ph_WM_HIDE) | 220 else if (winEvent->event_f==Ph_WM_HIDE) |
227 { | 221 { |
228 if (currently_hided) | 222 if (currently_hided) |
229 { | 223 { |
230 /* got unhide window event */ | 224 /* got unhide window event */ |
285 /* window has been resized, moved or removed */ | 279 /* window has been resized, moved or removed */ |
286 case Ph_EV_EXPOSE: | 280 case Ph_EV_EXPOSE: |
287 { | 281 { |
288 if (event->num_rects!=0) | 282 if (event->num_rects!=0) |
289 { | 283 { |
284 int numrects; | |
285 | |
290 if (SDL_VideoSurface) | 286 if (SDL_VideoSurface) |
291 { | 287 { |
292 rect = PhGetRects(event); | 288 rect = PhGetRects(event); |
289 if (event->num_rects>PH_SDL_MAX_RECTS) | |
290 { | |
291 /* sorry, buffers underrun, we'll update only first PH_SDL_MAX_RECTS rects */ | |
292 numrects=PH_SDL_MAX_RECTS; | |
293 } | |
293 | 294 |
294 for(i=0; i<event->num_rects; i++) | 295 for(i=0; i<event->num_rects; i++) |
295 { | 296 { |
296 sdlrects[i].x = rect[i].ul.x; | 297 sdlrects[i].x = rect[i].ul.x; |
297 sdlrects[i].y = rect[i].ul.y; | 298 sdlrects[i].y = rect[i].ul.y; |
366 } | 367 } |
367 break; | 368 break; |
368 | 369 |
369 case Ph_EV_INFO: | 370 case Ph_EV_INFO: |
370 { | 371 { |
372 if (event->subtype==Ph_OFFSCREEN_INVALID) | |
373 { | |
374 unsigned long* EvInfoData; | |
375 | |
376 EvInfoData=(unsigned long*)PhGetData(event); | |
377 | |
378 switch (*EvInfoData) | |
379 { | |
380 case Pg_VIDEO_MODE_SWITCHED: | |
381 { | |
382 } | |
383 break; | |
384 case Pg_ENTERED_DIRECT: | |
385 { | |
386 } | |
387 break; | |
388 case Pg_EXITED_DIRECT: | |
389 { | |
390 } | |
391 break; | |
392 case Pg_DRIVER_STARTED: | |
393 { | |
394 } | |
395 break; | |
396 } | |
397 } | |
371 } | 398 } |
372 break; | 399 break; |
373 } | 400 } |
374 | 401 |
375 return(posted); | 402 return(posted); |
385 { | 412 { |
386 switch(PhEventPeek(event, EVENT_SIZE)) | 413 switch(PhEventPeek(event, EVENT_SIZE)) |
387 { | 414 { |
388 case Ph_EVENT_MSG: | 415 case Ph_EVENT_MSG: |
389 return 1; | 416 return 1; |
390 break; | |
391 case -1: | 417 case -1: |
392 perror("ph_Pending(): PhEventNext failed"); | 418 SDL_SetError("ph_Pending(): PhEventNext failed.\n"); |
393 break; | 419 return 0; |
394 default: | 420 default: |
395 return 0; | 421 return 0; |
396 } | 422 } |
397 } | 423 } |
398 | 424 |