diff 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
line wrap: on
line diff
--- a/src/video/photon/SDL_ph_events.c	Sat Feb 14 10:12:27 2004 +0000
+++ b/src/video/photon/SDL_ph_events.c	Sat Feb 14 20:22:21 2004 +0000
@@ -47,17 +47,13 @@
 #include "SDL_ph_events_c.h"
 #include "SDL_phyuv_c.h"
 
-
-
 /* The translation tables from a photon keysym to a SDL keysym */
 static SDLKey ODD_keymap[256];
 static SDLKey MISC_keymap[0xFF + 1];
 SDL_keysym *ph_TranslateKey(PhKeyEvent_t *key, SDL_keysym *keysym);
 
 /* Check to see if this is a repeated key.
-   (idea shamelessly lifted from GII -- thanks guys! :)
- */
-
+   (idea shamelessly lifted from GII -- thanks guys! :) */
 static int ph_WarpedMotion(_THIS, PhEvent_t *winEvent)
 {
     PhRect_t *rect = PhGetRects( winEvent );
@@ -117,8 +113,6 @@
     return (mouse_button);
 }
 
-//                   void* PtAppCreateContext();
-
 static int ph_DispatchEvent(_THIS)
 {
     int posted;
@@ -127,7 +121,7 @@
     PhKeyEvent_t* keyEvent;
     PhWindowEvent_t* winEvent;
     int i, buttons;
-    SDL_Rect sdlrects[50]; 
+    SDL_Rect sdlrects[PH_SDL_MAX_RECTS];
 	
     posted = 0;
 	
@@ -217,12 +211,12 @@
                 set_motion_sensitivity(this, -1);
                 posted = SDL_PrivateAppActive(1, SDL_APPINPUTFOCUS);
             }
-            /* quit request */
+            /* request quit */
             else if (winEvent->event_f==Ph_WM_CLOSE)
             {
                 posted = SDL_PrivateQuit();
             }
-            /* hide/unhide request */
+            /* request hide/unhide */
             else if (winEvent->event_f==Ph_WM_HIDE)
             {
                 if (currently_hided)
@@ -287,9 +281,16 @@
         {
             if (event->num_rects!=0)
             {
+                int numrects;
+
                 if (SDL_VideoSurface)
                 {
                     rect = PhGetRects(event);
+                    if (event->num_rects>PH_SDL_MAX_RECTS)
+                    {
+                       /* sorry, buffers underrun, we'll update only first PH_SDL_MAX_RECTS rects */
+                       numrects=PH_SDL_MAX_RECTS;
+                    }
 
                     for(i=0; i<event->num_rects; i++)
                     {
@@ -368,6 +369,32 @@
         
         case Ph_EV_INFO:
         {
+           if (event->subtype==Ph_OFFSCREEN_INVALID)
+           {
+              unsigned long* EvInfoData;
+
+              EvInfoData=(unsigned long*)PhGetData(event);
+
+              switch (*EvInfoData)
+              {
+                 case Pg_VIDEO_MODE_SWITCHED:
+                      {
+                      }
+                      break;
+                 case Pg_ENTERED_DIRECT:
+                      {
+                      }
+                      break;
+                 case Pg_EXITED_DIRECT:
+                      {
+                      }
+                      break;
+                 case Pg_DRIVER_STARTED:
+                      {
+                      }
+                      break;
+              }
+           }
         }
         break;
     }
@@ -387,10 +414,9 @@
         {
             case Ph_EVENT_MSG:
                  return 1;
-                 break;
             case -1:
-                 perror("ph_Pending(): PhEventNext failed");
-                 break;
+                 SDL_SetError("ph_Pending(): PhEventNext failed.\n");
+                 return 0;
             default:
                  return 0;
         }