Commit f39e08f4 authored by Erwan Tulou's avatar Erwan Tulou

skins2: add a type to windows (TopWindow, VoutWindow, FullscreenWindow)

Specific attributes can be selected at creation of windows depending on type
parent e0114a72
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
GenericWindow::GenericWindow( intf_thread_t *pIntf, int left, int top, GenericWindow::GenericWindow( intf_thread_t *pIntf, int left, int top,
bool dragDrop, bool playOnDrop, bool dragDrop, bool playOnDrop,
GenericWindow *pParent ): GenericWindow *pParent, WindowType_t type ):
SkinObject( pIntf ), m_left( left ), m_top( top ), m_width( 0 ), SkinObject( pIntf ), m_left( left ), m_top( top ), m_width( 0 ),
m_height( 0 ), m_pVarVisible( NULL ) m_height( 0 ), m_pVarVisible( NULL )
{ {
...@@ -47,7 +47,7 @@ GenericWindow::GenericWindow( intf_thread_t *pIntf, int left, int top, ...@@ -47,7 +47,7 @@ GenericWindow::GenericWindow( intf_thread_t *pIntf, int left, int top,
// Create an OSWindow to handle OS specific processing // Create an OSWindow to handle OS specific processing
m_pOsWindow = pOsFactory->createOSWindow( *this, dragDrop, playOnDrop, m_pOsWindow = pOsFactory->createOSWindow( *this, dragDrop, playOnDrop,
pOSParent ); pOSParent, type );
// Create the visibility variable and register it in the manager // Create the visibility variable and register it in the manager
m_pVarVisible = new VarBoolImpl( pIntf ); m_pVarVisible = new VarBoolImpl( pIntf );
......
...@@ -49,9 +49,18 @@ private: ...@@ -49,9 +49,18 @@ private:
friend class VoutManager; friend class VoutManager;
friend class CtrlVideo; friend class CtrlVideo;
public: public:
enum WindowType_t
{
TopWindow,
VoutWindow,
FullscreenWindow,
};
GenericWindow( intf_thread_t *pIntf, int xPos, int yPos, GenericWindow( intf_thread_t *pIntf, int xPos, int yPos,
bool dragDrop, bool playOnDrop, bool dragDrop, bool playOnDrop,
GenericWindow *pParent = NULL ); GenericWindow *pParent = NULL,
WindowType_t type = TopWindow );
virtual ~GenericWindow(); virtual ~GenericWindow();
/// Methods to process OS events. /// Methods to process OS events.
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include <string> #include <string>
#include <list> #include <list>
class GenericWindow; #include "../src/generic_window.hpp"
class CmdGeneric; class CmdGeneric;
class OSBitmap; class OSBitmap;
class OSGraphics; class OSGraphics;
...@@ -102,7 +102,7 @@ public: ...@@ -102,7 +102,7 @@ public:
/// Instantiate an object OSWindow /// Instantiate an object OSWindow
virtual OSWindow *createOSWindow( GenericWindow &rWindow, virtual OSWindow *createOSWindow( GenericWindow &rWindow,
bool dragDrop, bool playOnDrop, bool dragDrop, bool playOnDrop,
OSWindow *pParent ) = 0; OSWindow *pParent, GenericWindow::WindowType_t ) = 0;
/// Instantiate an object OSTooltip /// Instantiate an object OSTooltip
virtual OSTooltip *createOSTooltip() = 0; virtual OSTooltip *createOSTooltip() = 0;
......
...@@ -58,7 +58,8 @@ class VoutMainWindow: public GenericWindow ...@@ -58,7 +58,8 @@ class VoutMainWindow: public GenericWindow
public: public:
VoutMainWindow( intf_thread_t *pIntf, int left = 0, int top = 0 ) : 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 ); resize( 10, 10 );
move( -50, -50 ); move( -50, -50 );
......
...@@ -38,7 +38,8 @@ int VoutWindow::count = 0; ...@@ -38,7 +38,8 @@ int VoutWindow::count = 0;
VoutWindow::VoutWindow( intf_thread_t *pIntf, vout_window_t* pWnd, VoutWindow::VoutWindow( intf_thread_t *pIntf, vout_window_t* pWnd,
int width, int height, GenericWindow* pParent ) : 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_pWnd( pWnd ), original_width( width ), original_height( height ),
m_pParentWindow( pParent ), m_pCtrlVideo( NULL ), m_bFullscreen( false ) m_pParentWindow( pParent ), m_pCtrlVideo( NULL ), m_bFullscreen( false )
{ {
...@@ -64,6 +65,7 @@ void VoutWindow::setCtrlVideo( CtrlVideo* pCtrlVideo ) ...@@ -64,6 +65,7 @@ void VoutWindow::setCtrlVideo( CtrlVideo* pCtrlVideo )
{ {
if( pCtrlVideo ) if( pCtrlVideo )
{ {
hide();
const Position *pPos = pCtrlVideo->getPosition(); const Position *pPos = pCtrlVideo->getPosition();
int x = pPos->getLeft(); int x = pPos->getLeft();
int y = pPos->getTop(); int y = pPos->getTop();
...@@ -77,6 +79,7 @@ void VoutWindow::setCtrlVideo( CtrlVideo* pCtrlVideo ) ...@@ -77,6 +79,7 @@ void VoutWindow::setCtrlVideo( CtrlVideo* pCtrlVideo )
} }
else else
{ {
hide();
int w = VoutManager::instance( getIntf() )->getVoutMainWindow()->getWidth(); int w = VoutManager::instance( getIntf() )->getVoutMainWindow()->getWidth();
int h = VoutManager::instance( getIntf() )->getVoutMainWindow()->getHeight(); int h = VoutManager::instance( getIntf() )->getVoutMainWindow()->getHeight();
...@@ -84,6 +87,7 @@ void VoutWindow::setCtrlVideo( CtrlVideo* pCtrlVideo ) ...@@ -84,6 +87,7 @@ void VoutWindow::setCtrlVideo( CtrlVideo* pCtrlVideo )
0, 0, w, h ); 0, 0, w, h );
m_pParentWindow = m_pParentWindow =
VoutManager::instance( getIntf() )->getVoutMainWindow(); VoutManager::instance( getIntf() )->getVoutMainWindow();
show();
} }
m_pCtrlVideo = pCtrlVideo; m_pCtrlVideo = pCtrlVideo;
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "win32_loop.hpp" #include "win32_loop.hpp"
#include "../src/theme.hpp" #include "../src/theme.hpp"
#include "../src/window_manager.hpp" #include "../src/window_manager.hpp"
#include "../src/generic_window.hpp"
#include "../commands/cmd_dialogs.hpp" #include "../commands/cmd_dialogs.hpp"
#include "../commands/cmd_minimize.hpp" #include "../commands/cmd_minimize.hpp"
...@@ -323,7 +324,8 @@ OSTimer *Win32Factory::createOSTimer( CmdGeneric &rCmd ) ...@@ -323,7 +324,8 @@ OSTimer *Win32Factory::createOSTimer( CmdGeneric &rCmd )
OSWindow *Win32Factory::createOSWindow( GenericWindow &rWindow, bool dragDrop, 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, return new Win32Window( getIntf(), rWindow, m_hInst, m_hParentWindow,
dragDrop, playOnDrop, (Win32Window*)pParent ); dragDrop, playOnDrop, (Win32Window*)pParent );
......
...@@ -32,6 +32,8 @@ ...@@ -32,6 +32,8 @@
#include <windows.h> #include <windows.h>
#include <shellapi.h> #include <shellapi.h>
#include "../src/os_factory.hpp" #include "../src/os_factory.hpp"
#include "../src/generic_window.hpp"
#include <map> #include <map>
...@@ -78,7 +80,8 @@ public: ...@@ -78,7 +80,8 @@ public:
/// Instantiate an OSWindow object /// Instantiate an OSWindow object
virtual OSWindow *createOSWindow( GenericWindow &rWindow, virtual OSWindow *createOSWindow( GenericWindow &rWindow,
bool dragDrop, bool playOnDrop, bool dragDrop, bool playOnDrop,
OSWindow *pParent ); OSWindow *pParent,
GenericWindow::WindowType_t type );
/// Instantiate an object OSTooltip /// Instantiate an object OSTooltip
virtual OSTooltip *createOSTooltip(); virtual OSTooltip *createOSTooltip();
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include "x11_window.hpp" #include "x11_window.hpp"
#include "x11_tooltip.hpp" #include "x11_tooltip.hpp"
#include "../src/generic_window.hpp"
X11Factory::X11Factory( intf_thread_t *pIntf ): OSFactory( pIntf ), X11Factory::X11Factory( intf_thread_t *pIntf ): OSFactory( pIntf ),
m_pDisplay( NULL ), m_pTimerLoop( NULL ), m_dirSep( "/" ) m_pDisplay( NULL ), m_pTimerLoop( NULL ), m_dirSep( "/" )
...@@ -140,10 +141,11 @@ OSTimer *X11Factory::createOSTimer( CmdGeneric &rCmd ) ...@@ -140,10 +141,11 @@ OSTimer *X11Factory::createOSTimer( CmdGeneric &rCmd )
OSWindow *X11Factory::createOSWindow( GenericWindow &rWindow, bool dragDrop, 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, return new X11Window( getIntf(), rWindow, *m_pDisplay, dragDrop,
playOnDrop, (X11Window*)pParent ); playOnDrop, (X11Window*)pParent, type );
} }
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include "../src/os_factory.hpp" #include "../src/os_factory.hpp"
#include "../src/generic_window.hpp"
#include <map> #include <map>
class X11Display; class X11Display;
...@@ -105,7 +106,8 @@ public: ...@@ -105,7 +106,8 @@ public:
/// Instantiate an OSWindow object /// Instantiate an OSWindow object
virtual OSWindow *createOSWindow( GenericWindow &rWindow, virtual OSWindow *createOSWindow( GenericWindow &rWindow,
bool dragDrop, bool playOnDrop, bool dragDrop, bool playOnDrop,
OSWindow *pParent ); OSWindow *pParent,
GenericWindow::WindowType_t type );
/// Instantiate an object OSTooltip /// Instantiate an object OSTooltip
virtual OSTooltip *createOSTooltip(); virtual OSTooltip *createOSTooltip();
......
...@@ -37,14 +37,30 @@ ...@@ -37,14 +37,30 @@
X11Window::X11Window( intf_thread_t *pIntf, GenericWindow &rWindow, X11Window::X11Window( intf_thread_t *pIntf, GenericWindow &rWindow,
X11Display &rDisplay, bool dragDrop, bool playOnDrop, X11Display &rDisplay, bool dragDrop, bool playOnDrop,
X11Window *pParentWindow ): X11Window *pParentWindow, GenericWindow::WindowType_t type ):
OSWindow( pIntf ), m_rDisplay( rDisplay ), m_pParent( pParentWindow ), OSWindow( pIntf ), m_rDisplay( rDisplay ), m_pParent( pParentWindow ),
m_dragDrop( dragDrop ) m_dragDrop( dragDrop )
{ {
XSetWindowAttributes attr; XSetWindowAttributes attr;
unsigned long valuemask; 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; m_wnd_parent = pParentWindow->m_wnd;
...@@ -54,6 +70,8 @@ X11Window::X11Window( intf_thread_t *pIntf, GenericWindow &rWindow, ...@@ -54,6 +70,8 @@ X11Window::X11Window( intf_thread_t *pIntf, GenericWindow &rWindow,
attr.backing_store = Always; attr.backing_store = Always;
attr.background_pixel = BlackPixel( XDISPLAY, i_screen ); attr.background_pixel = BlackPixel( XDISPLAY, i_screen );
valuemask = CWBackingStore | CWBackPixel | CWEventMask; valuemask = CWBackingStore | CWBackPixel | CWEventMask;
name_type = "VoutWindow";
} }
else else
{ {
...@@ -61,6 +79,8 @@ X11Window::X11Window( intf_thread_t *pIntf, GenericWindow &rWindow, ...@@ -61,6 +79,8 @@ X11Window::X11Window( intf_thread_t *pIntf, GenericWindow &rWindow,
attr.event_mask = ExposureMask | StructureNotifyMask; attr.event_mask = ExposureMask | StructureNotifyMask;
valuemask = CWEventMask; valuemask = CWEventMask;
name_type = "TopWindow";
} }
// Create the window // Create the window
...@@ -118,7 +138,8 @@ X11Window::X11Window( intf_thread_t *pIntf, GenericWindow &rWindow, ...@@ -118,7 +138,8 @@ X11Window::X11Window( intf_thread_t *pIntf, GenericWindow &rWindow,
} }
// Change the window title // 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 // Associate the window to the main "parent" window
XSetTransientForHint( XDISPLAY, m_wnd, m_rDisplay.getMainWindow() ); XSetTransientForHint( XDISPLAY, m_wnd, m_rDisplay.getMainWindow() );
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include "../src/generic_window.hpp"
#include "../src/os_window.hpp" #include "../src/os_window.hpp"
class X11Display; class X11Display;
...@@ -39,7 +40,7 @@ class X11Window: public OSWindow ...@@ -39,7 +40,7 @@ class X11Window: public OSWindow
public: public:
X11Window( intf_thread_t *pIntf, GenericWindow &rWindow, X11Window( intf_thread_t *pIntf, GenericWindow &rWindow,
X11Display &rDisplay, bool dragDrop, bool playOnDrop, X11Display &rDisplay, bool dragDrop, bool playOnDrop,
X11Window *pParentWindow ); X11Window *pParentWindow, GenericWindow::WindowType_t );
virtual ~X11Window(); virtual ~X11Window();
......
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