src/video/os2fslib/SDL_os2fslib.c
branchSDL-1.3
changeset 1668 4da1ee79c9af
parent 1662 782fd950bd46
     1.1 --- a/src/video/os2fslib/SDL_os2fslib.c	Mon May 29 03:53:21 2006 +0000
     1.2 +++ b/src/video/os2fslib/SDL_os2fslib.c	Mon May 29 04:04:35 2006 +0000
     1.3 @@ -62,7 +62,7 @@
     1.4  
     1.5  // Backdoors:
     1.6  DECLSPEC void SDLCALL
     1.7 -SDL_OS2FSLIB_SetFCFToUse (ULONG ulFCF)
     1.8 +SDL_OS2FSLIB_SetFCFToUse(ULONG ulFCF)
     1.9  {
    1.10      ulFCFToUse = ulFCF;
    1.11  }
    1.12 @@ -90,8 +90,8 @@
    1.13  
    1.14  /* The translation table from a VK keysym to a SDL keysym */
    1.15  static SDLKey HWScanKeyMap[256];
    1.16 -static SDL_keysym *TranslateKey (int vkey, int chcode, int scancode,
    1.17 -                                 SDL_keysym * keysym, int iPressed);
    1.18 +static SDL_keysym *TranslateKey(int vkey, int chcode, int scancode,
    1.19 +                                SDL_keysym * keysym, int iPressed);
    1.20  static int iShiftIsPressed;
    1.21  
    1.22  #ifdef BITBLT_IN_WINMESSAGEPROC
    1.23 @@ -119,12 +119,12 @@
    1.24  //
    1.25  /////////////////////////////////////////////////////////////////////
    1.26  static BOOL
    1.27 -SetAccessableWindowPos (HWND hwnd, HWND hwndInsertBehind,
    1.28 -                        LONG x, LONG y, LONG cx, LONG cy, ULONG fl)
    1.29 +SetAccessableWindowPos(HWND hwnd, HWND hwndInsertBehind,
    1.30 +                       LONG x, LONG y, LONG cx, LONG cy, ULONG fl)
    1.31  {
    1.32      SWP swpDesktop, swp;
    1.33      // Get desktop area
    1.34 -    WinQueryWindowPos (HWND_DESKTOP, &swpDesktop);
    1.35 +    WinQueryWindowPos(HWND_DESKTOP, &swpDesktop);
    1.36  
    1.37      if ((fl & SWP_MOVE) && (fl & SWP_SIZE)) {
    1.38          // If both moving and sizing, then change size and pos now!!
    1.39 @@ -136,10 +136,10 @@
    1.40              y = 0;
    1.41          if (y + cy > swpDesktop.cy)
    1.42              y = swpDesktop.cy - cy;
    1.43 -        return WinSetWindowPos (hwnd, hwndInsertBehind, x, y, cx, cy, fl);
    1.44 +        return WinSetWindowPos(hwnd, hwndInsertBehind, x, y, cx, cy, fl);
    1.45      } else if (fl & SWP_MOVE) {
    1.46          // Just moving
    1.47 -        WinQueryWindowPos (hwnd, &swp);
    1.48 +        WinQueryWindowPos(hwnd, &swp);
    1.49          if (x + swp.cx > swpDesktop.cx)
    1.50              x = swpDesktop.cx - swp.cx;
    1.51          if (x < 0)
    1.52 @@ -148,10 +148,10 @@
    1.53              y = 0;
    1.54          if (y + swp.cy > swpDesktop.cy)
    1.55              y = swpDesktop.cy - swp.cy;
    1.56 -        return WinSetWindowPos (hwnd, hwndInsertBehind, x, y, cx, cy, fl);
    1.57 +        return WinSetWindowPos(hwnd, hwndInsertBehind, x, y, cx, cy, fl);
    1.58      } else if (fl & SWP_SIZE) {
    1.59          // Just sizing
    1.60 -        WinQueryWindowPos (hwnd, &swp);
    1.61 +        WinQueryWindowPos(hwnd, &swp);
    1.62          x = swp.x;
    1.63          y = swp.y;
    1.64          if (x + cx > swpDesktop.cx)
    1.65 @@ -162,14 +162,14 @@
    1.66              y = 0;
    1.67          if (y + cy > swpDesktop.cy)
    1.68              y = swpDesktop.cy - cy;
    1.69 -        return WinSetWindowPos (hwnd, hwndInsertBehind, x, y, cx, cy,
    1.70 -                                fl | SWP_MOVE);
    1.71 +        return WinSetWindowPos(hwnd, hwndInsertBehind, x, y, cx, cy,
    1.72 +                               fl | SWP_MOVE);
    1.73      } else
    1.74 -        return WinSetWindowPos (hwnd, hwndInsertBehind, x, y, cx, cy, fl);
    1.75 +        return WinSetWindowPos(hwnd, hwndInsertBehind, x, y, cx, cy, fl);
    1.76  }
    1.77  
    1.78  static UniChar
    1.79 -NativeCharToUniChar (int chcode)
    1.80 +NativeCharToUniChar(int chcode)
    1.81  {
    1.82      UniChar ucResult = (UniChar) chcode;
    1.83      int rc;
    1.84 @@ -183,7 +183,7 @@
    1.85      size_t iNonIdentical;
    1.86  
    1.87      // Create unicode convert object
    1.88 -    rc = UniCreateUconvObject (L"", &ucoTemp);
    1.89 +    rc = UniCreateUconvObject(L"", &ucoTemp);
    1.90      if (rc != ULS_SUCCESS) {
    1.91          // Could not create convert object!
    1.92          return ucResult;
    1.93 @@ -191,25 +191,25 @@
    1.94      // Convert language code string to unicode string
    1.95      achFrom[0] = (char) chcode;
    1.96      achFrom[1] = 0;
    1.97 -    iFromCount = sizeof (char) * 2;
    1.98 -    iToCount = sizeof (UniChar) * 2;
    1.99 +    iFromCount = sizeof(char) * 2;
   1.100 +    iToCount = sizeof(UniChar) * 2;
   1.101      pucTo = &(aucTo[0]);
   1.102      pchFrom = &(achFrom[0]);
   1.103  
   1.104 -    rc = UniUconvToUcs (ucoTemp,
   1.105 -                        &pchFrom,
   1.106 -                        &iFromCount, &pucTo, &iToCount, &iNonIdentical);
   1.107 +    rc = UniUconvToUcs(ucoTemp,
   1.108 +                       &pchFrom,
   1.109 +                       &iFromCount, &pucTo, &iToCount, &iNonIdentical);
   1.110  
   1.111      if (rc != ULS_SUCCESS) {
   1.112          // Could not convert language code to UCS string!
   1.113 -        UniFreeUconvObject (ucoTemp);
   1.114 +        UniFreeUconvObject(ucoTemp);
   1.115          return ucResult;
   1.116      }
   1.117  
   1.118 -    UniFreeUconvObject (ucoTemp);
   1.119 +    UniFreeUconvObject(ucoTemp);
   1.120  
   1.121  #ifdef DEBUG_BUILD
   1.122 -    printf ("%02x converted to %02x\n", (int) chcode, (int) (aucTo[0]));
   1.123 +    printf("%02x converted to %02x\n", (int) chcode, (int) (aucTo[0]));
   1.124  #endif
   1.125  
   1.126      return aucTo[0];
   1.127 @@ -223,8 +223,8 @@
   1.128  //
   1.129  /////////////////////////////////////////////////////////////////////
   1.130  static SDL_keysym *
   1.131 -TranslateKey (int vkey, int chcode, int scancode, SDL_keysym * keysym,
   1.132 -              int iPressed)
   1.133 +TranslateKey(int vkey, int chcode, int scancode, SDL_keysym * keysym,
   1.134 +             int iPressed)
   1.135  {
   1.136      keysym->scancode = (unsigned char) scancode;
   1.137      keysym->mod = KMOD_NONE;
   1.138 @@ -232,7 +232,7 @@
   1.139  
   1.140      if (iPressed && SDL_TranslateUNICODE) {
   1.141          if (chcode)
   1.142 -            keysym->unicode = NativeCharToUniChar (chcode);
   1.143 +            keysym->unicode = NativeCharToUniChar(chcode);
   1.144          else
   1.145              keysym->unicode = vkey;
   1.146      }
   1.147 @@ -367,7 +367,7 @@
   1.148  //
   1.149  /////////////////////////////////////////////////////////////////////
   1.150  static MRESULT EXPENTRY
   1.151 -WndProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
   1.152 +WndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
   1.153  {
   1.154      HPS ps;
   1.155      RECTL rcl;
   1.156 @@ -378,7 +378,7 @@
   1.157  #ifdef DEBUG_BUILD
   1.158  //      printf("WM_CHAR\n"); fflush(stdout);
   1.159  #endif
   1.160 -        pVideo = WinQueryWindowPtr (hwnd, 0);
   1.161 +        pVideo = WinQueryWindowPtr(hwnd, 0);
   1.162          if (pVideo) {
   1.163              /*
   1.164                 // We skip repeated keys:
   1.165 @@ -392,7 +392,7 @@
   1.166               */
   1.167  
   1.168              // If it's not repeated, then let's see if its pressed or released!
   1.169 -            if (SHORT1FROMMP (mp1) & KC_KEYUP) {
   1.170 +            if (SHORT1FROMMP(mp1) & KC_KEYUP) {
   1.171                  // A key has been released
   1.172                  SDL_keysym keysym;
   1.173  
   1.174 @@ -415,10 +415,10 @@
   1.175                     &keysym,0));
   1.176                     } */
   1.177  
   1.178 -                SDL_PrivateKeyboard (SDL_RELEASED, TranslateKey (SHORT2FROMMP (mp2),    // VK_ code
   1.179 -                                                                 SHORT1FROMMP (mp2),    // Character code
   1.180 -                                                                 CHAR4FROMMP (mp1),     // HW Scan code
   1.181 -                                                                 &keysym, 0));
   1.182 +                SDL_PrivateKeyboard(SDL_RELEASED, TranslateKey(SHORT2FROMMP(mp2),       // VK_ code
   1.183 +                                                               SHORT1FROMMP(mp2),       // Character code
   1.184 +                                                               CHAR4FROMMP(mp1),        // HW Scan code
   1.185 +                                                               &keysym, 0));
   1.186  
   1.187              } else {
   1.188                  // A key has been pressed
   1.189 @@ -429,11 +429,11 @@
   1.190  #endif
   1.191                  // Check for fastkeys: ALT+HOME to toggle FS mode
   1.192                  //                     ALT+END to close app
   1.193 -                if ((SHORT1FROMMP (mp1) & KC_ALT) &&
   1.194 -                    (SHORT2FROMMP (mp2) == VK_HOME)) {
   1.195 +                if ((SHORT1FROMMP(mp1) & KC_ALT) &&
   1.196 +                    (SHORT2FROMMP(mp2) == VK_HOME)) {
   1.197  #ifdef DEBUG_BUILD
   1.198 -                    printf (" Pressed ALT+HOME!\n");
   1.199 -                    fflush (stdout);
   1.200 +                    printf(" Pressed ALT+HOME!\n");
   1.201 +                    fflush(stdout);
   1.202  #endif
   1.203                      // Only switch between fullscreen and back if it's not
   1.204                      // a resizable mode!
   1.205 @@ -442,30 +442,30 @@
   1.206                           &&
   1.207                           ((pVideo->hidden->pSDLSurface->
   1.208                             flags & SDL_RESIZABLE) == 0)))
   1.209 -                        FSLib_ToggleFSMode (hwnd, !FSLib_QueryFSMode (hwnd));
   1.210 +                        FSLib_ToggleFSMode(hwnd, !FSLib_QueryFSMode(hwnd));
   1.211  #ifdef DEBUG_BUILD
   1.212                      else
   1.213 -                        printf (" Resizable mode, so discarding ALT+HOME!\n");
   1.214 -                    fflush (stdout);
   1.215 +                        printf(" Resizable mode, so discarding ALT+HOME!\n");
   1.216 +                    fflush(stdout);
   1.217  #endif
   1.218 -                } else if ((SHORT1FROMMP (mp1) & KC_ALT) &&
   1.219 -                           (SHORT2FROMMP (mp2) == VK_END)) {
   1.220 +                } else if ((SHORT1FROMMP(mp1) & KC_ALT) &&
   1.221 +                           (SHORT2FROMMP(mp2) == VK_END)) {
   1.222  #ifdef DEBUG_BUILD
   1.223 -                    printf (" Pressed ALT+END!\n");
   1.224 -                    fflush (stdout);
   1.225 +                    printf(" Pressed ALT+END!\n");
   1.226 +                    fflush(stdout);
   1.227  #endif
   1.228                      // Close window, and get out of loop!
   1.229                      // Also send event to SDL application, but we won't
   1.230                      // wait for it to be processed!
   1.231 -                    SDL_PrivateQuit ();
   1.232 -                    WinPostMsg (hwnd, WM_QUIT, 0, 0);
   1.233 +                    SDL_PrivateQuit();
   1.234 +                    WinPostMsg(hwnd, WM_QUIT, 0, 0);
   1.235                  } else {
   1.236  
   1.237 -                    SDL_PrivateKeyboard (SDL_PRESSED, TranslateKey (SHORT2FROMMP (mp2), // VK_ code
   1.238 -                                                                    SHORT1FROMMP (mp2), // Character code
   1.239 -                                                                    CHAR4FROMMP (mp1),  // HW Scan code
   1.240 -                                                                    &keysym,
   1.241 -                                                                    1));
   1.242 +                    SDL_PrivateKeyboard(SDL_PRESSED, TranslateKey(SHORT2FROMMP(mp2),    // VK_ code
   1.243 +                                                                  SHORT1FROMMP(mp2),    // Character code
   1.244 +                                                                  CHAR4FROMMP(mp1),     // HW Scan code
   1.245 +                                                                  &keysym,
   1.246 +                                                                  1));
   1.247  
   1.248                  }
   1.249              }
   1.250 @@ -488,22 +488,22 @@
   1.251  
   1.252      case WM_PAINT:             // Window redraw!
   1.253  #ifdef DEBUG_BUILD
   1.254 -        printf ("WM_PAINT (0x%x)\n", hwnd);
   1.255 -        fflush (stdout);
   1.256 +        printf("WM_PAINT (0x%x)\n", hwnd);
   1.257 +        fflush(stdout);
   1.258  #endif
   1.259 -        ps = WinBeginPaint (hwnd, 0, &rcl);
   1.260 -        pVideo = FSLib_GetUserParm (hwnd);
   1.261 +        ps = WinBeginPaint(hwnd, 0, &rcl);
   1.262 +        pVideo = FSLib_GetUserParm(hwnd);
   1.263          if (pVideo) {
   1.264              if (!pVideo->hidden->pSDLSurface) {
   1.265                  RECTL rclRect;
   1.266                  // So, don't blit now!
   1.267  #ifdef DEBUG_BUILD
   1.268 -                printf ("WM_PAINT : Skipping blit while resizing (Pre!)!\n");
   1.269 -                fflush (stdout);
   1.270 +                printf("WM_PAINT : Skipping blit while resizing (Pre!)!\n");
   1.271 +                fflush(stdout);
   1.272  #endif
   1.273 -                WinQueryWindowRect (hwnd, &rclRect);
   1.274 +                WinQueryWindowRect(hwnd, &rclRect);
   1.275                  // Fill with black
   1.276 -                WinFillRect (ps, &rclRect, CLR_BLACK);
   1.277 +                WinFillRect(ps, &rclRect, CLR_BLACK);
   1.278              } else {
   1.279                  if (DosRequestMutexSem
   1.280                      (pVideo->hidden->hmtxUseSrcBuffer, 1000) == NO_ERROR) {
   1.281 @@ -514,14 +514,14 @@
   1.282  
   1.283                      // Re-blit the modified area!
   1.284                      // For this, we have to calculate the points, scaled!
   1.285 -                    WinQueryWindowPos (hwnd, &swp);
   1.286 +                    WinQueryWindowPos(hwnd, &swp);
   1.287  #ifdef DEBUG_BUILD
   1.288                      printf
   1.289                          ("WM_PAINT : WinSize: %d %d, BufSize: %d %d\n",
   1.290                           swp.cx, swp.cy,
   1.291                           pVideo->hidden->SrcBufferDesc.uiXResolution,
   1.292                           pVideo->hidden->SrcBufferDesc.uiYResolution);
   1.293 -                    fflush (stdout);
   1.294 +                    fflush(stdout);
   1.295  #endif
   1.296  
   1.297  #ifndef RESIZE_EVEN_IF_RESIZABLE
   1.298 @@ -536,17 +536,17 @@
   1.299                             pVideo->hidden->SrcBufferDesc.uiXResolution)
   1.300                            || (swp.cy !=
   1.301                                pVideo->hidden->SrcBufferDesc.uiYResolution))
   1.302 -                         && (!FSLib_QueryFSMode (hwnd)))) {
   1.303 +                         && (!FSLib_QueryFSMode(hwnd)))) {
   1.304                          RECTL rclRect;
   1.305                          // Resizable surface and in resizing!
   1.306                          // So, don't blit now!
   1.307  #ifdef DEBUG_BUILD
   1.308 -                        printf ("WM_PAINT : Skipping blit while resizing!\n");
   1.309 -                        fflush (stdout);
   1.310 +                        printf("WM_PAINT : Skipping blit while resizing!\n");
   1.311 +                        fflush(stdout);
   1.312  #endif
   1.313 -                        WinQueryWindowRect (hwnd, &rclRect);
   1.314 +                        WinQueryWindowRect(hwnd, &rclRect);
   1.315                          // Fill with black
   1.316 -                        WinFillRect (ps, &rclRect, CLR_BLACK);
   1.317 +                        WinFillRect(ps, &rclRect, CLR_BLACK);
   1.318                      } else
   1.319  #endif
   1.320                      {
   1.321 @@ -621,55 +621,55 @@
   1.322                               pVideo->hidden->SrcBufferDesc.
   1.323                               uiXResolution,
   1.324                               pVideo->hidden->SrcBufferDesc.uiYResolution);
   1.325 -                        fflush (stdout);
   1.326 +                        fflush(stdout);
   1.327  #endif
   1.328  
   1.329 -                        FSLIB_BITBLT (hwnd,
   1.330 -                                      pVideo->hidden->pchSrcBuffer,
   1.331 -                                      iTop, iLeft, iWidth, iHeight);
   1.332 +                        FSLIB_BITBLT(hwnd,
   1.333 +                                     pVideo->hidden->pchSrcBuffer,
   1.334 +                                     iTop, iLeft, iWidth, iHeight);
   1.335                      }
   1.336  
   1.337 -                    DosReleaseMutexSem (pVideo->hidden->hmtxUseSrcBuffer);
   1.338 +                    DosReleaseMutexSem(pVideo->hidden->hmtxUseSrcBuffer);
   1.339                  }
   1.340              }
   1.341          }
   1.342  #ifdef DEBUG_BUILD
   1.343          else {
   1.344 -            printf ("WM_PAINT : No pVideo!\n");
   1.345 -            fflush (stdout);
   1.346 +            printf("WM_PAINT : No pVideo!\n");
   1.347 +            fflush(stdout);
   1.348          }
   1.349  #endif
   1.350 -        WinEndPaint (ps);
   1.351 +        WinEndPaint(ps);
   1.352  #ifdef DEBUG_BUILD
   1.353 -        printf ("WM_PAINT : Done.\n");
   1.354 -        fflush (stdout);
   1.355 +        printf("WM_PAINT : Done.\n");
   1.356 +        fflush(stdout);
   1.357  #endif
   1.358          return 0;
   1.359  
   1.360      case WM_SIZE:
   1.361          {
   1.362  #ifdef DEBUG_BUILD
   1.363 -            printf ("WM_SIZE : (%d %d)\n",
   1.364 -                    SHORT1FROMMP (mp2), SHORT2FROMMP (mp2));
   1.365 -            fflush (stdout);
   1.366 +            printf("WM_SIZE : (%d %d)\n",
   1.367 +                   SHORT1FROMMP(mp2), SHORT2FROMMP(mp2));
   1.368 +            fflush(stdout);
   1.369  #endif
   1.370 -            iWindowSizeX = SHORT1FROMMP (mp2);
   1.371 -            iWindowSizeY = SHORT2FROMMP (mp2);
   1.372 +            iWindowSizeX = SHORT1FROMMP(mp2);
   1.373 +            iWindowSizeY = SHORT2FROMMP(mp2);
   1.374              bWindowResized = 1;
   1.375  
   1.376              // Make sure the window will be redrawn
   1.377 -            WinInvalidateRegion (hwnd, NULL, TRUE);
   1.378 +            WinInvalidateRegion(hwnd, NULL, TRUE);
   1.379          }
   1.380          break;
   1.381  
   1.382      case WM_FSLIBNOTIFICATION:
   1.383  #ifdef DEBUG_BUILD
   1.384 -        printf ("WM_FSLIBNOTIFICATION\n");
   1.385 -        fflush (stdout);
   1.386 +        printf("WM_FSLIBNOTIFICATION\n");
   1.387 +        fflush(stdout);
   1.388  #endif
   1.389          if ((int) mp1 == FSLN_TOGGLEFSMODE) {
   1.390              // FS mode changed, reblit image!
   1.391 -            pVideo = FSLib_GetUserParm (hwnd);
   1.392 +            pVideo = FSLib_GetUserParm(hwnd);
   1.393              if (pVideo) {
   1.394                  if (!pVideo->hidden->pSDLSurface) {
   1.395                      // Resizable surface and in resizing!
   1.396 @@ -677,7 +677,7 @@
   1.397  #ifdef DEBUG_BUILD
   1.398                      printf
   1.399                          ("WM_FSLIBNOTIFICATION : Can not blit if there is no surface, doing nothing.\n");
   1.400 -                    fflush (stdout);
   1.401 +                    fflush(stdout);
   1.402  #endif
   1.403                  } else {
   1.404                      if (DosRequestMutexSem
   1.405 @@ -690,7 +690,7 @@
   1.406                              // But only blit if the window is not resizable, or if
   1.407                              // the window is resizable and the source buffer size is the
   1.408                              // same as the destination buffer size!
   1.409 -                            WinQueryWindowPos (hwnd, &swp);
   1.410 +                            WinQueryWindowPos(hwnd, &swp);
   1.411                              if ((!pVideo->hidden->pSDLSurface) ||
   1.412                                  ((pVideo->hidden->pSDLSurface) &&
   1.413                                   (pVideo->hidden->pSDLSurface->
   1.414 @@ -702,40 +702,40 @@
   1.415                                    || (swp.cy !=
   1.416                                        pVideo->hidden->
   1.417                                        SrcBufferDesc.uiYResolution))
   1.418 -                                 && (!FSLib_QueryFSMode (hwnd)))) {
   1.419 +                                 && (!FSLib_QueryFSMode(hwnd)))) {
   1.420                                  // Resizable surface and in resizing!
   1.421                                  // So, don't blit now!
   1.422  #ifdef DEBUG_BUILD
   1.423                                  printf
   1.424                                      ("WM_FSLIBNOTIFICATION : Cannot blit while resizing, doing nothing.\n");
   1.425 -                                fflush (stdout);
   1.426 +                                fflush(stdout);
   1.427  #endif
   1.428                              } else
   1.429  #endif
   1.430                              {
   1.431  #ifdef DEBUG_BUILD
   1.432 -                                printf ("WM_FSLIBNOTIFICATION : Blitting!\n");
   1.433 -                                fflush (stdout);
   1.434 +                                printf("WM_FSLIBNOTIFICATION : Blitting!\n");
   1.435 +                                fflush(stdout);
   1.436  #endif
   1.437 -                                FSLIB_BITBLT (hwnd,
   1.438 -                                              pVideo->hidden->
   1.439 -                                              pchSrcBuffer, 0,
   1.440 -                                              0,
   1.441 -                                              pVideo->hidden->
   1.442 -                                              SrcBufferDesc.
   1.443 -                                              uiXResolution,
   1.444 -                                              pVideo->hidden->
   1.445 -                                              SrcBufferDesc.uiYResolution);
   1.446 +                                FSLIB_BITBLT(hwnd,
   1.447 +                                             pVideo->hidden->
   1.448 +                                             pchSrcBuffer, 0,
   1.449 +                                             0,
   1.450 +                                             pVideo->hidden->
   1.451 +                                             SrcBufferDesc.
   1.452 +                                             uiXResolution,
   1.453 +                                             pVideo->hidden->
   1.454 +                                             SrcBufferDesc.uiYResolution);
   1.455                              }
   1.456                          }
   1.457  #ifdef DEBUG_BUILD
   1.458                          else
   1.459                              printf
   1.460                                  ("WM_FSLIBNOTIFICATION : No public surface!\n");
   1.461 -                        fflush (stdout);
   1.462 +                        fflush(stdout);
   1.463  #endif
   1.464  
   1.465 -                        DosReleaseMutexSem (pVideo->hidden->hmtxUseSrcBuffer);
   1.466 +                        DosReleaseMutexSem(pVideo->hidden->hmtxUseSrcBuffer);
   1.467                      }
   1.468                  }
   1.469              }
   1.470 @@ -744,95 +744,93 @@
   1.471  
   1.472      case WM_ACTIVATE:
   1.473  #ifdef DEBUG_BUILD
   1.474 -        printf ("WM_ACTIVATE\n");
   1.475 -        fflush (stdout);
   1.476 +        printf("WM_ACTIVATE\n");
   1.477 +        fflush(stdout);
   1.478  #endif
   1.479  
   1.480 -        pVideo = FSLib_GetUserParm (hwnd);
   1.481 +        pVideo = FSLib_GetUserParm(hwnd);
   1.482          if (pVideo) {
   1.483              pVideo->hidden->fInFocus = (int) mp1;
   1.484              if (pVideo->hidden->fInFocus) {
   1.485                  // Went into focus
   1.486                  if ((pVideo->hidden->iMouseVisible)
   1.487                      && (!bMouseCaptured))
   1.488 -                    WinSetPointer (HWND_DESKTOP,
   1.489 -                                   WinQuerySysPointer (HWND_DESKTOP,
   1.490 -                                                       SPTR_ARROW, FALSE));
   1.491 +                    WinSetPointer(HWND_DESKTOP,
   1.492 +                                  WinQuerySysPointer(HWND_DESKTOP,
   1.493 +                                                     SPTR_ARROW, FALSE));
   1.494                  else
   1.495 -                    WinSetPointer (HWND_DESKTOP, NULL);
   1.496 +                    WinSetPointer(HWND_DESKTOP, NULL);
   1.497  
   1.498                  if (bMouseCapturable) {
   1.499                      // Re-capture the mouse, if we captured it before!
   1.500 -                    WinSetCapture (HWND_DESKTOP, hwnd);
   1.501 +                    WinSetCapture(HWND_DESKTOP, hwnd);
   1.502                      bMouseCaptured = 1;
   1.503                      {
   1.504                          SWP swpClient;
   1.505                          POINTL ptl;
   1.506                          // Center the mouse to the middle of the window!
   1.507 -                        WinQueryWindowPos (pVideo->hidden->hwndClient,
   1.508 -                                           &swpClient);
   1.509 +                        WinQueryWindowPos(pVideo->hidden->hwndClient,
   1.510 +                                          &swpClient);
   1.511                          ptl.x = 0;
   1.512                          ptl.y = 0;
   1.513 -                        WinMapWindowPoints (pVideo->hidden->
   1.514 -                                            hwndClient, HWND_DESKTOP,
   1.515 -                                            &ptl, 1);
   1.516 +                        WinMapWindowPoints(pVideo->hidden->
   1.517 +                                           hwndClient, HWND_DESKTOP, &ptl, 1);
   1.518                          pVideo->hidden->iSkipWMMOUSEMOVE++;     /* Don't take next WM_MOUSEMOVE into account!  */
   1.519 -                        WinSetPointerPos (HWND_DESKTOP,
   1.520 -                                          ptl.x + swpClient.cx / 2,
   1.521 -                                          ptl.y + swpClient.cy / 2);
   1.522 +                        WinSetPointerPos(HWND_DESKTOP,
   1.523 +                                         ptl.x + swpClient.cx / 2,
   1.524 +                                         ptl.y + swpClient.cy / 2);
   1.525                      }
   1.526                  }
   1.527              } else {
   1.528                  // Went out of focus
   1.529 -                WinSetPointer (HWND_DESKTOP,
   1.530 -                               WinQuerySysPointer (HWND_DESKTOP,
   1.531 -                                                   SPTR_ARROW, FALSE));
   1.532 +                WinSetPointer(HWND_DESKTOP,
   1.533 +                              WinQuerySysPointer(HWND_DESKTOP,
   1.534 +                                                 SPTR_ARROW, FALSE));
   1.535  
   1.536                  if (bMouseCaptured) {
   1.537                      // Release the mouse
   1.538 -                    WinSetCapture (HWND_DESKTOP, hwnd);
   1.539 +                    WinSetCapture(HWND_DESKTOP, hwnd);
   1.540                      bMouseCaptured = 0;
   1.541                  }
   1.542              }
   1.543          }
   1.544  #ifdef DEBUG_BUILD
   1.545 -        printf ("WM_ACTIVATE done\n");
   1.546 -        fflush (stdout);
   1.547 +        printf("WM_ACTIVATE done\n");
   1.548 +        fflush(stdout);
   1.549  #endif
   1.550  
   1.551          break;
   1.552  
   1.553      case WM_BUTTON1DOWN:
   1.554  #ifdef DEBUG_BUILD
   1.555 -        printf ("WM_BUTTON1DOWN\n");
   1.556 -        fflush (stdout);
   1.557 +        printf("WM_BUTTON1DOWN\n");
   1.558 +        fflush(stdout);
   1.559  #endif
   1.560  
   1.561 -        pVideo = FSLib_GetUserParm (hwnd);
   1.562 +        pVideo = FSLib_GetUserParm(hwnd);
   1.563          if (pVideo) {
   1.564 -            SDL_PrivateMouseButton (SDL_PRESSED, SDL_BUTTON_LEFT, 0, 0);        // Don't report mouse movement!
   1.565 +            SDL_PrivateMouseButton(SDL_PRESSED, SDL_BUTTON_LEFT, 0, 0); // Don't report mouse movement!
   1.566  
   1.567              if (bMouseCapturable) {
   1.568                  // We should capture the mouse!
   1.569                  if (!bMouseCaptured) {
   1.570 -                    WinSetCapture (HWND_DESKTOP, hwnd);
   1.571 -                    WinSetPointer (HWND_DESKTOP, NULL);
   1.572 +                    WinSetCapture(HWND_DESKTOP, hwnd);
   1.573 +                    WinSetPointer(HWND_DESKTOP, NULL);
   1.574                      bMouseCaptured = 1;
   1.575                      {
   1.576                          SWP swpClient;
   1.577                          POINTL ptl;
   1.578                          // Center the mouse to the middle of the window!
   1.579 -                        WinQueryWindowPos (pVideo->hidden->hwndClient,
   1.580 -                                           &swpClient);
   1.581 +                        WinQueryWindowPos(pVideo->hidden->hwndClient,
   1.582 +                                          &swpClient);
   1.583                          ptl.x = 0;
   1.584                          ptl.y = 0;
   1.585 -                        WinMapWindowPoints (pVideo->hidden->
   1.586 -                                            hwndClient, HWND_DESKTOP,
   1.587 -                                            &ptl, 1);
   1.588 +                        WinMapWindowPoints(pVideo->hidden->
   1.589 +                                           hwndClient, HWND_DESKTOP, &ptl, 1);
   1.590                          pVideo->hidden->iSkipWMMOUSEMOVE++;     /* Don't take next WM_MOUSEMOVE into account!  */
   1.591 -                        WinSetPointerPos (HWND_DESKTOP,
   1.592 -                                          ptl.x + swpClient.cx / 2,
   1.593 -                                          ptl.y + swpClient.cy / 2);
   1.594 +                        WinSetPointerPos(HWND_DESKTOP,
   1.595 +                                         ptl.x + swpClient.cx / 2,
   1.596 +                                         ptl.y + swpClient.cy / 2);
   1.597                      }
   1.598                  }
   1.599              }
   1.600 @@ -840,42 +838,41 @@
   1.601          break;
   1.602      case WM_BUTTON1UP:
   1.603  #ifdef DEBUG_BUILD
   1.604 -        printf ("WM_BUTTON1UP\n");
   1.605 -        fflush (stdout);
   1.606 +        printf("WM_BUTTON1UP\n");
   1.607 +        fflush(stdout);
   1.608  #endif
   1.609 -        SDL_PrivateMouseButton (SDL_RELEASED, SDL_BUTTON_LEFT, 0, 0);   // Don't report mouse movement!
   1.610 +        SDL_PrivateMouseButton(SDL_RELEASED, SDL_BUTTON_LEFT, 0, 0);    // Don't report mouse movement!
   1.611          break;
   1.612      case WM_BUTTON2DOWN:
   1.613  #ifdef DEBUG_BUILD
   1.614 -        printf ("WM_BUTTON2DOWN\n");
   1.615 -        fflush (stdout);
   1.616 +        printf("WM_BUTTON2DOWN\n");
   1.617 +        fflush(stdout);
   1.618  #endif
   1.619  
   1.620 -        pVideo = FSLib_GetUserParm (hwnd);
   1.621 +        pVideo = FSLib_GetUserParm(hwnd);
   1.622          if (pVideo) {
   1.623 -            SDL_PrivateMouseButton (SDL_PRESSED, SDL_BUTTON_RIGHT, 0, 0);       // Don't report mouse movement!
   1.624 +            SDL_PrivateMouseButton(SDL_PRESSED, SDL_BUTTON_RIGHT, 0, 0);        // Don't report mouse movement!
   1.625  
   1.626              if (bMouseCapturable) {
   1.627                  // We should capture the mouse!
   1.628                  if (!bMouseCaptured) {
   1.629 -                    WinSetCapture (HWND_DESKTOP, hwnd);
   1.630 -                    WinSetPointer (HWND_DESKTOP, NULL);
   1.631 +                    WinSetCapture(HWND_DESKTOP, hwnd);
   1.632 +                    WinSetPointer(HWND_DESKTOP, NULL);
   1.633                      bMouseCaptured = 1;
   1.634                      {
   1.635                          SWP swpClient;
   1.636                          POINTL ptl;
   1.637                          // Center the mouse to the middle of the window!
   1.638 -                        WinQueryWindowPos (pVideo->hidden->hwndClient,
   1.639 -                                           &swpClient);
   1.640 +                        WinQueryWindowPos(pVideo->hidden->hwndClient,
   1.641 +                                          &swpClient);
   1.642                          ptl.x = 0;
   1.643                          ptl.y = 0;
   1.644 -                        WinMapWindowPoints (pVideo->hidden->
   1.645 -                                            hwndClient, HWND_DESKTOP,
   1.646 -                                            &ptl, 1);
   1.647 +                        WinMapWindowPoints(pVideo->hidden->
   1.648 +                                           hwndClient, HWND_DESKTOP, &ptl, 1);
   1.649                          pVideo->hidden->iSkipWMMOUSEMOVE++;     /* Don't take next WM_MOUSEMOVE into account!  */
   1.650 -                        WinSetPointerPos (HWND_DESKTOP,
   1.651 -                                          ptl.x + swpClient.cx / 2,
   1.652 -                                          ptl.y + swpClient.cy / 2);
   1.653 +                        WinSetPointerPos(HWND_DESKTOP,
   1.654 +                                         ptl.x + swpClient.cx / 2,
   1.655 +                                         ptl.y + swpClient.cy / 2);
   1.656                      }
   1.657                  }
   1.658              }
   1.659 @@ -884,42 +881,41 @@
   1.660          break;
   1.661      case WM_BUTTON2UP:
   1.662  #ifdef DEBUG_BUILD
   1.663 -        printf ("WM_BUTTON2UP\n");
   1.664 -        fflush (stdout);
   1.665 +        printf("WM_BUTTON2UP\n");
   1.666 +        fflush(stdout);
   1.667  #endif
   1.668 -        SDL_PrivateMouseButton (SDL_RELEASED, SDL_BUTTON_RIGHT, 0, 0);  // Don't report mouse movement!
   1.669 +        SDL_PrivateMouseButton(SDL_RELEASED, SDL_BUTTON_RIGHT, 0, 0);   // Don't report mouse movement!
   1.670          break;
   1.671      case WM_BUTTON3DOWN:
   1.672  #ifdef DEBUG_BUILD
   1.673 -        printf ("WM_BUTTON3DOWN\n");
   1.674 -        fflush (stdout);
   1.675 +        printf("WM_BUTTON3DOWN\n");
   1.676 +        fflush(stdout);
   1.677  #endif
   1.678  
   1.679 -        pVideo = FSLib_GetUserParm (hwnd);
   1.680 +        pVideo = FSLib_GetUserParm(hwnd);
   1.681          if (pVideo) {
   1.682 -            SDL_PrivateMouseButton (SDL_PRESSED, SDL_BUTTON_MIDDLE, 0, 0);      // Don't report mouse movement!
   1.683 +            SDL_PrivateMouseButton(SDL_PRESSED, SDL_BUTTON_MIDDLE, 0, 0);       // Don't report mouse movement!
   1.684  
   1.685              if (bMouseCapturable) {
   1.686                  // We should capture the mouse!
   1.687                  if (!bMouseCaptured) {
   1.688 -                    WinSetCapture (HWND_DESKTOP, hwnd);
   1.689 -                    WinSetPointer (HWND_DESKTOP, NULL);
   1.690 +                    WinSetCapture(HWND_DESKTOP, hwnd);
   1.691 +                    WinSetPointer(HWND_DESKTOP, NULL);
   1.692                      bMouseCaptured = 1;
   1.693                      {
   1.694                          SWP swpClient;
   1.695                          POINTL ptl;
   1.696                          // Center the mouse to the middle of the window!
   1.697 -                        WinQueryWindowPos (pVideo->hidden->hwndClient,
   1.698 -                                           &swpClient);
   1.699 +                        WinQueryWindowPos(pVideo->hidden->hwndClient,
   1.700 +                                          &swpClient);
   1.701                          ptl.x = 0;
   1.702                          ptl.y = 0;
   1.703 -                        WinMapWindowPoints (pVideo->hidden->
   1.704 -                                            hwndClient, HWND_DESKTOP,
   1.705 -                                            &ptl, 1);
   1.706 +                        WinMapWindowPoints(pVideo->hidden->
   1.707 +                                           hwndClient, HWND_DESKTOP, &ptl, 1);
   1.708                          pVideo->hidden->iSkipWMMOUSEMOVE++;     /* Don't take next WM_MOUSEMOVE into account!  */
   1.709 -                        WinSetPointerPos (HWND_DESKTOP,
   1.710 -                                          ptl.x + swpClient.cx / 2,
   1.711 -                                          ptl.y + swpClient.cy / 2);
   1.712 +                        WinSetPointerPos(HWND_DESKTOP,
   1.713 +                                         ptl.x + swpClient.cx / 2,
   1.714 +                                         ptl.y + swpClient.cy / 2);
   1.715                      }
   1.716                  }
   1.717              }
   1.718 @@ -927,17 +923,17 @@
   1.719          break;
   1.720      case WM_BUTTON3UP:
   1.721  #ifdef DEBUG_BUILD
   1.722 -        printf ("WM_BUTTON3UP\n");
   1.723 -        fflush (stdout);
   1.724 +        printf("WM_BUTTON3UP\n");
   1.725 +        fflush(stdout);
   1.726  #endif
   1.727 -        SDL_PrivateMouseButton (SDL_RELEASED, SDL_BUTTON_MIDDLE, 0, 0); // Don't report mouse movement!
   1.728 +        SDL_PrivateMouseButton(SDL_RELEASED, SDL_BUTTON_MIDDLE, 0, 0);  // Don't report mouse movement!
   1.729          break;
   1.730      case WM_MOUSEMOVE:
   1.731  #ifdef DEBUG_BUILD
   1.732  //      printf("WM_MOUSEMOVE\n"); fflush(stdout);
   1.733  #endif
   1.734  
   1.735 -        pVideo = FSLib_GetUserParm (hwnd);
   1.736 +        pVideo = FSLib_GetUserParm(hwnd);
   1.737          if (pVideo) {
   1.738              if (pVideo->hidden->iSkipWMMOUSEMOVE) {
   1.739                  pVideo->hidden->iSkipWMMOUSEMOVE--;
   1.740 @@ -948,33 +944,32 @@
   1.741                  if (bMouseCaptured) {
   1.742                      SWP swpClient;
   1.743  
   1.744 -                    WinQueryWindowPos (pVideo->hidden->hwndClient,
   1.745 -                                       &swpClient);
   1.746 +                    WinQueryWindowPos(pVideo->hidden->hwndClient, &swpClient);
   1.747  
   1.748                      // Send relative mouse position, and re-center the mouse
   1.749                      // Reposition the mouse to the center of the screen/window
   1.750 -                    SDL_PrivateMouseMotion (0,  // Buttons not changed
   1.751 -                                            1,  // Relative position
   1.752 -                                            ppts->x -
   1.753 -                                            (swpClient.cx / 2),
   1.754 -                                            (swpClient.cy / 2) - ppts->y);
   1.755 +                    SDL_PrivateMouseMotion(0,   // Buttons not changed
   1.756 +                                           1,   // Relative position
   1.757 +                                           ppts->x -
   1.758 +                                           (swpClient.cx / 2),
   1.759 +                                           (swpClient.cy / 2) - ppts->y);
   1.760  
   1.761                      ptl.x = 0;
   1.762                      ptl.y = 0;
   1.763 -                    WinMapWindowPoints (pVideo->hidden->hwndClient,
   1.764 -                                        HWND_DESKTOP, &ptl, 1);
   1.765 +                    WinMapWindowPoints(pVideo->hidden->hwndClient,
   1.766 +                                       HWND_DESKTOP, &ptl, 1);
   1.767                      pVideo->hidden->iSkipWMMOUSEMOVE++; /* Don't take next WM_MOUSEMOVE into account!  */
   1.768                      // Center the mouse to the middle of the window!
   1.769 -                    WinSetPointerPos (HWND_DESKTOP,
   1.770 -                                      ptl.x + swpClient.cx / 2,
   1.771 -                                      ptl.y + swpClient.cy / 2);
   1.772 +                    WinSetPointerPos(HWND_DESKTOP,
   1.773 +                                     ptl.x + swpClient.cx / 2,
   1.774 +                                     ptl.y + swpClient.cy / 2);
   1.775                  } else {
   1.776 -                    CONVERTMOUSEPOSITION ();
   1.777 +                    CONVERTMOUSEPOSITION();
   1.778  
   1.779                      // Send absolute mouse position
   1.780 -                    SDL_PrivateMouseMotion (0,  // Buttons not changed
   1.781 -                                            0,  // Absolute position
   1.782 -                                            ppts->x, ppts->y);
   1.783 +                    SDL_PrivateMouseMotion(0,   // Buttons not changed
   1.784 +                                           0,   // Absolute position
   1.785 +                                           ppts->x, ppts->y);
   1.786                  }
   1.787              }
   1.788              if ((pVideo->hidden->iMouseVisible) && (!bMouseCaptured)) {
   1.789 @@ -983,13 +978,13 @@
   1.790  #endif
   1.791  
   1.792                  if (hptrGlobalPointer)
   1.793 -                    WinSetPointer (HWND_DESKTOP, hptrGlobalPointer);
   1.794 +                    WinSetPointer(HWND_DESKTOP, hptrGlobalPointer);
   1.795                  else
   1.796 -                    WinSetPointer (HWND_DESKTOP,
   1.797 -                                   WinQuerySysPointer (HWND_DESKTOP,
   1.798 -                                                       SPTR_ARROW, FALSE));
   1.799 +                    WinSetPointer(HWND_DESKTOP,
   1.800 +                                  WinQuerySysPointer(HWND_DESKTOP,
   1.801 +                                                     SPTR_ARROW, FALSE));
   1.802              } else {
   1.803 -                WinSetPointer (HWND_DESKTOP, NULL);
   1.804 +                WinSetPointer(HWND_DESKTOP, NULL);
   1.805              }
   1.806          }
   1.807  #ifdef DEBUG_BUILD
   1.808 @@ -999,21 +994,21 @@
   1.809          return (MRESULT) FALSE;
   1.810      case WM_CLOSE:             // Window close
   1.811  #ifdef DEBUG_BUILD
   1.812 -        printf ("WM_CLOSE\n");
   1.813 -        fflush (stdout);
   1.814 +        printf("WM_CLOSE\n");
   1.815 +        fflush(stdout);
   1.816  #endif
   1.817  
   1.818 -        pVideo = FSLib_GetUserParm (hwnd);
   1.819 +        pVideo = FSLib_GetUserParm(hwnd);
   1.820          if (pVideo) {
   1.821              // Send Quit message to the SDL application!
   1.822 -            SDL_PrivateQuit ();
   1.823 +            SDL_PrivateQuit();
   1.824              return 0;
   1.825          }
   1.826          break;
   1.827  
   1.828  #ifdef BITBLT_IN_WINMESSAGEPROC
   1.829      case WM_UPDATERECTSREQUEST:
   1.830 -        pVideo = FSLib_GetUserParm (hwnd);
   1.831 +        pVideo = FSLib_GetUserParm(hwnd);
   1.832          if ((pVideo) && (pVideo->hidden->pSDLSurface)) {
   1.833              if (DosRequestMutexSem
   1.834                  (pVideo->hidden->hmtxUseSrcBuffer,
   1.835 @@ -1026,7 +1021,7 @@
   1.836                  numrects = (int) mp1;
   1.837                  rects = (SDL_Rect *) mp2;
   1.838  
   1.839 -                WinQueryWindowPos (hwnd, &swp);
   1.840 +                WinQueryWindowPos(hwnd, &swp);
   1.841  #ifndef RESIZE_EVEN_IF_RESIZABLE
   1.842                  if ((!pVideo->hidden->pSDLSurface) ||
   1.843                      ((pVideo->hidden->pSDLSurface) &&
   1.844 @@ -1035,30 +1030,30 @@
   1.845                       ((swp.cx != pVideo->hidden->SrcBufferDesc.uiXResolution)
   1.846                        || (swp.cy !=
   1.847                            pVideo->hidden->SrcBufferDesc.uiYResolution))
   1.848 -                     && (!FSLib_QueryFSMode (hwnd)))) {
   1.849 +                     && (!FSLib_QueryFSMode(hwnd)))) {
   1.850                      // Resizable surface and in resizing!
   1.851                      // So, don't blit now!
   1.852  #ifdef DEBUG_BUILD
   1.853                      printf
   1.854                          ("[WM_UPDATERECTSREQUEST] : Skipping blit while resizing!\n");
   1.855 -                    fflush (stdout);
   1.856 +                    fflush(stdout);
   1.857  #endif
   1.858                  } else
   1.859  #endif
   1.860                  {
   1.861  #ifdef DEBUG_BUILD
   1.862 -                    printf ("[WM_UPDATERECTSREQUEST] : Blitting!\n");
   1.863 -                    fflush (stdout);
   1.864 +                    printf("[WM_UPDATERECTSREQUEST] : Blitting!\n");
   1.865 +                    fflush(stdout);
   1.866  #endif
   1.867  
   1.868                      // Blit the changed areas
   1.869                      for (i = 0; i < numrects; i++)
   1.870 -                        FSLIB_BITBLT (hwnd,
   1.871 -                                      pVideo->hidden->pchSrcBuffer,
   1.872 -                                      rects[i].y, rects[i].x,
   1.873 -                                      rects[i].w, rects[i].h);
   1.874 +                        FSLIB_BITBLT(hwnd,
   1.875 +                                     pVideo->hidden->pchSrcBuffer,
   1.876 +                                     rects[i].y, rects[i].x,
   1.877 +                                     rects[i].w, rects[i].h);
   1.878                  }
   1.879 -                DosReleaseMutexSem (pVideo->hidden->hmtxUseSrcBuffer);
   1.880 +                DosReleaseMutexSem(pVideo->hidden->hmtxUseSrcBuffer);
   1.881              }
   1.882          }
   1.883          return 0;
   1.884 @@ -1066,14 +1061,14 @@
   1.885  
   1.886      default:
   1.887  #ifdef DEBUG_BUILD
   1.888 -        printf ("Unhandled: %x\n", msg);
   1.889 -        fflush (stdout);
   1.890 +        printf("Unhandled: %x\n", msg);
   1.891 +        fflush(stdout);
   1.892  #endif
   1.893  
   1.894          break;
   1.895      }
   1.896      // Run the default window procedure for unhandled stuffs
   1.897 -    return WinDefWindowProc (hwnd, msg, mp1, mp2);
   1.898 +    return WinDefWindowProc(hwnd, msg, mp1, mp2);
   1.899  }
   1.900  
   1.901  /////////////////////////////////////////////////////////////////////
   1.902 @@ -1085,7 +1080,7 @@
   1.903  //
   1.904  /////////////////////////////////////////////////////////////////////
   1.905  static MRESULT EXPENTRY
   1.906 -FrameWndProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
   1.907 +FrameWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
   1.908  {
   1.909      PFNWP pOldFrameProc;
   1.910      MRESULT result;
   1.911 @@ -1096,13 +1091,13 @@
   1.912  
   1.913      SDL_VideoDevice *pVideo = NULL;
   1.914  
   1.915 -    pVideo = (SDL_VideoDevice *) WinQueryWindowULong (hwnd, QWL_USER);
   1.916 +    pVideo = (SDL_VideoDevice *) WinQueryWindowULong(hwnd, QWL_USER);
   1.917  
   1.918      pOldFrameProc = pVideo->hidden->pfnOldFrameProc;
   1.919  
   1.920      if ((pVideo->hidden->bProportionalResize) &&
   1.921          (msg == WM_ADJUSTWINDOWPOS) &&
   1.922 -        (!FSLib_QueryFSMode (pVideo->hidden->hwndClient))) {
   1.923 +        (!FSLib_QueryFSMode(pVideo->hidden->hwndClient))) {
   1.924          pswpTemp = (PSWP) mp1;
   1.925  
   1.926          /* Resizing? */
   1.927 @@ -1112,7 +1107,7 @@
   1.928              rclTemp.xRight = pswpTemp->x + pswpTemp->cx;
   1.929              rclTemp.yBottom = pswpTemp->y;
   1.930              rclTemp.yTop = pswpTemp->y + pswpTemp->cy;
   1.931 -            WinCalcFrameRect (hwnd, &rclTemp, TRUE);
   1.932 +            WinCalcFrameRect(hwnd, &rclTemp, TRUE);
   1.933  
   1.934              ncx = cx = rclTemp.xRight - rclTemp.xLeft;
   1.935              ncy = cy = rclTemp.yTop - rclTemp.yBottom;
   1.936 @@ -1138,7 +1133,7 @@
   1.937              rclTemp.xRight = pswpTemp->x + ncx;
   1.938              rclTemp.yBottom = pswpTemp->y;
   1.939              rclTemp.yTop = pswpTemp->y + ncy;
   1.940 -            WinCalcFrameRect (hwnd, &rclTemp, FALSE);
   1.941 +            WinCalcFrameRect(hwnd, &rclTemp, FALSE);
   1.942  
   1.943              /* Store new size/position info */
   1.944              pswpTemp->cx = rclTemp.xRight - rclTemp.xLeft;
   1.945 @@ -1178,7 +1173,7 @@
   1.946  /////////////////////////////////////////////////////////////////////
   1.947  int iNumOfPMThreadInstances = 0;        // Global!
   1.948  static void
   1.949 -PMThreadFunc (void *pParm)
   1.950 +PMThreadFunc(void *pParm)
   1.951  {
   1.952      SDL_VideoDevice *pVideo = pParm;
   1.953      HAB hab;
   1.954 @@ -1187,22 +1182,22 @@
   1.955      ULONG fcf;
   1.956  
   1.957  #ifdef DEBUG_BUILD
   1.958 -    printf ("[PMThreadFunc] : Starting\n");
   1.959 -    fflush (stdout);
   1.960 +    printf("[PMThreadFunc] : Starting\n");
   1.961 +    fflush(stdout);
   1.962  #endif
   1.963  
   1.964      iNumOfPMThreadInstances++;
   1.965  
   1.966      // Initialize PM, create a message queue.
   1.967  
   1.968 -    hab = WinInitialize (0);
   1.969 -    hmq = WinCreateMsgQueue (hab, 0);
   1.970 +    hab = WinInitialize(0);
   1.971 +    hmq = WinCreateMsgQueue(hab, 0);
   1.972      if (hmq == 0) {
   1.973  #ifdef DEBUG_BUILD
   1.974 -        printf ("[PMThreadFunc] : Could not create message queue!\n");
   1.975 +        printf("[PMThreadFunc] : Could not create message queue!\n");
   1.976          printf
   1.977              ("                 It might be that the application using SDL is not a PM app!\n");
   1.978 -        fflush (stdout);
   1.979 +        fflush(stdout);
   1.980  #endif
   1.981          pVideo->hidden->iPMThreadStatus = 2;
   1.982      } else {
   1.983 @@ -1212,43 +1207,43 @@
   1.984          fcf = ulFCFToUse;       // Get from global setting
   1.985  
   1.986  #ifdef DEBUG_BUILD
   1.987 -        printf ("[PMThreadFunc] : FSLib_CreateWindow()!\n");
   1.988 -        fflush (stdout);
   1.989 +        printf("[PMThreadFunc] : FSLib_CreateWindow()!\n");
   1.990 +        fflush(stdout);
   1.991  #endif
   1.992  
   1.993 -        rc = FSLib_CreateWindow (HWND_DESKTOP, 0, &fcf,
   1.994 -                                 "SDL Application",
   1.995 -                                 NULLHANDLE, 0,
   1.996 -                                 &(pVideo->hidden->SrcBufferDesc),
   1.997 -                                 WndProc,
   1.998 -                                 &(pVideo->hidden->hwndClient),
   1.999 -                                 &(pVideo->hidden->hwndFrame));
  1.1000 +        rc = FSLib_CreateWindow(HWND_DESKTOP, 0, &fcf,
  1.1001 +                                "SDL Application",
  1.1002 +                                NULLHANDLE, 0,
  1.1003 +                                &(pVideo->hidden->SrcBufferDesc),
  1.1004 +                                WndProc,
  1.1005 +                                &(pVideo->hidden->hwndClient),
  1.1006 +                                &(pVideo->hidden->hwndFrame));
  1.1007  
  1.1008  #ifdef DEBUG_BUILD
  1.1009 -        printf ("[PMThreadFunc] : FSLib_CreateWindow() rc = %d\n", rc);
  1.1010 -        fflush (stdout);
  1.1011 +        printf("[PMThreadFunc] : FSLib_CreateWindow() rc = %d\n", rc);
  1.1012 +        fflush(stdout);
  1.1013  #endif
  1.1014  
  1.1015          if (!rc) {
  1.1016  #ifdef DEBUG_BUILD
  1.1017 -            printf ("[PMThreadFunc] : Could not create FSLib window!\n");
  1.1018 -            fflush (stdout);
  1.1019 +            printf("[PMThreadFunc] : Could not create FSLib window!\n");
  1.1020 +            fflush(stdout);
  1.1021  #endif
  1.1022              pVideo->hidden->iPMThreadStatus = 3;
  1.1023          } else {
  1.1024  #ifdef DEBUG_BUILD
  1.1025 -            printf ("[PMThreadFunc] : FSLib_AddUserParm()!\n");
  1.1026 -            fflush (stdout);
  1.1027 +            printf("[PMThreadFunc] : FSLib_AddUserParm()!\n");
  1.1028 +            fflush(stdout);
  1.1029  #endif
  1.1030  
  1.1031              // Store pVideo pointer in window data for client window, so
  1.1032              // it will know the instance to which it belongs to.
  1.1033 -            FSLib_AddUserParm (pVideo->hidden->hwndClient, pVideo);
  1.1034 +            FSLib_AddUserParm(pVideo->hidden->hwndClient, pVideo);
  1.1035  
  1.1036              // Now set default image width height and fourcc!
  1.1037  #ifdef DEBUG_BUILD
  1.1038 -            printf ("[PMThreadFunc] : SetWindowPos()!\n");
  1.1039 -            fflush (stdout);
  1.1040 +            printf("[PMThreadFunc] : SetWindowPos()!\n");
  1.1041 +            fflush(stdout);
  1.1042  #endif
  1.1043  
  1.1044              // Set the position and size of the main window,
  1.1045 @@ -1258,71 +1253,71 @@
  1.1046              rectl.yBottom = 0;
  1.1047              rectl.xRight = pVideo->hidden->SrcBufferDesc.uiXResolution; // Noninclusive
  1.1048              rectl.yTop = pVideo->hidden->SrcBufferDesc.uiYResolution;   // Noninclusive
  1.1049 -            WinCalcFrameRect (pVideo->hidden->hwndFrame, &rectl, FALSE);
  1.1050 -
  1.1051 -            SetAccessableWindowPos (pVideo->hidden->hwndFrame,
  1.1052 -                                    HWND_TOP,
  1.1053 -                                    (WinQuerySysValue
  1.1054 -                                     (HWND_DESKTOP,
  1.1055 -                                      SV_CXSCREEN) - (rectl.xRight -
  1.1056 -                                                      rectl.xLeft)) / 2,
  1.1057 -                                    (WinQuerySysValue
  1.1058 -                                     (HWND_DESKTOP,
  1.1059 -                                      SV_CYSCREEN) - (rectl.yTop -
  1.1060 -                                                      rectl.yBottom)) / 2,
  1.1061 -                                    (rectl.xRight - rectl.xLeft),
  1.1062 -                                    (rectl.yTop - rectl.yBottom),
  1.1063 -                                    SWP_SIZE | SWP_ACTIVATE | SWP_SHOW |
  1.1064 -                                    SWP_MOVE);
  1.1065 +            WinCalcFrameRect(pVideo->hidden->hwndFrame, &rectl, FALSE);
  1.1066 +
  1.1067 +            SetAccessableWindowPos(pVideo->hidden->hwndFrame,
  1.1068 +                                   HWND_TOP,
  1.1069 +                                   (WinQuerySysValue
  1.1070 +                                    (HWND_DESKTOP,
  1.1071 +                                     SV_CXSCREEN) - (rectl.xRight -
  1.1072 +                                                     rectl.xLeft)) / 2,
  1.1073 +                                   (WinQuerySysValue
  1.1074 +                                    (HWND_DESKTOP,
  1.1075 +                                     SV_CYSCREEN) - (rectl.yTop -
  1.1076 +                                                     rectl.yBottom)) / 2,
  1.1077 +                                   (rectl.xRight - rectl.xLeft),
  1.1078 +                                   (rectl.yTop - rectl.yBottom),
  1.1079 +                                   SWP_SIZE | SWP_ACTIVATE | SWP_SHOW |
  1.1080 +                                   SWP_MOVE);
  1.1081  
  1.1082              // Subclass frame procedure and store old window proc address
  1.1083              pVideo->hidden->pfnOldFrameProc =
  1.1084 -                WinSubclassWindow (pVideo->hidden->hwndFrame, FrameWndProc);
  1.1085 -            WinSetWindowULong (pVideo->hidden->hwndFrame, QWL_USER,
  1.1086 -                               (ULONG) pVideo);
  1.1087 +                WinSubclassWindow(pVideo->hidden->hwndFrame, FrameWndProc);
  1.1088 +            WinSetWindowULong(pVideo->hidden->hwndFrame, QWL_USER,
  1.1089 +                              (ULONG) pVideo);
  1.1090  
  1.1091  #ifdef DEBUG_BUILD
  1.1092 -            printf ("[PMThreadFunc] : Entering message loop\n");
  1.1093 -            fflush (stdout);
  1.1094 +            printf("[PMThreadFunc] : Entering message loop\n");
  1.1095 +            fflush(stdout);
  1.1096  #endif
  1.1097              pVideo->hidden->iPMThreadStatus = 1;
  1.1098  
  1.1099 -            while (WinGetMsg (hab, (PQMSG) & msg, 0, 0, 0))
  1.1100 -                WinDispatchMsg (hab, (PQMSG) & msg);
  1.1101 +            while (WinGetMsg(hab, (PQMSG) & msg, 0, 0, 0))
  1.1102 +                WinDispatchMsg(hab, (PQMSG) & msg);
  1.1103  
  1.1104  #ifdef DEBUG_BUILD
  1.1105 -            printf ("[PMThreadFunc] : Leaving message loop\n");
  1.1106 -            fflush (stdout);
  1.1107 +            printf("[PMThreadFunc] : Leaving message loop\n");
  1.1108 +            fflush(stdout);
  1.1109  #endif
  1.1110              // We should release the captured the mouse!
  1.1111              if (bMouseCaptured) {
  1.1112 -                WinSetCapture (HWND_DESKTOP, NULLHANDLE);
  1.1113 +                WinSetCapture(HWND_DESKTOP, NULLHANDLE);
  1.1114                  bMouseCaptured = 0;
  1.1115              }
  1.1116              // Destroy our window
  1.1117 -            WinDestroyWindow (pVideo->hidden->hwndFrame);
  1.1118 +            WinDestroyWindow(pVideo->hidden->hwndFrame);
  1.1119              pVideo->hidden->hwndFrame = NULL;
  1.1120              // Show pointer to make sure it will not be left hidden.
  1.1121 -            WinSetPointer (HWND_DESKTOP,
  1.1122 -                           WinQuerySysPointer (HWND_DESKTOP, SPTR_ARROW,
  1.1123 -                                               FALSE));
  1.1124 -            WinShowPointer (HWND_DESKTOP, TRUE);
  1.1125 +            WinSetPointer(HWND_DESKTOP,
  1.1126 +                          WinQuerySysPointer(HWND_DESKTOP, SPTR_ARROW,
  1.1127 +                                             FALSE));
  1.1128 +            WinShowPointer(HWND_DESKTOP, TRUE);
  1.1129          }
  1.1130          // Uninitialize PM
  1.1131 -        WinDestroyMsgQueue (hmq);
  1.1132 +        WinDestroyMsgQueue(hmq);
  1.1133          // All done!
  1.1134          pVideo->hidden->iPMThreadStatus = 0;
  1.1135      }
  1.1136 -    WinTerminate (hab);
  1.1137 +    WinTerminate(hab);
  1.1138      /* Commented out, should not be needed anymore, because we send it
  1.1139         from WM_CLOSE.
  1.1140         // Notify SDL that it should really die now...
  1.1141         SDL_PrivateQuit(); SDL_PrivateQuit(); SDL_PrivateQuit(); //... :))
  1.1142       */
  1.1143  #ifdef DEBUG_BUILD
  1.1144 -    printf ("[PMThreadFunc] : End, status is %d!\n",
  1.1145 -            pVideo->hidden->iPMThreadStatus);
  1.1146 -    fflush (stdout);
  1.1147 +    printf("[PMThreadFunc] : End, status is %d!\n",
  1.1148 +           pVideo->hidden->iPMThreadStatus);
  1.1149 +    fflush(stdout);
  1.1150  #endif
  1.1151  
  1.1152      iNumOfPMThreadInstances--;
  1.1153 @@ -1336,25 +1331,25 @@
  1.1154      // give time to the app to finish its execution. If it does not, I kill it
  1.1155      // using DosExit(). Brute force, but should work.
  1.1156      if (pVideo->hidden->iPMThreadStatus == 0) {
  1.1157 -        DosSleep (5000);        // Wait 5 secs
  1.1158 +        DosSleep(5000);         // Wait 5 secs
  1.1159          // If a new PM thread has been spawned (reinitializing video mode), then all right.
  1.1160          // Otherwise, we have a problem, the app doesn't want to stop. Kill!
  1.1161          if (iNumOfPMThreadInstances == 0) {
  1.1162  #ifdef DEBUG_BUILD
  1.1163              printf
  1.1164                  ("[PMThreadFunc] : It seems that the application haven't terminated itself\n");
  1.1165 -            fflush (stdout);
  1.1166 +            fflush(stdout);
  1.1167              printf
  1.1168                  ("[PMThreadFunc] : in the last 5 seconds, so we go berserk.\n");
  1.1169 -            fflush (stdout);
  1.1170 +            fflush(stdout);
  1.1171              printf
  1.1172                  ("[PMThreadFunc] : Brute force mode. :) Killing process! Dieeeee...\n");
  1.1173 -            fflush (stdout);
  1.1174 +            fflush(stdout);
  1.1175  #endif
  1.1176 -            DosExit (EXIT_PROCESS, -1);
  1.1177 +            DosExit(EXIT_PROCESS, -1);
  1.1178          }
  1.1179      }
  1.1180 -    _endthread ();
  1.1181 +    _endthread();
  1.1182  }
  1.1183  
  1.1184  struct WMcursor
  1.1185 @@ -1366,25 +1361,25 @@
  1.1186  
  1.1187  /* Free a window manager cursor */
  1.1188  void
  1.1189 -os2fslib_FreeWMCursor (_THIS, WMcursor * cursor)
  1.1190 +os2fslib_FreeWMCursor(_THIS, WMcursor * cursor)
  1.1191  {
  1.1192      if (cursor) {
  1.1193 -        GpiDeleteBitmap (cursor->hbm);
  1.1194 -        WinDestroyPointer (cursor->hptr);
  1.1195 -        SDL_free (cursor->pchData);
  1.1196 -        SDL_free (cursor);
  1.1197 +        GpiDeleteBitmap(cursor->hbm);
  1.1198 +        WinDestroyPointer(cursor->hptr);
  1.1199 +        SDL_free(cursor->pchData);
  1.1200 +        SDL_free(cursor);
  1.1201      }
  1.1202  }
  1.1203  
  1.1204  /* Local functions to convert the SDL cursor mask into OS/2 format */
  1.1205  static void
  1.1206 -memnot (Uint8 * dst, Uint8 * src, int len)
  1.1207 +memnot(Uint8 * dst, Uint8 * src, int len)
  1.1208  {
  1.1209      while (len-- > 0)
  1.1210          *dst++ = ~*src++;
  1.1211  }
  1.1212  static void
  1.1213 -memxor (Uint8 * dst, Uint8 * src1, Uint8 * src2, int len)
  1.1214 +memxor(Uint8 * dst, Uint8 * src1, Uint8 * src2, int len)
  1.1215  {
  1.1216      while (len-- > 0)
  1.1217          *dst++ = (*src1++) ^ (*src2++);
  1.1218 @@ -1392,8 +1387,8 @@
  1.1219  
  1.1220  /* Create a black/white window manager cursor */
  1.1221  WMcursor *
  1.1222 -os2fslib_CreateWMCursor_Win (_THIS, Uint8 * data, Uint8 * mask,
  1.1223 -                             int w, int h, int hot_x, int hot_y)
  1.1224 +os2fslib_CreateWMCursor_Win(_THIS, Uint8 * data, Uint8 * mask,
  1.1225 +                            int w, int h, int hot_x, int hot_y)
  1.1226  {
  1.1227      HPOINTER hptr;
  1.1228      HBITMAP hbm;
  1.1229 @@ -1406,28 +1401,28 @@
  1.1230      int i, run, pad;
  1.1231      WMcursor *pResult;
  1.1232  
  1.1233 -    maxx = WinQuerySysValue (HWND_DESKTOP, SV_CXPOINTER);
  1.1234 -    maxy = WinQuerySysValue (HWND_DESKTOP, SV_CYPOINTER);
  1.1235 +    maxx = WinQuerySysValue(HWND_DESKTOP, SV_CXPOINTER);
  1.1236 +    maxy = WinQuerySysValue(HWND_DESKTOP, SV_CYPOINTER);
  1.1237  
  1.1238      // Check for max size!
  1.1239      if ((w > maxx) || (h > maxy))
  1.1240          return (WMcursor *) NULL;
  1.1241  
  1.1242 -    pResult = (WMcursor *) SDL_malloc (sizeof (WMcursor));
  1.1243 +    pResult = (WMcursor *) SDL_malloc(sizeof(WMcursor));
  1.1244      if (!pResult)
  1.1245          return (WMcursor *) NULL;
  1.1246  
  1.1247 -    pchTemp = (char *) SDL_malloc ((maxx + 7) / 8 * maxy * 2);
  1.1248 +    pchTemp = (char *) SDL_malloc((maxx + 7) / 8 * maxy * 2);
  1.1249      if (!pchTemp) {
  1.1250 -        SDL_free (pResult);
  1.1251 +        SDL_free(pResult);
  1.1252          return (WMcursor *) NULL;
  1.1253      }
  1.1254  
  1.1255 -    SDL_memset (pchTemp, 0, (maxx + 7) / 8 * maxy * 2);
  1.1256 -
  1.1257 -    hps = WinGetPS (_this->hidden->hwndClient);
  1.1258 -
  1.1259 -    bmi.cbFix = sizeof (BITMAPINFOHEADER);
  1.1260 +    SDL_memset(pchTemp, 0, (maxx + 7) / 8 * maxy * 2);
  1.1261 +
  1.1262 +    hps = WinGetPS(_this->hidden->hwndClient);
  1.1263 +
  1.1264 +    bmi.cbFix = sizeof(BITMAPINFOHEADER);
  1.1265      bmi.cx = maxx;
  1.1266      bmi.cy = 2 * maxy;
  1.1267      bmi.cPlanes = 1;
  1.1268 @@ -1439,8 +1434,8 @@
  1.1269      bmi.argbColor[1].bGreen = 0x00;
  1.1270      bmi.argbColor[1].bRed = 0xff;
  1.1271  
  1.1272 -    SDL_memset (&bmih, 0, sizeof (BITMAPINFOHEADER));
  1.1273 -    bmih.cbFix = sizeof (BITMAPINFOHEADER);
  1.1274 +    SDL_memset(&bmih, 0, sizeof(BITMAPINFOHEADER));
  1.1275 +    bmih.cbFix = sizeof(BITMAPINFOHEADER);
  1.1276      bmih.cx = maxx;
  1.1277      bmih.cy = 2 * maxy;
  1.1278      bmih.cPlanes = 1;
  1.1279 @@ -1452,15 +1447,15 @@
  1.1280      for (i = 0; i < h; i++) {
  1.1281          xptr = pchTemp + (maxx + 7) / 8 * (maxy - 1 - i);
  1.1282          aptr = pchTemp + (maxx + 7) / 8 * (maxy + maxy - 1 - i);
  1.1283 -        memxor (xptr, data, mask, run);
  1.1284 +        memxor(xptr, data, mask, run);
  1.1285          xptr += run;
  1.1286          data += run;
  1.1287 -        memnot (aptr, mask, run);
  1.1288 +        memnot(aptr, mask, run);
  1.1289          mask += run;
  1.1290          aptr += run;
  1.1291 -        SDL_memset (xptr, 0, pad);
  1.1292 +        SDL_memset(xptr, 0, pad);
  1.1293          xptr += pad;
  1.1294 -        SDL_memset (aptr, ~0, pad);
  1.1295 +        SDL_memset(aptr, ~0, pad);
  1.1296          aptr += pad;
  1.1297      }
  1.1298      pad += run;
  1.1299 @@ -1468,30 +1463,29 @@
  1.1300          xptr = pchTemp + (maxx + 7) / 8 * (maxy - 1 - i);
  1.1301          aptr = pchTemp + (maxx + 7) / 8 * (maxy + maxy - 1 - i);
  1.1302  
  1.1303 -        SDL_memset (xptr, 0, (maxx + 7) / 8);
  1.1304 +        SDL_memset(xptr, 0, (maxx + 7) / 8);
  1.1305          xptr += (maxx + 7) / 8;
  1.1306 -        SDL_memset (aptr, ~0, (maxx + 7) / 8);
  1.1307 +        SDL_memset(aptr, ~0, (maxx + 7) / 8);
  1.1308          aptr += (maxx + 7) / 8;
  1.1309      }
  1.1310  
  1.1311      hbm =
  1.1312 -        GpiCreateBitmap (hps, (PBITMAPINFOHEADER2) & bmih, CBM_INIT,
  1.1313 -                         (PBYTE) pchTemp, (PBITMAPINFO2) & bmi);
  1.1314 -    hptr =
  1.1315 -        WinCreatePointer (HWND_DESKTOP, hbm, TRUE, hot_x, maxy - hot_y - 1);
  1.1316 +        GpiCreateBitmap(hps, (PBITMAPINFOHEADER2) & bmih, CBM_INIT,
  1.1317 +                        (PBYTE) pchTemp, (PBITMAPINFO2) & bmi);
  1.1318 +    hptr = WinCreatePointer(HWND_DESKTOP, hbm, TRUE, hot_x, maxy - hot_y - 1);
  1.1319  
  1.1320  #ifdef DEBUG_BUILD
  1.1321 -    printf ("HotSpot          : %d ; %d\n", hot_x, hot_y);
  1.1322 -    printf ("HPS returned     : %x\n", (ULONG) hps);
  1.1323 -    printf ("HBITMAP returned : %x\n", (ULONG) hbm);
  1.1324 -    printf ("HPOINTER returned: %x\n", (ULONG) hptr);
  1.1325 +    printf("HotSpot          : %d ; %d\n", hot_x, hot_y);
  1.1326 +    printf("HPS returned     : %x\n", (ULONG) hps);
  1.1327 +    printf("HBITMAP returned : %x\n", (ULONG) hbm);
  1.1328 +    printf("HPOINTER returned: %x\n", (ULONG) hptr);
  1.1329  #endif
  1.1330  
  1.1331 -    WinReleasePS (hps);
  1.1332 +    WinReleasePS(hps);
  1.1333  
  1.1334  #ifdef DEBUG_BUILD
  1.1335 -    printf ("[CreateWMCursor] : ptr = %p\n", hptr);
  1.1336 -    fflush (stdout);
  1.1337 +    printf("[CreateWMCursor] : ptr = %p\n", hptr);
  1.1338 +    fflush(stdout);
  1.1339  #endif
  1.1340  
  1.1341      pResult->hptr = hptr;
  1.1342 @@ -1499,20 +1493,20 @@
  1.1343      pResult->pchData = pchTemp;
  1.1344  
  1.1345  #ifdef DEBUG_BUILD
  1.1346 -    printf ("[CreateWMCursor] : ptr = %p return.\n", hptr);
  1.1347 -    fflush (stdout);
  1.1348 +    printf("[CreateWMCursor] : ptr = %p return.\n", hptr);
  1.1349 +    fflush(stdout);
  1.1350  #endif
  1.1351  
  1.1352      return (WMcursor *) pResult;
  1.1353  }
  1.1354  
  1.1355  WMcursor *
  1.1356 -os2fslib_CreateWMCursor_FS (_THIS, Uint8 * data, Uint8 * mask,
  1.1357 -                            int w, int h, int hot_x, int hot_y)
  1.1358 +os2fslib_CreateWMCursor_FS(_THIS, Uint8 * data, Uint8 * mask,
  1.1359 +                           int w, int h, int hot_x, int hot_y)
  1.1360  {
  1.1361  #ifdef DEBUG_BUILD
  1.1362 -    printf ("[CreateWMCursor_FS] : returning pointer NULL\n");
  1.1363 -    fflush (stdout);
  1.1364 +    printf("[CreateWMCursor_FS] : returning pointer NULL\n");
  1.1365 +    fflush(stdout);
  1.1366  #endif
  1.1367  
  1.1368      // In FS mode we'll use software cursor
  1.1369 @@ -1521,26 +1515,26 @@
  1.1370  
  1.1371  /* Show the specified cursor, or hide if cursor is NULL */
  1.1372  int
  1.1373 -os2fslib_ShowWMCursor (_THIS, WMcursor * cursor)
  1.1374 +os2fslib_ShowWMCursor(_THIS, WMcursor * cursor)
  1.1375  {
  1.1376  #ifdef DEBUG_BUILD
  1.1377 -    printf ("[ShowWMCursor] : ptr = %p\n", cursor);
  1.1378 -    fflush (stdout);
  1.1379 +    printf("[ShowWMCursor] : ptr = %p\n", cursor);
  1.1380 +    fflush(stdout);
  1.1381  #endif
  1.1382  
  1.1383      if (cursor) {
  1.1384 -        WinSetPointer (HWND_DESKTOP, cursor->hptr);
  1.1385 +        WinSetPointer(HWND_DESKTOP, cursor->hptr);
  1.1386          hptrGlobalPointer = cursor->hptr;
  1.1387          _this->hidden->iMouseVisible = 1;
  1.1388      } else {
  1.1389 -        WinSetPointer (HWND_DESKTOP, FALSE);
  1.1390 +        WinSetPointer(HWND_DESKTOP, FALSE);
  1.1391          hptrGlobalPointer = NULL;
  1.1392          _this->hidden->iMouseVisible = 0;
  1.1393      }
  1.1394  
  1.1395  #ifdef DEBUG_BUILD
  1.1396 -    printf ("[ShowWMCursor] : ptr = %p, DONE\n", cursor);
  1.1397 -    fflush (stdout);
  1.1398 +    printf("[ShowWMCursor] : ptr = %p, DONE\n", cursor);
  1.1399 +    fflush(stdout);
  1.1400  #endif
  1.1401  
  1.1402      return 1;
  1.1403 @@ -1550,32 +1544,31 @@
  1.1404   If NULL, a mouse motion event is posted internally.
  1.1405   */
  1.1406  void
  1.1407 -os2fslib_WarpWMCursor (_THIS, Uint16 x, Uint16 y)
  1.1408 +os2fslib_WarpWMCursor(_THIS, Uint16 x, Uint16 y)
  1.1409  {
  1.1410      LONG lx, ly;
  1.1411      SWP swpClient;
  1.1412      POINTL ptlPoints;
  1.1413 -    WinQueryWindowPos (_this->hidden->hwndClient, &swpClient);
  1.1414 +    WinQueryWindowPos(_this->hidden->hwndClient, &swpClient);
  1.1415      ptlPoints.x = swpClient.x;
  1.1416      ptlPoints.y = swpClient.y;
  1.1417 -    WinMapWindowPoints (_this->hidden->hwndFrame, HWND_DESKTOP, &ptlPoints,
  1.1418 -                        1);
  1.1419 +    WinMapWindowPoints(_this->hidden->hwndFrame, HWND_DESKTOP, &ptlPoints, 1);
  1.1420      lx = ptlPoints.x +
  1.1421          (x * swpClient.cx) / _this->hidden->SrcBufferDesc.uiXResolution;
  1.1422      ly = ptlPoints.y + swpClient.cy -
  1.1423          ((y * swpClient.cy) / _this->hidden->SrcBufferDesc.uiYResolution) - 1;
  1.1424  
  1.1425 -    SDL_PrivateMouseMotion (0,  // Buttons not changed
  1.1426 -                            0,  // Absolute position
  1.1427 -                            x, y);
  1.1428 -
  1.1429 -    WinSetPointerPos (HWND_DESKTOP, lx, ly);
  1.1430 +    SDL_PrivateMouseMotion(0,   // Buttons not changed
  1.1431 +                           0,   // Absolute position
  1.1432 +                           x, y);
  1.1433 +
  1.1434 +    WinSetPointerPos(HWND_DESKTOP, lx, ly);
  1.1435  
  1.1436  }
  1.1437  
  1.1438  /* If not NULL, this is called when a mouse motion event occurs */
  1.1439  void
  1.1440 -os2fslib_MoveWMCursor (_THIS, int x, int y)
  1.1441 +os2fslib_MoveWMCursor(_THIS, int x, int y)
  1.1442  {
  1.1443      /*
  1.1444         SDL_Rect rect;
  1.1445 @@ -1601,12 +1594,12 @@
  1.1446   in higher accuracy sampling of the pointer motion.
  1.1447   */
  1.1448  void
  1.1449 -os2fslib_CheckMouseMode (_THIS)
  1.1450 +os2fslib_CheckMouseMode(_THIS)
  1.1451  {
  1.1452  }
  1.1453  
  1.1454  static void
  1.1455 -os2fslib_PumpEvents (_THIS)
  1.1456 +os2fslib_PumpEvents(_THIS)
  1.1457  {
  1.1458      // Notify SDL that if window has been resized!
  1.1459      if ((_this->hidden->pSDLSurface) &&
  1.1460 @@ -1617,8 +1610,8 @@
  1.1461          static time_t prev_time;
  1.1462          time_t curr_time;
  1.1463  
  1.1464 -        curr_time = time (NULL);
  1.1465 -        if ((difftime (curr_time, prev_time) >= 0.25) || (bWindowResized)) {
  1.1466 +        curr_time = time(NULL);
  1.1467 +        if ((difftime(curr_time, prev_time) >= 0.25) || (bWindowResized)) {
  1.1468              // Make sure we won't flood the event queue with resize events,
  1.1469              // only send them at 250 msecs!
  1.1470              // (or when the window is resized)
  1.1471 @@ -1626,10 +1619,10 @@
  1.1472              printf
  1.1473                  ("[os2fslib_PumpEvents] : Calling PrivateResize (%d %d).\n",
  1.1474                   iWindowSizeX, iWindowSizeY);
  1.1475 -            fflush (stdout);
  1.1476 +            fflush(stdout);
  1.1477  #endif
  1.1478              // Tell SDL the new size
  1.1479 -            SDL_PrivateResize (iWindowSizeX, iWindowSizeY);
  1.1480 +            SDL_PrivateResize(iWindowSizeX, iWindowSizeY);
  1.1481              prev_time = curr_time;
  1.1482              bWindowResized = 0;
  1.1483          }
  1.1484 @@ -1638,53 +1631,53 @@
  1.1485  
  1.1486  /* We don't actually allow hardware surfaces other than the main one */
  1.1487  static int
  1.1488 -os2fslib_AllocHWSurface (_THIS, SDL_Surface * surface)
  1.1489 +os2fslib_AllocHWSurface(_THIS, SDL_Surface * surface)
  1.1490  {
  1.1491      return (-1);
  1.1492  }
  1.1493  static void
  1.1494 -os2fslib_FreeHWSurface (_THIS, SDL_Surface * surface)
  1.1495 +os2fslib_FreeHWSurface(_THIS, SDL_Surface * surface)
  1.1496  {
  1.1497      return;
  1.1498  }
  1.1499  
  1.1500  /* We need to wait for vertical retrace on page flipped displays */
  1.1501  static int
  1.1502 -os2fslib_LockHWSurface (_THIS, SDL_Surface * surface)
  1.1503 +os2fslib_LockHWSurface(_THIS, SDL_Surface * surface)
  1.1504  {
  1.1505      return (0);
  1.1506  }
  1.1507  
  1.1508  static void
  1.1509 -os2fslib_UnlockHWSurface (_THIS, SDL_Surface * surface)
  1.1510 +os2fslib_UnlockHWSurface(_THIS, SDL_Surface * surface)
  1.1511  {
  1.1512      return;
  1.1513  }
  1.1514  
  1.1515  static int
  1.1516 -os2fslib_SetColors (_THIS, int firstcolor, int ncolors, SDL_Color * colors)
  1.1517 +os2fslib_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color * colors)
  1.1518  {
  1.1519 -    printf ("[os2fslib_SetColors] : TODO!\n");
  1.1520 -    fflush (stdout);
  1.1521 +    printf("[os2fslib_SetColors] : TODO!\n");
  1.1522 +    fflush(stdout);
  1.1523      // TODO: Implement paletted modes
  1.1524      return (1);
  1.1525  }
  1.1526  
  1.1527  static void
  1.1528 -os2fslib_DestroyIcon (HWND hwndFrame)
  1.1529 +os2fslib_DestroyIcon(HWND hwndFrame)
  1.1530  {
  1.1531      if (hptrCurrentIcon) {
  1.1532 -        WinDestroyPointer (hptrCurrentIcon);
  1.1533 +        WinDestroyPointer(hptrCurrentIcon);
  1.1534          hptrCurrentIcon = NULL;
  1.1535  
  1.1536 -        WinSendMsg (hwndFrame, WM_SETICON, NULL, NULL);
  1.1537 +        WinSendMsg(hwndFrame, WM_SETICON, NULL, NULL);
  1.1538      }
  1.1539  
  1.1540  }
  1.1541  
  1.1542  /* Set the window icon image */
  1.1543  void
  1.1544 -os2fslib_SetIcon (_THIS, SDL_Surface * icon, Uint8 * mask)
  1.1545 +os2fslib_SetIcon(_THIS, SDL_Surface * icon, Uint8 * mask)
  1.1546  {
  1.1547      HWND hwndFrame;
  1.1548      SDL_Surface *icon_rgb;
  1.1549 @@ -1699,14 +1692,14 @@
  1.1550      SDL_Rect bounds;
  1.1551  
  1.1552  #ifdef DEBUG_BUILD
  1.1553 -    printf ("[os2fslib_SetIcon] : Creating and setting new icon\n");
  1.1554 -    fflush (stdout);
  1.1555 +    printf("[os2fslib_SetIcon] : Creating and setting new icon\n");
  1.1556 +    fflush(stdout);
  1.1557  #endif
  1.1558  
  1.1559 -    hwndFrame = WinQueryWindow (_this->hidden->hwndClient, QW_PARENT);
  1.1560 +    hwndFrame = WinQueryWindow(_this->hidden->hwndClient, QW_PARENT);
  1.1561  
  1.1562      // Make sure the old icon resource will be free'd!
  1.1563 -    os2fslib_DestroyIcon (hwndFrame);
  1.1564 +    os2fslib_DestroyIcon(hwndFrame);
  1.1565  
  1.1566      if ((!icon) || (!mask))
  1.1567          return;
  1.1568 @@ -1714,33 +1707,33 @@
  1.1569      w = icon->w;
  1.1570      h = icon->h;
  1.1571  
  1.1572 -    maxx = WinQuerySysValue (HWND_DESKTOP, SV_CXICON);
  1.1573 -    maxy = WinQuerySysValue (HWND_DESKTOP, SV_CYICON);
  1.1574 +    maxx = WinQuerySysValue(HWND_DESKTOP, SV_CXICON);
  1.1575 +    maxy = WinQuerySysValue(HWND_DESKTOP, SV_CYICON);
  1.1576  
  1.1577      // Check for max size!
  1.1578      if ((w > maxx) || (h > maxy))
  1.1579          return;
  1.1580  
  1.1581 -    pchTemp = (char *) SDL_malloc (w * h * 2 * 4);
  1.1582 +    pchTemp = (char *) SDL_malloc(w * h * 2 * 4);
  1.1583      if (!pchTemp)
  1.1584          return;
  1.1585  
  1.1586 -    SDL_memset (pchTemp, 0, w * h * 2 * 4);
  1.1587 +    SDL_memset(pchTemp, 0, w * h * 2 * 4);
  1.1588  
  1.1589      // Convert surface to RGB, if it's not RGB yet!
  1.1590 -    icon_rgb = SDL_CreateRGBSurface (SDL_SWSURFACE, icon->w, icon->h,
  1.1591 -                                     32, 0, 0, 0, 0);
  1.1592 +    icon_rgb = SDL_CreateRGBSurface(SDL_SWSURFACE, icon->w, icon->h,
  1.1593 +                                    32, 0, 0, 0, 0);
  1.1594      if (icon_rgb == NULL) {
  1.1595 -        SDL_free (pchTemp);
  1.1596 +        SDL_free(pchTemp);
  1.1597          return;
  1.1598      }
  1.1599      bounds.x = 0;
  1.1600      bounds.y = 0;
  1.1601      bounds.w = icon->w;
  1.1602      bounds.h = icon->h;
  1.1603 -    if (SDL_LowerBlit (icon, &bounds, icon_rgb, &bounds) < 0) {
  1.1604 -        SDL_FreeSurface (icon_rgb);
  1.1605 -        SDL_free (pchTemp);
  1.1606 +    if (SDL_LowerBlit(icon, &bounds, icon_rgb, &bounds) < 0) {
  1.1607 +        SDL_FreeSurface(icon_rgb);
  1.1608 +        SDL_free(pchTemp);
  1.1609          return;
  1.1610      }
  1.1611  
  1.1612 @@ -1797,35 +1790,35 @@
  1.1613      }
  1.1614  
  1.1615      // There is no more need for the RGB surface
  1.1616 -    SDL_FreeSurface (icon_rgb);
  1.1617 -
  1.1618 -    hps = WinGetPS (_this->hidden->hwndClient);
  1.1619 -
  1.1620 -    bmi.cbFix = sizeof (BITMAPINFOHEADER);
  1.1621 +    SDL_FreeSurface(icon_rgb);
  1.1622 +
  1.1623 +    hps = WinGetPS(_this->hidden->hwndClient);
  1.1624 +
  1.1625 +    bmi.cbFix = sizeof(BITMAPINFOHEADER);
  1.1626      bmi.cx = w;
  1.1627      bmi.cy = 2 * h;
  1.1628      bmi.cPlanes = 1;
  1.1629      bmi.cBitCount = 32;
  1.1630  
  1.1631 -    SDL_memset (&bmih, 0, sizeof (BITMAPINFOHEADER));
  1.1632 -    bmih.cbFix = sizeof (BITMAPINFOHEADER);
  1.1633 +    SDL_memset(&bmih, 0, sizeof(BITMAPINFOHEADER));
  1.1634 +    bmih.cbFix = sizeof(BITMAPINFOHEADER);
  1.1635      bmih.cx = w;
  1.1636      bmih.cy = 2 * h;
  1.1637      bmih.cPlanes = 1;
  1.1638      bmih.cBitCount = 32;
  1.1639  
  1.1640      hbm =
  1.1641 -        GpiCreateBitmap (hps, (PBITMAPINFOHEADER2) & bmih, CBM_INIT,
  1.1642 -                         (PBYTE) pchTemp, (PBITMAPINFO2) & bmi);
  1.1643 -    hptrIcon = WinCreatePointer (HWND_DESKTOP, hbm, FALSE, 0, 0);
  1.1644 -
  1.1645 -    WinReleasePS (hps);
  1.1646 +        GpiCreateBitmap(hps, (PBITMAPINFOHEADER2) & bmih, CBM_INIT,
  1.1647 +                        (PBYTE) pchTemp, (PBITMAPINFO2) & bmi);
  1.1648 +    hptrIcon = WinCreatePointer(HWND_DESKTOP, hbm, FALSE, 0, 0);
  1.1649 +
  1.1650 +    WinReleasePS(hps);
  1.1651  
  1.1652      // Free pixel array
  1.1653 -    SDL_free (pchTemp);
  1.1654 +    SDL_free(pchTemp);
  1.1655  
  1.1656      // Change icon in frame window
  1.1657 -    WinSendMsg (hwndFrame, WM_SETICON, (MPARAM) hptrIcon, NULL);
  1.1658 +    WinSendMsg(hwndFrame, WM_SETICON, (MPARAM) hptrIcon, NULL);
  1.1659  
  1.1660      /*
  1.1661         // Change icon in switchlist
  1.1662 @@ -1853,7 +1846,7 @@
  1.1663  
  1.1664  
  1.1665  static void
  1.1666 -os2fslib_SetCursorManagementFunctions (_THIS, int iForWindowedMode)
  1.1667 +os2fslib_SetCursorManagementFunctions(_THIS, int iForWindowedMode)
  1.1668  {
  1.1669      if (iForWindowedMode) {
  1.1670          _this->FreeWMCursor = os2fslib_FreeWMCursor;
  1.1671 @@ -1874,7 +1867,7 @@
  1.1672  }
  1.1673  
  1.1674  static void
  1.1675 -os2fslib_InitOSKeymap (_THIS)
  1.1676 +os2fslib_InitOSKeymap(_THIS)
  1.1677  {
  1.1678      int i;
  1.1679  
  1.1680 @@ -2008,7 +2001,7 @@
  1.1681   window was actually iconified, it returns 0 otherwise.
  1.1682   */
  1.1683  int
  1.1684 -os2fslib_IconifyWindow (_THIS)
  1.1685 +os2fslib_IconifyWindow(_THIS)
  1.1686  {
  1.1687      HAB hab;
  1.1688      HMQ hmq;
  1.1689 @@ -2019,28 +2012,28 @@
  1.1690          return 0;
  1.1691  
  1.1692      // Cannot do anything in fullscreen mode!
  1.1693 -    if (FSLib_QueryFSMode (_this->hidden->hwndClient))
  1.1694 +    if (FSLib_QueryFSMode(_this->hidden->hwndClient))
  1.1695          return 0;
  1.1696  
  1.1697      // Make sure this thread is prepared for using the Presentation Manager!
  1.1698 -    hab = WinInitialize (0);
  1.1699 -    hmq = WinCreateMsgQueue (hab, 0);
  1.1700 +    hab = WinInitialize(0);
  1.1701 +    hmq = WinCreateMsgQueue(hab, 0);
  1.1702      // Remember if there was an error at WinCreateMsgQueue(), because we don't
  1.1703      // want to destroy somebody else's queue later. :)
  1.1704 -    hmqerror = WinGetLastError (hab);
  1.1705 -
  1.1706 -    WinSetWindowPos (_this->hidden->hwndFrame, HWND_TOP,
  1.1707 -                     0, 0, 0, 0, SWP_MINIMIZE);
  1.1708 +    hmqerror = WinGetLastError(hab);
  1.1709 +
  1.1710 +    WinSetWindowPos(_this->hidden->hwndFrame, HWND_TOP,
  1.1711 +                    0, 0, 0, 0, SWP_MINIMIZE);
  1.1712  
  1.1713      // Now destroy the message queue, if we've created it!
  1.1714 -    if (ERRORIDERROR (hmqerror) == 0)
  1.1715 -        WinDestroyMsgQueue (hmq);
  1.1716 +    if (ERRORIDERROR(hmqerror) == 0)
  1.1717 +        WinDestroyMsgQueue(hmq);
  1.1718  
  1.1719      return 1;
  1.1720  }
  1.1721  
  1.1722  static SDL_GrabMode
  1.1723 -os2fslib_GrabInput (_THIS, SDL_GrabMode mode)
  1.1724 +os2fslib_GrabInput(_THIS, SDL_GrabMode mode)
  1.1725  {
  1.1726      HAB hab;
  1.1727      HMQ hmq;
  1.1728 @@ -2052,63 +2045,63 @@
  1.1729          return SDL_GRAB_OFF;
  1.1730  
  1.1731      // Make sure this thread is prepared for using the Presentation Manager!
  1.1732 -    hab = WinInitialize (0);
  1.1733 -    hmq = WinCreateMsgQueue (hab, 0);
  1.1734 +    hab = WinInitialize(0);
  1.1735 +    hmq = WinCreateMsgQueue(hab, 0);
  1.1736      // Remember if there was an error at WinCreateMsgQueue(), because we don't
  1.1737      // want to destroy somebody else's queue later. :)
  1.1738 -    hmqerror = WinGetLastError (hab);
  1.1739 +    hmqerror = WinGetLastError(hab);
  1.1740  
  1.1741  
  1.1742      if (mode == SDL_GRAB_OFF) {
  1.1743  #ifdef DEBUG_BUILD
  1.1744 -        printf ("[os2fslib_GrabInput] : Releasing mouse\n");
  1.1745 -        fflush (stdout);
  1.1746 +        printf("[os2fslib_GrabInput] : Releasing mouse\n");
  1.1747 +        fflush(stdout);
  1.1748  #endif
  1.1749  
  1.1750          // Release the mouse
  1.1751          bMouseCapturable = 0;
  1.1752          if (bMouseCaptured) {
  1.1753 -            WinSetCapture (HWND_DESKTOP, NULLHANDLE);
  1.1754 +            WinSetCapture(HWND_DESKTOP, NULLHANDLE);
  1.1755              bMouseCaptured = 0;
  1.1756          }
  1.1757      } else {
  1.1758  #ifdef DEBUG_BUILD
  1.1759 -        printf ("[os2fslib_GrabInput] : Capturing mouse\n");
  1.1760 -        fflush (stdout);
  1.1761 +        printf("[os2fslib_GrabInput] : Capturing mouse\n");
  1.1762 +        fflush(stdout);
  1.1763  #endif
  1.1764  
  1.1765          // Capture the mouse
  1.1766          bMouseCapturable = 1;
  1.1767 -        if (WinQueryFocus (HWND_DESKTOP) == _this->hidden->hwndClient) {
  1.1768 -            WinSetCapture (HWND_DESKTOP, _this->hidden->hwndClient);
  1.1769 +        if (WinQueryFocus(HWND_DESKTOP) == _this->hidden->hwndClient) {
  1.1770 +            WinSetCapture(HWND_DESKTOP, _this->hidden->hwndClient);
  1.1771              bMouseCaptured = 1;
  1.1772              {
  1.1773                  SWP swpClient;
  1.1774                  POINTL ptl;
  1.1775                  // Center the mouse to the middle of the window!
  1.1776 -                WinQueryWindowPos (_this->hidden->hwndClient, &swpClient);
  1.1777 +                WinQueryWindowPos(_this->hidden->hwndClient, &swpClient);
  1.1778                  ptl.x = 0;
  1.1779                  ptl.y = 0;
  1.1780 -                WinMapWindowPoints (_this->hidden->hwndClient,
  1.1781 -                                    HWND_DESKTOP, &ptl, 1);
  1.1782 +                WinMapWindowPoints(_this->hidden->hwndClient,
  1.1783 +                                   HWND_DESKTOP, &ptl, 1);
  1.1784                  _this->hidden->iSkipWMMOUSEMOVE++;      /* Don't take next WM_MOUSEMOVE into account!  */
  1.1785 -                WinSetPointerPos (HWND_DESKTOP,
  1.1786 -                                  ptl.x + swpClient.cx / 2,
  1.1787 -                                  ptl.y + swpClient.cy / 2);
  1.1788 +                WinSetPointerPos(HWND_DESKTOP,
  1.1789 +                                 ptl.x + swpClient.cx / 2,
  1.1790 +                                 ptl.y + swpClient.cy / 2);
  1.1791              }
  1.1792          }
  1.1793      }
  1.1794  
  1.1795      // Now destroy the message queue, if we've created it!
  1.1796 -    if (ERRORIDERROR (hmqerror) == 0)
  1.1797 -        WinDestroyMsgQueue (hmq);
  1.1798 +    if (ERRORIDERROR(hmqerror) == 0)
  1.1799 +        WinDestroyMsgQueue(hmq);
  1.1800  
  1.1801      return mode;
  1.1802  }
  1.1803  
  1.1804  /* Set the title and icon text */
  1.1805  static void
  1.1806 -os2fslib_SetCaption (_THIS, const char *title, const char *icon)
  1.1807 +os2fslib_SetCaption(_THIS, const char *title, const char *icon)
  1.1808  {
  1.1809      HAB hab;
  1.1810      HMQ hmq;
  1.1811 @@ -2119,33 +2112,33 @@
  1.1812          return;
  1.1813  
  1.1814      // Make sure this thread is prepared for using the Presentation Manager!
  1.1815 -    hab = WinInitialize (0);
  1.1816 -    hmq = WinCreateMsgQueue (hab, 0);
  1.1817 +    hab = WinInitialize(0);
  1.1818 +    hmq = WinCreateMsgQueue(hab, 0);
  1.1819      // Remember if there was an error at WinCreateMsgQueue(), because we don't
  1.1820      // want to destroy somebody else's queue later. :)
  1.1821 -    hmqerror = WinGetLastError (hab);
  1.1822 -
  1.1823 -    WinSetWindowText (_this->hidden->hwndFrame, (char *) title);
  1.1824 +    hmqerror = WinGetLastError(hab);
  1.1825 +
  1.1826 +    WinSetWindowText(_this->hidden->hwndFrame, (char *) title);
  1.1827  
  1.1828      // Now destroy the message queue, if we've created it!
  1.1829 -    if (ERRORIDERROR (hmqerror) == 0)
  1.1830 -        WinDestroyMsgQueue (hmq);
  1.1831 +    if (ERRORIDERROR(hmqerror) == 0)
  1.1832 +        WinDestroyMsgQueue(hmq);
  1.1833  }
  1.1834  
  1.1835  static int
  1.1836 -os2fslib_ToggleFullScreen (_THIS, int on)
  1.1837 +os2fslib_ToggleFullScreen(_THIS, int on)
  1.1838  {
  1.1839  #ifdef DEBUG_BUILD
  1.1840 -    printf ("[os2fslib_ToggleFullScreen] : %d\n", on);
  1.1841 -    fflush (stdout);
  1.1842 +    printf("[os2fslib_ToggleFullScreen] : %d\n", on);
  1.1843 +    fflush(stdout);
  1.1844  #endif
  1.1845      // If there is no more window, nothing we can do!
  1.1846      if (_this->hidden->iPMThreadStatus != 1)
  1.1847          return 0;
  1.1848  
  1.1849 -    FSLib_ToggleFSMode (_this->hidden->hwndClient, on);
  1.1850 +    FSLib_ToggleFSMode(_this->hidden->hwndClient, on);
  1.1851      /* Cursor manager functions to Windowed/FS mode */
  1.1852 -    os2fslib_SetCursorManagementFunctions (_this, !on);
  1.1853 +    os2fslib_SetCursorManagementFunctions(_this, !on);
  1.1854      return 1;
  1.1855  }
  1.1856  
  1.1857 @@ -2154,7 +2147,7 @@
  1.1858   properly represent the current mouse focus and position.
  1.1859   */
  1.1860  static void
  1.1861 -os2fslib_UpdateMouse (_THIS)
  1.1862 +os2fslib_UpdateMouse(_THIS)
  1.1863  {
  1.1864      POINTL ptl;
  1.1865      HAB hab;
  1.1866 @@ -2168,40 +2161,40 @@
  1.1867  
  1.1868  
  1.1869      // Make sure this thread is prepared for using the Presentation Manager!
  1.1870 -    hab = WinInitialize (0);
  1.1871 -    hmq = WinCreateMsgQueue (hab, 0);
  1.1872 +    hab = WinInitialize(0);
  1.1873 +    hmq = WinCreateMsgQueue(hab, 0);
  1.1874      // Remember if there was an error at WinCreateMsgQueue(), because we don't
  1.1875      // want to destroy somebody else's queue later. :)
  1.1876 -    hmqerror = WinGetLastError (hab);
  1.1877 +    hmqerror = WinGetLastError(hab);
  1.1878  
  1.1879  
  1.1880  
  1.1881      if (_this->hidden->fInFocus) {
  1.1882          // If our app is in focus
  1.1883 -        SDL_PrivateAppActive (1, SDL_APPMOUSEFOCUS);
  1.1884 -        SDL_PrivateAppActive (1, SDL_APPINPUTFOCUS);
  1.1885 -        SDL_PrivateAppActive (1, SDL_APPACTIVE);
  1.1886 -        WinQueryPointerPos (HWND_DESKTOP, &ptl);
  1.1887 -        WinMapWindowPoints (HWND_DESKTOP, _this->hidden->hwndClient, &ptl, 1);
  1.1888 -        WinQueryWindowPos (_this->hidden->hwndClient, &swpClient);
  1.1889 +        SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS);
  1.1890 +        SDL_PrivateAppActive(1, SDL_APPINPUTFOCUS);
  1.1891 +        SDL_PrivateAppActive(1, SDL_APPACTIVE);
  1.1892 +        WinQueryPointerPos(HWND_DESKTOP, &ptl);
  1.1893 +        WinMapWindowPoints(HWND_DESKTOP, _this->hidden->hwndClient, &ptl, 1);
  1.1894 +        WinQueryWindowPos(_this->hidden->hwndClient, &swpClient);
  1.1895          // Convert OS/2 mouse position to SDL position, and also scale it!
  1.1896          ptl.x =
  1.1897              ptl.x * _this->hidden->SrcBufferDesc.uiXResolution / swpClient.cx;
  1.1898          ptl.y =
  1.1899              ptl.y * _this->hidden->SrcBufferDesc.uiYResolution / swpClient.cy;
  1.1900          ptl.y = _this->hidden->SrcBufferDesc.uiYResolution - ptl.y - 1;
  1.1901 -        SDL_PrivateMouseMotion (0, 0, (Sint16) (ptl.x), (Sint16) (ptl.y));
  1.1902 +        SDL_PrivateMouseMotion(0, 0, (Sint16) (ptl.x), (Sint16) (ptl.y));
  1.1903      } else {
  1.1904          // If we're not in focus
  1.1905 -        SDL_PrivateAppActive (0, SDL_APPMOUSEFOCUS);
  1.1906 -        SDL_PrivateAppActive (0, SDL_APPINPUTFOCUS);
  1.1907 -        SDL_PrivateAppActive (0, SDL_APPACTIVE);
  1.1908 -        SDL_PrivateMouseMotion (0, 0, (Sint16) - 1, (Sint16) - 1);
  1.1909 +        SDL_PrivateAppActive(0, SDL_APPMOUSEFOCUS);
  1.1910 +        SDL_PrivateAppActive(0, SDL_APPINPUTFOCUS);
  1.1911 +        SDL_PrivateAppActive(0, SDL_APPACTIVE);
  1.1912 +        SDL_PrivateMouseMotion(0, 0, (Sint16) - 1, (Sint16) - 1);
  1.1913      }
  1.1914  
  1.1915      // Now destroy the message queue, if we've created it!
  1.1916 -    if (ERRORIDERROR (hmqerror) == 0)
  1.1917 -        WinDestroyMsgQueue (hmq);
  1.1918 +    if (ERRORIDERROR(hmqerror) == 0)
  1.1919 +        WinDestroyMsgQueue(hmq);
  1.1920  
  1.1921  }
  1.1922  
  1.1923 @@ -2209,15 +2202,15 @@
  1.1924   point to an appropriate update function for the current video mode
  1.1925   */
  1.1926  static void
  1.1927 -os2fslib_UpdateRects (_THIS, int numrects, SDL_Rect * rects)
  1.1928 +os2fslib_UpdateRects(_THIS, int numrects, SDL_Rect * rects)
  1.1929  {
  1.1930      // If there is no more window, nothing we can do!
  1.1931      if (_this->hidden->iPMThreadStatus != 1)
  1.1932          return;
  1.1933  
  1.1934  #ifdef BITBLT_IN_WINMESSAGEPROC
  1.1935 -    WinSendMsg (_this->hidden->hwndClient,
  1.1936 -                WM_UPDATERECTSREQUEST, (MPARAM) numrects, (MPARAM) rects);
  1.1937 +    WinSendMsg(_this->hidden->hwndClient,
  1.1938 +               WM_UPDATERECTSREQUEST, (MPARAM) numrects, (MPARAM) rects);
  1.1939  #else
  1.1940      if (DosRequestMutexSem
  1.1941          (_this->hidden->hmtxUseSrcBuffer, SEM_INDEFINITE_WAIT) == NO_ERROR) {
  1.1942 @@ -2229,17 +2222,17 @@
  1.1943              // But only blit if the window is not resizable, or if
  1.1944              // the window is resizable and the source buffer size is the
  1.1945              // same as the destination buffer size!
  1.1946 -            WinQueryWindowPos (_this->hidden->hwndClient, &swp);
  1.1947 +            WinQueryWindowPos(_this->hidden->hwndClient, &swp);
  1.1948              if ((_this->hidden->pSDLSurface) &&
  1.1949                  (_this->hidden->pSDLSurface->flags & SDL_RESIZABLE) &&
  1.1950                  ((swp.cx != _this->hidden->SrcBufferDesc.uiXResolution) ||
  1.1951                   (swp.cy != _this->hidden->SrcBufferDesc.uiYResolution))
  1.1952 -                && (!FSLib_QueryFSMode (_this->hidden->hwndClient))) {
  1.1953 +                && (!FSLib_QueryFSMode(_this->hidden->hwndClient))) {
  1.1954                  // Resizable surface and in resizing!
  1.1955                  // So, don't blit now!
  1.1956  #ifdef DEBUG_BUILD
  1.1957 -                printf ("[UpdateRects] : Skipping blit while resizing!\n");
  1.1958 -                fflush (stdout);
  1.1959 +                printf("[UpdateRects] : Skipping blit while resizing!\n");
  1.1960 +                fflush(stdout);
  1.1961  #endif
  1.1962              } else
  1.1963  #endif
  1.1964 @@ -2252,29 +2245,29 @@
  1.1965                     _this->hidden->SrcBufferDesc.uiYResolution);
  1.1966                   */
  1.1967  #ifdef DEBUG_BUILD
  1.1968 -                printf ("[os2fslib_UpdateRects] : Blitting!\n");
  1.1969 -                fflush (stdout);
  1.1970 +                printf("[os2fslib_UpdateRects] : Blitting!\n");
  1.1971 +                fflush(stdout);
  1.1972  #endif
  1.1973  
  1.1974                  // Blit the changed areas
  1.1975                  for (i = 0; i < numrects; i++)
  1.1976 -                    FSLIB_BITBLT (_this->hidden->hwndClient,
  1.1977 -                                  _this->hidden->pchSrcBuffer,
  1.1978 -                                  rects[i].y, rects[i].x, rects[i].w,
  1.1979 -                                  rects[i].h);
  1.1980 +                    FSLIB_BITBLT(_this->hidden->hwndClient,
  1.1981 +                                 _this->hidden->pchSrcBuffer,
  1.1982 +                                 rects[i].y, rects[i].x, rects[i].w,
  1.1983 +                                 rects[i].h);
  1.1984              }
  1.1985          }
  1.1986  #ifdef DEBUG_BUILD
  1.1987          else
  1.1988 -            printf ("[os2fslib_UpdateRects] : No public surface!\n");
  1.1989 -        fflush (stdout);
  1.1990 +            printf("[os2fslib_UpdateRects] : No public surface!\n");
  1.1991 +        fflush(stdout);
  1.1992  #endif
  1.1993 -        DosReleaseMutexSem (_this->hidden->hmtxUseSrcBuffer);
  1.1994 +        DosReleaseMutexSem(_this->hidden->hmtxUseSrcBuffer);
  1.1995      }
  1.1996  #ifdef DEBUG_BUILD
  1.1997      else
  1.1998 -        printf ("[os2fslib_UpdateRects] : Error in mutex!\n");
  1.1999 -    fflush (stdout);
  1.2000 +        printf("[os2fslib_UpdateRects] : Error in mutex!\n");
  1.2001 +    fflush(stdout);
  1.2002  #endif
  1.2003  #endif
  1.2004  }
  1.2005 @@ -2284,54 +2277,53 @@
  1.2006   or if the application is shutting down the video subsystem.
  1.2007   */
  1.2008  static void
  1.2009 -os2fslib_VideoQuit (_THIS)
  1.2010 +os2fslib_VideoQuit(_THIS)
  1.2011  {
  1.2012  #ifdef DEBUG_BUILD
  1.2013 -    printf ("[os2fslib_VideoQuit]\n");
  1.2014 -    fflush (stdout);
  1.2015 +    printf("[os2fslib_VideoQuit]\n");
  1.2016 +    fflush(stdout);
  1.2017  #endif
  1.2018      // Close PM stuff if running!
  1.2019      if (_this->hidden->iPMThreadStatus == 1) {
  1.2020          int iTimeout;
  1.2021 -        WinPostMsg (_this->hidden->hwndFrame, WM_QUIT, (MPARAM) 0,
  1.2022 -                    (MPARAM) 0);
  1.2023 +        WinPostMsg(_this->hidden->hwndFrame, WM_QUIT, (MPARAM) 0, (MPARAM) 0);
  1.2024          // HACK: We had this line before:
  1.2025          //DosWaitThread((TID *) &(_this->hidden->tidPMThread), DCWW_WAIT);
  1.2026          // We don't use it, because the PMThread will never stop, or if it stops,
  1.2027          // it will kill the whole process as a emergency fallback.
  1.2028          // So, we only check for the iPMThreadStatus stuff!
  1.2029  #ifdef DEBUG_BUILD
  1.2030 -        printf ("[os2fslib_VideoQuit] : Waiting for PM thread to die\n");
  1.2031 -        fflush (stdout);
  1.2032 +        printf("[os2fslib_VideoQuit] : Waiting for PM thread to die\n");
  1.2033 +        fflush(stdout);
  1.2034  #endif
  1.2035  
  1.2036          iTimeout = 0;
  1.2037          while ((_this->hidden->iPMThreadStatus == 1) && (iTimeout < 100)) {
  1.2038              iTimeout++;
  1.2039 -            DosSleep (64);
  1.2040 +            DosSleep(64);
  1.2041          }
  1.2042  
  1.2043  #ifdef DEBUG_BUILD
  1.2044 -        printf ("[os2fslib_VideoQuit] : End of wait.\n");
  1.2045 -        fflush (stdout);
  1.2046 +        printf("[os2fslib_VideoQuit] : End of wait.\n");
  1.2047 +        fflush(stdout);
  1.2048  #endif
  1.2049  
  1.2050          if (_this->hidden->iPMThreadStatus == 1) {
  1.2051  #ifdef DEBUG_BUILD
  1.2052 -            printf ("[os2fslib_VideoQuit] : Killing PM thread!\n");
  1.2053 -            fflush (stdout);
  1.2054 +            printf("[os2fslib_VideoQuit] : Killing PM thread!\n");
  1.2055 +            fflush(stdout);
  1.2056  #endif
  1.2057  
  1.2058              _this->hidden->iPMThreadStatus = 0;
  1.2059 -            DosKillThread (_this->hidden->tidPMThread);
  1.2060 +            DosKillThread(_this->hidden->tidPMThread);
  1.2061  
  1.2062              if (_this->hidden->hwndFrame) {
  1.2063  #ifdef DEBUG_BUILD
  1.2064 -                printf ("[os2fslib_VideoQuit] : Destroying PM window!\n");
  1.2065 -                fflush (stdout);
  1.2066 +                printf("[os2fslib_VideoQuit] : Destroying PM window!\n");
  1.2067 +                fflush(stdout);
  1.2068  #endif
  1.2069  
  1.2070 -                WinDestroyWindow (_this->hidden->hwndFrame);
  1.2071 +                WinDestroyWindow(_this->hidden->hwndFrame);
  1.2072                  _this->hidden->hwndFrame = NULL;
  1.2073              }
  1.2074          }
  1.2075 @@ -2340,17 +2332,17 @@
  1.2076      // Free result of an old ListModes() call, because there is
  1.2077      // no FreeListModes() call in SDL!
  1.2078      if (_this->hidden->pListModesResult) {
  1.2079 -        SDL_free (_this->hidden->pListModesResult);
  1.2080 +        SDL_free(_this->hidden->pListModesResult);
  1.2081          _this->hidden->pListModesResult = NULL;
  1.2082      }
  1.2083      // Free list of available fullscreen modes
  1.2084      if (_this->hidden->pAvailableFSLibVideoModes) {
  1.2085 -        FSLib_FreeVideoModeList (_this->hidden->pAvailableFSLibVideoModes);
  1.2086 +        FSLib_FreeVideoModeList(_this->hidden->pAvailableFSLibVideoModes);
  1.2087          _this->hidden->pAvailableFSLibVideoModes = NULL;
  1.2088      }
  1.2089      // Free application icon if we had one
  1.2090      if (hptrCurrentIcon) {
  1.2091 -        WinDestroyPointer (hptrCurrentIcon);
  1.2092 +        WinDestroyPointer(hptrCurrentIcon);
  1.2093          hptrCurrentIcon = NULL;
  1.2094      }
  1.2095  }
  1.2096 @@ -2364,8 +2356,8 @@
  1.2097   should take care of cleaning up the current mode.
  1.2098   */
  1.2099  static SDL_Surface *
  1.2100 -os2fslib_SetVideoMode (_THIS, SDL_Surface * current,
  1.2101 -                       int width, int height, int bpp, Uint32 flags)
  1.2102 +os2fslib_SetVideoMode(_THIS, SDL_Surface * current,
  1.2103 +                      int width, int height, int bpp, Uint32 flags)
  1.2104  {
  1.2105      static int bFirstCall = 1;
  1.2106      FSLib_VideoMode_p pModeInfo, pModeInfoFound;
  1.2107 @@ -2384,7 +2376,7 @@
  1.2108      printf
  1.2109          ("[os2fslib_SetVideoMode] : Request for %dx%d @ %dBPP, flags=0x%x\n",
  1.2110           width, height, bpp, flags);
  1.2111 -    fflush (stdout);
  1.2112 +    fflush(stdout);
  1.2113  #endif
  1.2114  
  1.2115      // We don't support palette modes!
  1.2116 @@ -2408,7 +2400,7 @@
  1.2117      printf
  1.2118          ("[os2fslib_SetVideoMode] : Changed request to %dx%d @ %dBPP, flags=0x%x\n",
  1.2119           width, height, bpp, flags);
  1.2120 -    fflush (stdout);
  1.2121 +    fflush(stdout);
  1.2122  #endif
  1.2123  
  1.2124      // First check if there is such a video mode they want!
  1.2125 @@ -2439,7 +2431,7 @@
  1.2126  #ifdef DEBUG_BUILD
  1.2127          printf
  1.2128              ("[os2fslib_SetVideoMode] : Requested video mode not found, looking for a similar one!\n");
  1.2129 -        fflush (stdout);
  1.2130 +        fflush(stdout);
  1.2131  #endif
  1.2132          // Go through the video modes again, and find a similar resolution!
  1.2133          pModeInfo = _this->hidden->pAvailableFSLibVideoModes;
  1.2134 @@ -2465,27 +2457,26 @@
  1.2135      // If we did not find a good fullscreen mode, then return NULL
  1.2136      if (!pModeInfoFound) {
  1.2137  #ifdef DEBUG_BUILD
  1.2138 -        printf
  1.2139 -            ("[os2fslib_SetVideoMode] : Requested video mode not found!\n");
  1.2140 -        fflush (stdout);
  1.2141 +        printf("[os2fslib_SetVideoMode] : Requested video mode not found!\n");
  1.2142 +        fflush(stdout);
  1.2143  #endif
  1.2144          return NULL;
  1.2145      }
  1.2146  #ifdef DEBUG_BUILD
  1.2147 -    printf ("[os2fslib_SetVideoMode] : Found mode!\n");
  1.2148 -    fflush (stdout);
  1.2149 +    printf("[os2fslib_SetVideoMode] : Found mode!\n");
  1.2150 +    fflush(stdout);
  1.2151  #endif
  1.2152  
  1.2153      // We'll possibly adjust the structure, so copy out the values
  1.2154      // into TempModeInfo!
  1.2155 -    SDL_memcpy (&TempModeInfo, pModeInfoFound, sizeof (TempModeInfo));
  1.2156 +    SDL_memcpy(&TempModeInfo, pModeInfoFound, sizeof(TempModeInfo));
  1.2157      pModeInfoFound = &TempModeInfo;
  1.2158  
  1.2159      if (flags & SDL_RESIZABLE) {
  1.2160  #ifdef DEBUG_BUILD
  1.2161          printf
  1.2162              ("[os2fslib_SetVideoMode] : Requested mode is resizable, changing width/height\n");
  1.2163 -        fflush (stdout);
  1.2164 +        fflush(stdout);
  1.2165  #endif
  1.2166          // Change width and height to requested one!
  1.2167          TempModeInfo.uiXResolution = width;
  1.2168 @@ -2495,51 +2486,51 @@
  1.2169      // We can try create new surface!
  1.2170  
  1.2171      // Make sure this thread is prepared for using the Presentation Manager!
  1.2172 -    hab = WinInitialize (0);
  1.2173 -    hmq = WinCreateMsgQueue (hab, 0);
  1.2174 +    hab = WinInitialize(0);
  1.2175 +    hmq = WinCreateMsgQueue(hab, 0);
  1.2176      // Remember if there was an error at WinCreateMsgQueue(), because we don't
  1.2177      // want to destroy somebody else's queue later. :)
  1.2178 -    hmqerror = WinGetLastError (hab);
  1.2179 +    hmqerror = WinGetLastError(hab);
  1.2180  
  1.2181  
  1.2182  
  1.2183      if (DosRequestMutexSem
  1.2184          (_this->hidden->hmtxUseSrcBuffer, SEM_INDEFINITE_WAIT) == NO_ERROR) {
  1.2185  #ifdef DEBUG_BUILD
  1.2186 -        printf ("[os2fslib_SetVideoMode] : Creating new SW surface\n");
  1.2187 -        fflush (stdout);
  1.2188 +        printf("[os2fslib_SetVideoMode] : Creating new SW surface\n");
  1.2189 +        fflush(stdout);
  1.2190  #endif
  1.2191  
  1.2192          // Create new software surface!
  1.2193 -        pResult = SDL_CreateRGBSurface (SDL_SWSURFACE,
  1.2194 -                                        pModeInfoFound->uiXResolution,
  1.2195 -                                        pModeInfoFound->uiYResolution,
  1.2196 -                                        pModeInfoFound->uiBPP,
  1.2197 -                                        ((unsigned int) pModeInfoFound->
  1.2198 -                                         PixelFormat.
  1.2199 -                                         ucRedMask) << pModeInfoFound->
  1.2200 -                                        PixelFormat.ucRedPosition,
  1.2201 -                                        ((unsigned int) pModeInfoFound->
  1.2202 -                                         PixelFormat.
  1.2203 -                                         ucGreenMask) << pModeInfoFound->
  1.2204 -                                        PixelFormat.ucGreenPosition,
  1.2205 -                                        ((unsigned int) pModeInfoFound->
  1.2206 -                                         PixelFormat.
  1.2207 -                                         ucBlueMask) << pModeInfoFound->
  1.2208 -                                        PixelFormat.ucBluePosition,
  1.2209 -                                        ((unsigned int) pModeInfoFound->
  1.2210 -                                         PixelFormat.
  1.2211 -                                         ucAlphaMask) << pModeInfoFound->
  1.2212 -                                        PixelFormat.ucAlphaPosition);
  1.2213 +        pResult = SDL_CreateRGBSurface(SDL_SWSURFACE,
  1.2214 +                                       pModeInfoFound->uiXResolution,
  1.2215 +                                       pModeInfoFound->uiYResolution,
  1.2216 +                                       pModeInfoFound->uiBPP,
  1.2217 +                                       ((unsigned int) pModeInfoFound->
  1.2218 +                                        PixelFormat.
  1.2219 +                                        ucRedMask) << pModeInfoFound->
  1.2220 +                                       PixelFormat.ucRedPosition,
  1.2221 +                                       ((unsigned int) pModeInfoFound->
  1.2222 +                                        PixelFormat.
  1.2223 +                                        ucGreenMask) << pModeInfoFound->
  1.2224 +                                       PixelFormat.ucGreenPosition,
  1.2225 +                                       ((unsigned int) pModeInfoFound->
  1.2226 +                                        PixelFormat.
  1.2227 +                                        ucBlueMask) << pModeInfoFound->
  1.2228 +                                       PixelFormat.ucBluePosition,
  1.2229 +                                       ((unsigned int) pModeInfoFound->
  1.2230 +                                        PixelFormat.
  1.2231 +                                        ucAlphaMask) << pModeInfoFound->
  1.2232 +                                       PixelFormat.ucAlphaPosition);
  1.2233  
  1.2234          if (pResult == NULL) {
  1.2235 -            DosReleaseMutexSem (_this->hidden->hmtxUseSrcBuffer);
  1.2236 -            SDL_OutOfMemory ();
  1.2237 +            DosReleaseMutexSem(_this->hidden->hmtxUseSrcBuffer);
  1.2238 +            SDL_OutOfMemory();
  1.2239              return NULL;
  1.2240          }
  1.2241  #ifdef DEBUG_BUILD
  1.2242 -        printf ("[os2fslib_SetVideoMode] : Adjusting pixel format\n");
  1.2243 -        fflush (stdout);
  1.2244 +        printf("[os2fslib_SetVideoMode] : Adjusting pixel format\n");
  1.2245 +        fflush(stdout);
  1.2246  #endif
  1.2247  
  1.2248          // Adjust pixel format mask!
  1.2249 @@ -2578,24 +2569,24 @@
  1.2250          pModeInfoFound->uiScanLineSize = pResult->pitch;
  1.2251  
  1.2252          // Store new source buffer parameters!
  1.2253 -        SDL_memcpy (&(_this->hidden->SrcBufferDesc), pModeInfoFound,
  1.2254 -                    sizeof (*pModeInfoFound));
  1.2255 +        SDL_memcpy(&(_this->hidden->SrcBufferDesc), pModeInfoFound,
  1.2256 +                   sizeof(*pModeInfoFound));
  1.2257          _this->hidden->pchSrcBuffer = pResult->pixels;
  1.2258  
  1.2259  #ifdef DEBUG_BUILD
  1.2260 -        printf ("[os2fslib_SetVideoMode] : Telling FSLib the stuffs\n");
  1.2261 -        fflush (stdout);
  1.2262 +        printf("[os2fslib_SetVideoMode] : Telling FSLib the stuffs\n");
  1.2263 +        fflush(stdout);
  1.2264  #endif
  1.2265  
  1.2266          // Tell the FSLib window the new source image format
  1.2267 -        FSLib_SetSrcBufferDesc (_this->hidden->hwndClient,
  1.2268 -                                &(_this->hidden->SrcBufferDesc));
  1.2269 +        FSLib_SetSrcBufferDesc(_this->hidden->hwndClient,
  1.2270 +                               &(_this->hidden->SrcBufferDesc));
  1.2271  
  1.2272          if (((flags & SDL_RESIZABLE) == 0) || (bFirstCall)) {
  1.2273              bFirstCall = 0;
  1.2274  #ifdef DEBUG_BUILD
  1.2275 -            printf ("[os2fslib_SetVideoMode] : Modifying window size\n");
  1.2276 -            fflush (stdout);
  1.2277 +            printf("[os2fslib_SetVideoMode] : Modifying window size\n");
  1.2278 +            fflush(stdout);
  1.2279  #endif
  1.2280  
  1.2281              // Calculate frame window size from client window size
  1.2282 @@ -2603,45 +2594,44 @@
  1.2283              rectl.yBottom = 0;
  1.2284              rectl.xRight = pModeInfoFound->uiXResolution;       // Noninclusive
  1.2285              rectl.yTop = pModeInfoFound->uiYResolution; // Noninclusive
  1.2286 -            WinCalcFrameRect (_this->hidden->hwndFrame, &rectl, FALSE);
  1.2287 +            WinCalcFrameRect(_this->hidden->hwndFrame, &rectl, FALSE);
  1.2288  
  1.2289              // Set the new size of the main window
  1.2290 -            SetAccessableWindowPos (_this->hidden->hwndFrame,
  1.2291 -                                    HWND_TOP,
  1.2292 -                                    0, 0,
  1.2293 -                                    (rectl.xRight - rectl.xLeft),
  1.2294 -                                    (rectl.yTop - rectl.yBottom),
  1.2295 -                                    SWP_SIZE | SWP_ACTIVATE | SWP_SHOW);
  1.2296 +            SetAccessableWindowPos(_this->hidden->hwndFrame,
  1.2297 +                                   HWND_TOP,
  1.2298 +                                   0, 0,
  1.2299 +                                   (rectl.xRight - rectl.xLeft),
  1.2300 +                                   (rectl.yTop - rectl.yBottom),
  1.2301 +                                   SWP_SIZE | SWP_ACTIVATE | SWP_SHOW);
  1.2302          }
  1.2303          // Set fullscreen mode flag, and switch to fullscreen if needed!
  1.2304          if (flags & SDL_FULLSCREEN) {
  1.2305  #ifdef DEBUG_BUILD
  1.2306              printf
  1.2307                  ("[os2fslib_SetVideoMode] : Also trying to switch to fullscreen\n");
  1.2308 -            fflush (stdout);
  1.2309 +            fflush(stdout);
  1.2310  #endif
  1.2311 -            FSLib_ToggleFSMode (_this->hidden->hwndClient, 1);
  1.2312 +            FSLib_ToggleFSMode(_this->hidden->hwndClient, 1);
  1.2313              /* Cursor manager functions to FS mode */
  1.2314 -            os2fslib_SetCursorManagementFunctions (_this, 0);
  1.2315 +            os2fslib_SetCursorManagementFunctions(_this, 0);
  1.2316          } else {
  1.2317  #ifdef DEBUG_BUILD
  1.2318              printf
  1.2319                  ("[os2fslib_SetVideoMode] : Also trying to switch to desktop mode\n");
  1.2320 -            fflush (stdout);
  1.2321 +            fflush(stdout);
  1.2322  #endif
  1.2323 -            FSLib_ToggleFSMode (_this->hidden->hwndClient, 0);
  1.2324 +            FSLib_ToggleFSMode(_this->hidden->hwndClient, 0);
  1.2325              /* Cursor manager functions to Windowed mode */
  1.2326 -            os2fslib_SetCursorManagementFunctions (_this, 1);
  1.2327 +            os2fslib_SetCursorManagementFunctions(_this, 1);
  1.2328          }
  1.2329  
  1.2330          _this->hidden->pSDLSurface = pResult;
  1.2331  
  1.2332 -        DosReleaseMutexSem (_this->hidden->hmtxUseSrcBuffer);
  1.2333 +        DosReleaseMutexSem(_this->hidden->hmtxUseSrcBuffer);
  1.2334      } else {
  1.2335  #ifdef DEBUG_BUILD
  1.2336 -        printf
  1.2337 -            ("[os2fslib_SetVideoMode] : Could not get hmtxUseSrcBuffer!\n");
  1.2338 -        fflush (stdout);
  1.2339 +        printf("[os2fslib_SetVideoMode] : Could not get hmtxUseSrcBuffer!\n");
  1.2340 +        fflush(stdout);
  1.2341  #endif
  1.2342  
  1.2343          pResult = NULL;
  1.2344 @@ -2650,25 +2640,25 @@
  1.2345      // As we have the new surface, we don't need the current one anymore!
  1.2346      if ((pResult) && (current)) {
  1.2347  #ifdef DEBUG_BUILD
  1.2348 -        printf ("[os2fslib_SetVideoMode] : Freeing old surface\n");
  1.2349 -        fflush (stdout);
  1.2350 +        printf("[os2fslib_SetVideoMode] : Freeing old surface\n");
  1.2351 +        fflush(stdout);
  1.2352  #endif
  1.2353 -        SDL_FreeSurface (current);
  1.2354 +        SDL_FreeSurface(current);
  1.2355      }
  1.2356      // Redraw window
  1.2357 -    WinInvalidateRegion (_this->hidden->hwndClient, NULL, TRUE);
  1.2358 +    WinInvalidateRegion(_this->hidden->hwndClient, NULL, TRUE);
  1.2359  
  1.2360      // Now destroy the message queue, if we've created it!
  1.2361 -    if (ERRORIDERROR (hmqerror) == 0) {
  1.2362 +    if (ERRORIDERROR(hmqerror) == 0) {
  1.2363  #ifdef DEBUG_BUILD
  1.2364 -        printf ("[os2fslib_SetVideoMode] : Destroying message queue\n");
  1.2365 -        fflush (stdout);
  1.2366 +        printf("[os2fslib_SetVideoMode] : Destroying message queue\n");
  1.2367 +        fflush(stdout);
  1.2368  #endif
  1.2369 -        WinDestroyMsgQueue (hmq);
  1.2370 +        WinDestroyMsgQueue(hmq);
  1.2371      }
  1.2372  #ifdef DEBUG_BUILD
  1.2373 -    printf ("[os2fslib_SetVideoMode] : Done\n");
  1.2374 -    fflush (stdout);
  1.2375 +    printf("[os2fslib_SetVideoMode] : Done\n");
  1.2376 +    fflush(stdout);
  1.2377  #endif
  1.2378  
  1.2379      /* We're done */
  1.2380 @@ -2681,15 +2671,15 @@
  1.2381   from largest to smallest.
  1.2382   */
  1.2383  static SDL_Rect **
  1.2384 -os2fslib_ListModes (_THIS, SDL_PixelFormat * format, Uint32 flags)
  1.2385 +os2fslib_ListModes(_THIS, SDL_PixelFormat * format, Uint32 flags)
  1.2386  {
  1.2387  #ifdef DEBUG_BUILD
  1.2388 -    printf ("[os2fslib_ListModes] : ListModes of %d Bpp\n",
  1.2389 -            format->BitsPerPixel);
  1.2390 +    printf("[os2fslib_ListModes] : ListModes of %d Bpp\n",
  1.2391 +           format->BitsPerPixel);
  1.2392  #endif
  1.2393      // Destroy result of previous call, if there is any
  1.2394      if (_this->hidden->pListModesResult) {
  1.2395 -        SDL_free (_this->hidden->pListModesResult);
  1.2396 +        SDL_free(_this->hidden->pListModesResult);
  1.2397          _this->hidden->pListModesResult = NULL;
  1.2398      }
  1.2399      // For resizable and windowed mode we support every resolution!
  1.2400 @@ -2707,7 +2697,7 @@
  1.2401          pFSMode = _this->hidden->pAvailableFSLibVideoModes;
  1.2402          while (pFSMode) {
  1.2403              if (pFSMode->uiBPP == format->BitsPerPixel) {
  1.2404 -                SDL_Rect *pRect = (SDL_Rect *) SDL_malloc (sizeof (SDL_Rect));
  1.2405 +                SDL_Rect *pRect = (SDL_Rect *) SDL_malloc(sizeof(SDL_Rect));
  1.2406                  if (pRect) {
  1.2407                      // Fill description
  1.2408                      pRect->x = 0;
  1.2409 @@ -2726,13 +2716,12 @@
  1.2410  
  1.2411                          // We're the first one to be inserted!
  1.2412                          _this->hidden->pListModesResult =
  1.2413 -                            (SDL_Rect **) SDL_malloc (2 *
  1.2414 -                                                      sizeof (SDL_Rect *));
  1.2415 +                            (SDL_Rect **) SDL_malloc(2 * sizeof(SDL_Rect *));
  1.2416                          if (_this->hidden->pListModesResult) {
  1.2417                              _this->hidden->pListModesResult[0] = pRect;
  1.2418                              _this->hidden->pListModesResult[1] = NULL;
  1.2419                          } else {
  1.2420 -                            SDL_free (pRect);
  1.2421 +                            SDL_free(pRect);
  1.2422                          }
  1.2423                      } else {
  1.2424                          // We're not the first ones, so find the place where we
  1.2425 @@ -2766,20 +2755,20 @@
  1.2426  #endif
  1.2427  
  1.2428                          pNewList =
  1.2429 -                            (SDL_Rect **) SDL_realloc (_this->
  1.2430 -                                                       hidden->
  1.2431 -                                                       pListModesResult,
  1.2432 -                                                       (iNumOfSlots
  1.2433 -                                                        +
  1.2434 -                                                        1) *
  1.2435 -                                                       sizeof (SDL_Rect *));
  1.2436 +                            (SDL_Rect **) SDL_realloc(_this->
  1.2437 +                                                      hidden->
  1.2438 +                                                      pListModesResult,
  1.2439 +                                                      (iNumOfSlots
  1.2440 +                                                       +
  1.2441 +                                                       1) *
  1.2442 +                                                      sizeof(SDL_Rect *));
  1.2443                          if (pNewList) {
  1.2444                              for (i = iNumOfSlots; i > iPlace; i--)
  1.2445                                  pNewList[i] = pNewList[i - 1];
  1.2446                              pNewList[iPlace] = pRect;
  1.2447                              _this->hidden->pListModesResult = pNewList;
  1.2448                          } else {
  1.2449 -                            SDL_free (pRect);
  1.2450 +                            SDL_free(pRect);
  1.2451                          }
  1.2452                      }
  1.2453                  }
  1.2454 @@ -2797,20 +2786,20 @@
  1.2455   "best" display pixel format, returning 0 or -1 if there's an error.
  1.2456   */
  1.2457  static int
  1.2458 -os2fslib_VideoInit (_THIS, SDL_PixelFormat * vformat)
  1.2459 +os2fslib_VideoInit(_THIS, SDL_PixelFormat * vformat)
  1.2460  {
  1.2461      FSLib_VideoMode_p pDesktopMode;
  1.2462  
  1.2463  #ifdef DEBUG_BUILD
  1.2464 -    printf ("[os2fslib_VideoInit] : Enter\n");
  1.2465 -    fflush (stdout);
  1.2466 +    printf("[os2fslib_VideoInit] : Enter\n");
  1.2467 +    fflush(stdout);
  1.2468  #endif
  1.2469  
  1.2470      // Report the best pixel format. For this,
  1.2471      // we'll use the current desktop format.
  1.2472 -    pDesktopMode = FSLib_GetDesktopVideoMode ();
  1.2473 +    pDesktopMode = FSLib_GetDesktopVideoMode();
  1.2474      if (!pDesktopMode) {
  1.2475 -        SDL_SetError ("Could not query desktop video mode!");
  1.2476 +        SDL_SetError("Could not query desktop video mode!");
  1.2477  #ifdef DEBUG_BUILD
  1.2478          printf
  1.2479              ("[os2fslib_VideoInit] : Could not query desktop video mode!\n");
  1.2480 @@ -2860,7 +2849,7 @@
  1.2481      _this->hidden->iSkipWMMOUSEMOVE = 0;
  1.2482      _this->hidden->iMouseVisible = 1;
  1.2483  
  1.2484 -    if (getenv ("SDL_USE_PROPORTIONAL_WINDOW"))
  1.2485 +    if (getenv("SDL_USE_PROPORTIONAL_WINDOW"))
  1.2486          _this->hidden->bProportionalResize = 1;
  1.2487      else {
  1.2488          PPIB pib;
  1.2489 @@ -2874,92 +2863,91 @@
  1.2490           */
  1.2491          _this->hidden->bProportionalResize = 0;
  1.2492  
  1.2493 -        DosGetInfoBlocks (&tib, &pib);
  1.2494 +        DosGetInfoBlocks(&tib, &pib);
  1.2495          pchTemp = pchFileName = pib->pib_pchcmd;
  1.2496          while (*pchTemp) {
  1.2497              if (*pchTemp == '\\')
  1.2498                  pchFileName = pchTemp + 1;
  1.2499              pchTemp++;
  1.2500          }
  1.2501 -        if (getenv ("HOME")) {
  1.2502 -            sprintf (achConfigFile, "%s\\.sdl.proportionals",
  1.2503 -                     getenv ("HOME"));
  1.2504 -            hFile = fopen (achConfigFile, "rt");
  1.2505 +        if (getenv("HOME")) {
  1.2506 +            sprintf(achConfigFile, "%s\\.sdl.proportionals", getenv("HOME"));
  1.2507 +            hFile = fopen(achConfigFile, "rt");
  1.2508              if (!hFile) {
  1.2509                  /* Seems like the file cannot be opened or does not exist.
  1.2510                   * Let's try to create it with defaults!
  1.2511                   */
  1.2512 -                hFile = fopen (achConfigFile, "wt");
  1.2513 +                hFile = fopen(achConfigFile, "wt");
  1.2514                  if (hFile) {
  1.2515 -                    fprintf (hFile,
  1.2516 -                             "; This file is a config file of SDL/2, containing\n");
  1.2517 -                    fprintf (hFile,
  1.2518 -                             "; the list of executables that must have proportional\n");
  1.2519 -                    fprintf (hFile, "; windows.\n");
  1.2520 -                    fprintf (hFile, ";\n");
  1.2521 -                    fprintf (hFile,
  1.2522 -                             "; You can add executable filenames into this file,\n");
  1.2523 -                    fprintf (hFile,
  1.2524 -                             "; one under the other. If SDL finds that a given\n");
  1.2525 -                    fprintf (hFile,
  1.2526 -                             "; program is in this list, then that application\n");
  1.2527 -                    fprintf (hFile,
  1.2528 -                             "; will have proportional windows, just like if\n");
  1.2529 -                    fprintf (hFile,
  1.2530 -                             "; the SET SDL_USE_PROPORTIONAL_WINDOW env. variable\n");
  1.2531 -                    fprintf (hFile,
  1.2532 -                             "; would have been set for that process.\n");
  1.2533 -                    fprintf (hFile, ";\n");
  1.2534 -                    fprintf (hFile, "\n");
  1.2535 -                    fprintf (hFile, "dosbox.exe\n");
  1.2536 -                    fclose (hFile);
  1.2537 +                    fprintf(hFile,
  1.2538 +                            "; This file is a config file of SDL/2, containing\n");
  1.2539 +                    fprintf(hFile,
  1.2540 +                            "; the list of executables that must have proportional\n");
  1.2541 +                    fprintf(hFile, "; windows.\n");
  1.2542 +                    fprintf(hFile, ";\n");
  1.2543 +                    fprintf(hFile,
  1.2544 +                            "; You can add executable filenames into this file,\n");
  1.2545 +                    fprintf(hFile,
  1.2546 +                            "; one under the other. If SDL finds that a given\n");
  1.2547 +                    fprintf(hFile,
  1.2548 +                            "; program is in this list, then that application\n");
  1.2549 +                    fprintf(hFile,
  1.2550 +                            "; will have proportional windows, just like if\n");
  1.2551 +                    fprintf(hFile,
  1.2552 +                            "; the SET SDL_USE_PROPORTIONAL_WINDOW env. variable\n");
  1.2553 +                    fprintf(hFile,
  1.2554 +                            "; would have been set for that process.\n");
  1.2555 +                    fprintf(hFile, ";\n");
  1.2556 +                    fprintf(hFile, "\n");
  1.2557 +                    fprintf(hFile, "dosbox.exe\n");
  1.2558 +                    fclose(hFile);
  1.2559                  }
  1.2560  
  1.2561 -                hFile = fopen (achConfigFile, "rt");
  1.2562 +                hFile = fopen(achConfigFile, "rt");
  1.2563              }
  1.2564  
  1.2565              if (hFile) {
  1.2566 -                while (fgets (achConfigFile, sizeof (achConfigFile), hFile)) {
  1.2567 +                while (fgets(achConfigFile, sizeof(achConfigFile), hFile)) {
  1.2568                      /* Cut \n from end of string */
  1.2569  
  1.2570 -                    while (achConfigFile[strlen (achConfigFile) - 1]
  1.2571 +                    while (achConfigFile[strlen(achConfigFile) - 1]
  1.2572                             == '\n')
  1.2573 -                        achConfigFile[strlen (achConfigFile) - 1] = 0;
  1.2574 +                        achConfigFile[strlen(achConfigFile) - 1] = 0;
  1.2575  
  1.2576                      /* Compare... */
  1.2577 -                    if (stricmp (achConfigFile, pchFileName) == 0) {
  1.2578 +                    if (stricmp(achConfigFile, pchFileName) == 0) {
  1.2579                          /* Found it in config file! */
  1.2580                          _this->hidden->bProportionalResize = 1;
  1.2581                          break;
  1.2582                      }
  1.2583                  }
  1.2584 -                fclose (hFile);
  1.2585 +                fclose(hFile);
  1.2586              }
  1.2587          }
  1.2588      }
  1.2589  
  1.2590 -    DosCreateMutexSem (NULL, &(_this->hidden->hmtxUseSrcBuffer), 0, FALSE);
  1.2591 +    DosCreateMutexSem(NULL, &(_this->hidden->hmtxUseSrcBuffer), 0, FALSE);
  1.2592  
  1.2593      // Now create our window with a default size
  1.2594  
  1.2595      // For this, we select the first available fullscreen mode as
  1.2596      // current window size!
  1.2597 -    SDL_memcpy (&(_this->hidden->SrcBufferDesc),
  1.2598 -                _this->hidden->pAvailableFSLibVideoModes,
  1.2599 -                sizeof (_this->hidden->SrcBufferDesc));
  1.2600 +    SDL_memcpy(&(_this->hidden->SrcBufferDesc),
  1.2601 +               _this->hidden->pAvailableFSLibVideoModes,
  1.2602 +               sizeof(_this->hidden->SrcBufferDesc));
  1.2603      // Allocate new video buffer!
  1.2604      _this->hidden->pchSrcBuffer =
  1.2605 -        (char *) SDL_malloc (_this->hidden->pAvailableFSLibVideoModes->
  1.2606 -                             uiScanLineSize *
  1.2607 -                             _this->hidden->pAvailableFSLibVideoModes->
  1.2608 -                             uiYResolution);
  1.2609 +        (char *) SDL_malloc(_this->hidden->pAvailableFSLibVideoModes->
  1.2610 +                            uiScanLineSize *
  1.2611 +                            _this->hidden->pAvailableFSLibVideoModes->
  1.2612 +                            uiYResolution);
  1.2613      if (!_this->hidden->pchSrcBuffer) {
  1.2614  #ifdef DEBUG_BUILD
  1.2615          printf
  1.2616              ("[os2fslib_VideoInit] : Yikes, not enough memory for new video buffer!\n");
  1.2617 -        fflush (stdout);
  1.2618 +        fflush(stdout);
  1.2619  #endif
  1.2620 -        SDL_SetError ("Not enough memory for new video buffer!\n");
  1.2621 +        SDL_SetError("Not enough memory for new video buffer!\n");
  1.2622          return -1;
  1.2623      }
  1.2624      // For this, we need a message processing thread.
  1.2625 @@ -2967,30 +2955,30 @@
  1.2626      // what is related to PM
  1.2627      _this->hidden->iPMThreadStatus = 0;
  1.2628      _this->hidden->tidPMThread =
  1.2629 -        _beginthread (PMThreadFunc, NULL, 65536, (void *) _this);
  1.2630 +        _beginthread(PMThreadFunc, NULL, 65536, (void *) _this);
  1.2631      if (_this->hidden->tidPMThread <= 0) {
  1.2632  #ifdef DEBUG_BUILD
  1.2633 -        printf ("[os2fslib_VideoInit] : Could not create PM thread!\n");
  1.2634 +        printf("[os2fslib_VideoInit] : Could not create PM thread!\n");
  1.2635  #endif
  1.2636 -        SDL_SetError ("Could not create PM thread");
  1.2637 +        SDL_SetError("Could not create PM thread");
  1.2638          return -1;
  1.2639      }
  1.2640  #ifdef USE_DOSSETPRIORITY
  1.2641      // Burst the priority of PM Thread!
  1.2642 -    DosSetPriority (PRTYS_THREAD, PRTYC_TIMECRITICAL, 0,
  1.2643 -                    _this->hidden->tidPMThread);
  1.2644 +    DosSetPriority(PRTYS_THREAD, PRTYC_TIMECRITICAL, 0,
  1.2645 +                   _this->hidden->tidPMThread);
  1.2646  #endif
  1.2647      // Wait for the PM thread to initialize!
  1.2648      while (_this->hidden->iPMThreadStatus == 0)
  1.2649 -        DosSleep (32);
  1.2650 +        DosSleep(32);
  1.2651      // If the PM thread could not set up everything, then
  1.2652      // report an error!
  1.2653      if (_this->hidden->iPMThreadStatus != 1) {
  1.2654  #ifdef DEBUG_BUILD
  1.2655 -        printf ("[os2fslib_VideoInit] : PMThread reported an error : %d\n",
  1.2656 -                _this->hidden->iPMThreadStatus);
  1.2657 +        printf("[os2fslib_VideoInit] : PMThread reported an error : %d\n",
  1.2658 +               _this->hidden->iPMThreadStatus);
  1.2659  #endif
  1.2660 -        SDL_SetError ("Error initializing PM thread");
  1.2661 +        SDL_SetError("Error initializing PM thread");
  1.2662          return -1;
  1.2663      }
  1.2664  
  1.2665 @@ -2999,26 +2987,26 @@
  1.2666  
  1.2667  
  1.2668  static void
  1.2669 -os2fslib_DeleteDevice (_THIS)
  1.2670 +os2fslib_DeleteDevice(_THIS)
  1.2671  {
  1.2672  #ifdef DEBUG_BUILD
  1.2673 -    printf ("[os2fslib_DeleteDevice]\n");
  1.2674 -    fflush (stdout);
  1.2675 +    printf("[os2fslib_DeleteDevice]\n");
  1.2676 +    fflush(stdout);
  1.2677  #endif
  1.2678      // Free used memory
  1.2679 -    FSLib_FreeVideoModeList (_this->hidden->pAvailableFSLibVideoModes);
  1.2680 +    FSLib_FreeVideoModeList(_this->hidden->pAvailableFSLibVideoModes);
  1.2681      if (_this->hidden->pListModesResult)
  1.2682 -        SDL_free (_this->hidden->pListModesResult);
  1.2683 +        SDL_free(_this->hidden->pListModesResult);
  1.2684      if (_this->hidden->pchSrcBuffer)
  1.2685 -        SDL_free (_this->hidden->pchSrcBuffer);
  1.2686 -    DosCloseMutexSem (_this->hidden->hmtxUseSrcBuffer);
  1.2687 -    SDL_free (_this->hidden);
  1.2688 -    SDL_free (_this);
  1.2689 -    FSLib_Uninitialize ();
  1.2690 +        SDL_free(_this->hidden->pchSrcBuffer);
  1.2691 +    DosCloseMutexSem(_this->hidden->hmtxUseSrcBuffer);
  1.2692 +    SDL_free(_this->hidden);
  1.2693 +    SDL_free(_this);
  1.2694 +    FSLib_Uninitialize();
  1.2695  }
  1.2696  
  1.2697  static int
  1.2698 -os2fslib_Available (void)
  1.2699 +os2fslib_Available(void)
  1.2700  {
  1.2701  
  1.2702      // If we can run, it means that we could load FSLib,
  1.2703 @@ -3027,12 +3015,12 @@
  1.2704  }
  1.2705  
  1.2706  static void
  1.2707 -os2fslib_MorphToPM ()
  1.2708 +os2fslib_MorphToPM()
  1.2709  {
  1.2710      PPIB pib;
  1.2711      PTIB tib;
  1.2712  
  1.2713 -    DosGetInfoBlocks (&tib, &pib);
  1.2714 +    DosGetInfoBlocks(&tib, &pib);
  1.2715  
  1.2716      // Change flag from VIO to PM:
  1.2717      if (pib->pib_ultype == 2)
  1.2718 @@ -3040,36 +3028,35 @@
  1.2719  }
  1.2720  
  1.2721  static SDL_VideoDevice *
  1.2722 -os2fslib_CreateDevice (int devindex)
  1.2723 +os2fslib_CreateDevice(int devindex)
  1.2724  {
  1.2725      SDL_VideoDevice *device;
  1.2726  
  1.2727  #ifdef DEBUG_BUILD
  1.2728 -    printf ("[os2fslib_CreateDevice] : Enter\n");
  1.2729 -    fflush (stdout);
  1.2730 +    printf("[os2fslib_CreateDevice] : Enter\n");
  1.2731 +    fflush(stdout);
  1.2732  #endif
  1.2733  
  1.2734      /* Initialize all variables that we clean on shutdown */
  1.2735 -    device = (SDL_VideoDevice *) SDL_malloc (sizeof (SDL_VideoDevice));
  1.2736 +    device = (SDL_VideoDevice *) SDL_malloc(sizeof(SDL_VideoDevice));
  1.2737      if (device) {
  1.2738 -        SDL_memset (device, 0, (sizeof *device));
  1.2739 +        SDL_memset(device, 0, (sizeof *device));
  1.2740          // Also allocate memory for private data
  1.2741          device->hidden = (struct SDL_PrivateVideoData *)
  1.2742 -            SDL_malloc ((sizeof (struct SDL_PrivateVideoData)));
  1.2743 +            SDL_malloc((sizeof(struct SDL_PrivateVideoData)));
  1.2744      }
  1.2745      if ((device == NULL) || (device->hidden == NULL)) {
  1.2746 -        SDL_OutOfMemory ();
  1.2747 +        SDL_OutOfMemory();
  1.2748          if (device)
  1.2749 -            SDL_free (device);
  1.2750 +            SDL_free(device);
  1.2751          return NULL;
  1.2752      }
  1.2753 -    SDL_memset (device->hidden, 0, (sizeof *device->hidden));
  1.2754 +    SDL_memset(device->hidden, 0, (sizeof *device->hidden));
  1.2755  
  1.2756      /* Set the function pointers */
  1.2757  #ifdef DEBUG_BUILD
  1.2758 -    printf ("[os2fslib_CreateDevice] : VideoInit is %p\n",
  1.2759 -            os2fslib_VideoInit);
  1.2760 -    fflush (stdout);
  1.2761 +    printf("[os2fslib_CreateDevice] : VideoInit is %p\n", os2fslib_VideoInit);
  1.2762 +    fflush(stdout);
  1.2763  #endif
  1.2764  
  1.2765      /* Initialization/Query functions */
  1.2766 @@ -3099,7 +3086,7 @@
  1.2767      device->GrabInput = os2fslib_GrabInput;
  1.2768      device->GetWMInfo = NULL;
  1.2769      /* Cursor manager functions to Windowed mode */
  1.2770 -    os2fslib_SetCursorManagementFunctions (device, 1);
  1.2771 +    os2fslib_SetCursorManagementFunctions(device, 1);
  1.2772      /* Event manager functions */
  1.2773      device->InitOSKeymap = os2fslib_InitOSKeymap;
  1.2774      device->PumpEvents = os2fslib_PumpEvents;
  1.2775 @@ -3108,20 +3095,20 @@
  1.2776  
  1.2777      // Make sure we'll be able to use Win* API even if the application
  1.2778      // was linked to be a VIO application!
  1.2779 -    os2fslib_MorphToPM ();
  1.2780 +    os2fslib_MorphToPM();
  1.2781  
  1.2782      // Now initialize FSLib, and query available video modes!
  1.2783 -    if (!FSLib_Initialize ()) {
  1.2784 +    if (!FSLib_Initialize()) {
  1.2785          // Could not initialize FSLib!
  1.2786  #ifdef DEBUG_BUILD
  1.2787 -        printf ("[os2fslib_CreateDevice] : Could not initialize FSLib!\n");
  1.2788 +        printf("[os2fslib_CreateDevice] : Could not initialize FSLib!\n");
  1.2789  #endif
  1.2790 -        SDL_SetError ("Could not initialize FSLib!");
  1.2791 -        SDL_free (device->hidden);
  1.2792 -        SDL_free (device);
  1.2793 +        SDL_SetError("Could not initialize FSLib!");
  1.2794 +        SDL_free(device->hidden);
  1.2795 +        SDL_free(device);
  1.2796          return NULL;
  1.2797      }
  1.2798 -    device->hidden->pAvailableFSLibVideoModes = FSLib_GetVideoModeList ();
  1.2799 +    device->hidden->pAvailableFSLibVideoModes = FSLib_GetVideoModeList();
  1.2800  
  1.2801      return device;
  1.2802  }