src/video/gem/SDL_gemevents.c
changeset 2189 f54670a477bb
parent 2186 6fe43f7efd94
child 2199 7e1caa8452f3
     1.1 --- a/src/video/gem/SDL_gemevents.c	Fri Jul 13 22:52:53 2007 +0000
     1.2 +++ b/src/video/gem/SDL_gemevents.c	Fri Jul 13 22:55:15 2007 +0000
     1.3 @@ -32,10 +32,9 @@
     1.4  
     1.5  #include <gem.h>
     1.6  
     1.7 -#include "../../events/SDL_sysevents.h"
     1.8 +#include "SDL_gemvideo.h"
     1.9 +#include "SDL_gemevents.h"
    1.10  #include "../../events/SDL_events_c.h"
    1.11 -#include "SDL_gemvideo.h"
    1.12 -#include "SDL_gemevents_c.h"
    1.13  #include "../ataricommon/SDL_atarikeys.h"       /* for keyboard scancodes */
    1.14  #include "../ataricommon/SDL_atarievents_c.h"
    1.15  #include "../ataricommon/SDL_xbiosevents_c.h"
    1.16 @@ -55,20 +54,9 @@
    1.17  /* Functions */
    1.18  
    1.19  void
    1.20 -GEM_InitOSKeymap(_THIS)
    1.21 -{
    1.22 -    SDL_memset(gem_currentkeyboard, 0, sizeof(gem_currentkeyboard));
    1.23 -    SDL_memset(gem_previouskeyboard, 0, sizeof(gem_previouskeyboard));
    1.24 -
    1.25 -    /* Mouse init */
    1.26 -    GEM_mouse_relative = SDL_FALSE;
    1.27 -
    1.28 -    SDL_Atari_InitInternalKeymap(this);
    1.29 -}
    1.30 -
    1.31 -void
    1.32  GEM_PumpEvents(_THIS)
    1.33  {
    1.34 +#if 0
    1.35      short mousex, mousey, mouseb, dummy;
    1.36      short kstate, prevkc, prevks;
    1.37      int i;
    1.38 @@ -88,11 +76,8 @@
    1.39          if (!GEM_fullscreen && (GEM_handle >= 0)) {
    1.40              wind_get(GEM_handle, WF_WORKXYWH, &x2, &y2, &w2, &h2);
    1.41              event_mask |= MU_M1;
    1.42 -            if ((SDL_GetAppState() & SDL_APPMOUSEFOCUS)) {
    1.43 -                mouse_event = MO_LEAVE;
    1.44 -            } else {
    1.45 -                mouse_event = MO_ENTER;
    1.46 -            }
    1.47 +            mouse_event = ((SDL_GetAppState() & SDL_APPMOUSEFOCUS) ==
    1.48 +                SDL_APPMOUSEFOCUS) ? MO_LEAVE : MO_ENTER;
    1.49          }
    1.50  
    1.51          resultat = evnt_multi(event_mask,
    1.52 @@ -120,12 +105,11 @@
    1.53          /* Mouse entering/leaving window */
    1.54          if (resultat & MU_M1) {
    1.55              if (this->input_grab == SDL_GRAB_OFF) {
    1.56 -                if (SDL_GetAppState() & SDL_APPMOUSEFOCUS) {
    1.57 -                    SDL_PrivateAppActive(0, SDL_APPMOUSEFOCUS);
    1.58 -                } else {
    1.59 -                    SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS);
    1.60 -                }
    1.61 +                /* Switch mouse focus state */
    1.62 +                SDL_PrivateAppActive((mouse_event == MO_ENTER),
    1.63 +                    SDL_APPMOUSEFOCUS);
    1.64              }
    1.65 +            GEM_CheckMouseMode(this);
    1.66          }
    1.67  
    1.68          /* Timer event ? */
    1.69 @@ -165,15 +149,17 @@
    1.70          }
    1.71          GEM_refresh_name = SDL_FALSE;
    1.72      }
    1.73 +#endif
    1.74  }
    1.75  
    1.76  static int
    1.77  do_messages(_THIS, short *message)
    1.78  {
    1.79 -    int quit, posted;
    1.80 +#if 0
    1.81 +    int quit, posted, check_mouse_mode;
    1.82      short x2, y2, w2, h2;
    1.83  
    1.84 -    quit = 0;
    1.85 +    quit = check_mouse_mode = 0;
    1.86      switch (message[0]) {
    1.87      case WM_CLOSED:
    1.88      case AP_TERM:
    1.89 @@ -192,6 +178,7 @@
    1.90          if (VDI_setpalette) {
    1.91              VDI_setpalette(this, VDI_curpalette);
    1.92          }
    1.93 +        check_mouse_mode = 1;
    1.94          break;
    1.95      case WM_REDRAW:
    1.96          if (!GEM_lock_redraw) {
    1.97 @@ -215,6 +202,7 @@
    1.98                       0, 0);
    1.99              GEM_refresh_name = SDL_FALSE;
   1.100          }
   1.101 +        check_mouse_mode = 1;
   1.102          break;
   1.103      case WM_UNICONIFY:
   1.104          wind_set(message[3], WF_UNICONIFY, message[4], message[5],
   1.105 @@ -231,6 +219,7 @@
   1.106                       0, 0);
   1.107              GEM_refresh_name = SDL_FALSE;
   1.108          }
   1.109 +        check_mouse_mode = 1;
   1.110          break;
   1.111      case WM_SIZED:
   1.112          wind_set(message[3], WF_CURRXYWH, message[4], message[5],
   1.113 @@ -268,15 +257,24 @@
   1.114          if (VDI_setpalette) {
   1.115              VDI_setpalette(this, VDI_oldpalette);
   1.116          }
   1.117 +        check_mouse_mode = 1;
   1.118          break;
   1.119      }
   1.120  
   1.121 +    if (check_mouse_mode) {
   1.122 +        GEM_CheckMouseMode(this);
   1.123 +    }
   1.124 +
   1.125      return quit;
   1.126 +#else
   1.127 +    return 0;
   1.128 +#endif
   1.129  }
   1.130  
   1.131  static void
   1.132  do_keyboard(short kc, short ks)
   1.133  {
   1.134 +#if 0
   1.135      int scancode, asciicode;
   1.136  
   1.137      if (kc) {
   1.138 @@ -293,11 +291,13 @@
   1.139          gem_currentkeyboard[SCANCODE_LEFTCONTROL] = 0xFF;
   1.140      if (ks & K_ALT)
   1.141          gem_currentkeyboard[SCANCODE_LEFTALT] = 0xFF;
   1.142 +#endif
   1.143  }
   1.144  
   1.145  static void
   1.146  do_mouse(_THIS, short mx, short my, short mb, short ks)
   1.147  {
   1.148 +#if 0
   1.149      static short prevmousex = 0, prevmousey = 0, prevmouseb = 0;
   1.150      short x2, y2, w2, h2;
   1.151  
   1.152 @@ -377,6 +377,7 @@
   1.153          gem_currentkeyboard[SCANCODE_LEFTCONTROL] = 0xFF;
   1.154      if (ks & K_ALT)
   1.155          gem_currentkeyboard[SCANCODE_LEFTALT] = 0xFF;
   1.156 +#endif
   1.157  }
   1.158  
   1.159  /* vi: set ts=4 sw=4 expandtab: */