]> git.sesse.net Git - vlc/commitdiff
skins2: add a type to windows (TopWindow, VoutWindow, FullscreenWindow)
authorErwan Tulou <erwan10@videolan.org>
Tue, 15 Dec 2009 14:23:33 +0000 (15:23 +0100)
committerErwan Tulou <erwan10@videolan.org>
Tue, 15 Dec 2009 17:10:55 +0000 (18:10 +0100)
Specific attributes can be selected at creation of windows depending on type

modules/gui/skins2/src/generic_window.cpp
modules/gui/skins2/src/generic_window.hpp
modules/gui/skins2/src/os_factory.hpp
modules/gui/skins2/src/vout_manager.hpp
modules/gui/skins2/src/vout_window.cpp
modules/gui/skins2/win32/win32_factory.cpp
modules/gui/skins2/win32/win32_factory.hpp
modules/gui/skins2/x11/x11_factory.cpp
modules/gui/skins2/x11/x11_factory.hpp
modules/gui/skins2/x11/x11_window.cpp
modules/gui/skins2/x11/x11_window.hpp

index 9e50d5138d13ac292e6fc1beb8fb371bacb370d5..5a666faecb978b65f13658f282876cf16d0d0ec9 100644 (file)
@@ -31,7 +31,7 @@
 
 GenericWindow::GenericWindow( intf_thread_t *pIntf, int left, int top,
                               bool dragDrop, bool playOnDrop,
-                              GenericWindow *pParent ):
+                              GenericWindow *pParent, WindowType_t type ):
     SkinObject( pIntf ), m_left( left ), m_top( top ), m_width( 0 ),
     m_height( 0 ), m_pVarVisible( NULL )
 {
@@ -47,7 +47,7 @@ GenericWindow::GenericWindow( intf_thread_t *pIntf, int left, int top,
 
     // Create an OSWindow to handle OS specific processing
     m_pOsWindow = pOsFactory->createOSWindow( *this, dragDrop, playOnDrop,
-                                              pOSParent );
+                                              pOSParent, type );
 
     // Create the visibility variable and register it in the manager
     m_pVarVisible = new VarBoolImpl( pIntf );
index 3f8eac00dd0ef50f227edf89cc000ddecc4ac199..cc7deb8148aae876481fa0d1c26be20cc7328998 100644 (file)
@@ -49,9 +49,18 @@ private:
     friend class VoutManager;
     friend class CtrlVideo;
 public:
+
+    enum WindowType_t
+    {
+        TopWindow,
+        VoutWindow,
+        FullscreenWindow,
+    };
+
     GenericWindow( intf_thread_t *pIntf, int xPos, int yPos,
                    bool dragDrop, bool playOnDrop,
-                   GenericWindow *pParent = NULL );
+                   GenericWindow *pParent = NULL,
+                   WindowType_t type = TopWindow );
     virtual ~GenericWindow();
 
     /// Methods to process OS events.
index d9c3e6b9e2bec7d7e8046cb250dede1836b3adca..c4f3a8cfd5ad751579c64a37251124e1daaa756e 100644 (file)
@@ -30,7 +30,7 @@
 #include <string>
 #include <list>
 
-class GenericWindow;
+#include "../src/generic_window.hpp"
 class CmdGeneric;
 class OSBitmap;
 class OSGraphics;
@@ -102,7 +102,7 @@ public:
     /// Instantiate an object OSWindow
     virtual OSWindow *createOSWindow( GenericWindow &rWindow,
                                       bool dragDrop, bool playOnDrop,
-                                      OSWindow *pParent ) = 0;
+                                      OSWindow *pParent, GenericWindow::WindowType_t ) = 0;
 
     /// Instantiate an object OSTooltip
     virtual OSTooltip *createOSTooltip() = 0;
index f94638355faec3e25955b2f06613b67d254b055a..898aa81f7fbd02d5e99fa4ba4d07c8fbb88cd90e 100644 (file)
@@ -58,7 +58,8 @@ class VoutMainWindow: public GenericWindow
 public:
 
     VoutMainWindow( intf_thread_t *pIntf, int left = 0, int top = 0 ) :
