src/video/photon/SDL_ph_events.c
changeset 821 30168104389f
parent 769 b8d311d90021
child 886 05c551e5bc64
     1.1 --- a/src/video/photon/SDL_ph_events.c	Sat Feb 14 10:12:27 2004 +0000
     1.2 +++ b/src/video/photon/SDL_ph_events.c	Sat Feb 14 20:22:21 2004 +0000
     1.3 @@ -47,17 +47,13 @@
     1.4  #include "SDL_ph_events_c.h"
     1.5  #include "SDL_phyuv_c.h"
     1.6  
     1.7 -
     1.8 -
     1.9  /* The translation tables from a photon keysym to a SDL keysym */
    1.10  static SDLKey ODD_keymap[256];
    1.11  static SDLKey MISC_keymap[0xFF + 1];
    1.12  SDL_keysym *ph_TranslateKey(PhKeyEvent_t *key, SDL_keysym *keysym);
    1.13  
    1.14  /* Check to see if this is a repeated key.
    1.15 -   (idea shamelessly lifted from GII -- thanks guys! :)
    1.16 - */
    1.17 -
    1.18 +   (idea shamelessly lifted from GII -- thanks guys! :) */
    1.19  static int ph_WarpedMotion(_THIS, PhEvent_t *winEvent)
    1.20  {
    1.21      PhRect_t *rect = PhGetRects( winEvent );
    1.22 @@ -117,8 +113,6 @@
    1.23      return (mouse_button);
    1.24  }
    1.25  
    1.26 -//                   void* PtAppCreateContext();
    1.27 -
    1.28  static int ph_DispatchEvent(_THIS)
    1.29  {
    1.30      int posted;
    1.31 @@ -127,7 +121,7 @@
    1.32      PhKeyEvent_t* keyEvent;
    1.33      PhWindowEvent_t* winEvent;
    1.34      int i, buttons;
    1.35 -    SDL_Rect sdlrects[50]; 
    1.36 +    SDL_Rect sdlrects[PH_SDL_MAX_RECTS];
    1.37  	
    1.38      posted = 0;
    1.39  	
    1.40 @@ -217,12 +211,12 @@
    1.41                  set_motion_sensitivity(this, -1);
    1.42                  posted = SDL_PrivateAppActive(1, SDL_APPINPUTFOCUS);
    1.43              }
    1.44 -            /* quit request */
    1.45 +            /* request quit */
    1.46              else if (winEvent->event_f==Ph_WM_CLOSE)
    1.47              {
    1.48                  posted = SDL_PrivateQuit();
    1.49              }
    1.50 -            /* hide/unhide request */
    1.51 +            /* request hide/unhide */
    1.52              else if (winEvent->event_f==Ph_WM_HIDE)
    1.53              {
    1.54                  if (currently_hided)
    1.55 @@ -287,9 +281,16 @@
    1.56          {
    1.57              if (event->num_rects!=0)
    1.58              {
    1.59 +                int numrects;
    1.60 +
    1.61                  if (SDL_VideoSurface)
    1.62                  {
    1.63                      rect = PhGetRects(event);
    1.64 +                    if (event->num_rects>PH_SDL_MAX_RECTS)
    1.65 +                    {
    1.66 +                       /* sorry, buffers underrun, we'll update only first PH_SDL_MAX_RECTS rects */
    1.67 +                       numrects=PH_SDL_MAX_RECTS;
    1.68 +                    }
    1.69  
    1.70                      for(i=0; i<event->num_rects; i++)
    1.71                      {
    1.72 @@ -368,6 +369,32 @@
    1.73          
    1.74          case Ph_EV_INFO:
    1.75          {
    1.76 +           if (event->subtype==Ph_OFFSCREEN_INVALID)
    1.77 +           {
    1.78 +              unsigned long* EvInfoData;
    1.79 +
    1.80 +              EvInfoData=(unsigned long*)PhGetData(event);
    1.81 +
    1.82 +              switch (*EvInfoData)
    1.83 +              {
    1.84 +                 case Pg_VIDEO_MODE_SWITCHED:
    1.85 +                      {
    1.86 +                      }
    1.87 +                      break;
    1.88 +                 case Pg_ENTERED_DIRECT:
    1.89 +                      {
    1.90 +                      }
    1.91 +                      break;
    1.92 +                 case Pg_EXITED_DIRECT:
    1.93 +                      {
    1.94 +                      }
    1.95 +                      break;
    1.96 +                 case Pg_DRIVER_STARTED:
    1.97 +                      {
    1.98 +                      }
    1.99 +                      break;
   1.100 +              }
   1.101 +           }
   1.102          }
   1.103          break;
   1.104      }
   1.105 @@ -387,10 +414,9 @@
   1.106          {
   1.107              case Ph_EVENT_MSG:
   1.108                   return 1;
   1.109 -                 break;
   1.110              case -1:
   1.111 -                 perror("ph_Pending(): PhEventNext failed");
   1.112 -                 break;
   1.113 +                 SDL_SetError("ph_Pending(): PhEventNext failed.\n");
   1.114 +                 return 0;
   1.115              default:
   1.116                   return 0;
   1.117          }