src/video/wincommon/SDL_sysevents.c
branchSDL-1.3
changeset 1668 4da1ee79c9af
parent 1662 782fd950bd46
     1.1 --- a/src/video/wincommon/SDL_sysevents.c	Mon May 29 03:53:21 2006 +0000
     1.2 +++ b/src/video/wincommon/SDL_sysevents.c	Mon May 29 04:04:35 2006 +0000
     1.3 @@ -72,20 +72,20 @@
     1.4  
     1.5  
     1.6  /* Functions called by the message processing function */
     1.7 -LONG (*HandleMessage) (_THIS, HWND hwnd, UINT msg, WPARAM wParam,
     1.8 -                       LPARAM lParam) = NULL;
     1.9 +LONG(*HandleMessage) (_THIS, HWND hwnd, UINT msg, WPARAM wParam,
    1.10 +                      LPARAM lParam) = NULL;
    1.11  void (*WIN_RealizePalette) (_THIS);
    1.12  void (*WIN_PaletteChanged) (_THIS, HWND window);
    1.13  void (*WIN_WinPAINT) (_THIS, HDC hdc);
    1.14 -extern void DIB_SwapGamma (_THIS);
    1.15 +extern void DIB_SwapGamma(_THIS);
    1.16  
    1.17  #ifndef NO_GETKEYBOARDSTATE
    1.18  /* Variables and support functions for SDL_ToUnicode() */
    1.19  static int codepage;
    1.20 -static int Is9xME ();
    1.21 -static int GetCodePage ();
    1.22 -static int WINAPI ToUnicode9xME (UINT vkey, UINT scancode, BYTE * keystate,
    1.23 -                                 LPWSTR wchars, int wsize, UINT flags);
    1.24 +static int Is9xME();
    1.25 +static int GetCodePage();
    1.26 +static int WINAPI ToUnicode9xME(UINT vkey, UINT scancode, BYTE * keystate,
    1.27 +                                LPWSTR wchars, int wsize, UINT flags);
    1.28  
    1.29  ToUnicodeFN SDL_ToUnicode = ToUnicode9xME;
    1.30  #endif /* !NO_GETKEYBOARDSTATE */
    1.31 @@ -95,7 +95,7 @@
    1.32  
    1.33  // dynamically load aygshell dll because we want SDL to work on HPC and be300
    1.34  HINSTANCE aygshell = NULL;
    1.35 -BOOL (WINAPI * SHFullScreen) (HWND hwndRequester, DWORD dwState) = 0;
    1.36 +BOOL(WINAPI * SHFullScreen) (HWND hwndRequester, DWORD dwState) = 0;
    1.37  
    1.38  #define SHFS_SHOWTASKBAR            0x0001
    1.39  #define SHFS_HIDETASKBAR            0x0002
    1.40 @@ -105,20 +105,20 @@
    1.41  #define SHFS_HIDESTARTICON          0x0020
    1.42  
    1.43  static void
    1.44 -LoadAygshell (void)
    1.45 +LoadAygshell(void)
    1.46  {
    1.47      if (!aygshell)
    1.48 -        aygshell = SDL_LoadObject ("aygshell.dll");
    1.49 +        aygshell = SDL_LoadObject("aygshell.dll");
    1.50      if ((aygshell != 0) && (SHFullScreen == 0)) {
    1.51          SHFullScreen = (int (WINAPI *) (struct HWND__ *, unsigned long))
    1.52 -            SDL_LoadFunction (aygshell, "SHFullScreen");
    1.53 +            SDL_LoadFunction(aygshell, "SHFullScreen");
    1.54      }
    1.55  }
    1.56  
    1.57  /* for gapi landscape mode */
    1.58  static void
    1.59 -GapiTransform (SDL_ScreenOrientation rotate, char hires, Sint16 * x,
    1.60 -               Sint16 * y)
    1.61 +GapiTransform(SDL_ScreenOrientation rotate, char hires, Sint16 * x,
    1.62 +              Sint16 * y)
    1.63  {
    1.64      Sint16 rotatedX;
    1.65      Sint16 rotatedY;
    1.66 @@ -181,56 +181,56 @@
    1.67     about
    1.68  */
    1.69  void
    1.70 -WIN_FlushMessageQueue ()
    1.71 +WIN_FlushMessageQueue()
    1.72  {
    1.73      MSG msg;
    1.74 -    while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE)) {
    1.75 +    while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
    1.76          if (msg.message == WM_QUIT)
    1.77              break;
    1.78 -        TranslateMessage (&msg);
    1.79 -        DispatchMessage (&msg);
    1.80 +        TranslateMessage(&msg);
    1.81 +        DispatchMessage(&msg);
    1.82      }
    1.83  }
    1.84  
    1.85  static void
    1.86 -SDL_RestoreGameMode (void)
    1.87 +SDL_RestoreGameMode(void)
    1.88  {
    1.89  #ifdef _WIN32_WCE
    1.90      SDL_VideoDevice *this = current_video;
    1.91 -    if (SDL_strcmp (this->name, "gapi") == 0) {
    1.92 +    if (SDL_strcmp(this->name, "gapi") == 0) {
    1.93          if (this->hidden->suspended) {
    1.94              this->hidden->suspended = 0;
    1.95          }
    1.96      }
    1.97  #else
    1.98 -    ShowWindow (SDL_Window, SW_RESTORE);
    1.99 +    ShowWindow(SDL_Window, SW_RESTORE);
   1.100  #endif
   1.101  
   1.102  #ifndef NO_CHANGEDISPLAYSETTINGS
   1.103  #ifndef _WIN32_WCE
   1.104 -    ChangeDisplaySettings (&SDL_fullscreen_mode, CDS_FULLSCREEN);
   1.105 +    ChangeDisplaySettings(&SDL_fullscreen_mode, CDS_FULLSCREEN);
   1.106  #endif
   1.107  #endif /* NO_CHANGEDISPLAYSETTINGS */
   1.108  }
   1.109  static void
   1.110 -SDL_RestoreDesktopMode (void)
   1.111 +SDL_RestoreDesktopMode(void)
   1.112  {
   1.113  
   1.114  #ifdef _WIN32_WCE
   1.115      SDL_VideoDevice *this = current_video;
   1.116 -    if (SDL_strcmp (this->name, "gapi") == 0) {
   1.117 +    if (SDL_strcmp(this->name, "gapi") == 0) {
   1.118          if (!this->hidden->suspended) {
   1.119              this->hidden->suspended = 1;
   1.120          }
   1.121      }
   1.122  #else
   1.123      /* WinCE does not have a taskbar, so minimizing is not convenient */
   1.124 -    ShowWindow (SDL_Window, SW_MINIMIZE);
   1.125 +    ShowWindow(SDL_Window, SW_MINIMIZE);
   1.126  #endif
   1.127  
   1.128  #ifndef NO_CHANGEDISPLAYSETTINGS
   1.129  #ifndef _WIN32_WCE
   1.130 -    ChangeDisplaySettings (NULL, 0);
   1.131 +    ChangeDisplaySettings(NULL, 0);
   1.132  #endif
   1.133  #endif /* NO_CHANGEDISPLAYSETTINGS */
   1.134  }
   1.135 @@ -247,30 +247,30 @@
   1.136     Therefore, we implement our own version of _TrackMouseEvent() which
   1.137     uses our own implementation if TrackMouseEvent() is not available.
   1.138  */
   1.139 -static BOOL (WINAPI * _TrackMouseEvent) (TRACKMOUSEEVENT * ptme) = NULL;
   1.140 +static BOOL(WINAPI * _TrackMouseEvent) (TRACKMOUSEEVENT * ptme) = NULL;
   1.141  
   1.142  static VOID CALLBACK
   1.143 -TrackMouseTimerProc (HWND hWnd, UINT uMsg, UINT idEvent, DWORD dwTime)
   1.144 +TrackMouseTimerProc(HWND hWnd, UINT uMsg, UINT idEvent, DWORD dwTime)
   1.145  {
   1.146      RECT rect;
   1.147      POINT pt;
   1.148  
   1.149 -    GetClientRect (hWnd, &rect);
   1.150 -    MapWindowPoints (hWnd, NULL, (LPPOINT) & rect, 2);
   1.151 -    GetCursorPos (&pt);
   1.152 -    if (!PtInRect (&rect, pt) || (WindowFromPoint (pt) != hWnd)) {
   1.153 -        if (!KillTimer (hWnd, idEvent)) {
   1.154 +    GetClientRect(hWnd, &rect);
   1.155 +    MapWindowPoints(hWnd, NULL, (LPPOINT) & rect, 2);
   1.156 +    GetCursorPos(&pt);
   1.157 +    if (!PtInRect(&rect, pt) || (WindowFromPoint(pt) != hWnd)) {
   1.158 +        if (!KillTimer(hWnd, idEvent)) {
   1.159              /* Error killing the timer! */
   1.160          }
   1.161 -        PostMessage (hWnd, WM_MOUSELEAVE, 0, 0);
   1.162 +        PostMessage(hWnd, WM_MOUSELEAVE, 0, 0);
   1.163      }
   1.164  }
   1.165  static BOOL WINAPI
   1.166 -WIN_TrackMouseEvent (TRACKMOUSEEVENT * ptme)
   1.167 +WIN_TrackMouseEvent(TRACKMOUSEEVENT * ptme)
   1.168  {
   1.169      if (ptme->dwFlags == TME_LEAVE) {
   1.170 -        return SetTimer (ptme->hwndTrack, ptme->dwFlags, 100,
   1.171 -                         (TIMERPROC) TrackMouseTimerProc) != 0;
   1.172 +        return SetTimer(ptme->hwndTrack, ptme->dwFlags, 100,
   1.173 +                        (TIMERPROC) TrackMouseTimerProc) != 0;
   1.174      }
   1.175      return FALSE;
   1.176  }
   1.177 @@ -278,15 +278,15 @@
   1.178  
   1.179  /* Function to retrieve the current keyboard modifiers */
   1.180  static void
   1.181 -WIN_GetKeyboardState (void)
   1.182 +WIN_GetKeyboardState(void)
   1.183  {
   1.184  #ifndef NO_GETKEYBOARDSTATE
   1.185      SDLMod state;
   1.186      BYTE keyboard[256];
   1.187 -    Uint8 *kstate = SDL_GetKeyState (NULL);
   1.188 +    Uint8 *kstate = SDL_GetKeyState(NULL);
   1.189  
   1.190      state = KMOD_NONE;
   1.191 -    if (GetKeyboardState (keyboard)) {
   1.192 +    if (GetKeyboardState(keyboard)) {
   1.193          if (keyboard[VK_LSHIFT] & 0x80) {
   1.194              state |= KMOD_LSHIFT;
   1.195              kstate[SDLK_LSHIFT] = SDL_PRESSED;
   1.196 @@ -320,7 +320,7 @@
   1.197              kstate[SDLK_CAPSLOCK] = SDL_PRESSED;
   1.198          }
   1.199      }
   1.200 -    SDL_SetModState (state);
   1.201 +    SDL_SetModState(state);
   1.202  #endif /* !NO_GETKEYBOARDSTATE */
   1.203  }
   1.204  
   1.205 @@ -328,19 +328,19 @@
   1.206  DJM: This is no longer static as (DX5/DIB)_CreateWindow needs it
   1.207  */
   1.208  LRESULT CALLBACK
   1.209 -WinMessage (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
   1.210 +WinMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
   1.211  {
   1.212      SDL_VideoDevice *this = current_video;
   1.213      static int mouse_pressed = 0;
   1.214      static int in_window = 0;
   1.215  #ifdef WMMSG_DEBUG
   1.216 -    fprintf (stderr, "Received windows message:  ");
   1.217 +    fprintf(stderr, "Received windows message:  ");
   1.218      if (msg > MAX_WMMSG) {
   1.219 -        fprintf (stderr, "%d", msg);
   1.220 +        fprintf(stderr, "%d", msg);
   1.221      } else {
   1.222 -        fprintf (stderr, "%s", wmtab[msg]);
   1.223 +        fprintf(stderr, "%s", wmtab[msg]);
   1.224      }
   1.225 -    fprintf (stderr, " -- 0x%X, 0x%X\n", wParam, lParam);
   1.226 +    fprintf(stderr, " -- 0x%X, 0x%X\n", wParam, lParam);
   1.227  #endif
   1.228      switch (msg) {
   1.229  
   1.230 @@ -350,37 +350,37 @@
   1.231              BOOL minimized;
   1.232              Uint8 appstate;
   1.233  
   1.234 -            minimized = HIWORD (wParam);
   1.235 -            if (!minimized && (LOWORD (wParam) != WA_INACTIVE)) {
   1.236 +            minimized = HIWORD(wParam);
   1.237 +            if (!minimized && (LOWORD(wParam) != WA_INACTIVE)) {
   1.238                  /* Gain the following states */
   1.239                  appstate = SDL_APPACTIVE | SDL_APPINPUTFOCUS;
   1.240                  if (this->input_grab != SDL_GRAB_OFF) {
   1.241 -                    WIN_GrabInput (this, SDL_GRAB_ON);
   1.242 +                    WIN_GrabInput(this, SDL_GRAB_ON);
   1.243                  }
   1.244 -                if (!(SDL_GetAppState () & SDL_APPINPUTFOCUS)) {
   1.245 -                    if (!DDRAW_FULLSCREEN ()) {
   1.246 -                        DIB_SwapGamma (this);
   1.247 +                if (!(SDL_GetAppState() & SDL_APPINPUTFOCUS)) {
   1.248 +                    if (!DDRAW_FULLSCREEN()) {
   1.249 +                        DIB_SwapGamma(this);
   1.250                      }
   1.251 -                    if (WINDIB_FULLSCREEN ()) {
   1.252 -                        SDL_RestoreGameMode ();
   1.253 +                    if (WINDIB_FULLSCREEN()) {
   1.254 +                        SDL_RestoreGameMode();
   1.255                      }
   1.256                  }
   1.257  #if defined(_WIN32_WCE)
   1.258 -                if (WINDIB_FULLSCREEN ()) {
   1.259 -                    LoadAygshell ();
   1.260 +                if (WINDIB_FULLSCREEN()) {
   1.261 +                    LoadAygshell();
   1.262                      if (SHFullScreen)
   1.263 -                        SHFullScreen (SDL_Window,
   1.264 -                                      SHFS_HIDESTARTICON |
   1.265 -                                      SHFS_HIDETASKBAR | SHFS_HIDESIPBUTTON);
   1.266 +                        SHFullScreen(SDL_Window,
   1.267 +                                     SHFS_HIDESTARTICON |
   1.268 +                                     SHFS_HIDETASKBAR | SHFS_HIDESIPBUTTON);
   1.269                      else
   1.270 -                        ShowWindow (FindWindow
   1.271 -                                    (TEXT ("HHTaskBar"), NULL), SW_HIDE);
   1.272 +                        ShowWindow(FindWindow
   1.273 +                                   (TEXT("HHTaskBar"), NULL), SW_HIDE);
   1.274  
   1.275                  }
   1.276  #endif
   1.277  
   1.278 -                posted = SDL_PrivateAppActive (1, appstate);
   1.279 -                WIN_GetKeyboardState ();
   1.280 +                posted = SDL_PrivateAppActive(1, appstate);
   1.281 +                WIN_GetKeyboardState();
   1.282              } else {
   1.283                  /* Lose the following states */
   1.284                  appstate = SDL_APPINPUTFOCUS;
   1.285 @@ -388,29 +388,29 @@
   1.286                      appstate |= SDL_APPACTIVE;
   1.287                  }
   1.288                  if (this->input_grab != SDL_GRAB_OFF) {
   1.289 -                    WIN_GrabInput (this, SDL_GRAB_OFF);
   1.290 +                    WIN_GrabInput(this, SDL_GRAB_OFF);
   1.291                  }
   1.292 -                if (SDL_GetAppState () & SDL_APPINPUTFOCUS) {
   1.293 -                    if (!DDRAW_FULLSCREEN ()) {
   1.294 -                        DIB_SwapGamma (this);
   1.295 +                if (SDL_GetAppState() & SDL_APPINPUTFOCUS) {
   1.296 +                    if (!DDRAW_FULLSCREEN()) {
   1.297 +                        DIB_SwapGamma(this);
   1.298                      }
   1.299 -                    if (WINDIB_FULLSCREEN ()) {
   1.300 -                        SDL_RestoreDesktopMode ();
   1.301 +                    if (WINDIB_FULLSCREEN()) {
   1.302 +                        SDL_RestoreDesktopMode();
   1.303  #if defined(_WIN32_WCE)
   1.304 -                        LoadAygshell ();
   1.305 +                        LoadAygshell();
   1.306                          if (SHFullScreen)
   1.307 -                            SHFullScreen (SDL_Window,
   1.308 -                                          SHFS_SHOWSTARTICON |
   1.309 -                                          SHFS_SHOWTASKBAR |
   1.310 -                                          SHFS_SHOWSIPBUTTON);
   1.311 +                            SHFullScreen(SDL_Window,
   1.312 +                                         SHFS_SHOWSTARTICON |
   1.313 +                                         SHFS_SHOWTASKBAR |
   1.314 +                                         SHFS_SHOWSIPBUTTON);
   1.315                          else
   1.316 -                            ShowWindow (FindWindow
   1.317 -                                        (TEXT ("HHTaskBar"), NULL), SW_SHOW);
   1.318 +                            ShowWindow(FindWindow
   1.319 +                                       (TEXT("HHTaskBar"), NULL), SW_SHOW);
   1.320  
   1.321  #endif
   1.322                      }
   1.323                  }
   1.324 -                posted = SDL_PrivateAppActive (0, appstate);
   1.325 +                posted = SDL_PrivateAppActive(0, appstate);
   1.326              }
   1.327              return (0);
   1.328          }
   1.329 @@ -420,7 +420,7 @@
   1.330          {
   1.331  
   1.332              /* Mouse is handled by DirectInput when fullscreen */
   1.333 -            if (SDL_VideoSurface && !DINPUT_FULLSCREEN ()) {
   1.334 +            if (SDL_VideoSurface && !DINPUT_FULLSCREEN()) {
   1.335                  Sint16 x, y;
   1.336  
   1.337                  /* mouse has entered the window */
   1.338 @@ -428,19 +428,19 @@
   1.339  #ifdef WM_MOUSELEAVE
   1.340                      TRACKMOUSEEVENT tme;
   1.341  
   1.342 -                    tme.cbSize = sizeof (tme);
   1.343 +                    tme.cbSize = sizeof(tme);
   1.344                      tme.dwFlags = TME_LEAVE;
   1.345                      tme.hwndTrack = SDL_Window;
   1.346 -                    _TrackMouseEvent (&tme);
   1.347 +                    _TrackMouseEvent(&tme);
   1.348  #endif /* WM_MOUSELEAVE */
   1.349                      in_window = TRUE;
   1.350  
   1.351 -                    posted = SDL_PrivateAppActive (1, SDL_APPMOUSEFOCUS);
   1.352 +                    posted = SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS);
   1.353                  }
   1.354  
   1.355                  /* mouse has moved within the window */
   1.356 -                x = LOWORD (lParam);
   1.357 -                y = HIWORD (lParam);
   1.358 +                x = LOWORD(lParam);
   1.359 +                y = HIWORD(lParam);
   1.360                  if (mouse_relative) {
   1.361                      POINT center;
   1.362                      center.x = (SDL_VideoSurface->w / 2);
   1.363 @@ -448,17 +448,17 @@
   1.364                      x -= (Sint16) center.x;
   1.365                      y -= (Sint16) center.y;
   1.366                      if (x || y) {
   1.367 -                        ClientToScreen (SDL_Window, &center);
   1.368 -                        SetCursorPos (center.x, center.y);
   1.369 -                        posted = SDL_PrivateMouseMotion (0, 1, x, y);
   1.370 +                        ClientToScreen(SDL_Window, &center);
   1.371 +                        SetCursorPos(center.x, center.y);
   1.372 +                        posted = SDL_PrivateMouseMotion(0, 1, x, y);
   1.373                      }
   1.374                  } else {
   1.375  #ifdef _WIN32_WCE
   1.376                      if (SDL_VideoSurface)
   1.377 -                        GapiTransform (this->hidden->userOrientation,
   1.378 -                                       this->hidden->hiresFix, &x, &y);
   1.379 +                        GapiTransform(this->hidden->userOrientation,
   1.380 +                                      this->hidden->hiresFix, &x, &y);
   1.381  #endif
   1.382 -                    posted = SDL_PrivateMouseMotion (0, 0, x, y);
   1.383 +                    posted = SDL_PrivateMouseMotion(0, 0, x, y);
   1.384                  }
   1.385              }
   1.386          }
   1.387 @@ -469,11 +469,11 @@
   1.388          {
   1.389  
   1.390              /* Mouse is handled by DirectInput when fullscreen */
   1.391 -            if (SDL_VideoSurface && !DINPUT_FULLSCREEN ()) {
   1.392 +            if (SDL_VideoSurface && !DINPUT_FULLSCREEN()) {
   1.393                  /* mouse has left the window */
   1.394                  /* or */
   1.395                  /* Elvis has left the building! */
   1.396 -                posted = SDL_PrivateAppActive (0, SDL_APPMOUSEFOCUS);
   1.397 +                posted = SDL_PrivateAppActive(0, SDL_APPMOUSEFOCUS);
   1.398              }
   1.399              in_window = FALSE;
   1.400          }
   1.401 @@ -488,7 +488,7 @@
   1.402      case WM_RBUTTONUP:
   1.403          {
   1.404              /* Mouse is handled by DirectInput when fullscreen */
   1.405 -            if (SDL_VideoSurface && !DINPUT_FULLSCREEN ()) {
   1.406 +            if (SDL_VideoSurface && !DINPUT_FULLSCREEN()) {
   1.407                  Sint16 x, y;
   1.408                  Uint8 button, state;
   1.409  
   1.410 @@ -497,7 +497,7 @@
   1.411                     it acts like a normal windows "component"
   1.412                     (e.g. gains keyboard focus on a mouse click).
   1.413                   */
   1.414 -                SetFocus (SDL_Window);
   1.415 +                SetFocus(SDL_Window);
   1.416  
   1.417                  /* Figure out which button to use */
   1.418                  switch (msg) {
   1.419 @@ -532,12 +532,12 @@
   1.420                  if (state == SDL_PRESSED) {
   1.421                      /* Grab mouse so we get up events */
   1.422                      if (++mouse_pressed > 0) {
   1.423 -                        SetCapture (hwnd);
   1.424 +                        SetCapture(hwnd);
   1.425                      }
   1.426                  } else {
   1.427                      /* Release mouse after all up events */
   1.428                      if (--mouse_pressed <= 0) {
   1.429 -                        ReleaseCapture ();
   1.430 +                        ReleaseCapture();
   1.431                          mouse_pressed = 0;
   1.432                      }
   1.433                  }
   1.434 @@ -547,15 +547,15 @@
   1.435                      x = 0;
   1.436                      y = 0;
   1.437                  } else {
   1.438 -                    x = (Sint16) LOWORD (lParam);
   1.439 -                    y = (Sint16) HIWORD (lParam);
   1.440 +                    x = (Sint16) LOWORD(lParam);
   1.441 +                    y = (Sint16) HIWORD(lParam);
   1.442  #ifdef _WIN32_WCE
   1.443                      if (SDL_VideoSurface)
   1.444 -                        GapiTransform (this->hidden->userOrientation,
   1.445 -                                       this->hidden->hiresFix, &x, &y);
   1.446 +                        GapiTransform(this->hidden->userOrientation,
   1.447 +                                      this->hidden->hiresFix, &x, &y);
   1.448  #endif
   1.449                  }
   1.450 -                posted = SDL_PrivateMouseButton (state, button, x, y);
   1.451 +                posted = SDL_PrivateMouseButton(state, button, x, y);
   1.452              }
   1.453          }
   1.454          return (0);
   1.455 @@ -563,16 +563,16 @@
   1.456  
   1.457  #if (_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)
   1.458      case WM_MOUSEWHEEL:
   1.459 -        if (SDL_VideoSurface && !DINPUT_FULLSCREEN ()) {
   1.460 -            int move = (short) HIWORD (wParam);
   1.461 +        if (SDL_VideoSurface && !DINPUT_FULLSCREEN()) {
   1.462 +            int move = (short) HIWORD(wParam);
   1.463              if (move) {
   1.464                  Uint8 button;
   1.465                  if (move > 0)
   1.466                      button = SDL_BUTTON_WHEELUP;
   1.467                  else
   1.468                      button = SDL_BUTTON_WHEELDOWN;
   1.469 -                posted = SDL_PrivateMouseButton (SDL_PRESSED, button, 0, 0);
   1.470 -                posted |= SDL_PrivateMouseButton (SDL_RELEASED, button, 0, 0);
   1.471 +                posted = SDL_PrivateMouseButton(SDL_PRESSED, button, 0, 0);
   1.472 +                posted |= SDL_PrivateMouseButton(SDL_RELEASED, button, 0, 0);
   1.473              }
   1.474          }
   1.475          return (0);
   1.476 @@ -603,7 +603,7 @@
   1.477              }
   1.478  
   1.479              /* Get the current position of our window */
   1.480 -            GetWindowRect (SDL_Window, &size);
   1.481 +            GetWindowRect(SDL_Window, &size);
   1.482              x = size.left;
   1.483              y = size.top;
   1.484  
   1.485 @@ -623,11 +623,11 @@
   1.486                 Aparently it's too difficult for MS to check
   1.487                 inside their function, so I have to do it here.
   1.488               */
   1.489 -            style = GetWindowLong (hwnd, GWL_STYLE);
   1.490 -            AdjustWindowRect (&size,
   1.491 -                              style,
   1.492 -                              style & WS_CHILDWINDOW ? FALSE
   1.493 -                              : GetMenu (hwnd) != NULL);
   1.494 +            style = GetWindowLong(hwnd, GWL_STYLE);
   1.495 +            AdjustWindowRect(&size,
   1.496 +                             style,
   1.497 +                             style & WS_CHILDWINDOW ? FALSE
   1.498 +                             : GetMenu(hwnd) != NULL);
   1.499  
   1.500              width = size.right - size.left;
   1.501              height = size.bottom - size.top;
   1.502 @@ -651,10 +651,10 @@
   1.503              SDL_VideoDevice *this = current_video;
   1.504              int w, h;
   1.505  
   1.506 -            GetClientRect (SDL_Window, &SDL_bounds);
   1.507 -            ClientToScreen (SDL_Window, (LPPOINT) & SDL_bounds);
   1.508 -            ClientToScreen (SDL_Window, (LPPOINT) & SDL_bounds + 1);
   1.509 -            if (!SDL_resizing && !IsZoomed (SDL_Window) &&
   1.510 +            GetClientRect(SDL_Window, &SDL_bounds);
   1.511 +            ClientToScreen(SDL_Window, (LPPOINT) & SDL_bounds);
   1.512 +            ClientToScreen(SDL_Window, (LPPOINT) & SDL_bounds + 1);
   1.513 +            if (!SDL_resizing && !IsZoomed(SDL_Window) &&
   1.514                  SDL_PublicSurface &&
   1.515                  !(SDL_PublicSurface->flags & SDL_FULLSCREEN)) {
   1.516                  SDL_windowX = SDL_bounds.left;
   1.517 @@ -663,11 +663,11 @@
   1.518              w = SDL_bounds.right - SDL_bounds.left;
   1.519              h = SDL_bounds.bottom - SDL_bounds.top;
   1.520              if (this->input_grab != SDL_GRAB_OFF) {
   1.521 -                ClipCursor (&SDL_bounds);
   1.522 +                ClipCursor(&SDL_bounds);
   1.523              }
   1.524              if (SDL_PublicSurface &&
   1.525                  (SDL_PublicSurface->flags & SDL_RESIZABLE)) {
   1.526 -                SDL_PrivateResize (w, h);
   1.527 +                SDL_PrivateResize(w, h);
   1.528              }
   1.529          }
   1.530          break;
   1.531 @@ -677,9 +677,9 @@
   1.532          {
   1.533              Uint16 hittest;
   1.534  
   1.535 -            hittest = LOWORD (lParam);
   1.536 +            hittest = LOWORD(lParam);
   1.537              if (hittest == HTCLIENT) {
   1.538 -                SetCursor (SDL_hcursor);
   1.539 +                SetCursor(SDL_hcursor);
   1.540                  return (TRUE);
   1.541              }
   1.542          }
   1.543 @@ -688,7 +688,7 @@
   1.544          /* We are about to get palette focus! */
   1.545      case WM_QUERYNEWPALETTE:
   1.546          {
   1.547 -            WIN_RealizePalette (current_video);
   1.548 +            WIN_RealizePalette(current_video);
   1.549              return (TRUE);
   1.550          }
   1.551          break;
   1.552 @@ -696,7 +696,7 @@
   1.553          /* Another application changed the palette */
   1.554      case WM_PALETTECHANGED:
   1.555          {
   1.556 -            WIN_PaletteChanged (current_video, (HWND) wParam);
   1.557 +            WIN_PaletteChanged(current_video, (HWND) wParam);
   1.558          }
   1.559          break;
   1.560  
   1.561 @@ -706,39 +706,39 @@
   1.562              HDC hdc;
   1.563              PAINTSTRUCT ps;
   1.564  
   1.565 -            hdc = BeginPaint (SDL_Window, &ps);
   1.566 +            hdc = BeginPaint(SDL_Window, &ps);
   1.567              if (current_video->screen &&
   1.568                  !(current_video->screen->flags & SDL_INTERNALOPENGL)) {
   1.569 -                WIN_WinPAINT (current_video, hdc);
   1.570 +                WIN_WinPAINT(current_video, hdc);
   1.571              }
   1.572 -            EndPaint (SDL_Window, &ps);
   1.573 +            EndPaint(SDL_Window, &ps);
   1.574          }
   1.575          return (0);
   1.576  
   1.577          /* DJM: Send an expose event in this case */
   1.578      case WM_ERASEBKGND:
   1.579          {
   1.580 -            posted = SDL_PrivateExpose ();
   1.581 +            posted = SDL_PrivateExpose();
   1.582          }
   1.583          return (0);
   1.584  
   1.585      case WM_CLOSE:
   1.586          {
   1.587 -            if ((posted = SDL_PrivateQuit ()))
   1.588 -                PostQuitMessage (0);
   1.589 +            if ((posted = SDL_PrivateQuit()))
   1.590 +                PostQuitMessage(0);
   1.591          }
   1.592          return (0);
   1.593  
   1.594      case WM_DESTROY:
   1.595          {
   1.596 -            PostQuitMessage (0);
   1.597 +            PostQuitMessage(0);
   1.598          }
   1.599          return (0);
   1.600  
   1.601  #ifndef NO_GETKEYBOARDSTATE
   1.602      case WM_INPUTLANGCHANGE:
   1.603          {
   1.604 -            codepage = GetCodePage ();
   1.605 +            codepage = GetCodePage();
   1.606          }
   1.607          return (TRUE);
   1.608  #endif
   1.609 @@ -747,33 +747,33 @@
   1.610          {
   1.611              /* Special handling by the video driver */
   1.612              if (HandleMessage) {
   1.613 -                return (HandleMessage (current_video,
   1.614 -                                       hwnd, msg, wParam, lParam));
   1.615 +                return (HandleMessage(current_video,
   1.616 +                                      hwnd, msg, wParam, lParam));
   1.617              }
   1.618          }
   1.619          break;
   1.620      }
   1.621 -    return (DefWindowProc (hwnd, msg, wParam, lParam));
   1.622 +    return (DefWindowProc(hwnd, msg, wParam, lParam));
   1.623  }
   1.624  
   1.625  /* Allow the application handle to be stored and retrieved later */
   1.626  static void *SDL_handle = NULL;
   1.627  
   1.628  void
   1.629 -SDL_SetModuleHandle (void *handle)
   1.630 +SDL_SetModuleHandle(void *handle)
   1.631  {
   1.632      SDL_handle = handle;
   1.633  }
   1.634  
   1.635  void *
   1.636 -SDL_GetModuleHandle (void)
   1.637 +SDL_GetModuleHandle(void)
   1.638  {
   1.639      void *handle;
   1.640  
   1.641      if (SDL_handle) {
   1.642          handle = SDL_handle;
   1.643      } else {
   1.644 -        handle = GetModuleHandle (NULL);
   1.645 +        handle = GetModuleHandle(NULL);
   1.646      }
   1.647      return (handle);
   1.648  }
   1.649 @@ -785,7 +785,7 @@
   1.650  
   1.651  /* Register the class for this application -- exported for winmain.c */
   1.652  int
   1.653 -SDL_RegisterApp (char *name, Uint32 style, void *hInst)
   1.654 +SDL_RegisterApp(char *name, Uint32 style, void *hInst)
   1.655  {
   1.656      WNDCLASS class;
   1.657  #ifdef WM_MOUSELEAVE
   1.658 @@ -803,24 +803,24 @@
   1.659      if (!name && !SDL_Appname) {
   1.660          name = "SDL_app";
   1.661          SDL_Appstyle = CS_BYTEALIGNCLIENT;
   1.662 -        SDL_Instance = hInst ? hInst : SDL_GetModuleHandle ();
   1.663 +        SDL_Instance = hInst ? hInst : SDL_GetModuleHandle();
   1.664      }
   1.665  
   1.666      if (name) {
   1.667  #ifdef _WIN32_WCE
   1.668          /* WinCE uses the UNICODE version */
   1.669 -        SDL_Appname = SDL_iconv_utf8_ucs2 (name);
   1.670 +        SDL_Appname = SDL_iconv_utf8_ucs2(name);
   1.671  #else
   1.672 -        SDL_Appname = SDL_iconv_utf8_latin1 (name);
   1.673 +        SDL_Appname = SDL_iconv_utf8_latin1(name);
   1.674  #endif /* _WIN32_WCE */
   1.675          SDL_Appstyle = style;
   1.676 -        SDL_Instance = hInst ? hInst : SDL_GetModuleHandle ();
   1.677 +        SDL_Instance = hInst ? hInst : SDL_GetModuleHandle();
   1.678      }
   1.679  
   1.680      /* Register the application class */
   1.681      class.hCursor = NULL;
   1.682 -    class.hIcon = LoadImage (SDL_Instance, SDL_Appname,
   1.683 -                             IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR);
   1.684 +    class.hIcon = LoadImage(SDL_Instance, SDL_Appname,
   1.685 +                            IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR);
   1.686      class.lpszMenuName = NULL;
   1.687      class.lpszClassName = SDL_Appname;
   1.688      class.hbrBackground = NULL;
   1.689 @@ -832,18 +832,18 @@
   1.690      class.lpfnWndProc = WinMessage;
   1.691      class.cbWndExtra = 0;
   1.692      class.cbClsExtra = 0;
   1.693 -    if (!RegisterClass (&class)) {
   1.694 -        SDL_SetError ("Couldn't register application class");
   1.695 +    if (!RegisterClass(&class)) {
   1.696 +        SDL_SetError("Couldn't register application class");
   1.697          return (-1);
   1.698      }
   1.699  #ifdef WM_MOUSELEAVE
   1.700      /* Get the version of TrackMouseEvent() we use */
   1.701      _TrackMouseEvent = NULL;
   1.702 -    handle = GetModuleHandle ("USER32.DLL");
   1.703 +    handle = GetModuleHandle("USER32.DLL");
   1.704      if (handle) {
   1.705          _TrackMouseEvent =
   1.706 -            (BOOL (WINAPI *) (TRACKMOUSEEVENT *)) GetProcAddress (handle,
   1.707 -                                                                  "TrackMouseEvent");
   1.708 +            (BOOL(WINAPI *) (TRACKMOUSEEVENT *)) GetProcAddress(handle,
   1.709 +                                                                "TrackMouseEvent");
   1.710      }
   1.711      if (_TrackMouseEvent == NULL) {
   1.712          _TrackMouseEvent = WIN_TrackMouseEvent;
   1.713 @@ -852,8 +852,8 @@
   1.714  
   1.715  #ifndef NO_GETKEYBOARDSTATE
   1.716      /* Initialise variables for SDL_ToUnicode() */
   1.717 -    codepage = GetCodePage ();
   1.718 -    SDL_ToUnicode = Is9xME ()? ToUnicode9xME : ToUnicode;
   1.719 +    codepage = GetCodePage();
   1.720 +    SDL_ToUnicode = Is9xME()? ToUnicode9xME : ToUnicode;
   1.721  #endif
   1.722  
   1.723      app_registered = 1;
   1.724 @@ -862,7 +862,7 @@
   1.725  
   1.726  /* Unregisters the windowclass registered in SDL_RegisterApp above. */
   1.727  void
   1.728 -SDL_UnregisterApp ()
   1.729 +SDL_UnregisterApp()
   1.730  {
   1.731      WNDCLASS class;
   1.732  
   1.733 @@ -873,10 +873,10 @@
   1.734      --app_registered;
   1.735      if (app_registered == 0) {
   1.736          /* Check for any registered window classes. */
   1.737 -        if (GetClassInfo (SDL_Instance, SDL_Appname, &class)) {
   1.738 -            UnregisterClass (SDL_Appname, SDL_Instance);
   1.739 +        if (GetClassInfo(SDL_Instance, SDL_Appname, &class)) {
   1.740 +            UnregisterClass(SDL_Appname, SDL_Instance);
   1.741          }
   1.742 -        SDL_free (SDL_Appname);
   1.743 +        SDL_free(SDL_Appname);
   1.744          SDL_Appname = NULL;
   1.745      }
   1.746  }
   1.747 @@ -885,42 +885,41 @@
   1.748  /* JFP: Implementation of ToUnicode() that works on 9x/ME/2K/XP */
   1.749  
   1.750  static int
   1.751 -Is9xME ()
   1.752 +Is9xME()
   1.753  {
   1.754      OSVERSIONINFO info;
   1.755  
   1.756 -    SDL_memset (&info, 0, sizeof (info));
   1.757 -    info.dwOSVersionInfoSize = sizeof (info);
   1.758 -    if (!GetVersionEx (&info)) {
   1.759 +    SDL_memset(&info, 0, sizeof(info));
   1.760 +    info.dwOSVersionInfoSize = sizeof(info);
   1.761 +    if (!GetVersionEx(&info)) {
   1.762          return 0;
   1.763      }
   1.764      return (info.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS);
   1.765  }
   1.766  
   1.767  static int
   1.768 -GetCodePage ()
   1.769 +GetCodePage()
   1.770  {
   1.771      char buff[8];
   1.772 -    int lcid = MAKELCID (LOWORD (GetKeyboardLayout (0)), SORT_DEFAULT);
   1.773 -    int cp = GetACP ();
   1.774 +    int lcid = MAKELCID(LOWORD(GetKeyboardLayout(0)), SORT_DEFAULT);
   1.775 +    int cp = GetACP();
   1.776  
   1.777 -    if (GetLocaleInfo
   1.778 -        (lcid, LOCALE_IDEFAULTANSICODEPAGE, buff, sizeof (buff))) {
   1.779 -        cp = SDL_atoi (buff);
   1.780 +    if (GetLocaleInfo(lcid, LOCALE_IDEFAULTANSICODEPAGE, buff, sizeof(buff))) {
   1.781 +        cp = SDL_atoi(buff);
   1.782      }
   1.783      return cp;
   1.784  }
   1.785  
   1.786  static int WINAPI
   1.787 -ToUnicode9xME (UINT vkey, UINT scancode, PBYTE keystate, LPWSTR wchars,
   1.788 -               int wsize, UINT flags)
   1.789 +ToUnicode9xME(UINT vkey, UINT scancode, PBYTE keystate, LPWSTR wchars,
   1.790 +              int wsize, UINT flags)
   1.791  {
   1.792      BYTE chars[2];
   1.793  
   1.794      if (ToAsciiEx
   1.795          (vkey, scancode, keystate, (WORD *) chars, 0,
   1.796 -         GetKeyboardLayout (0)) == 1) {
   1.797 -        return MultiByteToWideChar (codepage, 0, chars, 1, wchars, wsize);
   1.798 +         GetKeyboardLayout(0)) == 1) {
   1.799 +        return MultiByteToWideChar(codepage, 0, chars, 1, wchars, wsize);
   1.800      }
   1.801      return 0;
   1.802  }