-            GenericWindow( pIntf, left, top, false, false, NULL )
+            GenericWindow( pIntf, left, top, false, false, NULL,
+                           GenericWindow::FullscreenWindow )
     {
         resize( 10, 10 );
         move( -50, -50 );
index fab916b314a79796258392386baba161c131361a..a80b865c718d7c8270a3b52e8d826a56d0cdaea6 100644 (file)
@@ -38,7 +38,8 @@ int VoutWindow::count = 0;
 
 VoutWindow::VoutWindow( intf_thread_t *pIntf, vout_window_t* pWnd,
                         int width, int height, GenericWindow* pParent ) :
-      GenericWindow( pIntf, 0, 0, false, false, pParent ),
+      GenericWindow( pIntf, 0, 0, false, false, pParent,
+                     GenericWindow::VoutWindow ),
       m_pWnd( pWnd ), original_width( width ), original_height( height ),
       m_pParentWindow( pParent ), m_pCtrlVideo( NULL ), m_bFullscreen( false )
 {
@@ -64,6 +65,7 @@ void VoutWindow::setCtrlVideo( CtrlVideo* pCtrlVideo )
 {
     if( pCtrlVideo )
     {
+        hide();
         const Position *pPos = pCtrlVideo->getPosition();
         int x = pPos->getLeft();
         int y = pPos->getTop();
@@ -77,6 +79,7 @@ void VoutWindow::setCtrlVideo( CtrlVideo* pCtrlVideo )
     }
     else
     {
+        hide();
         int w = VoutManager::instance( getIntf() )->getVoutMainWindow()->getWidth();
         int h = VoutManager::instance( getIntf() )->getVoutMainWindow()->getHeight();
 
@@ -84,6 +87,7 @@ void VoutWindow::setCtrlVideo( CtrlVideo* pCtrlVideo )
                    0, 0, w, h );
         m_pParentWindow =
                   VoutManager::instance( getIntf() )->getVoutMainWindow();
+        show();
     }
 
     m_pCtrlVideo = pCtrlVideo;
index 4b7621eb96e8a1afd3d2cf2c62bb2453251a895b..07b6325f488e0ff7c96c88b0c87d73cff21fd127 100644 (file)
@@ -33,6 +33,7 @@
 #include "win32_loop.hpp"
 #include "../src/theme.hpp"
 #include "../src/window_manager.hpp"
+#include "../src/generic_window.hpp"
 #include "../commands/cmd_dialogs.hpp"
 #include "../commands/cmd_minimize.hpp"
 
@@ -323,7 +324,8 @@ OSTimer *Win32Factory::createOSTimer( CmdGeneric &rCmd )
 
 
 OSWindow *Win32Factory::createOSWindow( GenericWindow &rWindow, bool dragDrop,
-                                        bool playOnDrop, OSWindow *pParent )
+                                        bool playOnDrop, OSWindow *pParent,
+                                        GenericWindow::WindowType_t type )
 {
     return new Win32Window( getIntf(), rWindow, m_hInst, m_hParentWindow,
                             dragDrop, playOnDrop, (Win32Window*)pParent );
index 9846e96d39db83f3c67b7305c9bff024e59ab3fa..9e4db905128c2f7bf9fe63ba8cef3e1eb79ab484 100644 (file)
@@ -32,6 +32,8 @@
 #include <windows.h>
 #include <shellapi.h>
 #include "../src/os_factory.hpp"
+#include "../src/generic_window.hpp"
+
 #include <map>
 
 
@@ -78,7 +80,8 @@ public:
     /// Instantiate an OSWindow object
     virtual OSWindow *createOSWindow( GenericWindow &rWindow,
                                       bool dragDrop, bool playOnDrop,
-                                      OSWindow *pParent );
+                                      OSWindow *pParent,
+                                      GenericWindow::WindowType_t type );
 
     /// Instantiate an object OSTooltip
     virtual OSTooltip *createOSTooltip();
index 95a30852585a7fbdf16842f2b9e7eba177dcec9f..a6b0df6f4bb0f289ebac06bc2fdd596c6a1601e4 100644 (file)
@@ -38,6 +38,7 @@
 #include "x11_window.hpp"
 #include "x11_tooltip.hpp"
 
+#include "../src/generic_window.hpp"
 
 X11Factory::X11Factory( intf_thread_t *pIntf ): OSFactory( pIntf ),
     m_pDisplay( NULL ), m_pTimerLoop( NULL ), m_dirSep( "/" )
@@ -140,10 +141,11 @@ OSTimer *X11Factory::createOSTimer( CmdGeneric &rCmd )
 
 
 OSWindow *X11Factory::createOSWindow( GenericWindow &rWindow, bool dragDrop,
-                                      bool playOnDrop, OSWindow *pParent )
+                                      bool playOnDrop, OSWindow *pParent,
+                                      GenericWindow::WindowType_t type )
 {
     return new X11Window( getIntf(), rWindow, *m_pDisplay, dragDrop,
-                          playOnDrop, (X11Window*)pParent );
+                          playOnDrop, (X11Window*)pParent, type );
 }
 
 
