diff src/video/cybergfx/SDL_cgxvideo.c @ 1668:4da1ee79c9af SDL-1.3

more tweaking indent options
author Sam Lantinga <slouken@libsdl.org>
date Mon, 29 May 2006 04:04:35 +0000
parents 782fd950bd46
children
line wrap: on
line diff
--- a/src/video/cybergfx/SDL_cgxvideo.c	Mon May 29 03:53:21 2006 +0000
+++ b/src/video/cybergfx/SDL_cgxvideo.c	Mon May 29 04:04:35 2006 +0000
@@ -43,14 +43,14 @@
 #include "SDL_cgximage_c.h"
 
 /* Initialization/Query functions */
-static int CGX_VideoInit (_THIS, SDL_PixelFormat * vformat);
-static SDL_Surface *CGX_SetVideoMode (_THIS, SDL_Surface * current, int width,
-                                      int height, int bpp, Uint32 flags);
-static int CGX_ToggleFullScreen (_THIS, int on);
-static void CGX_UpdateMouse (_THIS);
-static int CGX_SetColors (_THIS, int firstcolor, int ncolors,
-                          SDL_Color * colors);
-static void CGX_VideoQuit (_THIS);
+static int CGX_VideoInit(_THIS, SDL_PixelFormat * vformat);
+static SDL_Surface *CGX_SetVideoMode(_THIS, SDL_Surface * current, int width,
+                                     int height, int bpp, Uint32 flags);
+static int CGX_ToggleFullScreen(_THIS, int on);
+static void CGX_UpdateMouse(_THIS);
+static int CGX_SetColors(_THIS, int firstcolor, int ncolors,
+                         SDL_Color * colors);
+static void CGX_VideoQuit(_THIS);
 
 /* CGX driver bootstrap functions */
 
@@ -59,21 +59,21 @@
 struct GfxBase *GfxBase = NULL;
 
 int
-CGX_SetGamma (_THIS, float red, float green, float blue)
+CGX_SetGamma(_THIS, float red, float green, float blue)
 {
-    SDL_SetError ("Gamma correction not supported");
+    SDL_SetError("Gamma correction not supported");
     return -1;
 }
 
 int
-CGX_GetGamma (_THIS, float red, float green, float blue)
+CGX_GetGamma(_THIS, float red, float green, float blue)
 {
-    SDL_SetError ("Gamma correction not supported");
+    SDL_SetError("Gamma correction not supported");
     return -1;
 }
 
 int
-CGX_SetGammaRamp (_THIS, Uint16 * ramp)
+CGX_SetGammaRamp(_THIS, Uint16 * ramp)
 {
 #if 0
     Int i, ncolors;
@@ -81,7 +81,7 @@
 
     /* See if actually setting the gamma is supported */
     if (SDL_Visual->class != DirectColor) {
-        SDL_SetError ("Gamma correction not supported on this visual");
+        SDL_SetError("Gamma correction not supported on this visual");
         return (-1);
     }
 
@@ -89,26 +89,26 @@
     ncolors = SDL_Visual->map_entries;
     for (i = 0; i < ncolors; ++i) {
         Uint8 c = (256 * i / ncolors);
-        xcmap[i].pixel = SDL_MapRGB (this->screen->format, c, c, c);
+        xcmap[i].pixel = SDL_MapRGB(this->screen->format, c, c, c);
         xcmap[i].red = ramp[0 * 256 + c];
         xcmap[i].green = ramp[1 * 256 + c];
         xcmap[i].blue = ramp[2 * 256 + c];
         xcmap[i].flags = (DoRed | DoGreen | DoBlue);
     }
-    XStoreColors (GFX_Display, SDL_XColorMap, xcmap, ncolors);
-    XSync (GFX_Display, False);
+    XStoreColors(GFX_Display, SDL_XColorMap, xcmap, ncolors);
+    XSync(GFX_Display, False);
 
     return (0);
 
 #else
-    SDL_SetError ("Gamma correction not supported on this visual");
+    SDL_SetError("Gamma correction not supported on this visual");
     return (-1);
 
 #endif
 }
 
 static void
-DestroyScreen (_THIS)
+DestroyScreen(_THIS)
 {
     if (currently_fullscreen) {
         if (this->hidden->dbuffer) {
@@ -117,12 +117,12 @@
             this->hidden->dbuffer = 0;
 
             if (safeport) {
-                while (GetMsg (safeport) != NULL);
-                DeleteMsgPort (safeport);
+                while (GetMsg(safeport) != NULL);
+                DeleteMsgPort(safeport);
             }
             if (dispport) {
-                while (GetMsg (dispport) != NULL);
-                DeleteMsgPort (dispport);
+                while (GetMsg(dispport) != NULL);
+                DeleteMsgPort(dispport);
             }
 
             this->hidden->SB[0]->sb_DBufInfo->dbi_SafeMessage.
@@ -135,81 +135,81 @@
                 mn_ReplyPort = NULL;
 
             if (this->hidden->SB[1])
-                FreeScreenBuffer (SDL_Display, this->hidden->SB[1]);
+                FreeScreenBuffer(SDL_Display, this->hidden->SB[1]);
             if (this->hidden->SB[0])
-                FreeScreenBuffer (SDL_Display, this->hidden->SB[0]);
+                FreeScreenBuffer(SDL_Display, this->hidden->SB[0]);
 
 
             this->hidden->SB[0] = this->hidden->SB[1] = NULL;
 
             if (SDL_RastPort && SDL_RastPort != &SDL_Display->RastPort)
-                SDL_free (SDL_RastPort);
+                SDL_free(SDL_RastPort);
 
             SDL_RastPort = NULL;
         }
-        CloseScreen (GFX_Display);
+        CloseScreen(GFX_Display);
         currently_fullscreen = 0;
     } else if (GFX_Display)
-        UnlockPubScreen (NULL, GFX_Display);
+        UnlockPubScreen(NULL, GFX_Display);
 
     GFX_Display = NULL;
 }
 
 static int
-CGX_Available (void)
+CGX_Available(void)
 {
     struct Library *l;
 
-    l = OpenLibrary ("cybergraphics.library", 0L);
+    l = OpenLibrary("cybergraphics.library", 0L);
 
     if (l != NULL) {
-        D (bug ("CGX video device AVAILABLE\n"));
-        CloseLibrary (l);
+        D(bug("CGX video device AVAILABLE\n"));
+        CloseLibrary(l);
     }
-    D (
-          else
-          bug ("**CGX video device UNAVAILABLE\n"));
+    D(
+         else
+         bug("**CGX video device UNAVAILABLE\n"));
 
     return (l != NULL);
 }
 
 static void
-CGX_DeleteDevice (SDL_VideoDevice * device)
+CGX_DeleteDevice(SDL_VideoDevice * device)
 {
     if (device) {
         if (device->hidden) {
-            SDL_free (device->hidden);
+            SDL_free(device->hidden);
         }
         if (device->gl_data) {
-            SDL_free (device->gl_data);
+            SDL_free(device->gl_data);
         }
-        SDL_free (device);
+        SDL_free(device);
     }
 }
 
 static SDL_VideoDevice *
