src/video/macrom/SDL_romvideo.c
branchSDL-1.3
changeset 1668 4da1ee79c9af
parent 1662 782fd950bd46
     1.1 --- a/src/video/macrom/SDL_romvideo.c	Mon May 29 03:53:21 2006 +0000
     1.2 +++ b/src/video/macrom/SDL_romvideo.c	Mon May 29 04:04:35 2006 +0000
     1.3 @@ -53,20 +53,20 @@
     1.4  #include "../maccommon/SDL_macevents_c.h"
     1.5  
     1.6  /* Initialization/Query functions */
     1.7 -static int ROM_VideoInit (_THIS, SDL_PixelFormat * vformat);
     1.8 -static SDL_Rect **ROM_ListModes (_THIS, SDL_PixelFormat * format,
     1.9 -                                 Uint32 flags);
    1.10 -static SDL_Surface *ROM_SetVideoMode (_THIS, SDL_Surface * current, int width,
    1.11 -                                      int height, int bpp, Uint32 flags);
    1.12 -static int ROM_SetColors (_THIS, int firstcolor, int ncolors,
    1.13 -                          SDL_Color * colors);
    1.14 -static void ROM_VideoQuit (_THIS);
    1.15 +static int ROM_VideoInit(_THIS, SDL_PixelFormat * vformat);
    1.16 +static SDL_Rect **ROM_ListModes(_THIS, SDL_PixelFormat * format,
    1.17 +                                Uint32 flags);
    1.18 +static SDL_Surface *ROM_SetVideoMode(_THIS, SDL_Surface * current, int width,
    1.19 +                                     int height, int bpp, Uint32 flags);
    1.20 +static int ROM_SetColors(_THIS, int firstcolor, int ncolors,
    1.21 +                         SDL_Color * colors);
    1.22 +static void ROM_VideoQuit(_THIS);
    1.23  
    1.24  /* Hardware surface functions */
    1.25 -static int ROM_AllocHWSurface (_THIS, SDL_Surface * surface);
    1.26 -static int ROM_LockHWSurface (_THIS, SDL_Surface * surface);
    1.27 -static void ROM_UnlockHWSurface (_THIS, SDL_Surface * surface);
    1.28 -static void ROM_FreeHWSurface (_THIS, SDL_Surface * surface);
    1.29 +static int ROM_AllocHWSurface(_THIS, SDL_Surface * surface);
    1.30 +static int ROM_LockHWSurface(_THIS, SDL_Surface * surface);
    1.31 +static void ROM_UnlockHWSurface(_THIS, SDL_Surface * surface);
    1.32 +static void ROM_FreeHWSurface(_THIS, SDL_Surface * surface);
    1.33  
    1.34  #if !TARGET_API_MAC_CARBON      /* This seems not to be available? -sts Aug 2000 */
    1.35  /* Saved state for the menu bar */
    1.36 @@ -90,27 +90,27 @@
    1.37  
    1.38  /* ControlStrip inline glue for PowerPC */
    1.39  static pascal Boolean
    1.40 -SBIsControlStripVisible (void)
    1.41 +SBIsControlStripVisible(void)
    1.42  {
    1.43 -    static short procData[] = TWOWORDSTUB (0x7000, 0xAAF2);
    1.44 +    static short procData[] = TWOWORDSTUB(0x7000, 0xAAF2);
    1.45      ProcInfoType procInfo = kD0DispatchedPascalStackBased
    1.46 -        | RESULT_SIZE (SIZE_CODE (sizeof (Boolean)))
    1.47 -        | DISPATCHED_STACK_ROUTINE_SELECTOR_SIZE (kFourByteCode);
    1.48 +        | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
    1.49 +        | DISPATCHED_STACK_ROUTINE_SELECTOR_SIZE(kFourByteCode);
    1.50  
    1.51      return ((Boolean)
    1.52 -            CallUniversalProc ((UniversalProcPtr) procData, procInfo, 0x00));
    1.53 +            CallUniversalProc((UniversalProcPtr) procData, procInfo, 0x00));
    1.54  }
    1.55  
    1.56  static pascal void
    1.57 -SBShowHideControlStrip (Boolean showIt)
    1.58 +SBShowHideControlStrip(Boolean showIt)
    1.59  {
    1.60 -    static short procData[] = THREEWORDSTUB (0x303C, 0x0101, 0xAAF2);
    1.61 +    static short procData[] = THREEWORDSTUB(0x303C, 0x0101, 0xAAF2);
    1.62      ProcInfoType procInfo = kD0DispatchedPascalStackBased
    1.63 -        | DISPATCHED_STACK_ROUTINE_SELECTOR_SIZE (kFourByteCode)
    1.64 -        | DISPATCHED_STACK_ROUTINE_PARAMETER (1,
    1.65 -                                              SIZE_CODE (sizeof (Boolean)));
    1.66 +        | DISPATCHED_STACK_ROUTINE_SELECTOR_SIZE(kFourByteCode)
    1.67 +        | DISPATCHED_STACK_ROUTINE_PARAMETER(1,
    1.68 +                                             SIZE_CODE(sizeof(Boolean)));
    1.69  
    1.70 -    CallUniversalProc ((UniversalProcPtr) procData, procInfo, 0x01, showIt);
    1.71 +    CallUniversalProc((UniversalProcPtr) procData, procInfo, 0x01, showIt);
    1.72  }
    1.73  #endif /* powerc */
    1.74  #endif /* !TARGET_API_MAC_CARBON */
    1.75 @@ -118,38 +118,38 @@
    1.76  /* Macintosh toolbox driver bootstrap functions */
    1.77  
    1.78  static int
    1.79 -ROM_Available (void)
    1.80 +ROM_Available(void)
    1.81  {
    1.82      return (1);
    1.83  }
    1.84  
    1.85  static void
    1.86 -ROM_DeleteDevice (SDL_VideoDevice * device)
    1.87 +ROM_DeleteDevice(SDL_VideoDevice * device)
    1.88  {
    1.89 -    SDL_free (device->hidden);
    1.90 -    SDL_free (device);
    1.91 +    SDL_free(device->hidden);
    1.92 +    SDL_free(device);
    1.93  }
    1.94  
    1.95  static SDL_VideoDevice *
    1.96 -ROM_CreateDevice (int devindex)
    1.97 +ROM_CreateDevice(int devindex)
    1.98  {
    1.99      SDL_VideoDevice *device;
   1.100  
   1.101      /* Initialize all variables that we clean on shutdown */
   1.102 -    device = (SDL_VideoDevice *) SDL_malloc (sizeof (SDL_VideoDevice));
   1.103 +    device = (SDL_VideoDevice *) SDL_malloc(sizeof(SDL_VideoDevice));
   1.104      if (device) {
   1.105 -        SDL_memset (device, 0, (sizeof *device));
   1.106 +        SDL_memset(device, 0, (sizeof *device));
   1.107          device->hidden = (struct SDL_PrivateVideoData *)
   1.108 -            SDL_malloc ((sizeof *device->hidden));
   1.109 +            SDL_malloc((sizeof *device->hidden));
   1.110      }
   1.111      if ((device == NULL) || (device->hidden == NULL)) {
   1.112 -        SDL_OutOfMemory ();
   1.113 +        SDL_OutOfMemory();
   1.114          if (device) {
   1.115 -            SDL_free (device);
   1.116 +            SDL_free(device);
   1.117          }
   1.118          return (0);
   1.119      }
   1.120 -    SDL_memset (device->hidden, 0, (sizeof *device->hidden));
   1.121 +    SDL_memset(device->hidden, 0, (sizeof *device->hidden));
   1.122  
   1.123      /* Set the function pointers */
   1.124      device->VideoInit = ROM_VideoInit;
   1.125 @@ -197,22 +197,22 @@
   1.126  
   1.127  
   1.128  static int
   1.129 -ROM_VideoInit (_THIS, SDL_PixelFormat * vformat)
   1.130 +ROM_VideoInit(_THIS, SDL_PixelFormat * vformat)
   1.131  {
   1.132      long info;
   1.133  
   1.134      /* Check out some things about the system */
   1.135 -    Gestalt (gestaltQuickdrawVersion, &info);
   1.136 +    Gestalt(gestaltQuickdrawVersion, &info);
   1.137      if (info == gestaltOriginalQD) {
   1.138 -        SDL_SetError ("Color Quickdraw not available");
   1.139 +        SDL_SetError("Color Quickdraw not available");
   1.140          return (-1);
   1.141      }
   1.142  
   1.143      /* Start ROMintosh events */
   1.144 -    Mac_InitEvents (this);
   1.145 +    Mac_InitEvents(this);
   1.146  
   1.147      /* Get a handle to the main monitor */
   1.148 -    SDL_Display = GetMainDevice ();
   1.149 +    SDL_Display = GetMainDevice();
   1.150  
   1.151      /* Determine the current screen size */
   1.152      this->info.current_w = (**SDL_Display).gdRect.right;
   1.153 @@ -231,21 +231,21 @@
   1.154      }
   1.155  
   1.156      /* Create our palette */
   1.157 -    SDL_CTab = (CTabHandle) NewHandle (sizeof (ColorSpec) * 256 + 8);
   1.158 +    SDL_CTab = (CTabHandle) NewHandle(sizeof(ColorSpec) * 256 + 8);
   1.159      if (SDL_CTab == nil) {
   1.160 -        SDL_OutOfMemory ();
   1.161 +        SDL_OutOfMemory();
   1.162          return (-1);
   1.163      }
   1.164 -    (**SDL_CTab).ctSeed = GetCTSeed ();
   1.165 +    (**SDL_CTab).ctSeed = GetCTSeed();
   1.166      (**SDL_CTab).ctFlags = 0;
   1.167      (**SDL_CTab).ctSize = 255;
   1.168 -    CTabChanged (SDL_CTab);
   1.169 -    SDL_CPal = NewPalette (256, SDL_CTab, pmExplicit + pmTolerant, 0);
   1.170 +    CTabChanged(SDL_CTab);
   1.171 +    SDL_CPal = NewPalette(256, SDL_CTab, pmExplicit + pmTolerant, 0);
   1.172  
   1.173      /* Get a list of available fullscreen modes */
   1.174 -    SDL_modelist = (SDL_Rect **) SDL_malloc ((1 + 1) * sizeof (SDL_Rect *));
   1.175 +    SDL_modelist = (SDL_Rect **) SDL_malloc((1 + 1) * sizeof(SDL_Rect *));
   1.176      if (SDL_modelist) {
   1.177 -        SDL_modelist[0] = (SDL_Rect *) SDL_malloc (sizeof (SDL_Rect));
   1.178 +        SDL_modelist[0] = (SDL_Rect *) SDL_malloc(sizeof(SDL_Rect));
   1.179          if (SDL_modelist[0]) {
   1.180              SDL_modelist[0]->x = 0;
   1.181              SDL_modelist[0]->y = 0;
   1.182 @@ -263,7 +263,7 @@
   1.183  }
   1.184  
   1.185  static SDL_Rect **
   1.186 -ROM_ListModes (_THIS, SDL_PixelFormat * format, Uint32 flags)
   1.187 +ROM_ListModes(_THIS, SDL_PixelFormat * format, Uint32 flags)
   1.188  {
   1.189      if (this->screen->format->BitsPerPixel == format->BitsPerPixel) {
   1.190          if ((flags & SDL_FULLSCREEN) == SDL_FULLSCREEN) {
   1.191 @@ -277,7 +277,7 @@
   1.192  }
   1.193  
   1.194  static void
   1.195 -ROM_HideMenuBar (_THIS)
   1.196 +ROM_HideMenuBar(_THIS)
   1.197  {
   1.198  #if !TARGET_API_MAC_CARBON      /* This seems not to be available? -sts Aug 2000 */
   1.199      RgnHandle drawRgn = nil;
   1.200 @@ -290,79 +290,79 @@
   1.201      short height;
   1.202      EventRecord theEvent;
   1.203  
   1.204 -    height = GetMBarHeight ();
   1.205 +    height = GetMBarHeight();
   1.206  
   1.207      if (height > 0) {
   1.208 -        tempRgn = NewRgn ();
   1.209 -        drawRgn = NewRgn ();
   1.210 -        gSaveGrayRgn = NewRgn ();
   1.211 +        tempRgn = NewRgn();
   1.212 +        drawRgn = NewRgn();
   1.213 +        gSaveGrayRgn = NewRgn();
   1.214          if (!tempRgn || !drawRgn || !gSaveGrayRgn) {
   1.215              goto CLEANUP;
   1.216          }
   1.217 -        grayRgn = GetGrayRgn ();        /* No need to check for this */
   1.218 +        grayRgn = GetGrayRgn(); /* No need to check for this */
   1.219  
   1.220 -        GetPort (&savePort);
   1.221 +        GetPort(&savePort);
   1.222  
   1.223          /* Hide the control strip if it's present, and record its 
   1.224             previous position into the dirty region for redrawing. 
   1.225             This isn't necessary, but may help catch stray bits. */
   1.226 -        CopyRgn (grayRgn, tempRgn);
   1.227 -        if (!Gestalt (gestaltControlStripAttr, &response) &&
   1.228 +        CopyRgn(grayRgn, tempRgn);
   1.229 +        if (!Gestalt(gestaltControlStripAttr, &response) &&
   1.230              (response & (1L << gestaltControlStripExists))) {
   1.231 -            gSaveCSVis = SBIsControlStripVisible ();
   1.232 +            gSaveCSVis = SBIsControlStripVisible();
   1.233              if (gSaveCSVis)
   1.234 -                SBShowHideControlStrip (false);
   1.235 +                SBShowHideControlStrip(false);
   1.236          }
   1.237 -        DiffRgn (grayRgn, tempRgn, drawRgn);
   1.238 +        DiffRgn(grayRgn, tempRgn, drawRgn);
   1.239  
   1.240          /* Save the gray region once the control strip is hidden */
   1.241 -        CopyRgn (grayRgn, gSaveGrayRgn);
   1.242 +        CopyRgn(grayRgn, gSaveGrayRgn);
   1.243  
   1.244          /* Change the menu height in lowmem */
   1.245          gSaveMenuBar = height;
   1.246 -        LMSetMBarHeight (0);
   1.247 +        LMSetMBarHeight(0);
   1.248  
   1.249          /* Walk the monitor rectangles, and combine any pieces that
   1.250             aren't in GrayRgn: menubar, round corners, fake floaters. */
   1.251 -        for (gd = GetDeviceList (); gd; gd = GetNextDevice (gd)) {
   1.252 -            if (!TestDeviceAttribute (gd, screenDevice))
   1.253 +        for (gd = GetDeviceList(); gd; gd = GetNextDevice(gd)) {
   1.254 +            if (!TestDeviceAttribute(gd, screenDevice))
   1.255                  continue;
   1.256 -            if (!TestDeviceAttribute (gd, screenActive))
   1.257 +            if (!TestDeviceAttribute(gd, screenActive))
   1.258                  continue;
   1.259  
   1.260 -            RectRgn (tempRgn, &(*gd)->gdRect);  /* Get the whole screen */
   1.261 -            DiffRgn (tempRgn, grayRgn, tempRgn);        /* Subtract out GrayRgn */
   1.262 -            UnionRgn (tempRgn, drawRgn, drawRgn);       /* Combine all the bits */
   1.263 +            RectRgn(tempRgn, &(*gd)->gdRect);   /* Get the whole screen */
   1.264 +            DiffRgn(tempRgn, grayRgn, tempRgn); /* Subtract out GrayRgn */
   1.265 +            UnionRgn(tempRgn, drawRgn, drawRgn);        /* Combine all the bits */
   1.266          }
   1.267  
   1.268          /* Add the bits into the GrayRgn */
   1.269 -        UnionRgn (drawRgn, grayRgn, grayRgn);
   1.270 +        UnionRgn(drawRgn, grayRgn, grayRgn);
   1.271  
   1.272          /* Modify the vis regions of exposed windows */
   1.273 -        window = (FrontWindow ())? FrontWindow () : (WindowPtr) - 1L;
   1.274 -        PaintBehind (window, drawRgn);
   1.275 -        CalcVisBehind (window, drawRgn);
   1.276 +        window = (FrontWindow())? FrontWindow() : (WindowPtr) - 1L;
   1.277 +        PaintBehind(window, drawRgn);
   1.278 +        CalcVisBehind(window, drawRgn);
   1.279  
   1.280 -        SetPort (savePort);
   1.281 +        SetPort(savePort);
   1.282  
   1.283          /* Yield time so that floaters can catch up */
   1.284 -        EventAvail (0, &theEvent);
   1.285 -        EventAvail (0, &theEvent);
   1.286 -        EventAvail (0, &theEvent);
   1.287 -        EventAvail (0, &theEvent);
   1.288 +        EventAvail(0, &theEvent);
   1.289 +        EventAvail(0, &theEvent);
   1.290 +        EventAvail(0, &theEvent);
   1.291 +        EventAvail(0, &theEvent);
   1.292      }
   1.293  
   1.294    CLEANUP:
   1.295  
   1.296      if (tempRgn)
   1.297 -        DisposeRgn (tempRgn);
   1.298 +        DisposeRgn(tempRgn);
   1.299      if (drawRgn)
   1.300 -        DisposeRgn (drawRgn);
   1.301 +        DisposeRgn(drawRgn);
   1.302  #endif /* !TARGET_API_MAC_CARBON */
   1.303  }
   1.304  
   1.305  static void
   1.306 -ROM_ShowMenuBar (_THIS)
   1.307 +ROM_ShowMenuBar(_THIS)
   1.308  {
   1.309  #if !TARGET_API_MAC_CARBON      /* This seems not to be available? -sts Aug 2000 */
   1.310      RgnHandle drawRgn = nil;
   1.311 @@ -379,112 +379,112 @@
   1.312      RGBColor saveRGB;
   1.313      RGBColor blackRGB = { 0, 0, 0 };
   1.314  
   1.315 -    height = GetMBarHeight ();
   1.316 +    height = GetMBarHeight();
   1.317  
   1.318      if ((height <= 0) && (gSaveMenuBar > 0)) {
   1.319 -        drawRgn = NewRgn ();
   1.320 -        menuRgn = NewRgn ();
   1.321 -        tempRgn = NewRgn ();
   1.322 +        drawRgn = NewRgn();
   1.323 +        menuRgn = NewRgn();
   1.324 +        tempRgn = NewRgn();
   1.325          if (!tempRgn || !drawRgn || !gSaveGrayRgn) {
   1.326              goto CLEANUP;
   1.327          }
   1.328 -        grayRgn = GetGrayRgn ();        /* No need to check for this */
   1.329 +        grayRgn = GetGrayRgn(); /* No need to check for this */
   1.330  
   1.331 -        GetPort (&savePort);
   1.332 -        GetWMgrPort (&wMgrPort);
   1.333 +        GetPort(&savePort);
   1.334 +        GetWMgrPort(&wMgrPort);
   1.335  
   1.336          /* Set the height properly */
   1.337 -        LMSetMBarHeight (gSaveMenuBar);
   1.338 +        LMSetMBarHeight(gSaveMenuBar);
   1.339  
   1.340          /* Restore the old GrayRgn: rounded corners, etc, but not
   1.341             the menubar -- subtract that out first! */
   1.342          if (gSaveGrayRgn) {
   1.343 -            menuRect = (*GetMainDevice ())->gdRect;
   1.344 +            menuRect = (*GetMainDevice())->gdRect;
   1.345              menuRect.bottom = menuRect.top + gSaveMenuBar;
   1.346 -            RectRgn (menuRgn, &menuRect);
   1.347 +            RectRgn(menuRgn, &menuRect);
   1.348  
   1.349 -            DiffRgn (grayRgn, gSaveGrayRgn, drawRgn);   /* What do we inval? */
   1.350 -            DiffRgn (drawRgn, menuRgn, drawRgn);        /* Clip out the menu */
   1.351 +            DiffRgn(grayRgn, gSaveGrayRgn, drawRgn);    /* What do we inval? */
   1.352 +            DiffRgn(drawRgn, menuRgn, drawRgn); /* Clip out the menu */
   1.353  
   1.354              /* Now redraw the corners and other bits black */
   1.355 -            SetPort (wMgrPort);
   1.356 -            GetClip (tempRgn);
   1.357 -            SetClip (drawRgn);
   1.358 -            GetForeColor (&saveRGB);
   1.359 -            RGBForeColor (&blackRGB);
   1.360 -            PaintRgn (drawRgn);
   1.361 -            RGBForeColor (&saveRGB);
   1.362 -            SetClip (tempRgn);
   1.363 -            SetPort (savePort);
   1.364 +            SetPort(wMgrPort);
   1.365 +            GetClip(tempRgn);
   1.366 +            SetClip(drawRgn);
   1.367 +            GetForeColor(&saveRGB);
   1.368 +            RGBForeColor(&blackRGB);
   1.369 +            PaintRgn(drawRgn);
   1.370 +            RGBForeColor(&saveRGB);
   1.371 +            SetClip(tempRgn);
   1.372 +            SetPort(savePort);
   1.373  
   1.374 -            UnionRgn (drawRgn, menuRgn, drawRgn);       /* Put back the menu */
   1.375 +            UnionRgn(drawRgn, menuRgn, drawRgn);        /* Put back the menu */
   1.376  
   1.377              /* Now actually restore the GrayRgn */
   1.378 -            CopyRgn (gSaveGrayRgn, grayRgn);
   1.379 -            DisposeRgn (gSaveGrayRgn);
   1.380 +            CopyRgn(gSaveGrayRgn, grayRgn);
   1.381 +            DisposeRgn(gSaveGrayRgn);
   1.382              gSaveGrayRgn = nil;
   1.383          }
   1.384  
   1.385          /* Modify the vis regions of exposed windows and draw menubar */
   1.386 -        window = (FrontWindow ())? FrontWindow () : (WindowPtr) - 1L;
   1.387 -        PaintBehind (window, drawRgn);
   1.388 -        CalcVisBehind (window, drawRgn);
   1.389 -        DrawMenuBar ();
   1.390 +        window = (FrontWindow())? FrontWindow() : (WindowPtr) - 1L;
   1.391 +        PaintBehind(window, drawRgn);
   1.392 +        CalcVisBehind(window, drawRgn);
   1.393 +        DrawMenuBar();
   1.394  
   1.395 -        SetPort (savePort);
   1.396 +        SetPort(savePort);
   1.397          gSaveMenuBar = 0;
   1.398  
   1.399          /* Now show the control strip if it's present */
   1.400 -        if (!Gestalt (gestaltControlStripAttr, &response) &&
   1.401 +        if (!Gestalt(gestaltControlStripAttr, &response) &&
   1.402              (response & (1L << gestaltControlStripExists))) {
   1.403 -            if (gSaveCSVis && !SBIsControlStripVisible ())
   1.404 -                SBShowHideControlStrip (true);
   1.405 +            if (gSaveCSVis && !SBIsControlStripVisible())
   1.406 +                SBShowHideControlStrip(true);
   1.407              gSaveCSVis = true;
   1.408          }
   1.409  
   1.410          /* Yield time so that floaters can catch up */
   1.411 -        EventAvail (0, &theEvent);
   1.412 -        EventAvail (0, &theEvent);
   1.413 -        EventAvail (0, &theEvent);
   1.414 -        EventAvail (0, &theEvent);
   1.415 +        EventAvail(0, &theEvent);
   1.416 +        EventAvail(0, &theEvent);
   1.417 +        EventAvail(0, &theEvent);
   1.418 +        EventAvail(0, &theEvent);
   1.419      }
   1.420  
   1.421    CLEANUP:
   1.422  
   1.423      if (drawRgn)
   1.424 -        DisposeRgn (drawRgn);
   1.425 +        DisposeRgn(drawRgn);
   1.426      if (menuRgn)
   1.427 -        DisposeRgn (menuRgn);
   1.428 +        DisposeRgn(menuRgn);
   1.429      if (tempRgn)
   1.430 -        DisposeRgn (tempRgn);
   1.431 +        DisposeRgn(tempRgn);
   1.432  #endif /* !TARGET_API_MAC_CARBON */
   1.433  }
   1.434  
   1.435  /* Various screen update functions available */
   1.436 -static void ROM_DirectUpdate (_THIS, int numrects, SDL_Rect * rects);
   1.437 -static void ROM_WindowUpdate (_THIS, int numrects, SDL_Rect * rects);
   1.438 +static void ROM_DirectUpdate(_THIS, int numrects, SDL_Rect * rects);
   1.439 +static void ROM_WindowUpdate(_THIS, int numrects, SDL_Rect * rects);
   1.440  
   1.441  static void
   1.442 -ROM_UnsetVideoMode (_THIS, SDL_Surface * current)
   1.443 +ROM_UnsetVideoMode(_THIS, SDL_Surface * current)
   1.444  {
   1.445      /* Free the current window, if any */
   1.446      if (SDL_Window != nil) {
   1.447          GWorldPtr memworld;
   1.448  
   1.449          /* Handle OpenGL support */
   1.450 -        Mac_GL_Quit (this);
   1.451 +        Mac_GL_Quit(this);
   1.452  
   1.453 -        memworld = (GWorldPtr) GetWRefCon (SDL_Window);
   1.454 +        memworld = (GWorldPtr) GetWRefCon(SDL_Window);
   1.455          if (memworld != nil) {
   1.456 -            UnlockPixels (GetGWorldPixMap (memworld));
   1.457 -            DisposeGWorld (memworld);
   1.458 +            UnlockPixels(GetGWorldPixMap(memworld));
   1.459 +            DisposeGWorld(memworld);
   1.460          }
   1.461          if ((current->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN) {
   1.462  #if USE_QUICKTIME
   1.463 -            EndFullScreen (fullscreen_ctx, nil);
   1.464 +            EndFullScreen(fullscreen_ctx, nil);
   1.465              SDL_Window = nil;
   1.466  #else
   1.467 -            ROM_ShowMenuBar (this);
   1.468 +            ROM_ShowMenuBar(this);
   1.469  #endif
   1.470          }
   1.471      }
   1.472 @@ -493,8 +493,8 @@
   1.473  }
   1.474  
   1.475  static SDL_Surface *
   1.476 -ROM_SetVideoMode (_THIS, SDL_Surface * current,
   1.477 -                  int width, int height, int bpp, Uint32 flags)
   1.478 +ROM_SetVideoMode(_THIS, SDL_Surface * current,
   1.479 +                 int width, int height, int bpp, Uint32 flags)
   1.480  {
   1.481      Rect wrect, orect;
   1.482  #if TARGET_API_MAC_CARBON
   1.483 @@ -502,26 +502,26 @@
   1.484  #endif
   1.485  
   1.486      /* Free any previous video mode */
   1.487 -    ROM_UnsetVideoMode (this, current);
   1.488 +    ROM_UnsetVideoMode(this, current);
   1.489  
   1.490      /* Create the ROM window and SDL video surface */
   1.491      current->flags = 0;         /* Clear flags */
   1.492      current->w = width;
   1.493      current->h = height;
   1.494 -    SetRect (&wrect, 0, 0, width, height);
   1.495 +    SetRect(&wrect, 0, 0, width, height);
   1.496      if (SDL_Window) {
   1.497          /* If we recreate the window, don't move it around */
   1.498  #if TARGET_API_MAC_CARBON
   1.499 -        orect = *GetWindowPortBounds (SDL_Window, &tmprect);
   1.500 +        orect = *GetWindowPortBounds(SDL_Window, &tmprect);
   1.501  #else
   1.502          orect = SDL_Window->portRect;
   1.503  #endif
   1.504 -        OffsetRect (&wrect, orect.left, orect.top);
   1.505 +        OffsetRect(&wrect, orect.left, orect.top);
   1.506      } else {
   1.507          /* Center the window the first time we show it */
   1.508 -        OffsetRect (&wrect,
   1.509 -                    (SDL_modelist[0]->w - width) / 2,
   1.510 -                    (SDL_modelist[0]->h - height) / 2);
   1.511 +        OffsetRect(&wrect,
   1.512 +                   (SDL_modelist[0]->w - width) / 2,
   1.513 +                   (SDL_modelist[0]->h - height) / 2);
   1.514      }
   1.515  
   1.516  #if defined(__MACOSX__) && !USE_QUICKTIME
   1.517 @@ -532,14 +532,14 @@
   1.518          /* Create the fullscreen window and use screen bits */
   1.519          current->flags |= SDL_HWSURFACE | SDL_FULLSCREEN;
   1.520          if (SDL_Window) {
   1.521 -            DisposeWindow (SDL_Window);
   1.522 +            DisposeWindow(SDL_Window);
   1.523          }
   1.524  #if USE_QUICKTIME
   1.525 -        BeginFullScreen (&fullscreen_ctx, nil, 0, 0, &SDL_Window, nil, 0);
   1.526 +        BeginFullScreen(&fullscreen_ctx, nil, 0, 0, &SDL_Window, nil, 0);
   1.527  #else
   1.528 -        SDL_Window = NewCWindow (nil, &wrect, "\p", true, plainDBox,
   1.529 -                                 (WindowPtr) - 1, false, 0);
   1.530 -        ROM_HideMenuBar (this);
   1.531 +        SDL_Window = NewCWindow(nil, &wrect, "\p", true, plainDBox,
   1.532 +                                (WindowPtr) - 1, false, 0);
   1.533 +        ROM_HideMenuBar(this);
   1.534  #endif
   1.535          current->pitch = (**(**SDL_Display).gdPMap).rowBytes & 0x3FFF;
   1.536          current->pixels = (**(**SDL_Display).gdPMap).baseAddr;
   1.537 @@ -561,51 +561,51 @@
   1.538              /* Resize existing window, if necessary */
   1.539              if (((orect.right - orect.left) != width) ||
   1.540                  ((orect.bottom - orect.top) != height)) {
   1.541 -                SizeWindow (SDL_Window, width, height, false);
   1.542 +                SizeWindow(SDL_Window, width, height, false);
   1.543              }
   1.544          } else {
   1.545              /* Recreate the window in the new style */
   1.546              if (SDL_Window) {
   1.547 -                DisposeWindow (SDL_Window);
   1.548 +                DisposeWindow(SDL_Window);
   1.549              }
   1.550 -            SDL_Window = NewCWindow (nil, &wrect, "\p", true,
   1.551 -                                     style, (WindowPtr) - 1, true, 0);
   1.552 +            SDL_Window = NewCWindow(nil, &wrect, "\p", true,
   1.553 +                                    style, (WindowPtr) - 1, true, 0);
   1.554  
   1.555              /* Set the window title, if any */
   1.556              {
   1.557                  char *title;
   1.558 -                SDL_WM_GetCaption (&title, NULL);
   1.559 +                SDL_WM_GetCaption(&title, NULL);
   1.560                  if (title) {
   1.561 -                    Mac_SetCaption (this, title, NULL);
   1.562 +                    Mac_SetCaption(this, title, NULL);
   1.563                  }
   1.564              }
   1.565          }
   1.566          current_style = style;
   1.567 -        SetPalette (SDL_Window, SDL_CPal, false);
   1.568 -        ActivatePalette (SDL_Window);
   1.569 -        if (NewGWorld (&memworld, 0,
   1.570 +        SetPalette(SDL_Window, SDL_CPal, false);
   1.571 +        ActivatePalette(SDL_Window);
   1.572 +        if (NewGWorld(&memworld, 0,
   1.573  #if TARGET_API_MAC_CARBON
   1.574 -                       GetWindowPortBounds (SDL_Window, &tmprect),
   1.575 +                      GetWindowPortBounds(SDL_Window, &tmprect),
   1.576  #else
   1.577 -                       &SDL_Window->portRect,
   1.578 +                      &SDL_Window->portRect,
   1.579  #endif
   1.580 -                       SDL_CTab, nil, 0) != noErr) {
   1.581 -            SDL_SetError ("NewGWorld() failed");
   1.582 +                      SDL_CTab, nil, 0) != noErr) {
   1.583 +            SDL_SetError("NewGWorld() failed");
   1.584              return (NULL);
   1.585          }
   1.586 -        SetWRefCon (SDL_Window, (long) memworld);
   1.587 -        pixmap = GetGWorldPixMap (memworld);
   1.588 -        LockPixels (pixmap);
   1.589 +        SetWRefCon(SDL_Window, (long) memworld);
   1.590 +        pixmap = GetGWorldPixMap(memworld);
   1.591 +        LockPixels(pixmap);
   1.592          current->pitch = (**pixmap).rowBytes & 0x3FFF;
   1.593 -        current->pixels = GetPixBaseAddr (pixmap);
   1.594 +        current->pixels = GetPixBaseAddr(pixmap);
   1.595          this->UpdateRects = ROM_WindowUpdate;
   1.596      }
   1.597 -    SetPortWindowPort (SDL_Window);
   1.598 -    SelectWindow (SDL_Window);
   1.599 +    SetPortWindowPort(SDL_Window);
   1.600 +    SelectWindow(SDL_Window);
   1.601  
   1.602      /* Handle OpenGL support */
   1.603      if (flags & SDL_INTERNALOPENGL) {
   1.604 -        if (Mac_GL_Init (this) == 0) {
   1.605 +        if (Mac_GL_Init(this) == 0) {
   1.606              current->flags |= SDL_INTERNALOPENGL;
   1.607          } else {
   1.608              current = NULL;
   1.609 @@ -621,35 +621,35 @@
   1.610  
   1.611  /* We don't actually allow hardware surfaces other than the main one */
   1.612  static int
   1.613 -ROM_AllocHWSurface (_THIS, SDL_Surface * surface)
   1.614 +ROM_AllocHWSurface(_THIS, SDL_Surface * surface)
   1.615  {
   1.616      return (-1);
   1.617  }
   1.618  static void
   1.619 -ROM_FreeHWSurface (_THIS, SDL_Surface * surface)
   1.620 +ROM_FreeHWSurface(_THIS, SDL_Surface * surface)
   1.621  {
   1.622      return;
   1.623  }
   1.624  static int
   1.625 -ROM_LockHWSurface (_THIS, SDL_Surface * surface)
   1.626 +ROM_LockHWSurface(_THIS, SDL_Surface * surface)
   1.627  {
   1.628      return (0);
   1.629  }
   1.630  static void
   1.631 -ROM_UnlockHWSurface (_THIS, SDL_Surface * surface)
   1.632 +ROM_UnlockHWSurface(_THIS, SDL_Surface * surface)
   1.633  {
   1.634      return;
   1.635  }
   1.636  
   1.637  static void
   1.638 -ROM_DirectUpdate (_THIS, int numrects, SDL_Rect * rects)
   1.639 +ROM_DirectUpdate(_THIS, int numrects, SDL_Rect * rects)
   1.640  {
   1.641      /* The application is already updating the visible video memory */
   1.642      return;
   1.643  }
   1.644  
   1.645  static void
   1.646 -ROM_WindowUpdate (_THIS, int numrects, SDL_Rect * rects)
   1.647 +ROM_WindowUpdate(_THIS, int numrects, SDL_Rect * rects)
   1.648  {
   1.649      GWorldPtr memworld;
   1.650      GrafPtr saveport;
   1.651 @@ -660,17 +660,17 @@
   1.652      Rect update;
   1.653  
   1.654      /* Copy from the offscreen GWorld to the window port */
   1.655 -    GetPort (&saveport);
   1.656 -    SetPortWindowPort (SDL_Window);
   1.657 -    thePort = GetWindowPort (SDL_Window);
   1.658 -    memworld = (GWorldPtr) GetWRefCon (SDL_Window);
   1.659 +    GetPort(&saveport);
   1.660 +    SetPortWindowPort(SDL_Window);
   1.661 +    thePort = GetWindowPort(SDL_Window);
   1.662 +    memworld = (GWorldPtr) GetWRefCon(SDL_Window);
   1.663  #if TARGET_API_MAC_CARBON && ACCESSOR_CALLS_ARE_FUNCTIONS
   1.664 -    memBits = GetPortBitMapForCopyBits ((CGrafPtr) memworld);
   1.665 +    memBits = GetPortBitMapForCopyBits((CGrafPtr) memworld);
   1.666  #else
   1.667      memBits = &((GrafPtr) memworld)->portBits;
   1.668  #endif
   1.669  #if TARGET_API_MAC_CARBON && ACCESSOR_CALLS_ARE_FUNCTIONS
   1.670 -    winBits = GetPortBitMapForCopyBits (thePort);
   1.671 +    winBits = GetPortBitMapForCopyBits(thePort);
   1.672  #else
   1.673      winBits = &SDL_Window->portBits;
   1.674  #endif
   1.675 @@ -679,18 +679,18 @@
   1.676          update.right = rects[i].x + rects[i].w;
   1.677          update.top = rects[i].y;
   1.678          update.bottom = rects[i].y + rects[i].h;
   1.679 -        CopyBits (memBits, winBits, &update, &update, srcCopy, nil);
   1.680 +        CopyBits(memBits, winBits, &update, &update, srcCopy, nil);
   1.681      }
   1.682  #if TARGET_API_MAC_CARBON
   1.683 -    if (QDIsPortBuffered (thePort)) {
   1.684 -        QDFlushPortBuffer (thePort, NULL);
   1.685 +    if (QDIsPortBuffered(thePort)) {
   1.686 +        QDFlushPortBuffer(thePort, NULL);
   1.687      }
   1.688  #endif
   1.689 -    SetPort (saveport);
   1.690 +    SetPort(saveport);
   1.691  }
   1.692  
   1.693  static int
   1.694 -ROM_SetColors (_THIS, int firstcolor, int ncolors, SDL_Color * colors)
   1.695 +ROM_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color * colors)
   1.696  {
   1.697      CTabHandle cTab;
   1.698      int i;
   1.699 @@ -718,43 +718,43 @@
   1.700  //      if ( (this->screen->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN ) 
   1.701      {
   1.702          GDevice **odisplay;
   1.703 -        odisplay = GetGDevice ();
   1.704 -        SetGDevice (SDL_Display);
   1.705 -        SetEntries (0, (**cTab).ctSize, (ColorSpec *) & (**cTab).ctTable);
   1.706 -        SetGDevice (odisplay);
   1.707 +        odisplay = GetGDevice();
   1.708 +        SetGDevice(SDL_Display);
   1.709 +        SetEntries(0, (**cTab).ctSize, (ColorSpec *) & (**cTab).ctTable);
   1.710 +        SetGDevice(odisplay);
   1.711      }
   1.712      return (1);
   1.713  }
   1.714  
   1.715  void
   1.716 -ROM_VideoQuit (_THIS)
   1.717 +ROM_VideoQuit(_THIS)
   1.718  {
   1.719      int i;
   1.720  
   1.721      /* Free current video mode */
   1.722 -    ROM_UnsetVideoMode (this, this->screen);
   1.723 +    ROM_UnsetVideoMode(this, this->screen);
   1.724      if (SDL_Window) {
   1.725 -        DisposeWindow (SDL_Window);
   1.726 +        DisposeWindow(SDL_Window);
   1.727          SDL_Window = nil;
   1.728      }
   1.729  
   1.730      /* Free palette and restore original one */
   1.731      if (SDL_CTab != nil) {
   1.732 -        DisposeHandle ((Handle) SDL_CTab);
   1.733 +        DisposeHandle((Handle) SDL_CTab);
   1.734          SDL_CTab = nil;
   1.735      }
   1.736      if (SDL_CPal != nil) {
   1.737 -        DisposePalette (SDL_CPal);
   1.738 +        DisposePalette(SDL_CPal);
   1.739          SDL_CPal = nil;
   1.740      }
   1.741 -    RestoreDeviceClut (GetMainDevice ());
   1.742 +    RestoreDeviceClut(GetMainDevice());
   1.743  
   1.744      /* Free list of video modes */
   1.745      if (SDL_modelist != NULL) {
   1.746          for (i = 0; SDL_modelist[i]; ++i) {
   1.747 -            SDL_free (SDL_modelist[i]);
   1.748 +            SDL_free(SDL_modelist[i]);
   1.749          }
   1.750 -        SDL_free (SDL_modelist);
   1.751 +        SDL_free(SDL_modelist);
   1.752          SDL_modelist = NULL;
   1.753      }
   1.754  }