Commit 03ed2bc5 authored by Erwan Tulou's avatar Erwan Tulou

skins2(X11): add icon to vlc

this should fix https://bugs.launchpad.net/ubuntu/+source/vlc/+bug/521850
Tested successfully with compiz and metacity

Todo: adapt configure.ac to ensure XPM is available for skins2 (as done with mozilla)
(cherry picked from commit 7e7ead5d)
parent f20958fd
......@@ -3961,7 +3961,7 @@ if test "${enable_skins2}" = "yes" ||
ALIASES="${ALIASES} svlc"
VLC_ADD_CPPFLAGS([skins2],[-Imodules/gui/skins2 ${X_CFLAGS} -DX11_SKINS])
VLC_ADD_CXXFLAGS([skins2],[-O2 -fno-rtti])
VLC_ADD_LIBS([skins2],[${X_LIBS} ${X_PRE_LIBS} -lXext -lX11])
VLC_ADD_LIBS([skins2],[${X_LIBS} ${X_PRE_LIBS} -lXext -lXpm -lX11])
need_xid_provider="no"
fi fi fi
fi
......
......@@ -26,11 +26,14 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/xpm.h>
#include <X11/extensions/shape.h>
#include "x11_display.hpp"
#include "../src/logger.hpp"
#include "../../../share/icons/32x32/vlc.xpm"
template<class type> type X11Display::putPixel(type r, type g, type b) const
{
return ( (r >> m_redRightShift) << m_redLeftShift ) |
......@@ -237,6 +240,28 @@ X11Display::X11Display( intf_thread_t *pIntf ): SkinObject( pIntf ),
// Change the window title
XStoreName( m_pDisplay, m_mainWindow, "VLC Media Player" );
// Add an icon
Pixmap icon_pixmap, shape_pixmap;
int ret = XpmCreatePixmapFromData( m_pDisplay, root, (char**)vlc_xpm,
&icon_pixmap, &shape_pixmap, NULL );
if( ret == XpmSuccess )
{
XWMHints *wm = XAllocWMHints();
if( wm )
{
wm->icon_pixmap = icon_pixmap;
wm->icon_mask = shape_pixmap;
wm->flags = (IconPixmapHint|IconMaskHint);
XSetWMHints( m_pDisplay, m_mainWindow, wm );
XFree( wm );
}
}
else
{
msg_Err( getIntf(), "icon failed to be loaded (err=%i)", ret );
}
// Receive map notify events
XSelectInput( m_pDisplay, m_mainWindow, StructureNotifyMask );
......@@ -461,5 +486,4 @@ unsigned long X11Display::getPixelValue( uint8_t r, uint8_t g, uint8_t b )
return m_pixelSize==1 ? 255 - value : value;
}
#endif
......@@ -166,6 +166,14 @@ X11Window::X11Window( intf_thread_t *pIntf, GenericWindow &rWindow,
classhint.res_class = (char*) "Vlc";
XSetClassHint( XDISPLAY, m_wnd, &classhint );
// copies WM_HINTS from the main window
XWMHints *wm = XGetWMHints( XDISPLAY, m_rDisplay.getMainWindow() );
if( wm )
{
XSetWMHints( XDISPLAY, m_wnd, wm );
XFree( wm );
}
// initialize WM_CLIENT_MACHINE
char* hostname = NULL;
long host_name_max = sysconf( _SC_HOST_NAME_MAX );
......
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