-CGX_CreateDevice (int devindex)
+CGX_CreateDevice(int devindex)
 {
     SDL_VideoDevice *device;
 
     /* Initialize all variables that we clean on shutdown */
-    device = (SDL_VideoDevice *) SDL_malloc (sizeof (SDL_VideoDevice));
+    device = (SDL_VideoDevice *) SDL_malloc(sizeof(SDL_VideoDevice));
     if (device) {
-        SDL_memset (device, 0, (sizeof *device));
+        SDL_memset(device, 0, (sizeof *device));
         device->hidden = (struct SDL_PrivateVideoData *)
-            SDL_malloc ((sizeof *device->hidden));
+            SDL_malloc((sizeof *device->hidden));
         device->gl_data = (struct SDL_PrivateGLData *)
-            SDL_malloc ((sizeof *device->gl_data));
+            SDL_malloc((sizeof *device->gl_data));
     }
     if ((device == NULL) || (device->hidden == NULL) ||
         (device->gl_data == NULL)) {
-        D (bug ("Unable to create video device!\n"));
-        SDL_OutOfMemory ();
-        CGX_DeleteDevice (device);
+        D(bug("Unable to create video device!\n"));
+        SDL_OutOfMemory();
+        CGX_DeleteDevice(device);
         return (0);
     }
-    SDL_memset (device->hidden, 0, sizeof (*device->hidden));
-    SDL_memset (device->gl_data, 0, sizeof (*device->gl_data));
+    SDL_memset(device->hidden, 0, sizeof(*device->hidden));
+    SDL_memset(device->gl_data, 0, sizeof(*device->gl_data));
 
     /* Set the driver flags */
     device->handles_any_size = 1;
@@ -266,21 +266,21 @@
 };
 
 Uint32
-MakeBitMask (_THIS, int type, int format, int *bpp)
+MakeBitMask(_THIS, int type, int format, int *bpp)
 {
-    D (if (type == 0) bug ("REAL pixel format: "));
+    D(if (type == 0) bug("REAL pixel format: "));
 
     if (this->hidden->depth == *bpp) {
 
         switch (format) {
         case PIXFMT_LUT8:
-            D (if (type == 0) bug ("LUT8\n"));
+            D(if (type == 0) bug("LUT8\n"));
             return 0;
         case PIXFMT_BGR15:
         case PIXFMT_RGB15PC:
             switch (type) {
             case 0:
-                D (bug ("RGB15PC/BGR15\n"));
+                D(bug("RGB15PC/BGR15\n"));
                 return 31;
             case 1:
                 return 992;
@@ -291,7 +291,7 @@
         case PIXFMT_BGR15PC:
             switch (type) {
             case 0:
-                D (bug ("RGB15/BGR15PC\n"));
+                D(bug("RGB15/BGR15PC\n"));
                 return 31744;
             case 1:
                 return 992;
@@ -302,7 +302,7 @@
         case PIXFMT_RGB16:
             switch (type) {
             case 0:
-                D (bug ("RGB16PC\n"));
+                D(bug("RGB16PC\n"));
                 return 63488;
             case 1:
                 return 2016;
@@ -313,7 +313,7 @@
         case PIXFMT_RGB16PC:
             switch (type) {
             case 0:
-                D (bug ("RGB16PC/BGR16\n"));
+                D(bug("RGB16PC/BGR16\n"));
                 return 31;
             case 1:
                 return 2016;
@@ -324,7 +324,7 @@
         case PIXFMT_RGB24:
             switch (type) {
             case 0:
-                D (bug ("RGB24/BGR24\n"));
+                D(bug("RGB24/BGR24\n"));
                 return 0xff0000;
             case 1:
                 return 0xff00;
@@ -334,7 +334,7 @@
         case PIXFMT_BGR24:
             switch (type) {
             case 0:
-                D (bug ("BGR24\n"));
+                D(bug("BGR24\n"));
                 return 0xff;
             case 1:
                 return 0xff00;
@@ -344,7 +344,7 @@
         case PIXFMT_ARGB32:
             switch (type) {
             case 0:
-                D (bug ("ARGB32\n"));
+                D(bug("ARGB32\n"));
                 return 0xff0000;
             case 1:
                 return 0xff00;
@@ -354,7 +354,7 @@
         case PIXFMT_BGRA32:
             switch (type) {
             case 0:
-                D (bug ("BGRA32\n"));
+                D(bug("BGRA32\n"));
                 return 0xff00;
             case 1:
                 return 0xff0000;
@@ -364,7 +364,7 @@
         case PIXFMT_RGBA32:
             switch (type) {
             case 0:
-                D (bug ("RGBA32\n"));
+                D(bug("RGBA32\n"));
                 return 0xff000000;
             case 1:
                 return 0xff0000;
@@ -372,16 +372,16 @@
                 return 0xff00;
             }
         default:
-            D (bug ("Unknown pixel format! Default to 24bit\n"));
+            D(bug("Unknown pixel format! Default to 24bit\n"));
             return (Uint32) (255 << (type * 8));
         }
     } else {
-        D (if (type == 0)
-           bug ("DIFFERENT from screen.\nAllocated screen format: "));
+        D(if (type == 0)
+          bug("DIFFERENT from screen.\nAllocated screen format: "));
 
         switch (*bpp) {
         case 32:
-            D (if (type == 0) bug ("RGBA32\n"));
+            D(if (type == 0) bug("RGBA32\n"));
             switch (type) {
             case 0:
                 return 0xff000000;
@@ -395,7 +395,7 @@
           use_truecolor:
             switch (type) {
             case 0:
-                D (bug ("RGB24\n"));
+                D(bug("RGB24\n"));
                 return 0xff0000;
             case 1:
                 return 0xff00;
@@ -404,13 +404,13 @@
             }
         case 16:
         case 15:
-            D (if (type == 0)
-               bug ("Not supported, switching to 24bit!\n"));
+            D(if (type == 0)
+              bug("Not supported, switching to 24bit!\n"));
             *bpp = 24;
             goto use_truecolor;
             break;
         default:
-            D (if (type == 0) bug ("This is a chunky display\n"));
+            D(if (type == 0) bug("This is a chunky display\n"));
 // For chunky display mask is always 0;
             return 0;
         }
@@ -419,19 +419,19 @@
 }
 
 static int
-CGX_VideoInit (_THIS, SDL_PixelFormat * vformat)
+CGX_VideoInit(_THIS, SDL_PixelFormat * vformat)
 {
     int i;
     struct Library *RTGBase;
 
-    D (bug ("VideoInit... Opening libraries\n"));
+    D(bug("VideoInit... Opening libraries\n"));
 
     if (!IntuitionBase) {
         if (!
             (IntuitionBase =
-             (struct IntuitionBase *) OpenLibrary ("intuition.library",
-                                                   39L))) {
-            SDL_SetError ("Couldn't open intuition V39+");
+             (struct IntuitionBase *) OpenLibrary("intuition.library",
+                                                  39L))) {
+            SDL_SetError("Couldn't open intuition V39+");
             return -1;
         }
     }
@@ -439,64 +439,64 @@
     if (!GfxBase) {
         if (!
             (GfxBase =
-             (struct GfxBase *) OpenLibrary ("graphics.library", 39L))) {
-            SDL_SetError ("Couldn't open graphics V39+");
+             (struct GfxBase *) OpenLibrary("graphics.library", 39L))) {
+            SDL_SetError("Couldn't open graphics V39+");
             return -1;
         }
     }
 
     if (!CyberGfxBase) {
-        if (!(CyberGfxBase = OpenLibrary ("cybergraphics.library", 40L))) {
-            SDL_SetError ("Couldn't open cybergraphics.");
+        if (!(CyberGfxBase = OpenLibrary("cybergraphics.library", 40L))) {
+            SDL_SetError("Couldn't open cybergraphics.");
             return (-1);
         }
     }
 
-    if (RTGBase = OpenLibrary ("libs:picasso96/rtg.library", 0L)) {
+    if (RTGBase = OpenLibrary("libs:picasso96/rtg.library", 0L)) {
         extern int use_picasso96;
 
-        CloseLibrary (RTGBase);
+        CloseLibrary(RTGBase);
         use_picasso96 = 1;
     }
 
-    D (bug ("Library intialized, locking screen...\n"));
+    D(bug("Library intialized, locking screen...\n"));
 
-    SDL_Display = LockPubScreen (NULL);
+    SDL_Display = LockPubScreen(NULL);
 
     if (SDL_Display == NULL) {
-        D (bug ("Cannot lock display...\n"));
-        SDL_SetError ("Couldn't lock the display");
+        D(bug("Cannot lock display...\n"));
+        SDL_SetError("Couldn't lock the display");
         return (-1);
     }
     this->info.current_w = SDL_Display->Width;
     this->info.current_h = SDL_Display->Height;
 
-    D (bug ("Checking if we are using a CGX native display...\n"));
+    D(bug("Checking if we are using a CGX native display...\n"));
 
-    if (!IsCyberModeID (GetVPModeID (&SDL_Display->ViewPort))) {
+    if (!IsCyberModeID(GetVPModeID(&SDL_Display->ViewPort))) {
         Uint32 okid =
-            BestCModeIDTags (CYBRBIDTG_NominalWidth, SDL_Display->Width,
-                             CYBRBIDTG_NominalHeight, SDL_Display->Height,
-                             CYBRBIDTG_Depth, 8,
-                             TAG_DONE);
+            BestCModeIDTags(CYBRBIDTG_NominalWidth, SDL_Display->Width,
+                            CYBRBIDTG_NominalHeight, SDL_Display->Height,
+                            CYBRBIDTG_Depth, 8,
+                            TAG_DONE);
 
-        D (bug ("Default visual is not CGX native!\n"));
+        D(bug("Default visual is not CGX native!\n"));
 
-        UnlockPubScreen (NULL, SDL_Display);
+        UnlockPubScreen(NULL, SDL_Display);
 
         GFX_Display = NULL;
 
         if (okid != INVALID_ID) {
-            GFX_Display = OpenScreenTags (NULL,
-                                          SA_Width, SDL_Display->Width,
-                                          SA_Height, SDL_Display->Height,
-                                          SA_Depth, 8, SA_Quiet, TRUE,
-                                          SA_ShowTitle, FALSE,
-                                          SA_DisplayID, okid, TAG_DONE);
+            GFX_Display = OpenScreenTags(NULL,
+                                         SA_Width, SDL_Display->Width,
+                                         SA_Height, SDL_Display->Height,
+                                         SA_Depth, 8, SA_Quiet, TRUE,
+                                         SA_ShowTitle, FALSE,
+                                         SA_DisplayID, okid, TAG_DONE);
         }
 
         if (!GFX_Display) {
-            SDL_SetError ("Unable to open a suited CGX display");
+            SDL_SetError("Unable to open a suited CGX display");
             return -1;
         } else
             SDL_Display = GFX_Display;
@@ -515,10 +515,10 @@
         swap_pixels = 1;
     }
 
-    D (bug ("Before GetVideoModes....\n"));
+    D(bug("Before GetVideoModes....\n"));
 
     /* Get the available video modes */
-    if (CGX_GetVideoModes (this) < 0)
+    if (CGX_GetVideoModes(this) < 0)
         return -1;
 
     /* Determine the default screen depth:
@@ -526,7 +526,7 @@
 
     for (i = 0; i < this->hidden->nvisuals; i++)
         if (this->hidden->visuals[i].depth ==
-            GetCyberMapAttr (SDL_Display->RastPort.BitMap, CYBRMATTR_DEPTH))
+            GetCyberMapAttr(SDL_Display->RastPort.BitMap, CYBRMATTR_DEPTH))
             break;
     if (i == this->hidden->nvisuals) {
         /* default visual was useless, take the deepest one instead */
@@ -537,7 +537,7 @@
 //      SDL_XColorMap = SDL_DisplayColormap;
 
     this->hidden->depth = this->hidden->visuals[i].depth;
-    D (bug ("Init: Setting screen depth to: %ld\n", this->hidden->depth));
+    D(bug("Init: Setting screen depth to: %ld\n", this->hidden->depth));
     vformat->BitsPerPixel = this->hidden->visuals[i].depth;     /* this->hidden->visuals[i].bpp; */
 
     {
@@ -545,29 +545,26 @@
         APTR handle;
         struct DisplayInfo info;
 
-        if (!(handle = FindDisplayInfo (this->hidden->visuals[i].visual))) {
-            D (bug ("Unable to get visual info...\n"));
+        if (!(handle = FindDisplayInfo(this->hidden->visuals[i].visual))) {
+            D(bug("Unable to get visual info...\n"));
             return -1;
         }
 
         if (!GetDisplayInfoData
-            (handle, (char *) &info, sizeof (struct DisplayInfo), DTAG_DISP,
+            (handle, (char *) &info, sizeof(struct DisplayInfo), DTAG_DISP,
              NULL)) {
-            D (bug ("Unable to get visual info data...\n"));
+            D(bug("Unable to get visual info data...\n"));
             return -1;
         }
 
-        form = GetCyberIDAttr (CYBRIDATTR_PIXFMT, SDL_Visual);
+        form = GetCyberIDAttr(CYBRIDATTR_PIXFMT, SDL_Visual);
 
 // In this case I use makebitmask in a way that I'm sure I'll get PIXFMT pixel mask
 
         if (vformat->BitsPerPixel > 8) {
-            vformat->Rmask =
-                MakeBitMask (this, 0, form, &this->hidden->depth);
-            vformat->Gmask =
-                MakeBitMask (this, 1, form, &this->hidden->depth);
-            vformat->Bmask =
-                MakeBitMask (this, 2, form, &this->hidden->depth);
+            vformat->Rmask = MakeBitMask(this, 0, form, &this->hidden->depth);
+            vformat->Gmask = MakeBitMask(this, 1, form, &this->hidden->depth);
+            vformat->Bmask = MakeBitMask(this, 2, form, &this->hidden->depth);
         }
     }
 
@@ -576,7 +573,7 @@
     SDL_windowid = NULL;
 
     /* Create the blank cursor */
-    SDL_BlankCursor = AllocMem (16, MEMF_CHIP | MEMF_CLEAR);
+    SDL_BlankCursor = AllocMem(16, MEMF_CHIP | MEMF_CLEAR);
 
     /* Fill in some window manager capabilities */
     this->info.wm_available = 1;
@@ -589,15 +586,15 @@
     this->hidden->same_format = 0;
     SDL_RastPort = &SDL_Display->RastPort;
     /* We're done! */
-    D (bug ("End of CGX_VideoInit\n"));
+    D(bug("End of CGX_VideoInit\n"));
 
     return (0);
 }
 
 void
-CGX_DestroyWindow (_THIS, SDL_Surface * screen)
+CGX_DestroyWindow(_THIS, SDL_Surface * screen)
 {
-    D (bug ("Destroy Window...\n"));
+    D(bug("Destroy Window...\n"));
 
     if (!SDL_windowid) {
         /* Hide the managed window */
@@ -616,7 +613,7 @@
 
         /* Destroy the output window */
         if (SDL_Window) {
-            CloseWindow (SDL_Window);
+            CloseWindow(SDL_Window);
             SDL_Window = NULL;
         }
 
@@ -635,62 +632,61 @@
                 if (!was_fullscreen && this->hidden->depth == 8) {
                     for (pixel = 0; pixel < numcolors; pixel++) {
                         if (SDL_XPixels[pixel] >= 0)
-                            ReleasePen (GFX_Display->ViewPort.
-                                        ColorMap, SDL_XPixels[pixel]);
+                            ReleasePen(GFX_Display->ViewPort.
+                                       ColorMap, SDL_XPixels[pixel]);
                     }
                 }
             }
-            SDL_free (SDL_XPixels);
+            SDL_free(SDL_XPixels);
             SDL_XPixels = NULL;
         }
     }
 }
 
 static void
-CGX_SetSizeHints (_THIS, int w, int h, Uint32 flags)
+CGX_SetSizeHints(_THIS, int w, int h, Uint32 flags)
 {
     if (flags & SDL_RESIZABLE) {
-        WindowLimits (SDL_Window, 32, 32, 4096, 4096);
+        WindowLimits(SDL_Window, 32, 32, 4096, 4096);
     } else {
-        WindowLimits (SDL_Window, w, h, w, h);
+        WindowLimits(SDL_Window, w, h, w, h);
     }
     if (flags & SDL_FULLSCREEN) {
         flags &= ~SDL_RESIZABLE;
-    } else if (SDL_getenv ("SDL_VIDEO_CENTERED")) {
+    } else if (SDL_getenv("SDL_VIDEO_CENTERED")) {
         int display_w, display_h;
 
         display_w = SDL_Display->Width;
         display_h = SDL_Display->Height;
-        ChangeWindowBox (SDL_Window,
-                         (display_w - w - SDL_Window->BorderLeft -
-                          SDL_Window->BorderRight) / 2,
-                         (display_h - h - SDL_Window->BorderTop -
-                          SDL_Window->BorderBottom) / 2,
-                         w + SDL_Window->BorderLeft +
-                         SDL_Window->BorderRight,
-                         h + SDL_Window->BorderTop +
-                         SDL_Window->BorderBottom);
+        ChangeWindowBox(SDL_Window,
+                        (display_w - w - SDL_Window->BorderLeft -
+                         SDL_Window->BorderRight) / 2,
+                        (display_h - h - SDL_Window->BorderTop -
+                         SDL_Window->BorderBottom) / 2,
+                        w + SDL_Window->BorderLeft +
+                        SDL_Window->BorderRight,
+                        h + SDL_Window->BorderTop + SDL_Window->BorderBottom);
     }
 }
 
 int
-CGX_CreateWindow (_THIS, SDL_Surface * screen,
-                  int w, int h, int bpp, Uint32 flags)
+CGX_CreateWindow(_THIS, SDL_Surface * screen,
+                 int w, int h, int bpp, Uint32 flags)
 {
 #if 0
     int i, depth;
     Uint32 vis;
 #endif
-    D (bug ("CGX_CreateWindow\n"));
+    D(bug("CGX_CreateWindow\n"));
 
     /* If a window is already present, destroy it and start fresh */
     if (SDL_Window) {
-        CGX_DestroyWindow (this, screen);
+        CGX_DestroyWindow(this, screen);
     }
 
     /* See if we have been given a window id */
     if (SDL_windowid) {
-        SDL_Window = (struct Window *) atol (SDL_windowid);
+        SDL_Window = (struct Window *) atol(SDL_windowid);
     } else {
         SDL_Window = 0;
     }
@@ -710,7 +706,7 @@
             break;
     }
     if (i == this->hidden->nvisuals) {
-        SDL_SetError ("No matching visual for requested depth");
+        SDL_SetError("No matching visual for requested depth");
         return -1;              /* should never happen */
     }
     vis = this->hidden->visuals[i].visual;
@@ -718,7 +714,7 @@
 //      }
     SDL_Visual = vis;
     this->hidden->depth = depth;
-    D (bug ("Setting screen depth to: %ld\n", this->hidden->depth));
+    D(bug("Setting screen depth to: %ld\n", this->hidden->depth));
 #endif
 
     /* Allocate the new pixel format for this video mode */
@@ -727,40 +723,40 @@
         APTR handle;
         struct DisplayInfo info;
 
-        if (!(handle = FindDisplayInfo (SDL_Visual)))
+        if (!(handle = FindDisplayInfo(SDL_Visual)))
             return -1;
 
         if (!GetDisplayInfoData
-            (handle, (char *) &info, sizeof (struct DisplayInfo), DTAG_DISP,
+            (handle, (char *) &info, sizeof(struct DisplayInfo), DTAG_DISP,
              NULL))
             return -1;
 
-        form = GetCyberIDAttr (CYBRIDATTR_PIXFMT, SDL_Visual);
+        form = GetCyberIDAttr(CYBRIDATTR_PIXFMT, SDL_Visual);
 
         if (flags & SDL_HWSURFACE) {
             if (bpp != this->hidden->depth) {
                 bpp = this->hidden->depth;
-                D (bug ("Accel forces bpp to be equal (%ld)\n", bpp));
+                D(bug("Accel forces bpp to be equal (%ld)\n", bpp));
             }
         }
 
-        D (bug
-           ("BEFORE screen allocation: bpp:%ld (real:%ld)\n", bpp,
-            this->hidden->depth));
+        D(bug
+          ("BEFORE screen allocation: bpp:%ld (real:%ld)\n", bpp,
+           this->hidden->depth));
 
 /* With this call if needed I'll revert the wanted bpp to a bpp best suited for the display, actually occurs
    only with requested format 15/16bit and display format != 15/16bit
  */
 
-        if (!SDL_ReallocFormat (screen, bpp,
-                                MakeBitMask (this, 0, form, &bpp),
-                                MakeBitMask (this, 1, form, &bpp),
-                                MakeBitMask (this, 2, form, &bpp), 0))
+        if (!SDL_ReallocFormat(screen, bpp,
+                               MakeBitMask(this, 0, form, &bpp),
+                               MakeBitMask(this, 1, form, &bpp),
+                               MakeBitMask(this, 2, form, &bpp), 0))
             return -1;
 
-        D (bug
-           ("AFTER screen allocation: bpp:%ld (real:%ld)\n", bpp,
-            this->hidden->depth));
+        D(bug
+          ("AFTER screen allocation: bpp:%ld (real:%ld)\n", bpp,
+           this->hidden->depth));
 
     }
 
@@ -770,10 +766,10 @@
 		XFreeColormap(SDL_Display, SDL_XColorMap);
 	}
 */
-    if (GetCyberMapAttr (SDL_Display->RastPort.BitMap, CYBRMATTR_PIXFMT) ==
+    if (GetCyberMapAttr(SDL_Display->RastPort.BitMap, CYBRMATTR_PIXFMT) ==
         PIXFMT_LUT8 || bpp == 8) {
         int ncolors, i;
-        D (bug ("XPixels palette allocation...\n"));
+        D(bug("XPixels palette allocation...\n"));
 
         /* Allocate the pixel flags */
 
@@ -782,10 +778,10 @@
         else
             ncolors = 1 << screen->format->BitsPerPixel;
 
-        SDL_XPixels = (Sint32 *) SDL_malloc (ncolors * sizeof (Sint32));
+        SDL_XPixels = (Sint32 *) SDL_malloc(ncolors * sizeof(Sint32));
 
         if (SDL_XPixels == NULL) {
-            SDL_OutOfMemory ();
+            SDL_OutOfMemory();
             return -1;
         }
 
@@ -807,19 +803,19 @@
 
     if (!SDL_windowid) {
         if (flags & SDL_FULLSCREEN) {
-            SDL_Window = OpenWindowTags (NULL, WA_Width, w, WA_Height, h,
-                                         WA_Flags,
-                                         WFLG_ACTIVATE | WFLG_RMBTRAP |
-                                         WFLG_BORDERLESS | WFLG_BACKDROP |
-                                         WFLG_REPORTMOUSE, WA_IDCMP,
-                                         IDCMP_RAWKEY | IDCMP_MOUSEBUTTONS
-                                         | IDCMP_MOUSEMOVE,
-                                         WA_CustomScreen,
-                                         (ULONG) SDL_Display, TAG_DONE);
+            SDL_Window = OpenWindowTags(NULL, WA_Width, w, WA_Height, h,
+                                        WA_Flags,
+                                        WFLG_ACTIVATE | WFLG_RMBTRAP |
+                                        WFLG_BORDERLESS | WFLG_BACKDROP |
+                                        WFLG_REPORTMOUSE, WA_IDCMP,
+                                        IDCMP_RAWKEY | IDCMP_MOUSEBUTTONS
+                                        | IDCMP_MOUSEMOVE,
+                                        WA_CustomScreen,
+                                        (ULONG) SDL_Display, TAG_DONE);
 
-            D (bug
-               ("Opening backdrop window %ldx%ld on display %lx!\n", w, h,
-                SDL_Display));
+            D(bug
+              ("Opening backdrop window %ldx%ld on display %lx!\n", w, h,
+               SDL_Display));
         } else {
             /* Create GimmeZeroZero window when OpenGL is used */
             unsigned long gzz = FALSE;
@@ -828,24 +824,24 @@
             }
 
             SDL_Window =
-                OpenWindowTags (NULL, WA_InnerWidth, w, WA_InnerHeight, h,
-                                WA_Flags,
-                                WFLG_REPORTMOUSE | WFLG_ACTIVATE |
-                                WFLG_RMBTRAP | ((flags & SDL_NOFRAME) ? 0
-                                                : (WFLG_DEPTHGADGET |
-                                                   WFLG_CLOSEGADGET |
-                                                   WFLG_DRAGBAR |
-                                                   ((flags &
-                                                     SDL_RESIZABLE) ?
-                                                    WFLG_SIZEGADGET |
-                                                    WFLG_SIZEBBOTTOM :
-                                                    0))), WA_IDCMP,
-                                IDCMP_RAWKEY | IDCMP_CLOSEWINDOW |
-                                IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE |
-                                IDCMP_MOUSEMOVE, WA_PubScreen,
-                                (ULONG) SDL_Display, WA_GimmeZeroZero,
-                                gzz, TAG_DONE);
-            D (bug ("Opening WB window of size: %ldx%ld!\n", w, h));
+                OpenWindowTags(NULL, WA_InnerWidth, w, WA_InnerHeight, h,
+                               WA_Flags,
+                               WFLG_REPORTMOUSE | WFLG_ACTIVATE |
+                               WFLG_RMBTRAP | ((flags & SDL_NOFRAME) ? 0
+                                               : (WFLG_DEPTHGADGET |
+                                                  WFLG_CLOSEGADGET |
+                                                  WFLG_DRAGBAR |
+                                                  ((flags &
+                                                    SDL_RESIZABLE) ?
+                                                   WFLG_SIZEGADGET |
+                                                   WFLG_SIZEBBOTTOM :
+                                                   0))), WA_IDCMP,
+                               IDCMP_RAWKEY | IDCMP_CLOSEWINDOW |
+                               IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE |
+                               IDCMP_MOUSEMOVE, WA_PubScreen,
+                               (ULONG) SDL_Display, WA_GimmeZeroZero,
+                               gzz, TAG_DONE);
+            D(bug("Opening WB window of size: %ldx%ld!\n", w, h));
         }
 
         if (!SDL_Window)
@@ -853,11 +849,11 @@
     }
 
     this->hidden->BytesPerPixel =
-        GetCyberMapAttr (SDL_Window->RPort->BitMap, CYBRMATTR_BPPIX);
+        GetCyberMapAttr(SDL_Window->RPort->BitMap, CYBRMATTR_BPPIX);
 
     if (screen->flags & SDL_DOUBLEBUF) {
-        if (SDL_RastPort = SDL_malloc (sizeof (struct RastPort))) {
-            InitRastPort (SDL_RastPort);
+        if (SDL_RastPort = SDL_malloc(sizeof(struct RastPort))) {
+            InitRastPort(SDL_RastPort);
             SDL_RastPort->BitMap = this->hidden->SB[1]->sb_BitMap;
         } else
             return -1;
@@ -868,7 +864,7 @@
         screen->flags |= SDL_HWSURFACE;
 
     if (!SDL_windowid) {
-        CGX_SetSizeHints (this, w, h, flags);
+        CGX_SetSizeHints(this, w, h, flags);
     }
 
     /* Set our colormaps when not setting a GL mode */
@@ -890,18 +886,18 @@
     }
     screen->w = w;
     screen->h = h;
-    screen->pitch = SDL_CalculatePitch (screen);
-    CGX_ResizeImage (this, screen, flags);
+    screen->pitch = SDL_CalculatePitch(screen);
+    CGX_ResizeImage(this, screen, flags);
 
     /* Make OpenGL Context if needed */
     if (flags & SDL_INTERNALOPENGL) {
         if (this->gl_data->gl_active == 0) {
-            if (CGX_GL_Init (this) < 0)
+            if (CGX_GL_Init(this) < 0)
                 return -1;
             else
                 screen->flags |= SDL_INTERNALOPENGL;
         } else {
-            if (CGX_GL_Update (this) < 0)
+            if (CGX_GL_Update(this) < 0)
                 return -1;
             else
                 screen->flags |= SDL_INTERNALOPENGL;
@@ -910,40 +906,39 @@
 }
 
 int
-CGX_ResizeWindow (_THIS, SDL_Surface * screen, int w, int h, Uint32 flags)
+CGX_ResizeWindow(_THIS, SDL_Surface * screen, int w, int h, Uint32 flags)
 {
-    D (bug ("CGX_ResizeWindow\n"));
+    D(bug("CGX_ResizeWindow\n"));
 
     if (!SDL_windowid) {
         /* Resize the window manager window */
-        CGX_SetSizeHints (this, w, h, flags);
+        CGX_SetSizeHints(this, w, h, flags);
 
-        ChangeWindowBox (SDL_Window, SDL_Window->LeftEdge,
-                         SDL_Window->TopEdge,
-                         w + SDL_Window->BorderLeft +
-                         SDL_Window->BorderRight,
-                         h + SDL_Window->BorderTop +
-                         SDL_Window->BorderBottom);
+        ChangeWindowBox(SDL_Window, SDL_Window->LeftEdge,
+                        SDL_Window->TopEdge,
+                        w + SDL_Window->BorderLeft +
+                        SDL_Window->BorderRight,
+                        h + SDL_Window->BorderTop + SDL_Window->BorderBottom);
 
         screen->w = w;
         screen->h = h;
-        screen->pitch = SDL_CalculatePitch (screen);
-        CGX_ResizeImage (this, screen, flags);
+        screen->pitch = SDL_CalculatePitch(screen);
+        CGX_ResizeImage(this, screen, flags);
     }
     return (0);
 }
 
 static SDL_Surface *
-CGX_SetVideoMode (_THIS, SDL_Surface * current,
-                  int width, int height, int bpp, Uint32 flags)
+CGX_SetVideoMode(_THIS, SDL_Surface * current,
+                 int width, int height, int bpp, Uint32 flags)
 {
     Uint32 saved_flags;
     int needcreate = 0;
 
-    D (bug ("CGX_SetVideoMode current:%lx\n", current));
+    D(bug("CGX_SetVideoMode current:%lx\n", current));
 
     /* Lock the event thread, in multi-threading environments */
-    SDL_Lock_EventThread ();
+    SDL_Lock_EventThread();
 
 // Check if the window needs to be closed or can be resized
 
@@ -957,27 +952,27 @@
     if (current && current->flags & SDL_FULLSCREEN
         && !(flags & SDL_FULLSCREEN)) {
         unsigned long i;
-        D (bug ("Destroying image, window & screen!\n"));
+        D(bug("Destroying image, window & screen!\n"));
 
-        CGX_DestroyImage (this, current);
-        CGX_DestroyWindow (this, current);
-        DestroyScreen (this);
-        GFX_Display = SDL_Display = LockPubScreen (NULL);
+        CGX_DestroyImage(this, current);
+        CGX_DestroyWindow(this, current);
+        DestroyScreen(this);
+        GFX_Display = SDL_Display = LockPubScreen(NULL);
 
         bpp = this->hidden->depth =
-            GetCyberMapAttr (SDL_Display->RastPort.BitMap, CYBRMATTR_DEPTH);
+            GetCyberMapAttr(SDL_Display->RastPort.BitMap, CYBRMATTR_DEPTH);
 
         for (i = 0; i < this->hidden->nvisuals; i++) {
             if (this->hidden->visuals[i].depth == bpp)  /* era .depth */
                 break;
         }
         if (i == this->hidden->nvisuals) {
-            SDL_SetError ("No matching visual for requested depth");
+            SDL_SetError("No matching visual for requested depth");
             return NULL;        /* should never happen */
         }
         SDL_Visual = this->hidden->visuals[i].visual;
 
-        D (bug ("Setting screen depth to: %ld\n", this->hidden->depth));
+        D(bug("Setting screen depth to: %ld\n", this->hidden->depth));
 
     }
     /* Check the combination of flags we were passed */
@@ -991,72 +986,72 @@
             if (current->w != width ||
                 current->h != height ||
                 (this->hidden && this->hidden->depth != bpp)) {
-                D (bug ("Deleting previous window...\n"));
-                CGX_DestroyImage (this, current);
-                CGX_DestroyWindow (this, current);
-                DestroyScreen (this);
+                D(bug("Deleting previous window...\n"));
+                CGX_DestroyImage(this, current);
+                CGX_DestroyWindow(this, current);
+                DestroyScreen(this);
                 goto buildnewscreen;
             }
         } else
           buildnewscreen:
         {
-            Uint32 okid = BestCModeIDTags (CYBRBIDTG_NominalWidth, width,
-                                           CYBRBIDTG_NominalHeight,
-                                           height,
-                                           CYBRBIDTG_Depth, bpp,
-                                           TAG_DONE);
+            Uint32 okid = BestCModeIDTags(CYBRBIDTG_NominalWidth, width,
+                                          CYBRBIDTG_NominalHeight,
+                                          height,
+                                          CYBRBIDTG_Depth, bpp,
+                                          TAG_DONE);
 
             GFX_Display = NULL;
 
-            D (bug ("Opening screen...\n"));
+            D(bug("Opening screen...\n"));
 
             if (okid != INVALID_ID)
-                GFX_Display = OpenScreenTags (NULL,
-                                              SA_Width, width,
-                                              SA_Height, height,
-                                              SA_Quiet, TRUE,
-                                              SA_ShowTitle, FALSE,
-                                              SA_Depth, bpp, SA_DisplayID,
-                                              okid, TAG_DONE);
+                GFX_Display = OpenScreenTags(NULL,
+                                             SA_Width, width,
+                                             SA_Height, height,
+                                             SA_Quiet, TRUE,
+                                             SA_ShowTitle, FALSE,
+                                             SA_Depth, bpp, SA_DisplayID,
+                                             okid, TAG_DONE);
 
             if (!GFX_Display) {
                 GFX_Display = SDL_Display;
                 flags &= ~SDL_FULLSCREEN;
                 flags &= ~SDL_DOUBLEBUF;
             } else {
-                UnlockPubScreen (NULL, SDL_Display);
+                UnlockPubScreen(NULL, SDL_Display);
                 SDL_Display = GFX_Display;
 
-                D (bug ("Screen opened.\n"));
+                D(bug("Screen opened.\n"));
 
                 if (flags & SDL_DOUBLEBUF) {
                     int ok = 0;
-                    D (bug ("Start of DBuffering allocations...\n"));
+                    D(bug("Start of DBuffering allocations...\n"));
 
                     if (this->hidden->SB[0] =
-                        AllocScreenBuffer (SDL_Display, NULL,
-                                           SB_SCREEN_BITMAP)) {
+                        AllocScreenBuffer(SDL_Display, NULL,
+                                          SB_SCREEN_BITMAP)) {
 
                         if (this->hidden->SB[1] =
-                            AllocScreenBuffer (SDL_Display, NULL, 0L)) {
+                            AllocScreenBuffer(SDL_Display, NULL, 0L)) {
                             extern struct MsgPort *safeport, *dispport;
 
-                            safeport = CreateMsgPort ();
-                            dispport = CreateMsgPort ();
+                            safeport = CreateMsgPort();
+                            dispport = CreateMsgPort();
 
                             if (!safeport || !dispport) {
                                 if (safeport) {
-                                    DeleteMsgPort (safeport);
+                                    DeleteMsgPort(safeport);
                                     safeport = NULL;
                                 }
                                 if (dispport) {
-                                    DeleteMsgPort (dispport);
+                                    DeleteMsgPort(dispport);
                                     dispport = NULL;
                                 }
-                                FreeScreenBuffer (SDL_Display,
-                                                  this->hidden->SB[0]);
-                                FreeScreenBuffer (SDL_Display,
-                                                  this->hidden->SB[1]);
+                                FreeScreenBuffer(SDL_Display,
+                                                 this->hidden->SB[0]);
+                                FreeScreenBuffer(SDL_Display,
+                                                 this->hidden->SB[1]);
                             } else {
                                 extern ULONG safe_sigbit, disp_sigbit;
                                 int i;
@@ -1076,13 +1071,13 @@
                                 }
 
                                 ok = 1;
-                                D (bug ("Dbuffering enabled!\n"));
+                                D(bug("Dbuffering enabled!\n"));
                                 this->hidden->dbuffer = 1;
                                 current->flags |= SDL_DOUBLEBUF;
                             }
                         } else {
-                            FreeScreenBuffer (SDL_Display,
-                                              this->hidden->SB[1]);
+                            FreeScreenBuffer(SDL_Display,
+                                             this->hidden->SB[1]);
                             this->hidden->SB[0] = NULL;
                         }
                     }
@@ -1098,15 +1093,15 @@
         }
 
         bpp = this->hidden->depth =
-            GetCyberMapAttr (SDL_Display->RastPort.BitMap, CYBRMATTR_DEPTH);
-        D (bug ("Setting screen depth to: %ld\n", this->hidden->depth));
+            GetCyberMapAttr(SDL_Display->RastPort.BitMap, CYBRMATTR_DEPTH);
+        D(bug("Setting screen depth to: %ld\n", this->hidden->depth));
 
         for (i = 0; i < this->hidden->nvisuals; i++)
             if (this->hidden->visuals[i].depth == bpp)  /* era .depth */
                 break;
 
         if (i == this->hidden->nvisuals) {
-            SDL_SetError ("No matching visual for requested depth");
+            SDL_SetError("No matching visual for requested depth");
             return NULL;        /* should never happen */
         }
         SDL_Visual = this->hidden->visuals[i].visual;
@@ -1119,12 +1114,12 @@
     if (SDL_Window
         && (saved_flags & SDL_INTERNALOPENGL) == (flags & SDL_INTERNALOPENGL)
         && bpp == current->format->BitsPerPixel && !needcreate) {
-        if (CGX_ResizeWindow (this, current, width, height, flags) < 0) {
+        if (CGX_ResizeWindow(this, current, width, height, flags) < 0) {
             current = NULL;
             goto done;
         }
     } else {
-        if (CGX_CreateWindow (this, current, width, height, bpp, flags) < 0) {
+        if (CGX_CreateWindow(this, current, width, height, bpp, flags) < 0) {
             current = NULL;
             goto done;
         }
@@ -1137,8 +1132,8 @@
     {
         current->w = width;
         current->h = height;
-        current->pitch = SDL_CalculatePitch (current);
-        CGX_ResizeImage (this, current, flags);
+        current->pitch = SDL_CalculatePitch(current);
+        CGX_ResizeImage(this, current, flags);
     }
 #endif
 
@@ -1146,14 +1141,14 @@
 
   done:
     /* Release the event thread */
-    SDL_Unlock_EventThread ();
+    SDL_Unlock_EventThread();
 
     /* We're done! */
     return (current);
 }
 
 static int
-CGX_ToggleFullScreen (_THIS, int on)
+CGX_ToggleFullScreen(_THIS, int on)
 {
     Uint32 event_thread;
 
@@ -1163,34 +1158,34 @@
     }
 
     /* Don't lock if we are the event thread */
-    event_thread = SDL_EventThreadID ();
-    if (event_thread && (SDL_ThreadID () == event_thread)) {
+    event_thread = SDL_EventThreadID();
+    if (event_thread && (SDL_ThreadID() == event_thread)) {
         event_thread = 0;
     }
     if (event_thread) {
-        SDL_Lock_EventThread ();
+        SDL_Lock_EventThread();
     }
     if (on) {
         this->screen->flags |= SDL_FULLSCREEN;
-        CGX_EnterFullScreen (this);
+        CGX_EnterFullScreen(this);
     } else {
         this->screen->flags &= ~SDL_FULLSCREEN;
-        CGX_LeaveFullScreen (this);
+        CGX_LeaveFullScreen(this);
     }
 
-    CGX_RefreshDisplay (this);
+    CGX_RefreshDisplay(this);
     if (event_thread) {
-        SDL_Unlock_EventThread ();
+        SDL_Unlock_EventThread();
     }
 
-    SDL_ResetKeyboard ();
+    SDL_ResetKeyboard();
 
     return (1);
 }
 
 static void
-SetSingleColor (Uint32 fmt, unsigned char r, unsigned char g, unsigned char b,
-                unsigned char *c)
+SetSingleColor(Uint32 fmt, unsigned char r, unsigned char g, unsigned char b,
+               unsigned char *c)
 {
     switch (fmt) {
     case PIXFMT_BGR15:
@@ -1253,21 +1248,21 @@
         break;
 
     default:
-        D (bug ("Error, SetSingleColor with PIXFMT %ld!\n", fmt));
+        D(bug("Error, SetSingleColor with PIXFMT %ld!\n", fmt));
     }
 }
 
 /* Update the current mouse state and position */
 static void
-CGX_UpdateMouse (_THIS)
+CGX_UpdateMouse(_THIS)
 {
     /* Lock the event thread, in multi-threading environments */
-    SDL_Lock_EventThread ();
+    SDL_Lock_EventThread();
 
     if (currently_fullscreen) {
-        SDL_PrivateAppActive (1, SDL_APPMOUSEFOCUS);
-        SDL_PrivateMouseMotion (0, 0, SDL_Display->MouseX,
-                                SDL_Display->MouseY);
+        SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS);
+        SDL_PrivateMouseMotion(0, 0, SDL_Display->MouseX,
+                               SDL_Display->MouseY);
     } else {
         if (SDL_Display->MouseX >=
             (SDL_Window->LeftEdge + SDL_Window->BorderLeft)
@@ -1279,23 +1274,23 @@
             && SDL_Display->MouseY <
             (SDL_Window->TopEdge + SDL_Window->Height -
              SDL_Window->BorderBottom)) {
-            SDL_PrivateAppActive (1, SDL_APPMOUSEFOCUS);
-            SDL_PrivateMouseMotion (0, 0,
-                                    SDL_Display->MouseX -
-                                    SDL_Window->LeftEdge -
-                                    SDL_Window->BorderLeft,
-                                    SDL_Display->MouseY -
-                                    SDL_Window->TopEdge -
-                                    SDL_Window->BorderTop);
+            SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS);
+            SDL_PrivateMouseMotion(0, 0,
+                                   SDL_Display->MouseX -
+                                   SDL_Window->LeftEdge -
+                                   SDL_Window->BorderLeft,
+                                   SDL_Display->MouseY -
+                                   SDL_Window->TopEdge -
+                                   SDL_Window->BorderTop);
         } else {
-            SDL_PrivateAppActive (0, SDL_APPMOUSEFOCUS);
+            SDL_PrivateAppActive(0, SDL_APPMOUSEFOCUS);
         }
     }
-    SDL_Unlock_EventThread ();
+    SDL_Unlock_EventThread();
 }
 
 static int
-CGX_SetColors (_THIS, int firstcolor, int ncolors, SDL_Color * colors)
+CGX_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color * colors)
 {
     int i;
 
@@ -1316,50 +1311,50 @@
             xcmap[i * 3 + 3] = colors[i + firstcolor].b << 24;
         }
         xcmap[ncolors * 3 + 1] = 0;
-        LoadRGB32 (&GFX_Display->ViewPort, xcmap);
+        LoadRGB32(&GFX_Display->ViewPort, xcmap);
     } else {
 // XPixels are not needed on 8bit screen with hwpalette
         unsigned long pixel;
 
         if (SDL_XPixels == NULL) {
-            D (bug ("SetColors without colormap!"));
+            D(bug("SetColors without colormap!"));
             return (0);
         }
 
         if (this->hidden->depth == 8) {
 // In this case I have to unalloc and realloc the full palette
-            D (bug ("Obtaining %ld colors on the screen\n", ncolors));
+            D(bug("Obtaining %ld colors on the screen\n", ncolors));
 
             /* Free existing allocated colors */
             for (pixel = 0;
                  pixel < this->screen->format->palette->ncolors; ++pixel) {
                 if (SDL_XPixels[pixel] >= 0)
-                    ReleasePen (GFX_Display->ViewPort.ColorMap,
-                                SDL_XPixels[pixel]);
+                    ReleasePen(GFX_Display->ViewPort.ColorMap,
+                               SDL_XPixels[pixel]);
             }
 
             /* Try to allocate all the colors */
             for (i = 0; i < this->screen->format->palette->ncolors; ++i) {
                 SDL_XPixels[i] =
-                    ObtainBestPenA (GFX_Display->ViewPort.ColorMap,
-                                    colors[i].r << 24,
-                                    colors[i].g << 24,
-                                    colors[i].b << 24, NULL);
+                    ObtainBestPenA(GFX_Display->ViewPort.ColorMap,
+                                   colors[i].r << 24,
+                                   colors[i].g << 24,
+                                   colors[i].b << 24, NULL);
             }
         } else {
 #ifndef USE_CGX_WRITELUTPIXEL
             Uint32 fmt;
-            D (bug ("Preparing a conversion pixel table...\n"));
+            D(bug("Preparing a conversion pixel table...\n"));
 
             fmt =
-                GetCyberMapAttr (SDL_Display->RastPort.BitMap,
-                                 CYBRMATTR_PIXFMT);
+                GetCyberMapAttr(SDL_Display->RastPort.BitMap,
+                                CYBRMATTR_PIXFMT);
 
             for (i = 0; i < ncolors; i++) {
-                SetSingleColor (fmt, colors[firstcolor + i].r,
-                                colors[firstcolor + i].g,
-                                colors[firstcolor + i].b, (unsigned char *)
-                                &SDL_XPixels[firstcolor + i]);
+                SetSingleColor(fmt, colors[firstcolor + i].r,
+                               colors[firstcolor + i].g,
+                               colors[firstcolor + i].b, (unsigned char *)
+                               &SDL_XPixels[firstcolor + i]);
             }
 #else
 //                      D(bug("Executing XPixel(%lx) remapping: (from %ld, %ld colors) first: r%ld g%ld b%ld\n",SDL_XPixels,firstcolor,ncolors,colors[firstcolor].r,colors[firstcolor].g,colors[firstcolor].b));
@@ -1381,40 +1376,40 @@
    another SDL video routine -- notably UpdateRects.
 */
 static void
-CGX_VideoQuit (_THIS)
+CGX_VideoQuit(_THIS)
 {
     /* Shutdown everything that's still up */
     /* The event thread should be done, so we can touch SDL_Display */
-    D (bug ("CGX_VideoQuit\n"));
+    D(bug("CGX_VideoQuit\n"));
 
     if (SDL_Display != NULL) {
         /* Clean up OpenGL */
         if (this->gl_data->gl_active == 1) {
-            CGX_GL_Quit (this);
+            CGX_GL_Quit(this);
         }
         /* Start shutting down the windows */
-        D (bug ("Destroying image...\n"));
-        CGX_DestroyImage (this, this->screen);
-        D (bug ("Destroying window...\n"));
-        CGX_DestroyWindow (this, this->screen);
+        D(bug("Destroying image...\n"));
+        CGX_DestroyImage(this, this->screen);
+        D(bug("Destroying window...\n"));
+        CGX_DestroyWindow(this, this->screen);
 // Otherwise SDL_VideoQuit will try to free it!
         SDL_VideoSurface = NULL;
 
-        CGX_FreeVideoModes (this);
+        CGX_FreeVideoModes(this);
 
         /* Free that blank cursor */
         if (SDL_BlankCursor != NULL) {
-            FreeMem (SDL_BlankCursor, 16);
+            FreeMem(SDL_BlankCursor, 16);
             SDL_BlankCursor = NULL;
         }
 
         /* Close the X11 graphics connection */
         this->hidden->same_format = 0;
 
-        D (bug ("Destroying screen...\n"));
+        D(bug("Destroying screen...\n"));
 
         if (GFX_Display != NULL)
-            DestroyScreen (this);
+            DestroyScreen(this);
 
         /* Close the X11 display connection */
         SDL_Display = NULL;
@@ -1422,19 +1417,19 @@
         /* Unload GL library after X11 shuts down */
     }
 
-    D (bug ("Closing libraries...\n"));
+    D(bug("Closing libraries...\n"));
 
     if (CyberGfxBase) {
-        CloseLibrary (CyberGfxBase);
+        CloseLibrary(CyberGfxBase);
         CyberGfxBase = NULL;
     }
 
     if (IntuitionBase) {
-        CloseLibrary ((struct Library *) IntuitionBase);
+        CloseLibrary((struct Library *) IntuitionBase);
         IntuitionBase = NULL;
     }
     if (GfxBase) {
-        CloseLibrary ((struct Library *) GfxBase);
+        CloseLibrary((struct Library *) GfxBase);
         GfxBase = NULL;
     }
 
@@ -1442,7 +1437,7 @@
         /* Direct screen access, no memory buffer */
         this->screen->pixels = NULL;
     }
-    D (bug ("End of CGX_VideoQuit.\n"));
+    D(bug("End of CGX_VideoQuit.\n"));
 
 }