Commit 0cd04434 authored by Cyril Deguet's avatar Cyril Deguet

* x11_display.cpp: support 15bpp mode for X11 skins and avoid a segfault

    when a mode is not supported (closes bug #1809). Move the "main window"
    outside the screen to avoid seeing it in the workspace selector applet.
parent cb98a99c
...@@ -106,6 +106,7 @@ X11Display::X11Display( intf_thread_t *pIntf ): SkinObject( pIntf ), ...@@ -106,6 +106,7 @@ X11Display::X11Display( intf_thread_t *pIntf ): SkinObject( pIntf ),
m_pixelSize = 1; m_pixelSize = 1;
break; break;
case 15:
case 16: case 16:
case 24: case 24:
case 32: case 32:
...@@ -135,7 +136,7 @@ X11Display::X11Display( intf_thread_t *pIntf ): SkinObject( pIntf ), ...@@ -135,7 +136,7 @@ X11Display::X11Display( intf_thread_t *pIntf ): SkinObject( pIntf ),
m_pixelSize = 1; m_pixelSize = 1;
} }
if( depth == 16 ) if( depth == 15 || depth == 16 )
{ {
if( order == MSBFirst ) if( order == MSBFirst )
{ {
...@@ -180,41 +181,44 @@ X11Display::X11Display( intf_thread_t *pIntf ): SkinObject( pIntf ), ...@@ -180,41 +181,44 @@ X11Display::X11Display( intf_thread_t *pIntf ): SkinObject( pIntf ),
xgcvalues.graphics_exposures = False; xgcvalues.graphics_exposures = False;
m_gc = XCreateGC( m_pDisplay, DefaultRootWindow( m_pDisplay ), m_gc = XCreateGC( m_pDisplay, DefaultRootWindow( m_pDisplay ),
GCGraphicsExposures, &xgcvalues ); GCGraphicsExposures, &xgcvalues );
}
// Create a parent window to have a single task in the task bar // Create a parent window to have a single task in the task bar
XSetWindowAttributes attr; XSetWindowAttributes attr;
m_mainWindow = XCreateWindow( m_pDisplay, DefaultRootWindow( m_pDisplay), m_mainWindow = XCreateWindow( m_pDisplay, DefaultRootWindow( m_pDisplay),
0, 0, 1, 1, 0, 0, InputOutput, 0, 0, 1, 1, 0, 0, InputOutput,
CopyFromParent, 0, &attr ); CopyFromParent, 0, &attr );
// Changing decorations // Changing decorations
struct { struct {
unsigned long flags; unsigned long flags;
unsigned long functions; unsigned long functions;
unsigned long decorations; unsigned long decorations;
long input_mode; long input_mode;
unsigned long status; unsigned long status;
} motifWmHints; } motifWmHints;
Atom hints_atom = XInternAtom( m_pDisplay, "_MOTIF_WM_HINTS", False ); Atom hints_atom = XInternAtom( m_pDisplay, "_MOTIF_WM_HINTS", False );
motifWmHints.flags = 2; // MWM_HINTS_DECORATIONS; motifWmHints.flags = 2; // MWM_HINTS_DECORATIONS;
motifWmHints.decorations = 0; motifWmHints.decorations = 0;
XChangeProperty( m_pDisplay, m_mainWindow, hints_atom, hints_atom, 32, XChangeProperty( m_pDisplay, m_mainWindow, hints_atom, hints_atom, 32,
PropModeReplace, (unsigned char *)&motifWmHints, PropModeReplace, (unsigned char *)&motifWmHints,
sizeof( motifWmHints ) / sizeof( long ) ); sizeof( motifWmHints ) / sizeof( long ) );
// Change the window title // Change the window title
XStoreName( m_pDisplay, m_mainWindow, "VLC Media Player" ); XStoreName( m_pDisplay, m_mainWindow, "VLC Media Player" );
// Receive map notify events // Receive map notify events
XSelectInput( m_pDisplay, m_mainWindow, StructureNotifyMask ); XSelectInput( m_pDisplay, m_mainWindow, StructureNotifyMask );
// Set an empty mask for the window // Set an empty mask for the window
Region mask = XCreateRegion(); Region mask = XCreateRegion();
XShapeCombineRegion( m_pDisplay, m_mainWindow, ShapeBounding, 0, 0, mask, XShapeCombineRegion( m_pDisplay, m_mainWindow, ShapeBounding, 0, 0, mask,
ShapeSet ); ShapeSet );
// Map the window // Map the window
XMapWindow( m_pDisplay, m_mainWindow); XMapWindow( m_pDisplay, m_mainWindow);
// Move it outside the screen to avoid seeing it in workspace selector
XMoveWindow( m_pDisplay, m_mainWindow, -10, -10 );
}
} }
......
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