]> git.sesse.net Git - vlc/commitdiff
Skins2: Cosmetics
authorJP Dinger <jpd@videolan.org>
Sat, 21 Nov 2009 10:43:25 +0000 (11:43 +0100)
committerJP Dinger <jpd@videolan.org>
Sat, 5 Dec 2009 21:25:42 +0000 (22:25 +0100)
modules/gui/skins2/src/theme_loader.cpp
modules/gui/skins2/utils/position.cpp
modules/gui/skins2/win32/win32_factory.cpp
modules/gui/skins2/x11/x11_display.cpp
modules/gui/skins2/x11/x11_loop.cpp

index d02fa718e1a777bb7c07b658631bd97ea93ba080..5f342710b52a450d2d78c3d027f22dd2fc412dcd 100644 (file)
@@ -579,34 +579,33 @@ int tar_extract_all( TAR *t, char *prefix )
 
             switch( buffer.header.typeflag )
             {
-                case DIRTYPE:
-                    makedir( fname );
-                    break;
-                case REGTYPE:
-                case AREGTYPE:
-                    remaining = getoct( buffer.header.size, 12 );
-                    if( remaining )
+            case DIRTYPE:
+                makedir( fname );
+                break;
+            case REGTYPE:
+            case AREGTYPE:
+                remaining = getoct( buffer.header.size, 12 );
+                if( !remaining ) outfile = NULL; else
+                {
+                    outfile = fopen( fname, "wb" );
+                    if( outfile == NULL )
                     {
-                        outfile = fopen( fname, "wb" );
-                        if( outfile == NULL )
+                        /* try creating directory */
+                        char *p = strrchr( fname, '/' );
+                        if( p != NULL )
                         {
-                            /* try creating directory */
-                            char *p = strrchr( fname, '/' );
-                            if( p != NULL )
+                            *p = '\0';
+                            makedir( fname );
+                            *p = '/';
+                            outfile = fopen( fname, "wb" );
+                            if( !outfile )
                             {
-                                *p = '\0';
-                                makedir( fname );
-                                *p = '/';
-                                outfile = fopen( fname, "wb" );
-                                if( !outfile )
-                                {
-                                    fprintf( stderr, "tar couldn't create %s\n",
-                                             fname );
-                                }
+                                fprintf( stderr, "tar couldn't create %s\n",
+                                         fname );
                             }
                         }
                     }
-                    else outfile = NULL;
+                }
 
                 /*
                  * could have no contents
@@ -741,16 +740,16 @@ int gzopen_frontend( const char *pathname, int oflags, int mode )
 
     switch( oflags )
     {
-        case O_WRONLY:
-            gzflags = "wb";
-            break;
-        case O_RDONLY:
-            gzflags = "rb";
-            break;
-        case O_RDWR:
-        default:
-            errno = EINVAL;
-            return -1;
+    case O_WRONLY:
+        gzflags = "wb";
+        break;
+    case O_RDONLY:
+        gzflags = "rb";
+        break;
+    case O_RDWR:
+    default:
+        errno = EINVAL;
+        return -1;
     }
 
     gzf = gzopen( pathname, gzflags );
index 6ba21cb3c094dc8d7b52e57e12d8d515da42c49a..cd71e518a5ad5bcae060114e15c5ad752080362e 100644 (file)
@@ -120,14 +120,14 @@ int Position::getLeft() const
     {
         switch( m_refLeftTop )
         {
-            case kLeftTop:
-            case kLeftBottom:
-                return m_rRect.getLeft() + m_left;
-                break;
-            case kRightTop:
-            case kRightBottom:
-                return m_rRect.getLeft() + m_rRect.getWidth() + m_left - 1;
-                break;
+        case kLeftTop:
+        case kLeftBottom:
+            return m_rRect.getLeft() + m_left;
+            break;
+        case kRightTop:
+        case kRightBottom:
+            return m_rRect.getLeft() + m_rRect.getWidth() + m_left - 1;
+            break;
         }
         // Avoid a warning
         return 0;
index dd02a3aa1a217b6f221a95528cfae2657ce7ec1d..4b7621eb96e8a1afd3d2cf2c62bb2453251a895b 100644 (file)
@@ -389,24 +389,12 @@ void Win32Factory::changeCursor( CursorType_t type ) const
     LPCTSTR id;
     switch( type )
     {
-        case kDefaultArrow:
-            id = IDC_ARROW;
-            break;
-        case kResizeNWSE:
-            id = IDC_SIZENWSE;
-            break;
-        case kResizeNS:
-            id = IDC_SIZENS;
-            break;
-        case kResizeWE:
-            id = IDC_SIZEWE;
-            break;
-        case kResizeNESW:
-            id = IDC_SIZENESW;
-            break;
-        default:
-            id = IDC_ARROW;
-            break;
+    default:
+    case kDefaultArrow: id = IDC_ARROW;    break;
+    case kResizeNWSE:   id = IDC_SIZENWSE; break;
+    case kResizeNS:     id = IDC_SIZENS;   break;
+    case kResizeWE:     id = IDC_SIZEWE;   break;
+    case kResizeNESW:   id = IDC_SIZENESW; break;
     }
 
     HCURSOR hCurs = LoadCursor( NULL, id );
index f905d36e20cc01e54880aed59aa381f23124183a..11d73a6e101903493a65da0ecfd6ffaf97b6d829 100644 (file)
@@ -87,110 +87,110 @@ X11Display::X11Display( intf_thread_t *pIntf ): SkinObject( pIntf ),
 
     switch( depth )
     {
-        case 8:
-            xVInfoTemplate.c_class = DirectColor;
-            // Get the DirectColor visual
-            pVInfo = XGetVisualInfo( m_pDisplay, VisualScreenMask |
-                                     VisualClassMask, &xVInfoTemplate,
-                                     &vCount );
-            if( pVInfo == NULL )
-            {
-                msg_Err( getIntf(), "no DirectColor visual available" );
-                m_pDisplay = NULL;
-                break;
-            }
-            m_pVisual = pVInfo->visual;
-
-            // Compute the color shifts
-            getShifts( pVInfo->red_mask, m_redLeftShift, m_redRightShift );
-            getShifts( pVInfo->green_mask, m_greenLeftShift,
-                       m_greenRightShift );
-            getShifts( pVInfo->blue_mask, m_blueLeftShift, m_blueRightShift );
-
-            // Create a color map
-            m_colormap = XCreateColormap( m_pDisplay, root,
-                    DefaultVisual( m_pDisplay, screen ), AllocAll );
-
-            // Create the palette
-            XColor pColors[255];
-            for( uint16_t i = 0; i < 255; i++ )
+    case 8:
+        xVInfoTemplate.c_class = DirectColor;
+        // Get the DirectColor visual
+        pVInfo = XGetVisualInfo( m_pDisplay, VisualScreenMask |
+                                 VisualClassMask, &xVInfoTemplate,
+                                 &vCount );
+        if( pVInfo == NULL )
+        {
+            msg_Err( getIntf(), "no DirectColor visual available" );
+            m_pDisplay = NULL;
+            break;
+        }
+        m_pVisual = pVInfo->visual;
+
+        // Compute the color shifts
+        getShifts( pVInfo->red_mask, m_redLeftShift, m_redRightShift );
+        getShifts( pVInfo->green_mask, m_greenLeftShift,
+                   m_greenRightShift );
+        getShifts( pVInfo->blue_mask, m_blueLeftShift, m_blueRightShift );
+
+        // Create a color map
+        m_colormap = XCreateColormap( m_pDisplay, root,
+                DefaultVisual( m_pDisplay, screen ), AllocAll );
+
+        // Create the palette
+        XColor pColors[255];
+        for( uint16_t i = 0; i < 255; i++ )
+        {
+            // kludge: colors are indexed reversely because color 255 seems
+            // to bereserved for black even if we try to set it to white
+            pColors[i].pixel = 254-i;
+            pColors[i].pad   = 0;
+            pColors[i].flags = DoRed | DoGreen | DoBlue;
+            pColors[i].red   =
+                (i >> m_redLeftShift) << (m_redRightShift + 8);
+            pColors[i].green =
+                (i >> m_greenLeftShift) << (m_greenRightShift + 8);
+            pColors[i].blue  =
+                (i >> m_blueLeftShift) << (m_blueRightShift + 8);
+        }
+        XStoreColors( m_pDisplay, m_colormap, pColors, 255 );
+        blendPixelImpl = &X11Display::blendPixel8;
+        putPixelImpl = &X11Display::putPixel8;
+        m_pixelSize = 1;
+        break;
+
+    case 15:
+    case 16:
+    case 24:
+    case 32:
+        // Get the TrueColor visual
+        xVInfoTemplate.c_class = TrueColor;
+        pVInfo = XGetVisualInfo( m_pDisplay, VisualScreenMask |
+                                 VisualDepthMask | VisualClassMask,
+                                 &xVInfoTemplate, &vCount );
+        if( pVInfo == NULL )
+        {
+            msg_Err( getIntf(), "No TrueColor visual for depth %d",
+                     depth );
+            m_pDisplay = NULL;
+            break;
+        }
+        m_pVisual = pVInfo->visual;
+
+        // Compute the color shifts
+        getShifts( pVInfo->red_mask, m_redLeftShift, m_redRightShift );
+        getShifts( pVInfo->green_mask, m_greenLeftShift,
+                   m_greenRightShift );
+        getShifts( pVInfo->blue_mask, m_blueLeftShift, m_blueRightShift );
+
+        if( depth == 15 || depth == 16 )
+        {
+            if( order == MSBFirst )
             {
-                // kludge: colors are indexed reversely because color 255 seems
-                // to bereserved for black even if we try to set it to white
-                pColors[i].pixel = 254-i;
-                pColors[i].pad   = 0;
-                pColors[i].flags = DoRed | DoGreen | DoBlue;
-                pColors[i].red   =
-                    (i >> m_redLeftShift) << (m_redRightShift + 8);
-                pColors[i].green =
-                    (i >> m_greenLeftShift) << (m_greenRightShift + 8);
-                pColors[i].blue  =
-                    (i >> m_blueLeftShift) << (m_blueRightShift + 8);
+                blendPixelImpl = &X11Display::blendPixel16MSB;
+                putPixelImpl = &X11Display::putPixel16MSB;
             }
-            XStoreColors( m_pDisplay, m_colormap, pColors, 255 );
-            blendPixelImpl = &X11Display::blendPixel8;
-            putPixelImpl = &X11Display::putPixel8;
-            m_pixelSize = 1;
-            break;
-
-        case 15:
-        case 16:
-        case 24:
-        case 32:
-            // Get the TrueColor visual
-            xVInfoTemplate.c_class = TrueColor;
-            pVInfo = XGetVisualInfo( m_pDisplay, VisualScreenMask |
-                                     VisualDepthMask | VisualClassMask,
-                                     &xVInfoTemplate, &vCount );
-            if( pVInfo == NULL )
+            else
             {
-                msg_Err( getIntf(), "No TrueColor visual for depth %d",
-                         depth );
-                m_pDisplay = NULL;
-                break;
+                blendPixelImpl = &X11Display::blendPixel16LSB;
+                putPixelImpl = &X11Display::putPixel16LSB;
             }
-            m_pVisual = pVInfo->visual;
-
-            // Compute the color shifts
-            getShifts( pVInfo->red_mask, m_redLeftShift, m_redRightShift );
-            getShifts( pVInfo->green_mask, m_greenLeftShift,
-                       m_greenRightShift );
-            getShifts( pVInfo->blue_mask, m_blueLeftShift, m_blueRightShift );
-
-            if( depth == 15 || depth == 16 )
+            m_pixelSize = 2;
+        }
+        else
+        {
+            if( order == MSBFirst )
             {
-                if( order == MSBFirst )
-                {
-                    blendPixelImpl = &X11Display::blendPixel16MSB;
-                    putPixelImpl = &X11Display::putPixel16MSB;
-                }
-                else
-                {
-                    blendPixelImpl = &X11Display::blendPixel16LSB;
-                    putPixelImpl = &X11Display::putPixel16LSB;
-                }
-                m_pixelSize = 2;
+                blendPixelImpl = &X11Display::blendPixel32MSB;
+                putPixelImpl = &X11Display::putPixel32MSB;
             }
             else
             {
-                if( order == MSBFirst )
-                {
-                    blendPixelImpl = &X11Display::blendPixel32MSB;
-                    putPixelImpl = &X11Display::putPixel32MSB;
-                }
-                else
-                {
-                    blendPixelImpl = &X11Display::blendPixel32LSB;
-                    putPixelImpl = &X11Display::putPixel32LSB;
-                }
-                m_pixelSize = 4;
+                blendPixelImpl = &X11Display::blendPixel32LSB;
+                putPixelImpl = &X11Display::putPixel32LSB;
             }
-            break;
-
-        default:
-            msg_Err( getIntf(), "unsupported depth: %d bpp\n", depth );
-            m_pDisplay = NULL;
-            break;
+            m_pixelSize = 4;
+        }
+        break;
+
+    default:
+        msg_Err( getIntf(), "unsupported depth: %d bpp\n", depth );
+        m_pDisplay = NULL;
+        break;
     }
 
     // Free the visual info
index 4e11ce989d1b22d50c1fe798bec3f276cb6c252a..06b7303dfc822c5cbf48d3105223c47d4af44dfd 100644 (file)
@@ -222,12 +222,12 @@ void X11Loop::handleX11Event()
             EvtMouse::ActionType_t action = EvtMouse::kDown;
             switch( event.type )
             {
-                case ButtonPress:
-                    action = EvtMouse::kDown;
-                    break;
-                case ButtonRelease:
-                    action = EvtMouse::kUp;
-                    break;
+            case ButtonPress:
+                action = EvtMouse::kDown;
+                break;
+            case ButtonRelease:
+                action = EvtMouse::kUp;
+                break;
             }
 
             // Get the modifiers
@@ -345,12 +345,12 @@ void X11Loop::handleX11Event()
 
             switch( event.type )
             {
-                case KeyPress:
-                    action = EvtKey::kDown;
-                    break;
-                case KeyRelease:
-                    action = EvtKey::kUp;
-                    break;
+            case KeyPress:
+                action = EvtKey::kDown;
+                break;
+            case KeyRelease:
+                action = EvtKey::kUp;
+                break;
             }
             EvtKey evt( getIntf(), key, action, mod );
             pWin->processEvent( evt );