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

Skins2: Cosmetics

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