Commit db31a972 authored by Gildas Bazin's avatar Gildas Bazin

* modules/gui/skins/*, configure.ac.in: removed the skins plugin depandancy on msimg32.dll. Additionnaly, TransparentBlt() and SetLayeredWindowAttributes() are only used if present on the system. This allows us to run the plugin (without transparency though) on NT4/win95/98 as well.
parent e0d3ebea
......@@ -2391,7 +2391,7 @@ if test "x${enable_skins}" != "xno"; then
if test "x${SYS}" = "xmingw32" -o "x${SYS}" = "xcygwin"; then
PLUGINS="${PLUGINS} skins"
CPPFLAGS_skins="${CPPFLAGS_skins} -O2 -U_OFF_T_ -U_off_t -fno-rtti -Imodules/gui/skins"
LDFLAGS_skins="${LDFLAGS_skins} -loleaut32 -lwinspool -lwinmm -lshell32 -lctl3d32 -ladvapi32 -lwsock32 -lstdc++ -lgdi32 -lcomdlg32 -lole32 -luuid -lcomctl32 -lmsimg32"
LDFLAGS_skins="${LDFLAGS_skins} -loleaut32 -lwinspool -lwinmm -lshell32 -lctl3d32 -ladvapi32 -lwsock32 -lstdc++ -lgdi32 -lcomdlg32 -lole32 -luuid -lcomctl32"
else
if test "x${enable_skins}" = "xyes"; then
PKG_CHECK_MODULES(GTK2, [gtk+-2.0 >= 2.0.0, gthread-2.0])
......
......@@ -2,7 +2,7 @@
* skin_common.h: Private Skin interface description
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: skin_common.h,v 1.7 2003/04/28 22:44:26 ipkiss Exp $
* $Id: skin_common.h,v 1.8 2003/04/29 12:54:57 gbazin Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -92,6 +92,14 @@ struct intf_sys_t
#ifdef WIN32
bool b_wx_die;
ExitTimer *p_kludgy_timer;
// We dynamically load msimg32.dll to get a pointer to TransparentBlt()
HINSTANCE h_msimg32_dll;
BOOL (WINAPI *TransparentBlt)( HDC,int,int,int,int,HDC,int,
int,int,int,UINT );
// idem for user32.dll and SetLayeredWindowAttributes()
HINSTANCE h_user32_dll;
BOOL (WINAPI *SetLayeredWindowAttributes)( HWND,COLORREF,BYTE,DWORD );
#endif
};
......
......@@ -2,7 +2,7 @@
* skin-main.cpp: skins plugin for VLC
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: skin_main.cpp,v 1.21 2003/04/28 14:12:33 asmax Exp $
* $Id: skin_main.cpp,v 1.22 2003/04/29 12:54:57 gbazin Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -115,9 +115,37 @@ static int Open ( vlc_object_t *p_this )
char **pp_args = p_args;
gdk_init( &i_args, &pp_args );
#elif defined X11_SKINS
// Initialize X11
p_intf->p_sys->display = XOpenDisplay( NULL );
#elif defined WIN32
// We dynamically load msimg32.dll to get a pointer to TransparentBlt()
p_intf->p_sys->h_msimg32_dll = LoadLibrary("msimg32.dll");
if( !p_intf->p_sys->h_msimg32_dll ||
!( p_intf->p_sys->TransparentBlt =
(BOOL (WINAPI*)(HDC,int,int,int,int,HDC,
int,int,int,int,unsigned int))
GetProcAddress( p_intf->p_sys->h_msimg32_dll, "TransparentBlt" ) ) )
{
p_intf->p_sys->TransparentBlt = NULL;
msg_Dbg( p_intf, "Couldn't find TransparentBlt(), "
"falling back to BitBlt()" );
}
// idem for user32.dll and SetLayeredWindowAttributes()
p_intf->p_sys->h_user32_dll = LoadLibrary("user32.dll");
if( !p_intf->p_sys->h_user32_dll ||
!( p_intf->p_sys->SetLayeredWindowAttributes =
(BOOL (WINAPI *)(HWND,COLORREF,BYTE,DWORD))
GetProcAddress( p_intf->p_sys->h_user32_dll,
"SetLayeredWindowAttributes" ) ) )
{
p_intf->p_sys->SetLayeredWindowAttributes = NULL;
msg_Dbg( p_intf, "Couldn't find SetLayeredWindowAttributes()" );
}
#endif
// Initialize conditions and mutexes
......@@ -157,6 +185,14 @@ static void Close ( vlc_object_t *p_this )
vlc_cond_destroy( &p_intf->p_sys->init_cond );
vlc_mutex_destroy( &p_intf->p_sys->init_lock );
#ifdef WIN32
// Unload msimg32.dll and user32.dll
if( p_intf->p_sys->h_msimg32_dll )
FreeLibrary( p_intf->p_sys->h_msimg32_dll );
if( p_intf->p_sys->h_user32_dll )
FreeLibrary( p_intf->p_sys->h_user32_dll );
#endif
// Destroy structure
free( p_intf->p_sys );
}
......
......@@ -2,7 +2,7 @@
* win32_bitmap.cpp: Win32 implementation of the Bitmap class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: win32_bitmap.cpp,v 1.5 2003/04/28 00:18:27 ipkiss Exp $
* $Id: win32_bitmap.cpp,v 1.6 2003/04/29 12:54:57 gbazin Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -91,11 +91,11 @@ Win32Bitmap::Win32Bitmap( intf_thread_t *p_intf, string FileName, int AColor )
DeleteObject( Brush );
delete r;
if( IS_WINNT )
if( p_intf->p_sys->TransparentBlt && IS_WINNT )
{
// This function contains a memory leak on win95/win98
TransparentBlt( bufDC, 0, 0, Width, Height, bmpDC, 0, 0,
Width, Height, 0 );
p_intf->p_sys->TransparentBlt( bufDC, 0, 0, Width, Height,
bmpDC, 0, 0, Width, Height, 0 );
}
else
{
......@@ -157,11 +157,11 @@ void Win32Bitmap::DrawBitmap( int x, int y, int w, int h, int xRef, int yRef,
{
HDC destDC = ( (Win32Graphics *)dest )->GetImageHandle();
if( IS_WINNT )
if( p_intf->p_sys->TransparentBlt && IS_WINNT )
{
// This function contains a memory leak on win95/win98
TransparentBlt( destDC, xRef, yRef, w, h, bmpDC, x, y, w, h,
AlphaColor );
p_intf->p_sys->TransparentBlt( destDC, xRef, yRef, w, h,
bmpDC, x, y, w, h, AlphaColor );
}
else
{
......
......@@ -2,7 +2,7 @@
* win32_run.cpp:
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: win32_run.cpp,v 1.11 2003/04/28 22:44:26 ipkiss Exp $
* $Id: win32_run.cpp,v 1.12 2003/04/29 12:54:57 gbazin Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -217,7 +217,8 @@ void OSRun( intf_thread_t *p_intf )
// Create a new thread for wxWindows
if( vlc_thread_create( p_intf, "Skins Dialogs Thread", SkinsDialogsThread,
0, 0 ) ) {
0, 0 ) )
{
msg_Err( p_intf, "cannot create SkinsDialogsThread" );
// Don't even enter the main loop
return;
......
......@@ -2,7 +2,7 @@
* win32_theme.cpp: Win32 implementation of the Theme class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: win32_theme.cpp,v 1.6 2003/04/21 21:51:16 asmax Exp $
* $Id: win32_theme.cpp,v 1.7 2003/04/29 12:54:57 gbazin Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -225,21 +225,24 @@ void Win32Theme::OnLoadTheme()
}
// Create Window
ParentWindow = CreateWindowEx( WS_EX_LAYERED|WS_EX_TOOLWINDOW,
"ParentWindow", "VLC Media Player",
WS_SYSMENU,
0, 0, 0, 0, 0, 0, hinst, NULL );
ParentWindow = CreateWindowEx( WS_EX_TOOLWINDOW, "ParentWindow",
"VLC Media Player", WS_SYSMENU, 0, 0, 0, 0, 0, 0, hinst, NULL );
// We do it this way otherwise CreateWindowEx will fail
// if WS_EX_LAYERED is not supported
SetWindowLongPtr( ParentWindow, GWL_EXSTYLE, GetWindowLong( ParentWindow,
GWL_EXSTYLE ) | WS_EX_LAYERED );
// Store with it a pointer to the interface thread
SetWindowLongPtr( ParentWindow, GWLP_USERDATA, (LONG_PTR)p_intf );
ShowWindow( ParentWindow, SW_SHOW );
// System tray icon
TrayIcon.cbSize = sizeof( PNOTIFYICONDATA );
TrayIcon.hWnd = ParentWindow;
TrayIcon.uID = 42;
TrayIcon.uFlags = NIF_ICON|NIF_TIP|NIF_MESSAGE;
TrayIcon.uCallbackMessage = WM_RBUTTONDOWN;
TrayIcon.cbSize = sizeof( PNOTIFYICONDATA );
TrayIcon.hWnd = ParentWindow;
TrayIcon.uID = 42;
TrayIcon.uFlags = NIF_ICON|NIF_TIP|NIF_MESSAGE;
TrayIcon.uCallbackMessage = WM_RBUTTONDOWN;
TrayIcon.hIcon = LoadIcon( hinst, "VLC_ICON" );
strcpy( TrayIcon.szTip, "VLC Media Player" );
......@@ -281,7 +284,7 @@ void Win32Theme::AddWindow( string name, int x, int y, bool visible,
{
HWND hwnd;
hwnd = CreateWindowEx( WS_EX_LAYERED|WS_EX_TOOLWINDOW,
hwnd = CreateWindowEx( WS_EX_TOOLWINDOW,
"SkinWindow", name.c_str(), WS_POPUP, CW_USEDEFAULT, CW_USEDEFAULT,
0, 0, ParentWindow, 0, hinst, NULL );
......@@ -291,10 +294,15 @@ void Win32Theme::AddWindow( string name, int x, int y, bool visible,
return;
}
// We do it this way otherwise CreateWindowEx will fail
// if WS_EX_LAYERED is not supported
SetWindowLongPtr( hwnd, GWL_EXSTYLE,
GetWindowLong( hwnd, GWL_EXSTYLE ) | WS_EX_LAYERED );
SetWindowLongPtr( hwnd, GWLP_USERDATA, (LONG_PTR)p_intf );
WindowList.push_back( (SkinWindow *)new OSWindow( p_intf, hwnd, x, y, visible,
fadetime, alpha, movealpha, dragdrop ) ) ;
WindowList.push_back( (SkinWindow *)new OSWindow( p_intf, hwnd, x, y,
visible, fadetime, alpha, movealpha, dragdrop ) ) ;
}
//---------------------------------------------------------------------------
void Win32Theme::ChangeTray()
......
......@@ -2,7 +2,7 @@
* win32_window.cpp: Win32 implementation of the Window class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: win32_window.cpp,v 1.10 2003/04/21 21:51:16 asmax Exp $
* $Id: win32_window.cpp,v 1.11 2003/04/29 12:54:57 gbazin Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -54,11 +54,6 @@
//---------------------------------------------------------------------------
#define LWA_COLORKEY 0x00000001
#define LWA_ALPHA 0x00000002
typedef BOOL (WINAPI *SLWA)(HWND, COLORREF, BYTE, DWORD);
HMODULE hModule = LoadLibrary( "user32.dll" );
SLWA SetLayeredWindowAttributes =
(SLWA)GetProcAddress( hModule, "SetLayeredWindowAttributes" );
//---------------------------------------------------------------------------
// Skinable Window
......@@ -219,7 +214,11 @@ void Win32Window::SetTransparency( int Value )
{
if( Value > -1 )
Alpha = Value;
SetLayeredWindowAttributes( hWnd, 0, Alpha, LWA_ALPHA | LWA_COLORKEY );
if( p_intf->p_sys->SetLayeredWindowAttributes )
p_intf->p_sys->SetLayeredWindowAttributes( hWnd, 0, Alpha,
LWA_ALPHA | LWA_COLORKEY );
UpdateWindow( hWnd );
}
//---------------------------------------------------------------------------
......
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