From: JP Dinger Date: Sat, 21 Nov 2009 10:43:25 +0000 (+0100) Subject: Skins2: Cosmetics X-Git-Tag: 1.1.0-ff~2199 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=00b26db6568cd6a2d829abf7dff191d57d4d4a78;p=vlc Skins2: Cosmetics --- diff --git a/modules/gui/skins2/src/theme_loader.cpp b/modules/gui/skins2/src/theme_loader.cpp index d02fa718e1..5f342710b5 100644 --- a/modules/gui/skins2/src/theme_loader.cpp +++ b/modules/gui/skins2/src/theme_loader.cpp @@ -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 ); diff --git a/modules/gui/skins2/utils/position.cpp b/modules/gui/skins2/utils/position.cpp index 6ba21cb3c0..cd71e518a5 100644 --- a/modules/gui/skins2/utils/position.cpp +++ b/modules/gui/skins2/utils/position.cpp @@ -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; diff --git a/modules/gui/skins2/win32/win32_factory.cpp b/modules/gui/skins2/win32/win32_factory.cpp index dd02a3aa1a..4b7621eb96 100644 --- a/modules/gui/skins2/win32/win32_factory.cpp +++ b/modules/gui/skins2/win32/win32_factory.cpp @@ -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 ); diff --git a/modules/gui/skins2/x11/x11_display.cpp b/modules/gui/skins2/x11/x11_display.cpp index f905d36e20..11d73a6e10 100644 --- a/modules/gui/skins2/x11/x11_display.cpp +++ b/modules/gui/skins2/x11/x11_display.cpp @@ -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 diff --git a/modules/gui/skins2/x11/x11_loop.cpp b/modules/gui/skins2/x11/x11_loop.cpp index 4e11ce989d..06b7303dfc 100644 --- a/modules/gui/skins2/x11/x11_loop.cpp +++ b/modules/gui/skins2/x11/x11_loop.cpp @@ -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 );