Commit 614fa0d5 authored by Cyril Deguet's avatar Cyril Deguet

* X11 skin windows should have an icon now

parent 3663faf1
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* skin_common.h: Private Skin interface description * skin_common.h: Private Skin interface description
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: skin_common.h,v 1.20 2003/06/11 10:42:34 gbazin Exp $ * $Id: skin_common.h,v 1.21 2003/06/13 21:18:53 asmax Exp $
* *
* Authors: Olivier Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr> * Emmanuel Puig <karibu@via.ecp.fr>
...@@ -87,6 +87,8 @@ struct intf_sys_t ...@@ -87,6 +87,8 @@ struct intf_sys_t
Display *display; Display *display;
Window mainWin; // Window which receives "broadcast" events Window mainWin; // Window which receives "broadcast" events
vlc_mutex_t xlock; vlc_mutex_t xlock;
Pixmap iconPixmap; // vlc icon
Pixmap iconMask;
#endif #endif
#ifdef WIN32 #ifdef WIN32
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* skin-main.cpp: skins plugin for VLC * skin-main.cpp: skins plugin for VLC
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: skin_main.cpp,v 1.38 2003/06/11 21:46:57 asmax Exp $ * $Id: skin_main.cpp,v 1.39 2003/06/13 21:18:53 asmax Exp $
* *
* Authors: Olivier Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr> * Emmanuel Puig <karibu@via.ecp.fr>
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
#ifdef X11_SKINS #ifdef X11_SKINS
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <Imlib2.h>
#endif #endif
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
...@@ -129,13 +130,45 @@ static int Open ( vlc_object_t *p_this ) ...@@ -129,13 +130,45 @@ static int Open ( vlc_object_t *p_this )
#elif defined X11_SKINS #elif defined X11_SKINS
// Initialize X11 // Initialize X11
p_intf->p_sys->display = XOpenDisplay( NULL ); Display *display = XOpenDisplay( NULL );
p_intf->p_sys->display = display;
vlc_mutex_init( p_intf, &p_intf->p_sys->xlock ); vlc_mutex_init( p_intf, &p_intf->p_sys->xlock );
// Fake window to receive broadcast events // Fake window to receive broadcast events
Window root = DefaultRootWindow( p_intf->p_sys->display ); Window root = DefaultRootWindow( display );
p_intf->p_sys->mainWin = XCreateSimpleWindow( p_intf->p_sys->display, root, 0, 0, p_intf->p_sys->mainWin = XCreateSimpleWindow( display, root, 0, 0,
1, 1, 0, 0, 0 ); 1, 1, 0, 0, 0 );
XStoreName( p_intf->p_sys->display, p_intf->p_sys->mainWin, "VLC Media Player" ); XStoreName( display, p_intf->p_sys->mainWin, "VLC Media Player" );
// Load the vlc icon
int screen = DefaultScreen( display );
Screen *screenptr = DefaultScreenOfDisplay( display );
Visual *visual = DefaultVisualOfScreen( screenptr );
imlib_context_set_display( display );
imlib_context_set_visual( visual );
imlib_context_set_drawable( root );
imlib_context_set_colormap( DefaultColormap( display, screen ) );
imlib_context_set_dither( 1 );
imlib_context_set_blend( 1 );
Imlib_Image img = imlib_load_image_immediately( DATA_PATH "vlc32x32.png" );
if( img == NULL )
{
// for developers ;)
img = imlib_load_image_immediately( "./share/vlc32x32.png" );
}
if( img == NULL )
{
msg_Err( p_intf, "loading vlc icon failed" );
p_intf->p_sys->iconPixmap = None;
p_intf->p_sys->iconMask = None;
}
else
{
imlib_context_set_image( img );
imlib_render_pixmaps_for_whole_image( &p_intf->p_sys->iconPixmap,
&p_intf->p_sys->iconMask );
imlib_free_image();
}
#elif defined WIN32 #elif defined WIN32
// Interface thread id used to post broadcast messages // Interface thread id used to post broadcast messages
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* x11_window.cpp: X11 implementation of the Window class * x11_window.cpp: X11 implementation of the Window class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: x11_window.cpp,v 1.21 2003/06/09 19:08:33 asmax Exp $ * $Id: x11_window.cpp,v 1.22 2003/06/13 21:18:54 asmax Exp $
* *
* Authors: Cyril Deguet <asmax@videolan.org> * Authors: Cyril Deguet <asmax@videolan.org>
* *
...@@ -95,6 +95,27 @@ X11Window::X11Window( intf_thread_t *p_intf, Window wnd, int x, int y, ...@@ -95,6 +95,27 @@ X11Window::X11Window( intf_thread_t *p_intf, Window wnd, int x, int y,
XUNLOCK; XUNLOCK;
} }
// Associate vlc icon to the window
XLOCK;
XWMHints *hints = XGetWMHints( display, Wnd );
if( !hints)
{
hints = XAllocWMHints();
}
if( hints->icon_pixmap != None )
{
hints->icon_pixmap = p_intf->p_sys->iconPixmap;
hints->flags |= IconPixmapHint;
}
if( hints->icon_mask != None )
{
hints->icon_mask = p_intf->p_sys->iconMask;
hints->flags |= IconMaskHint;
}
XSetWMHints( display, Wnd, hints );
XFree( hints );
XUNLOCK;
// Create Tool Tip window // Create Tool Tip window
XColor color; XColor color;
color.red = 0xffff; color.red = 0xffff;
......
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