index df8986a65889c813d923330f4ed3a0778dbac029..66c8047f5c2d5b0476ad1a725ddb5342f53b9d08 100644 (file)
@@ -28,6 +28,7 @@
 #include <X11/Xlib.h>
 
 #include "../src/os_factory.hpp"
+#include "../src/generic_window.hpp"
 #include <map>
 
 class X11Display;
@@ -105,7 +106,8 @@ public:
     /// Instantiate an OSWindow object
     virtual OSWindow *createOSWindow( GenericWindow &rWindow,
                                       bool dragDrop, bool playOnDrop,
-                                      OSWindow *pParent );
+                                      OSWindow *pParent,
+                                      GenericWindow::WindowType_t type );
 
     /// Instantiate an object OSTooltip
     virtual OSTooltip *createOSTooltip();
index 8ca46a6d14432d820e02c38393f7786575b580d0..50be1e8031ba16a8d60aa2182150b17c267647fa 100644 (file)
 
 X11Window::X11Window( intf_thread_t *pIntf, GenericWindow &rWindow,
                       X11Display &rDisplay, bool dragDrop, bool playOnDrop,
-                      X11Window *pParentWindow ):
+                      X11Window *pParentWindow, GenericWindow::WindowType_t type ):
     OSWindow( pIntf ), m_rDisplay( rDisplay ), m_pParent( pParentWindow ),
     m_dragDrop( dragDrop )
 {
     XSetWindowAttributes attr;
     unsigned long valuemask;
+    string name_type;
 
-    if (pParentWindow)
+    if( type == GenericWindow::FullscreenWindow )
+    {
+        m_wnd_parent = DefaultRootWindow( XDISPLAY );
+
+        int i_screen = DefaultScreen( XDISPLAY );
+
+        attr.event_mask = ExposureMask | StructureNotifyMask;
+        attr.background_pixel = BlackPixel( XDISPLAY, i_screen );
+        attr.backing_store = Always;
+        attr.override_redirect = True;
+        valuemask = CWBackingStore | CWOverrideRedirect |
+                    CWBackPixel | CWEventMask;
+
+        name_type = "Fullscreen";
+    }
+    else if( type == GenericWindow::VoutWindow )
     {
         m_wnd_parent = pParentWindow->m_wnd;
 
@@ -54,6 +70,8 @@ X11Window::X11Window( intf_thread_t *pIntf, GenericWindow &rWindow,
         attr.backing_store = Always;
         attr.background_pixel = BlackPixel( XDISPLAY, i_screen );
         valuemask = CWBackingStore | CWBackPixel | CWEventMask;
+
+        name_type = "VoutWindow";
     }
     else
     {
@@ -61,6 +79,8 @@ X11Window::X11Window( intf_thread_t *pIntf, GenericWindow &rWindow,
 
         attr.event_mask = ExposureMask | StructureNotifyMask;
         valuemask = CWEventMask;
+
+        name_type = "TopWindow";
     }
 
     // Create the window
@@ -118,7 +138,8 @@ X11Window::X11Window( intf_thread_t *pIntf, GenericWindow &rWindow,
     }
 
     // Change the window title
-    XStoreName( XDISPLAY, m_wnd, "VLC" );
+    string name_window = "VLC (" + name_type + ")";
+    XStoreName( XDISPLAY, m_wnd, name_window.c_str() );
 
     // Associate the window to the main "parent" window
     XSetTransientForHint( XDISPLAY, m_wnd, m_rDisplay.getMainWindow() );
index dcd1b7bd43122058b5f88e064d5073904090197b..4fde1af42b37c65830fe83903e1d720d76506b01 100644 (file)
@@ -27,6 +27,7 @@
 
 #include <X11/Xlib.h>
 
+#include "../src/generic_window.hpp"
 #include "../src/os_window.hpp"
 
 class X11Display;
@@ -39,7 +40,7 @@ class X11Window: public OSWindow
 public:
     X11Window( intf_thread_t *pIntf, GenericWindow &rWindow,
                X11Display &rDisplay, bool dragDrop, bool playOnDrop,
-               X11Window *pParentWindow );
+               X11Window *pParentWindow, GenericWindow::WindowType_t );
 
     virtual ~X11Window();