]> git.sesse.net Git - vlc/commitdiff
* modules/gui/skins/*, configure.ac.in: removed the skins plugin depandancy on msimg3...
authorGildas Bazin <gbazin@videolan.org>
Tue, 29 Apr 2003 12:54:57 +0000 (12:54 +0000)
committerGildas Bazin <gbazin@videolan.org>
Tue, 29 Apr 2003 12:54:57 +0000 (12:54 +0000)
configure.ac.in
modules/gui/skins/src/skin_common.h
modules/gui/skins/src/skin_main.cpp
modules/gui/skins/win32/win32_bitmap.cpp
modules/gui/skins/win32/win32_run.cpp
modules/gui/skins/win32/win32_theme.cpp
modules/gui/skins/win32/win32_window.cpp

index d0a17d41b58700de5f1b32db08a458102b6169ad..9ed3305ce96d386eece0cf5939886e9ed1ad8fcc 100644 (file)
@@ -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])
index b181e8de62d6ef5b719cfbee180fcbaf3c5b5f2c..b955a371577edcf921db0222aeab9b3185813928 100644 (file)
@@ -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 Teulière <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
 
 };
index ed9e588642843776bd5707c73fa03d801484a539..c93900410a3c50a9f5539cdaf5f0433518279fbc 100644 (file)
@@ -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 Teulière <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 );
 }
index 077741b70b7a4f56290e571092147cd9bcec591c..8d0e8b1ec79ab3464b5674e8aa930c22ade7e180 100644 (file)
@@ -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 Teulière <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
     {
index bab61297a07f81e983cb62ef22ecbb1a61d26ab5..a685b81a1cf910204a110b270c952e9d70330b78 100644 (file)
@@ -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 Teulière <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;
index 215e6b3f63b4a132a095bb1e08ad72c8a25d15a2..0a8cea6bdd44ea8496b213bde6cd9b084b378078 100644 (file)
@@ -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 Teulière <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 );\r
-    TrayIcon.hWnd = ParentWindow;\r
-    TrayIcon.uID = 42;\r
-    TrayIcon.uFlags = NIF_ICON|NIF_TIP|NIF_MESSAGE;\r
-    TrayIcon.uCallbackMessage = WM_RBUTTONDOWN;\r
+    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()
index d255ea46b59f693d7bd0977c5dd48a1fcd3f14cc..f86fb15739e529e41bcdcec900530d5c8aaaca22 100644 (file)
@@ -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 Teulière <ipkiss@via.ecp.fr>
  *          Emmanuel Puig    <karibu@via.ecp.fr>
 //---------------------------------------------------------------------------
 #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 );
 }
 //---------------------------------------------------------------------------