Commit 00b26db6 authored by JP Dinger's avatar JP Dinger
Browse files

Skins2: Cosmetics

parent 1603369c
......@@ -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 );
......
......@@ -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;
......
......@@ -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 );
......
......@@ -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
......
......@@ -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 );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment