src/video/photon/SDL_ph_events.c
branchSDL-1.3
changeset 1662 782fd950bd46
parent 1643 51038e80ae59
child 1668 4da1ee79c9af
     1.1 --- a/src/video/photon/SDL_ph_events.c	Sun May 21 17:27:13 2006 +0000
     1.2 +++ b/src/video/photon/SDL_ph_events.c	Sun May 28 13:04:16 2006 +0000
     1.3 @@ -44,13 +44,14 @@
     1.4  /* The translation tables from a photon keysym to a SDL keysym */
     1.5  static SDLKey ODD_keymap[256];
     1.6  static SDLKey MISC_keymap[0xFF + 1];
     1.7 -SDL_keysym *ph_TranslateKey(PhKeyEvent_t *key, SDL_keysym *keysym);
     1.8 +SDL_keysym *ph_TranslateKey (PhKeyEvent_t * key, SDL_keysym * keysym);
     1.9  
    1.10  /* Check to see if this is a repeated key.
    1.11     (idea shamelessly lifted from GII -- thanks guys! :) */
    1.12 -static int ph_WarpedMotion(_THIS, PhEvent_t *winEvent)
    1.13 +static int
    1.14 +ph_WarpedMotion (_THIS, PhEvent_t * winEvent)
    1.15  {
    1.16 -    PhRect_t *rect = PhGetRects( winEvent );
    1.17 +    PhRect_t *rect = PhGetRects (winEvent);
    1.18  
    1.19      int centre_x, centre_y;
    1.20      int dx, dy;
    1.21 @@ -63,11 +64,11 @@
    1.22      dx = rect->ul.x - centre_x;
    1.23      dy = rect->ul.y - centre_y;
    1.24  
    1.25 -    posted = SDL_PrivateMouseMotion( 0, 1, dx, dy );
    1.26 +    posted = SDL_PrivateMouseMotion (0, 1, dx, dy);
    1.27  
    1.28      /* Move mouse cursor to middle of the window */
    1.29 -    PtGetAbsPosition( window, &abs_x, &abs_y );
    1.30 -    PhMoveCursorAbs(PhInputGroup(NULL), abs_x + centre_x, abs_y + centre_y);
    1.31 +    PtGetAbsPosition (window, &abs_x, &abs_y);
    1.32 +    PhMoveCursorAbs (PhInputGroup (NULL), abs_x + centre_x, abs_y + centre_y);
    1.33  
    1.34      return (posted);
    1.35  }
    1.36 @@ -75,25 +76,26 @@
    1.37  /* Control which motion flags the window has set, a flags value of -1 sets
    1.38   * MOTION_BUTTON and MOTION_NOBUTTON */
    1.39  
    1.40 -static void set_motion_sensitivity(_THIS, unsigned int flags)
    1.41 +static void
    1.42 +set_motion_sensitivity (_THIS, unsigned int flags)
    1.43  {
    1.44      int rid;
    1.45      int fields = Ph_EV_PTR_MOTION_BUTTON | Ph_EV_PTR_MOTION_NOBUTTON;
    1.46      PhRegion_t region;
    1.47  
    1.48 -    if( window )
    1.49 -    {
    1.50 -        rid = PtWidgetRid(window);
    1.51 -        if( rid != 0 && PhRegionQuery(rid, &region, NULL, NULL, 0) == 0 )
    1.52 -        {
    1.53 -            region.events_sense=(region.events_sense & ~fields)|(flags & fields);
    1.54 -            PhRegionChange(Ph_REGION_EV_SENSE, 0, &region, NULL, NULL);
    1.55 +    if (window) {
    1.56 +        rid = PtWidgetRid (window);
    1.57 +        if (rid != 0 && PhRegionQuery (rid, &region, NULL, NULL, 0) == 0) {
    1.58 +            region.events_sense =
    1.59 +                (region.events_sense & ~fields) | (flags & fields);
    1.60 +            PhRegionChange (Ph_REGION_EV_SENSE, 0, &region, NULL, NULL);
    1.61          }
    1.62      }
    1.63  }
    1.64  
    1.65  /* Convert the photon button state value to an SDL value */
    1.66 -static Uint8 ph2sdl_mousebutton(unsigned short button_state)
    1.67 +static Uint8
    1.68 +ph2sdl_mousebutton (unsigned short button_state)
    1.69  {
    1.70      Uint8 mouse_button = 0;
    1.71  
    1.72 @@ -107,443 +109,441 @@
    1.73      return (mouse_button);
    1.74  }
    1.75  
    1.76 -static int ph_DispatchEvent(_THIS)
    1.77 +static int
    1.78 +ph_DispatchEvent (_THIS)
    1.79  {
    1.80      int posted;
    1.81 -    PhRect_t* rect;
    1.82 -    PhPointerEvent_t* pointerEvent;
    1.83 -    PhKeyEvent_t* keyEvent;
    1.84 -    PhWindowEvent_t* winEvent;
    1.85 +    PhRect_t *rect;
    1.86 +    PhPointerEvent_t *pointerEvent;
    1.87 +    PhKeyEvent_t *keyEvent;
    1.88 +    PhWindowEvent_t *winEvent;
    1.89      int i, buttons;
    1.90      SDL_Rect sdlrects[PH_SDL_MAX_RECTS];
    1.91 -	
    1.92 +
    1.93      posted = 0;
    1.94 -	
    1.95 -    switch (phevent->type)
    1.96 -    {
    1.97 -        case Ph_EV_BOUNDARY:
    1.98 +
    1.99 +    switch (phevent->type) {
   1.100 +    case Ph_EV_BOUNDARY:
   1.101          {
   1.102 -            if (phevent->subtype == Ph_EV_PTR_ENTER)
   1.103 -            {
   1.104 -                posted = SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS);
   1.105 -            }
   1.106 -            else if (phevent->subtype ==Ph_EV_PTR_LEAVE)
   1.107 -            {
   1.108 -                posted = SDL_PrivateAppActive(0, SDL_APPMOUSEFOCUS);	
   1.109 +            if (phevent->subtype == Ph_EV_PTR_ENTER) {
   1.110 +                posted = SDL_PrivateAppActive (1, SDL_APPMOUSEFOCUS);
   1.111 +            } else if (phevent->subtype == Ph_EV_PTR_LEAVE) {
   1.112 +                posted = SDL_PrivateAppActive (0, SDL_APPMOUSEFOCUS);
   1.113              }
   1.114          }
   1.115          break;
   1.116  
   1.117 -        case Ph_EV_PTR_MOTION_BUTTON:
   1.118 -        case Ph_EV_PTR_MOTION_NOBUTTON:
   1.119 +    case Ph_EV_PTR_MOTION_BUTTON:
   1.120 +    case Ph_EV_PTR_MOTION_NOBUTTON:
   1.121          {
   1.122 -            if (SDL_VideoSurface)
   1.123 -            {
   1.124 -                pointerEvent = PhGetData(phevent);
   1.125 -                rect = PhGetRects(phevent);
   1.126 +            if (SDL_VideoSurface) {
   1.127 +                pointerEvent = PhGetData (phevent);
   1.128 +                rect = PhGetRects (phevent);
   1.129  
   1.130 -                if (mouse_relative)
   1.131 -                {
   1.132 -                    posted = ph_WarpedMotion(this, phevent);
   1.133 -                }
   1.134 -                else
   1.135 -                {
   1.136 -                    posted = SDL_PrivateMouseMotion(0, 0, rect->ul.x, rect->ul.y);
   1.137 +                if (mouse_relative) {
   1.138 +                    posted = ph_WarpedMotion (this, phevent);
   1.139 +                } else {
   1.140 +                    posted =
   1.141 +                        SDL_PrivateMouseMotion (0, 0, rect->ul.x, rect->ul.y);
   1.142                  }
   1.143              }
   1.144          }
   1.145          break;
   1.146  
   1.147 -        case Ph_EV_BUT_PRESS:
   1.148 +    case Ph_EV_BUT_PRESS:
   1.149          {
   1.150 -            pointerEvent = PhGetData(phevent);
   1.151 -            buttons = ph2sdl_mousebutton(pointerEvent->buttons);
   1.152 -            if (buttons != 0)
   1.153 -            {
   1.154 -                posted = SDL_PrivateMouseButton(SDL_PRESSED, buttons, 0, 0);
   1.155 +            pointerEvent = PhGetData (phevent);
   1.156 +            buttons = ph2sdl_mousebutton (pointerEvent->buttons);
   1.157 +            if (buttons != 0) {
   1.158 +                posted = SDL_PrivateMouseButton (SDL_PRESSED, buttons, 0, 0);
   1.159              }
   1.160          }
   1.161          break;
   1.162  
   1.163 -        case Ph_EV_BUT_RELEASE:
   1.164 +    case Ph_EV_BUT_RELEASE:
   1.165          {
   1.166 -            pointerEvent = PhGetData(phevent);
   1.167 -            buttons = ph2sdl_mousebutton(pointerEvent->buttons);
   1.168 -            if (phevent->subtype == Ph_EV_RELEASE_REAL && buttons != 0)
   1.169 -            {
   1.170 -                posted = SDL_PrivateMouseButton(SDL_RELEASED, buttons, 0, 0);
   1.171 -            }
   1.172 -            else if(phevent->subtype == Ph_EV_RELEASE_PHANTOM)
   1.173 -            {
   1.174 +            pointerEvent = PhGetData (phevent);
   1.175 +            buttons = ph2sdl_mousebutton (pointerEvent->buttons);
   1.176 +            if (phevent->subtype == Ph_EV_RELEASE_REAL && buttons != 0) {
   1.177 +                posted = SDL_PrivateMouseButton (SDL_RELEASED, buttons, 0, 0);
   1.178 +            } else if (phevent->subtype == Ph_EV_RELEASE_PHANTOM) {
   1.179                  /* If the mouse is outside the window,
   1.180                   * only a phantom release event is sent, so
   1.181                   * check if the window doesn't have mouse focus.
   1.182                   * Not perfect, maybe checking the mouse button
   1.183                   * state for Ph_EV_BOUNDARY events would be
   1.184                   * better. */
   1.185 -                if ((SDL_GetAppState() & SDL_APPMOUSEFOCUS) == 0)
   1.186 -		{
   1.187 -                    posted = SDL_PrivateMouseButton(SDL_RELEASED, buttons, 0, 0);
   1.188 +                if ((SDL_GetAppState () & SDL_APPMOUSEFOCUS) == 0) {
   1.189 +                    posted =
   1.190 +                        SDL_PrivateMouseButton (SDL_RELEASED, buttons, 0, 0);
   1.191                  }
   1.192              }
   1.193          }
   1.194          break;
   1.195  
   1.196 -        case Ph_EV_WM:
   1.197 +    case Ph_EV_WM:
   1.198          {
   1.199 -            winEvent = PhGetData(phevent);
   1.200 +            winEvent = PhGetData (phevent);
   1.201  
   1.202              /* losing focus */
   1.203 -            if ((winEvent->event_f==Ph_WM_FOCUS) && (winEvent->event_state==Ph_WM_EVSTATE_FOCUSLOST))
   1.204 -            {
   1.205 -                set_motion_sensitivity(this, Ph_EV_PTR_MOTION_BUTTON);
   1.206 -                posted = SDL_PrivateAppActive(0, SDL_APPINPUTFOCUS);	
   1.207 +            if ((winEvent->event_f == Ph_WM_FOCUS)
   1.208 +                && (winEvent->event_state == Ph_WM_EVSTATE_FOCUSLOST)) {
   1.209 +                set_motion_sensitivity (this, Ph_EV_PTR_MOTION_BUTTON);
   1.210 +                posted = SDL_PrivateAppActive (0, SDL_APPINPUTFOCUS);
   1.211              }
   1.212              /* gaining focus */
   1.213 -            else if ((winEvent->event_f==Ph_WM_FOCUS) && (winEvent->event_state==Ph_WM_EVSTATE_FOCUS))
   1.214 -            {
   1.215 -                set_motion_sensitivity(this, -1);
   1.216 -                posted = SDL_PrivateAppActive(1, SDL_APPINPUTFOCUS);
   1.217 +            else if ((winEvent->event_f == Ph_WM_FOCUS)
   1.218 +                     && (winEvent->event_state == Ph_WM_EVSTATE_FOCUS)) {
   1.219 +                set_motion_sensitivity (this, -1);
   1.220 +                posted = SDL_PrivateAppActive (1, SDL_APPINPUTFOCUS);
   1.221              }
   1.222              /* request quit */
   1.223 -            else if (winEvent->event_f==Ph_WM_CLOSE)
   1.224 -            {
   1.225 -                posted = SDL_PrivateQuit();
   1.226 +            else if (winEvent->event_f == Ph_WM_CLOSE) {
   1.227 +                posted = SDL_PrivateQuit ();
   1.228              }
   1.229              /* request hide/unhide */
   1.230 -            else if (winEvent->event_f==Ph_WM_HIDE)
   1.231 -            {
   1.232 -                if (currently_hided)
   1.233 -                {
   1.234 -                   /* got unhide window event                                */
   1.235 -                   /* TODO: restore application's palette if in palette mode */
   1.236 -                   currently_hided=0;
   1.237 -                }
   1.238 -                else
   1.239 -                {
   1.240 -                   /* got hide window event                                  */
   1.241 -                   /* TODO: restore original palette if in palette mode      */
   1.242 -                   currently_hided=1;
   1.243 +            else if (winEvent->event_f == Ph_WM_HIDE) {
   1.244 +                if (currently_hided) {
   1.245 +                    /* got unhide window event                                */
   1.246 +                    /* TODO: restore application's palette if in palette mode */
   1.247 +                    currently_hided = 0;
   1.248 +                } else {
   1.249 +                    /* got hide window event                                  */
   1.250 +                    /* TODO: restore original palette if in palette mode      */
   1.251 +                    currently_hided = 1;
   1.252                  }
   1.253              }
   1.254              /* request to resize */
   1.255 -            else if (winEvent->event_f==Ph_WM_RESIZE)
   1.256 -            {
   1.257 -                currently_maximized=0;
   1.258 -                #if (_NTO_VERSION < 630)
   1.259 -                   SDL_PrivateResize(winEvent->size.w+1, winEvent->size.h+1);
   1.260 -                #else
   1.261 -                   /* QNX 6.3.0 have this bug fixed */
   1.262 -                   SDL_PrivateResize(winEvent->size.w, winEvent->size.h);
   1.263 -                #endif /* _NTO_VERSION */
   1.264 +            else if (winEvent->event_f == Ph_WM_RESIZE) {
   1.265 +                currently_maximized = 0;
   1.266 +#if (_NTO_VERSION < 630)
   1.267 +                SDL_PrivateResize (winEvent->size.w + 1,
   1.268 +                                   winEvent->size.h + 1);
   1.269 +#else
   1.270 +                /* QNX 6.3.0 have this bug fixed */
   1.271 +                SDL_PrivateResize (winEvent->size.w, winEvent->size.h);
   1.272 +#endif /* _NTO_VERSION */
   1.273              }
   1.274              /* request to move */
   1.275 -            else if (winEvent->event_f==Ph_WM_MOVE)
   1.276 -            {
   1.277 -                if (current_overlay!=NULL)
   1.278 -                {
   1.279 -                   int lockedstate=current_overlay->hwdata->locked;
   1.280 -                   int chromastate=current_overlay->hwdata->ischromakey;
   1.281 -                   int error;
   1.282 -                   SDL_Rect src, dst;
   1.283 +            else if (winEvent->event_f == Ph_WM_MOVE) {
   1.284 +                if (current_overlay != NULL) {
   1.285 +                    int lockedstate = current_overlay->hwdata->locked;
   1.286 +                    int chromastate = current_overlay->hwdata->ischromakey;
   1.287 +                    int error;
   1.288 +                    SDL_Rect src, dst;
   1.289  
   1.290 -                   current_overlay->hwdata->locked=1;
   1.291 -                   src.x = 0;
   1.292 -                   src.y = 0;
   1.293 -                   src.w = current_overlay->w;
   1.294 -                   src.y = current_overlay->h;
   1.295 -                   dst.x=current_overlay->hwdata->CurrentViewPort.pos.x;
   1.296 -                   dst.y=current_overlay->hwdata->CurrentViewPort.pos.y;
   1.297 -                   dst.w=current_overlay->hwdata->CurrentViewPort.size.w;
   1.298 -                   dst.h=current_overlay->hwdata->CurrentViewPort.size.h;
   1.299 -                   current_overlay->hwdata->ischromakey=0;
   1.300 -                   error=ph_DisplayYUVOverlay(this, current_overlay, &src, &dst);
   1.301 -                   if (!error)
   1.302 -                   {
   1.303 -                       current_overlay->hwdata->ischromakey=chromastate;
   1.304 -                       current_overlay->hwdata->locked=lockedstate;
   1.305 -                   }
   1.306 +                    current_overlay->hwdata->locked = 1;
   1.307 +                    src.x = 0;
   1.308 +                    src.y = 0;
   1.309 +                    src.w = current_overlay->w;
   1.310 +                    src.y = current_overlay->h;
   1.311 +                    dst.x = current_overlay->hwdata->CurrentViewPort.pos.x;
   1.312 +                    dst.y = current_overlay->hwdata->CurrentViewPort.pos.y;
   1.313 +                    dst.w = current_overlay->hwdata->CurrentViewPort.size.w;
   1.314 +                    dst.h = current_overlay->hwdata->CurrentViewPort.size.h;
   1.315 +                    current_overlay->hwdata->ischromakey = 0;
   1.316 +                    error =
   1.317 +                        ph_DisplayYUVOverlay (this, current_overlay,
   1.318 +                                              &src, &dst);
   1.319 +                    if (!error) {
   1.320 +                        current_overlay->hwdata->ischromakey = chromastate;
   1.321 +                        current_overlay->hwdata->locked = lockedstate;
   1.322 +                    }
   1.323                  }
   1.324              }
   1.325              /* maximize request */
   1.326 -            else if (winEvent->event_f==Ph_WM_MAX)
   1.327 -            {
   1.328 +            else if (winEvent->event_f == Ph_WM_MAX) {
   1.329                  /* window already moved and resized here */
   1.330 -                currently_maximized=1;
   1.331 +                currently_maximized = 1;
   1.332              }
   1.333              /* restore request */
   1.334 -            else if (winEvent->event_f==Ph_WM_RESTORE)
   1.335 -            {
   1.336 +            else if (winEvent->event_f == Ph_WM_RESTORE) {
   1.337                  /* window already moved and resized here */
   1.338 -                currently_maximized=0;
   1.339 +                currently_maximized = 0;
   1.340              }
   1.341          }
   1.342          break;
   1.343  
   1.344          /* window has been resized, moved or removed */
   1.345 -        case Ph_EV_EXPOSE:
   1.346 +    case Ph_EV_EXPOSE:
   1.347          {
   1.348 -            if (phevent->num_rects!=0)
   1.349 -            {
   1.350 +            if (phevent->num_rects != 0) {
   1.351                  int numrects;
   1.352  
   1.353 -                if (SDL_VideoSurface)
   1.354 -                {
   1.355 -                    rect = PhGetRects(phevent);
   1.356 -                    if (phevent->num_rects>PH_SDL_MAX_RECTS)
   1.357 -                    {
   1.358 -                       /* sorry, buffers underrun, we'll update only first PH_SDL_MAX_RECTS rects */
   1.359 -                       numrects=PH_SDL_MAX_RECTS;
   1.360 +                if (SDL_VideoSurface) {
   1.361 +                    rect = PhGetRects (phevent);
   1.362 +                    if (phevent->num_rects > PH_SDL_MAX_RECTS) {
   1.363 +                        /* sorry, buffers underrun, we'll update only first PH_SDL_MAX_RECTS rects */
   1.364 +                        numrects = PH_SDL_MAX_RECTS;
   1.365                      }
   1.366  
   1.367 -                    for(i=0; i<phevent->num_rects; i++)
   1.368 -                    {
   1.369 +                    for (i = 0; i < phevent->num_rects; i++) {
   1.370                          sdlrects[i].x = rect[i].ul.x;
   1.371                          sdlrects[i].y = rect[i].ul.y;
   1.372                          sdlrects[i].w = rect[i].lr.x - rect[i].ul.x + 1;
   1.373                          sdlrects[i].h = rect[i].lr.y - rect[i].ul.y + 1;
   1.374                      }
   1.375  
   1.376 -                    this->UpdateRects(this, phevent->num_rects, sdlrects);
   1.377 +                    this->UpdateRects (this, phevent->num_rects, sdlrects);
   1.378  
   1.379 -                    if (current_overlay!=NULL)
   1.380 -                    {
   1.381 -                        int lockedstate=current_overlay->hwdata->locked;
   1.382 +                    if (current_overlay != NULL) {
   1.383 +                        int lockedstate = current_overlay->hwdata->locked;
   1.384                          int error;
   1.385                          SDL_Rect src, dst;
   1.386  
   1.387 -                        current_overlay->hwdata->locked=1;
   1.388 +                        current_overlay->hwdata->locked = 1;
   1.389                          src.x = 0;
   1.390                          src.y = 0;
   1.391                          src.w = current_overlay->w;
   1.392                          src.y = current_overlay->h;
   1.393 -                        dst.x=current_overlay->hwdata->CurrentViewPort.pos.x;
   1.394 -                        dst.y=current_overlay->hwdata->CurrentViewPort.pos.y;
   1.395 -                        dst.w=current_overlay->hwdata->CurrentViewPort.size.w;
   1.396 -                        dst.h=current_overlay->hwdata->CurrentViewPort.size.h;
   1.397 -                        current_overlay->hwdata->forcedredraw=1;
   1.398 -                        error=ph_DisplayYUVOverlay(this, current_overlay, &src, &dst);
   1.399 -                        if (!error)
   1.400 -                        {
   1.401 -                            current_overlay->hwdata->forcedredraw=0;
   1.402 -                            current_overlay->hwdata->locked=lockedstate;
   1.403 +                        dst.x =
   1.404 +                            current_overlay->hwdata->CurrentViewPort.pos.x;
   1.405 +                        dst.y =
   1.406 +                            current_overlay->hwdata->CurrentViewPort.pos.y;
   1.407 +                        dst.w =
   1.408 +                            current_overlay->hwdata->CurrentViewPort.size.w;
   1.409 +                        dst.h =
   1.410 +                            current_overlay->hwdata->CurrentViewPort.size.h;
   1.411 +                        current_overlay->hwdata->forcedredraw = 1;
   1.412 +                        error =
   1.413 +                            ph_DisplayYUVOverlay (this,
   1.414 +                                                  current_overlay,
   1.415 +                                                  &src, &dst);
   1.416 +                        if (!error) {
   1.417 +                            current_overlay->hwdata->forcedredraw = 0;
   1.418 +                            current_overlay->hwdata->locked = lockedstate;
   1.419                          }
   1.420                      }
   1.421                  }
   1.422              }
   1.423          }
   1.424 -	break;
   1.425 +        break;
   1.426  
   1.427 -        case Ph_EV_KEY:
   1.428 +    case Ph_EV_KEY:
   1.429          {
   1.430              SDL_keysym keysym;
   1.431  
   1.432              posted = 0;
   1.433  
   1.434 -            keyEvent = PhGetData(phevent);
   1.435 +            keyEvent = PhGetData (phevent);
   1.436  
   1.437 -            if (Pk_KF_Key_Down & keyEvent->key_flags)
   1.438 -            {
   1.439 +            if (Pk_KF_Key_Down & keyEvent->key_flags) {
   1.440                  /* split the wheel events from real key events */
   1.441 -                if ((keyEvent->key_cap==Pk_Up) && (keyEvent->key_scan==0) && ((keyEvent->key_flags & Pk_KF_Scan_Valid)==Pk_KF_Scan_Valid))
   1.442 -                {
   1.443 -                   posted = SDL_PrivateMouseButton(SDL_PRESSED, SDL_BUTTON_WHEELUP, 0, 0);
   1.444 -                   break;
   1.445 +                if ((keyEvent->key_cap == Pk_Up)
   1.446 +                    && (keyEvent->key_scan == 0)
   1.447 +                    && ((keyEvent->key_flags & Pk_KF_Scan_Valid) ==
   1.448 +                        Pk_KF_Scan_Valid)) {
   1.449 +                    posted =
   1.450 +                        SDL_PrivateMouseButton (SDL_PRESSED,
   1.451 +                                                SDL_BUTTON_WHEELUP, 0, 0);
   1.452 +                    break;
   1.453                  }
   1.454 -                if ((keyEvent->key_cap==Pk_Down) && (keyEvent->key_scan==0) && ((keyEvent->key_flags & Pk_KF_Scan_Valid)==Pk_KF_Scan_Valid))
   1.455 -                {
   1.456 -                   posted = SDL_PrivateMouseButton(SDL_PRESSED, SDL_BUTTON_WHEELDOWN, 0, 0);
   1.457 -                   break;
   1.458 +                if ((keyEvent->key_cap == Pk_Down)
   1.459 +                    && (keyEvent->key_scan == 0)
   1.460 +                    && ((keyEvent->key_flags & Pk_KF_Scan_Valid) ==
   1.461 +                        Pk_KF_Scan_Valid)) {
   1.462 +                    posted =
   1.463 +                        SDL_PrivateMouseButton (SDL_PRESSED,
   1.464 +                                                SDL_BUTTON_WHEELDOWN, 0, 0);
   1.465 +                    break;
   1.466                  }
   1.467 -                posted = SDL_PrivateKeyboard(SDL_PRESSED, ph_TranslateKey(keyEvent, &keysym));
   1.468 -            }
   1.469 -            else /* must be key release */
   1.470 -            {
   1.471 +                posted =
   1.472 +                    SDL_PrivateKeyboard (SDL_PRESSED,
   1.473 +                                         ph_TranslateKey (keyEvent, &keysym));
   1.474 +            } else {            /* must be key release */
   1.475 +
   1.476                  /* split the wheel events from real key events */
   1.477 -                if ((keyEvent->key_cap==Pk_Up) && (keyEvent->key_scan==0) && ((keyEvent->key_flags & Pk_KF_Scan_Valid)==Pk_KF_Scan_Valid))
   1.478 -                {
   1.479 -                   posted = SDL_PrivateMouseButton(SDL_RELEASED, SDL_BUTTON_WHEELUP, 0, 0);
   1.480 -                   break;
   1.481 +                if ((keyEvent->key_cap == Pk_Up)
   1.482 +                    && (keyEvent->key_scan == 0)
   1.483 +                    && ((keyEvent->key_flags & Pk_KF_Scan_Valid) ==
   1.484 +                        Pk_KF_Scan_Valid)) {
   1.485 +                    posted =
   1.486 +                        SDL_PrivateMouseButton (SDL_RELEASED,
   1.487 +                                                SDL_BUTTON_WHEELUP, 0, 0);
   1.488 +                    break;
   1.489                  }
   1.490 -                if ((keyEvent->key_cap==Pk_Down) && (keyEvent->key_scan==0) && ((keyEvent->key_flags & Pk_KF_Scan_Valid)==Pk_KF_Scan_Valid))
   1.491 -                {
   1.492 -                   posted = SDL_PrivateMouseButton(SDL_RELEASED, SDL_BUTTON_WHEELDOWN, 0, 0);
   1.493 -                   break;
   1.494 +                if ((keyEvent->key_cap == Pk_Down)
   1.495 +                    && (keyEvent->key_scan == 0)
   1.496 +                    && ((keyEvent->key_flags & Pk_KF_Scan_Valid) ==
   1.497 +                        Pk_KF_Scan_Valid)) {
   1.498 +                    posted =
   1.499 +                        SDL_PrivateMouseButton (SDL_RELEASED,
   1.500 +                                                SDL_BUTTON_WHEELDOWN, 0, 0);
   1.501 +                    break;
   1.502                  }
   1.503 -                posted = SDL_PrivateKeyboard(SDL_RELEASED, ph_TranslateKey( keyEvent, &keysym));
   1.504 +                posted =
   1.505 +                    SDL_PrivateKeyboard (SDL_RELEASED,
   1.506 +                                         ph_TranslateKey (keyEvent, &keysym));
   1.507              }
   1.508          }
   1.509          break;
   1.510 -        
   1.511 -        case Ph_EV_INFO:
   1.512 +
   1.513 +    case Ph_EV_INFO:
   1.514          {
   1.515 -           if (phevent->subtype==Ph_OFFSCREEN_INVALID)
   1.516 -           {
   1.517 -              unsigned long* EvInfoData;
   1.518 +            if (phevent->subtype == Ph_OFFSCREEN_INVALID) {
   1.519 +                unsigned long *EvInfoData;
   1.520  
   1.521 -              EvInfoData=(unsigned long*)PhGetData(phevent);
   1.522 +                EvInfoData = (unsigned long *) PhGetData (phevent);
   1.523  
   1.524 -              switch (*EvInfoData)
   1.525 -              {
   1.526 -                 case Pg_VIDEO_MODE_SWITCHED:
   1.527 -                      {
   1.528 -                      }
   1.529 -                      break;
   1.530 -                 case Pg_ENTERED_DIRECT:
   1.531 -                      {
   1.532 -                      }
   1.533 -                      break;
   1.534 -                 case Pg_EXITED_DIRECT:
   1.535 -                      {
   1.536 -                      }
   1.537 -                      break;
   1.538 -                 case Pg_DRIVER_STARTED:
   1.539 -                      {
   1.540 -                      }
   1.541 -                      break;
   1.542 -              }
   1.543 -           }
   1.544 +                switch (*EvInfoData) {
   1.545 +                case Pg_VIDEO_MODE_SWITCHED:
   1.546 +                    {
   1.547 +                    }
   1.548 +                    break;
   1.549 +                case Pg_ENTERED_DIRECT:
   1.550 +                    {
   1.551 +                    }
   1.552 +                    break;
   1.553 +                case Pg_EXITED_DIRECT:
   1.554 +                    {
   1.555 +                    }
   1.556 +                    break;
   1.557 +                case Pg_DRIVER_STARTED:
   1.558 +                    {
   1.559 +                    }
   1.560 +                    break;
   1.561 +                }
   1.562 +            }
   1.563          }
   1.564          break;
   1.565      }
   1.566  
   1.567 -    return(posted);
   1.568 +    return (posted);
   1.569  }
   1.570  
   1.571  /* perform a blocking read if no events available */
   1.572 -int ph_Pending(_THIS)
   1.573 +int
   1.574 +ph_Pending (_THIS)
   1.575  {
   1.576      /* Flush the display connection and look to see if events are queued */
   1.577 -    PgFlush();
   1.578 +    PgFlush ();
   1.579  
   1.580 -    while (1)
   1.581 -    {
   1.582 -        switch(PhEventPeek(phevent, EVENT_SIZE))
   1.583 -        {
   1.584 -            case Ph_EVENT_MSG:
   1.585 -                 return 1;
   1.586 -            case -1:
   1.587 -                 SDL_SetError("ph_Pending(): PhEventNext failed.\n");
   1.588 -                 return 0;
   1.589 -            default:
   1.590 -                 return 0;
   1.591 +    while (1) {
   1.592 +        switch (PhEventPeek (phevent, EVENT_SIZE)) {
   1.593 +        case Ph_EVENT_MSG:
   1.594 +            return 1;
   1.595 +        case -1:
   1.596 +            SDL_SetError ("ph_Pending(): PhEventNext failed.\n");
   1.597 +            return 0;
   1.598 +        default:
   1.599 +            return 0;
   1.600          }
   1.601      }
   1.602  
   1.603      /* Oh well, nothing is ready .. */
   1.604 -    return(0);
   1.605 +    return (0);
   1.606  }
   1.607  
   1.608 -void ph_PumpEvents(_THIS)
   1.609 +void
   1.610 +ph_PumpEvents (_THIS)
   1.611  {
   1.612      /* Flush the display connection and look to see if events are queued */
   1.613 -    PgFlush();
   1.614 +    PgFlush ();
   1.615  
   1.616 -    while (ph_Pending(this))
   1.617 -    {
   1.618 -        PtEventHandler(phevent);
   1.619 -        ph_DispatchEvent(this);
   1.620 +    while (ph_Pending (this)) {
   1.621 +        PtEventHandler (phevent);
   1.622 +        ph_DispatchEvent (this);
   1.623      }
   1.624  }
   1.625  
   1.626 -void ph_InitKeymap(void)
   1.627 +void
   1.628 +ph_InitKeymap (void)
   1.629  {
   1.630      int i;
   1.631  
   1.632      /* Odd keys used in international keyboards */
   1.633 -    for (i=0; i<SDL_arraysize(ODD_keymap); ++i)
   1.634 -    {
   1.635 +    for (i = 0; i < SDL_arraysize (ODD_keymap); ++i) {
   1.636          ODD_keymap[i] = SDLK_UNKNOWN;
   1.637      }
   1.638  
   1.639      /* Map the miscellaneous keys */
   1.640 -    for (i=0; i<SDL_arraysize(MISC_keymap); ++i)
   1.641 -    {
   1.642 +    for (i = 0; i < SDL_arraysize (MISC_keymap); ++i) {
   1.643          MISC_keymap[i] = SDLK_UNKNOWN;
   1.644      }
   1.645  
   1.646 -    MISC_keymap[Pk_BackSpace&0xFF] = SDLK_BACKSPACE;
   1.647 -    MISC_keymap[Pk_Tab&0xFF] = SDLK_TAB;
   1.648 -    MISC_keymap[Pk_Clear&0xFF] = SDLK_CLEAR;
   1.649 -    MISC_keymap[Pk_Return&0xFF] = SDLK_RETURN;
   1.650 -    MISC_keymap[Pk_Pause&0xFF] = SDLK_PAUSE;
   1.651 -    MISC_keymap[Pk_Escape&0xFF] = SDLK_ESCAPE;
   1.652 -    MISC_keymap[Pk_Delete&0xFF] = SDLK_DELETE;
   1.653 +    MISC_keymap[Pk_BackSpace & 0xFF] = SDLK_BACKSPACE;
   1.654 +    MISC_keymap[Pk_Tab & 0xFF] = SDLK_TAB;
   1.655 +    MISC_keymap[Pk_Clear & 0xFF] = SDLK_CLEAR;
   1.656 +    MISC_keymap[Pk_Return & 0xFF] = SDLK_RETURN;
   1.657 +    MISC_keymap[Pk_Pause & 0xFF] = SDLK_PAUSE;
   1.658 +    MISC_keymap[Pk_Escape & 0xFF] = SDLK_ESCAPE;
   1.659 +    MISC_keymap[Pk_Delete & 0xFF] = SDLK_DELETE;
   1.660  
   1.661 -    MISC_keymap[Pk_KP_0&0xFF] = SDLK_KP0;
   1.662 -    MISC_keymap[Pk_KP_1&0xFF] = SDLK_KP1;
   1.663 -    MISC_keymap[Pk_KP_2&0xFF] = SDLK_KP2;
   1.664 -    MISC_keymap[Pk_KP_3&0xFF] = SDLK_KP3;
   1.665 -    MISC_keymap[Pk_KP_4&0xFF] = SDLK_KP4;
   1.666 -    MISC_keymap[Pk_KP_5&0xFF] = SDLK_KP5;
   1.667 -    MISC_keymap[Pk_KP_6&0xFF] = SDLK_KP6;
   1.668 -    MISC_keymap[Pk_KP_7&0xFF] = SDLK_KP7;
   1.669 -    MISC_keymap[Pk_KP_8&0xFF] = SDLK_KP8;
   1.670 -    MISC_keymap[Pk_KP_9&0xFF] = SDLK_KP9;
   1.671 +    MISC_keymap[Pk_KP_0 & 0xFF] = SDLK_KP0;
   1.672 +    MISC_keymap[Pk_KP_1 & 0xFF] = SDLK_KP1;
   1.673 +    MISC_keymap[Pk_KP_2 & 0xFF] = SDLK_KP2;
   1.674 +    MISC_keymap[Pk_KP_3 & 0xFF] = SDLK_KP3;
   1.675 +    MISC_keymap[Pk_KP_4 & 0xFF] = SDLK_KP4;
   1.676 +    MISC_keymap[Pk_KP_5 & 0xFF] = SDLK_KP5;
   1.677 +    MISC_keymap[Pk_KP_6 & 0xFF] = SDLK_KP6;
   1.678 +    MISC_keymap[Pk_KP_7 & 0xFF] = SDLK_KP7;
   1.679 +    MISC_keymap[Pk_KP_8 & 0xFF] = SDLK_KP8;
   1.680 +    MISC_keymap[Pk_KP_9 & 0xFF] = SDLK_KP9;
   1.681  
   1.682 -    MISC_keymap[Pk_KP_Decimal&0xFF] = SDLK_KP_PERIOD;
   1.683 -    MISC_keymap[Pk_KP_Divide&0xFF] = SDLK_KP_DIVIDE;
   1.684 -    MISC_keymap[Pk_KP_Multiply&0xFF] = SDLK_KP_MULTIPLY;
   1.685 -    MISC_keymap[Pk_KP_Subtract&0xFF] = SDLK_KP_MINUS;
   1.686 -    MISC_keymap[Pk_KP_Add&0xFF] = SDLK_KP_PLUS;
   1.687 -    MISC_keymap[Pk_KP_Enter&0xFF] = SDLK_KP_ENTER;
   1.688 -    MISC_keymap[Pk_KP_Equal&0xFF] = SDLK_KP_EQUALS;
   1.689 +    MISC_keymap[Pk_KP_Decimal & 0xFF] = SDLK_KP_PERIOD;
   1.690 +    MISC_keymap[Pk_KP_Divide & 0xFF] = SDLK_KP_DIVIDE;
   1.691 +    MISC_keymap[Pk_KP_Multiply & 0xFF] = SDLK_KP_MULTIPLY;
   1.692 +    MISC_keymap[Pk_KP_Subtract & 0xFF] = SDLK_KP_MINUS;
   1.693 +    MISC_keymap[Pk_KP_Add & 0xFF] = SDLK_KP_PLUS;
   1.694 +    MISC_keymap[Pk_KP_Enter & 0xFF] = SDLK_KP_ENTER;
   1.695 +    MISC_keymap[Pk_KP_Equal & 0xFF] = SDLK_KP_EQUALS;
   1.696  
   1.697 -    MISC_keymap[Pk_Up&0xFF] = SDLK_UP;
   1.698 -    MISC_keymap[Pk_Down&0xFF] = SDLK_DOWN;
   1.699 -    MISC_keymap[Pk_Right&0xFF] = SDLK_RIGHT;
   1.700 -    MISC_keymap[Pk_Left&0xFF] = SDLK_LEFT;
   1.701 -    MISC_keymap[Pk_Insert&0xFF] = SDLK_INSERT;
   1.702 -    MISC_keymap[Pk_Home&0xFF] = SDLK_HOME;
   1.703 -    MISC_keymap[Pk_End&0xFF] = SDLK_END;
   1.704 -    MISC_keymap[Pk_Pg_Up&0xFF] = SDLK_PAGEUP;
   1.705 -    MISC_keymap[Pk_Pg_Down&0xFF] = SDLK_PAGEDOWN;
   1.706 +    MISC_keymap[Pk_Up & 0xFF] = SDLK_UP;
   1.707 +    MISC_keymap[Pk_Down & 0xFF] = SDLK_DOWN;
   1.708 +    MISC_keymap[Pk_Right & 0xFF] = SDLK_RIGHT;
   1.709 +    MISC_keymap[Pk_Left & 0xFF] = SDLK_LEFT;
   1.710 +    MISC_keymap[Pk_Insert & 0xFF] = SDLK_INSERT;
   1.711 +    MISC_keymap[Pk_Home & 0xFF] = SDLK_HOME;
   1.712 +    MISC_keymap[Pk_End & 0xFF] = SDLK_END;
   1.713 +    MISC_keymap[Pk_Pg_Up & 0xFF] = SDLK_PAGEUP;
   1.714 +    MISC_keymap[Pk_Pg_Down & 0xFF] = SDLK_PAGEDOWN;
   1.715  
   1.716 -    MISC_keymap[Pk_F1&0xFF] = SDLK_F1;
   1.717 -    MISC_keymap[Pk_F2&0xFF] = SDLK_F2;
   1.718 -    MISC_keymap[Pk_F3&0xFF] = SDLK_F3;
   1.719 -    MISC_keymap[Pk_F4&0xFF] = SDLK_F4;
   1.720 -    MISC_keymap[Pk_F5&0xFF] = SDLK_F5;
   1.721 -    MISC_keymap[Pk_F6&0xFF] = SDLK_F6;
   1.722 -    MISC_keymap[Pk_F7&0xFF] = SDLK_F7;
   1.723 -    MISC_keymap[Pk_F8&0xFF] = SDLK_F8;
   1.724 -    MISC_keymap[Pk_F9&0xFF] = SDLK_F9;
   1.725 -    MISC_keymap[Pk_F10&0xFF] = SDLK_F10;
   1.726 -    MISC_keymap[Pk_F11&0xFF] = SDLK_F11;
   1.727 -    MISC_keymap[Pk_F12&0xFF] = SDLK_F12;
   1.728 -    MISC_keymap[Pk_F13&0xFF] = SDLK_F13;
   1.729 -    MISC_keymap[Pk_F14&0xFF] = SDLK_F14;
   1.730 -    MISC_keymap[Pk_F15&0xFF] = SDLK_F15;
   1.731 +    MISC_keymap[Pk_F1 & 0xFF] = SDLK_F1;
   1.732 +    MISC_keymap[Pk_F2 & 0xFF] = SDLK_F2;
   1.733 +    MISC_keymap[Pk_F3 & 0xFF] = SDLK_F3;
   1.734 +    MISC_keymap[Pk_F4 & 0xFF] = SDLK_F4;
   1.735 +    MISC_keymap[Pk_F5 & 0xFF] = SDLK_F5;
   1.736 +    MISC_keymap[Pk_F6 & 0xFF] = SDLK_F6;
   1.737 +    MISC_keymap[Pk_F7 & 0xFF] = SDLK_F7;
   1.738 +    MISC_keymap[Pk_F8 & 0xFF] = SDLK_F8;
   1.739 +    MISC_keymap[Pk_F9 & 0xFF] = SDLK_F9;
   1.740 +    MISC_keymap[Pk_F10 & 0xFF] = SDLK_F10;
   1.741 +    MISC_keymap[Pk_F11 & 0xFF] = SDLK_F11;
   1.742 +    MISC_keymap[Pk_F12 & 0xFF] = SDLK_F12;
   1.743 +    MISC_keymap[Pk_F13 & 0xFF] = SDLK_F13;
   1.744 +    MISC_keymap[Pk_F14 & 0xFF] = SDLK_F14;
   1.745 +    MISC_keymap[Pk_F15 & 0xFF] = SDLK_F15;
   1.746  
   1.747 -    MISC_keymap[Pk_Num_Lock&0xFF] = SDLK_NUMLOCK;
   1.748 -    MISC_keymap[Pk_Caps_Lock&0xFF] = SDLK_CAPSLOCK;
   1.749 -    MISC_keymap[Pk_Scroll_Lock&0xFF] = SDLK_SCROLLOCK;
   1.750 -    MISC_keymap[Pk_Shift_R&0xFF] = SDLK_RSHIFT;
   1.751 -    MISC_keymap[Pk_Shift_L&0xFF] = SDLK_LSHIFT;
   1.752 -    MISC_keymap[Pk_Control_R&0xFF] = SDLK_RCTRL;
   1.753 -    MISC_keymap[Pk_Control_L&0xFF] = SDLK_LCTRL;
   1.754 -    MISC_keymap[Pk_Alt_R&0xFF] = SDLK_RALT;
   1.755 -    MISC_keymap[Pk_Alt_L&0xFF] = SDLK_LALT;
   1.756 -    MISC_keymap[Pk_Meta_R&0xFF] = SDLK_RMETA;
   1.757 -    MISC_keymap[Pk_Meta_L&0xFF] = SDLK_LMETA;
   1.758 -    MISC_keymap[Pk_Super_L&0xFF] = SDLK_LSUPER;
   1.759 -    MISC_keymap[Pk_Super_R&0xFF] = SDLK_RSUPER;
   1.760 -    MISC_keymap[Pk_Mode_switch&0xFF] = SDLK_MODE; /* "Alt Gr" key    */
   1.761 +    MISC_keymap[Pk_Num_Lock & 0xFF] = SDLK_NUMLOCK;
   1.762 +    MISC_keymap[Pk_Caps_Lock & 0xFF] = SDLK_CAPSLOCK;
   1.763 +    MISC_keymap[Pk_Scroll_Lock & 0xFF] = SDLK_SCROLLOCK;
   1.764 +    MISC_keymap[Pk_Shift_R & 0xFF] = SDLK_RSHIFT;
   1.765 +    MISC_keymap[Pk_Shift_L & 0xFF] = SDLK_LSHIFT;
   1.766 +    MISC_keymap[Pk_Control_R & 0xFF] = SDLK_RCTRL;
   1.767 +    MISC_keymap[Pk_Control_L & 0xFF] = SDLK_LCTRL;
   1.768 +    MISC_keymap[Pk_Alt_R & 0xFF] = SDLK_RALT;
   1.769 +    MISC_keymap[Pk_Alt_L & 0xFF] = SDLK_LALT;
   1.770 +    MISC_keymap[Pk_Meta_R & 0xFF] = SDLK_RMETA;
   1.771 +    MISC_keymap[Pk_Meta_L & 0xFF] = SDLK_LMETA;
   1.772 +    MISC_keymap[Pk_Super_L & 0xFF] = SDLK_LSUPER;
   1.773 +    MISC_keymap[Pk_Super_R & 0xFF] = SDLK_RSUPER;
   1.774 +    MISC_keymap[Pk_Mode_switch & 0xFF] = SDLK_MODE;     /* "Alt Gr" key    */
   1.775  
   1.776 -    MISC_keymap[Pk_Help&0xFF] = SDLK_HELP;
   1.777 -    MISC_keymap[Pk_Print&0xFF] = SDLK_PRINT;
   1.778 -    MISC_keymap[Pk_Break&0xFF] = SDLK_BREAK;
   1.779 -    MISC_keymap[Pk_Menu&0xFF] = SDLK_MENU;        /* Windows "Menu" key */
   1.780 +    MISC_keymap[Pk_Help & 0xFF] = SDLK_HELP;
   1.781 +    MISC_keymap[Pk_Print & 0xFF] = SDLK_PRINT;
   1.782 +    MISC_keymap[Pk_Break & 0xFF] = SDLK_BREAK;
   1.783 +    MISC_keymap[Pk_Menu & 0xFF] = SDLK_MENU;    /* Windows "Menu" key */
   1.784  
   1.785 -    MISC_keymap[Pk_Hyper_R&0xFF] = SDLK_RSUPER;   /* Right "Windows" */
   1.786 +    MISC_keymap[Pk_Hyper_R & 0xFF] = SDLK_RSUPER;       /* Right "Windows" */
   1.787  
   1.788      /* Left "Windows" key, but it can't be catched by application */
   1.789 -    MISC_keymap[Pk_Hyper_L&0xFF] = SDLK_LSUPER;
   1.790 +    MISC_keymap[Pk_Hyper_L & 0xFF] = SDLK_LSUPER;
   1.791  }
   1.792  
   1.793  static unsigned long cap;
   1.794  
   1.795 -SDL_keysym *ph_TranslateKey(PhKeyEvent_t *key, SDL_keysym *keysym)
   1.796 +SDL_keysym *
   1.797 +ph_TranslateKey (PhKeyEvent_t * key, SDL_keysym * keysym)
   1.798  {
   1.799      /* 'sym' is set to the value of the key with modifiers applied to it.
   1.800         This member is valid only if Pk_KF_Sym_Valid is set in the key_flags.
   1.801 @@ -553,64 +553,62 @@
   1.802  
   1.803      cap = key->key_cap;
   1.804  
   1.805 -    switch (cap>>8)
   1.806 -    {
   1.807 -        case 0x00:  /* Latin 1 */
   1.808 -        case 0x01:  /* Latin 2 */
   1.809 -        case 0x02:  /* Latin 3 */
   1.810 -        case 0x03:  /* Latin 4 */
   1.811 -        case 0x04:  /* Katakana */
   1.812 -        case 0x05:  /* Arabic */
   1.813 -        case 0x06:  /* Cyrillic */
   1.814 -        case 0x07:  /* Greek */
   1.815 -        case 0x08:  /* Technical */
   1.816 -        case 0x0A:  /* Publishing */
   1.817 -        case 0x0C:  /* Hebrew */
   1.818 -        case 0x0D:  /* Thai */
   1.819 -                   keysym->sym = (SDLKey)(cap&0xFF);
   1.820 -                   /* Map capital letter syms to lowercase */
   1.821 -                   if ((keysym->sym >= 'A')&&(keysym->sym <= 'Z'))
   1.822 -                       keysym->sym += ('a'-'A');
   1.823 -                   break;
   1.824 -        case 0xF0:
   1.825 -                   keysym->sym = MISC_keymap[cap&0xFF];
   1.826 -                   break;
   1.827 -        default:
   1.828 -                   keysym->sym = SDLK_UNKNOWN;                
   1.829 -                   break;
   1.830 +    switch (cap >> 8) {
   1.831 +    case 0x00:                 /* Latin 1 */
   1.832 +    case 0x01:                 /* Latin 2 */
   1.833 +    case 0x02:                 /* Latin 3 */
   1.834 +    case 0x03:                 /* Latin 4 */
   1.835 +    case 0x04:                 /* Katakana */
   1.836 +    case 0x05:                 /* Arabic */
   1.837 +    case 0x06:                 /* Cyrillic */
   1.838 +    case 0x07:                 /* Greek */
   1.839 +    case 0x08:                 /* Technical */
   1.840 +    case 0x0A:                 /* Publishing */
   1.841 +    case 0x0C:                 /* Hebrew */
   1.842 +    case 0x0D:                 /* Thai */
   1.843 +        keysym->sym = (SDLKey) (cap & 0xFF);
   1.844 +        /* Map capital letter syms to lowercase */
   1.845 +        if ((keysym->sym >= 'A') && (keysym->sym <= 'Z'))
   1.846 +            keysym->sym += ('a' - 'A');
   1.847 +        break;
   1.848 +    case 0xF0:
   1.849 +        keysym->sym = MISC_keymap[cap & 0xFF];
   1.850 +        break;
   1.851 +    default:
   1.852 +        keysym->sym = SDLK_UNKNOWN;
   1.853 +        break;
   1.854      }
   1.855  
   1.856      keysym->scancode = key->key_scan;
   1.857      keysym->unicode = 0;
   1.858  
   1.859 -    if (SDL_TranslateUNICODE)
   1.860 -    {
   1.861 +    if (SDL_TranslateUNICODE) {
   1.862          char utf8[MB_CUR_MAX];
   1.863          int utf8len;
   1.864          wchar_t unicode;
   1.865  
   1.866 -        switch (keysym->scancode)
   1.867 -        {
   1.868 -           /* Esc key */
   1.869 -           case 0x01: keysym->unicode = 27;
   1.870 -                      break;
   1.871 -           /* BackSpace key */
   1.872 -           case 0x0E: keysym->unicode = 127;
   1.873 -                      break;
   1.874 -           /* Enter key */
   1.875 -           case 0x1C: keysym->unicode = 10;
   1.876 -                      break;
   1.877 -           default:
   1.878 -                      utf8len = PhKeyToMb(utf8, key);
   1.879 -                      if (utf8len > 0)
   1.880 -                      {
   1.881 -                         utf8len = mbtowc(&unicode, utf8, utf8len);
   1.882 -                         if (utf8len > 0)
   1.883 -                         {
   1.884 -                             keysym->unicode = unicode;
   1.885 -                         }
   1.886 -                      }
   1.887 -                      break;
   1.888 +        switch (keysym->scancode) {
   1.889 +            /* Esc key */
   1.890 +        case 0x01:
   1.891 +            keysym->unicode = 27;
   1.892 +            break;
   1.893 +            /* BackSpace key */
   1.894 +        case 0x0E:
   1.895 +            keysym->unicode = 127;
   1.896 +            break;
   1.897 +            /* Enter key */
   1.898 +        case 0x1C:
   1.899 +            keysym->unicode = 10;
   1.900 +            break;
   1.901 +        default:
   1.902 +            utf8len = PhKeyToMb (utf8, key);
   1.903 +            if (utf8len > 0) {
   1.904 +                utf8len = mbtowc (&unicode, utf8, utf8len);
   1.905 +                if (utf8len > 0) {
   1.906 +                    keysym->unicode = unicode;
   1.907 +                }
   1.908 +            }
   1.909 +            break;
   1.910          }
   1.911  
   1.912      }
   1.913 @@ -618,7 +616,10 @@
   1.914      return (keysym);
   1.915  }
   1.916  
   1.917 -void ph_InitOSKeymap(_THIS)
   1.918 +void
   1.919 +ph_InitOSKeymap (_THIS)
   1.920  {
   1.921 -    ph_InitKeymap();
   1.922 +    ph_InitKeymap ();
   1.923  }
   1.924 +
   1.925 +/* vi: set ts=4 sw=4 expandtab: */