Commit cc1f85bd authored by Cyril Deguet's avatar Cyril Deguet

* x11/x11_display.cpp: the "parent" window now receive structure

    notify events
  * x11/x11_window.cpp: same thing for the other windows
  * x11/x11_loop.cpp: when the "parent" window receives a map notify event,
    we show all the windows because it doesn't seem to be automatic.
    To have this working, we must update the visibility variable of the
    windows when they are hidden by the window manager
  
parent 9e42c869
...@@ -68,10 +68,10 @@ class GenericWindow: public SkinObject, public Observer<VarBool> ...@@ -68,10 +68,10 @@ class GenericWindow: public SkinObject, public Observer<VarBool>
virtual void refresh( int left, int top, int width, int height ) {} virtual void refresh( int left, int top, int width, int height ) {}
/// Get the coordinates of the window /// Get the coordinates of the window
virtual int getLeft() const { return m_left; } int getLeft() const { return m_left; }
virtual int getTop() const { return m_top; } int getTop() const { return m_top; }
virtual int getWidth() const { return m_width; } int getWidth() const { return m_width; }
virtual int getHeight() const { return m_height; } int getHeight() const { return m_height; }
/// Give access to the visibility variable /// Give access to the visibility variable
VarBool &getVisibleVar() { return m_varVisible; } VarBool &getVisibleVar() { return m_varVisible; }
......
...@@ -147,19 +147,14 @@ void WindowManager::move( TopWindow &rWindow, int left, int top ) const ...@@ -147,19 +147,14 @@ void WindowManager::move( TopWindow &rWindow, int left, int top ) const
} }
void WindowManager::raiseAll( TopWindow &rWindow ) const void WindowManager::raiseAll() const
{ {
// Raise all the windows // Raise all the windows
WinSet_t::const_iterator it; WinSet_t::const_iterator it;
for( it = m_allWindows.begin(); it != m_allWindows.end(); it++ ) for( it = m_allWindows.begin(); it != m_allWindows.end(); it++ )
{
if( *it != &rWindow )
{ {
(*it)->raise(); (*it)->raise();
} }
}
// Make sure to raise the given window at the end, so that it is above
rWindow.raise();
} }
......
...@@ -67,8 +67,8 @@ class WindowManager: public SkinObject ...@@ -67,8 +67,8 @@ class WindowManager: public SkinObject
/// If a new anchoring is detected, the windows will move accordingly. /// If a new anchoring is detected, the windows will move accordingly.
void move( TopWindow &rWindow, int left, int top ) const; void move( TopWindow &rWindow, int left, int top ) const;
/// Raise all the windows, rWindow being above the others /// Raise all the windows
void raiseAll( TopWindow &rWindow ) const; void raiseAll() const;
/// Show all the registered windows /// Show all the registered windows
void showAll() const; void showAll() const;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* var_bool.cpp * var_bool.cpp
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: var_bool.cpp,v 1.3 2004/01/18 19:54:46 asmax Exp $ * $Id$
* *
* Authors: Cyril Deguet <asmax@via.ecp.fr> * Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr> * Olivier Teulire <ipkiss@via.ecp.fr>
...@@ -34,14 +34,16 @@ VarBoolImpl::VarBoolImpl( intf_thread_t *pIntf ): ...@@ -34,14 +34,16 @@ VarBoolImpl::VarBoolImpl( intf_thread_t *pIntf ):
} }
void VarBoolImpl::set( bool value ) void VarBoolImpl::set( bool value, bool doNotify )
{ {
if( value != m_value ) if( value != m_value )
{ {
m_value = value; m_value = value;
if( doNotify )
{
notify(); notify();
} }
}
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* var_bool.hpp * var_bool.hpp
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: var_bool.hpp,v 1.3 2004/01/18 19:54:46 asmax Exp $ * $Id$
* *
* Authors: Cyril Deguet <asmax@via.ecp.fr> * Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr> * Olivier Teulire <ipkiss@via.ecp.fr>
...@@ -60,7 +60,7 @@ class VarBoolImpl: public VarBool ...@@ -60,7 +60,7 @@ class VarBoolImpl: public VarBool
virtual bool get() const { return m_value; } virtual bool get() const { return m_value; }
/// Set the internal value /// Set the internal value
virtual void set( bool value ); virtual void set( bool value, bool doNotify = true );
private: private:
/// Boolean value /// Boolean value
......
...@@ -206,6 +206,9 @@ X11Display::X11Display( intf_thread_t *pIntf ): SkinObject( pIntf ), ...@@ -206,6 +206,9 @@ X11Display::X11Display( intf_thread_t *pIntf ): SkinObject( pIntf ),
// Change the window title // Change the window title
XStoreName( m_pDisplay, m_mainWindow, "VLC Media Player" ); XStoreName( m_pDisplay, m_mainWindow, "VLC Media Player" );
// Receive map notify events
XSelectInput( m_pDisplay, m_mainWindow, StructureNotifyMask );
// Set an empty mask for the window // Set an empty mask for the window
Region mask = XCreateRegion(); Region mask = XCreateRegion();
XShapeCombineRegion( m_pDisplay, m_mainWindow, ShapeBounding, 0, 0, mask, XShapeCombineRegion( m_pDisplay, m_mainWindow, ShapeBounding, 0, 0, mask,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* x11_loop.cpp * x11_loop.cpp
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: x11_loop.cpp,v 1.2 2004/01/18 00:25:02 asmax Exp $ * $Id$
* *
* Authors: Cyril Deguet <asmax@via.ecp.fr> * Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr> * Olivier Teulire <ipkiss@via.ecp.fr>
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
#include "x11_factory.hpp" #include "x11_factory.hpp"
#include "x11_timer.hpp" #include "x11_timer.hpp"
#include "../src/generic_window.hpp" #include "../src/generic_window.hpp"
#include "../src/theme.hpp"
#include "../src/window_manager.hpp"
#include "../events/evt_focus.hpp" #include "../events/evt_focus.hpp"
#include "../events/evt_key.hpp" #include "../events/evt_key.hpp"
#include "../events/evt_mouse.hpp" #include "../events/evt_mouse.hpp"
...@@ -39,6 +41,7 @@ ...@@ -39,6 +41,7 @@
#include "../events/evt_refresh.hpp" #include "../events/evt_refresh.hpp"
#include "../events/evt_scroll.hpp" #include "../events/evt_scroll.hpp"
#include "../commands/async_queue.hpp" #include "../commands/async_queue.hpp"
#include "../utils/var_bool.hpp"
#include "vlc_keys.h" #include "vlc_keys.h"
...@@ -152,6 +155,13 @@ void X11Loop::handleX11Event() ...@@ -152,6 +155,13 @@ void X11Loop::handleX11Event()
// Look for the next event in the queue // Look for the next event in the queue
XNextEvent( XDISPLAY, &event ); XNextEvent( XDISPLAY, &event );
// If the "parent" window is mapped, show all the windows
if( event.xany.window == m_rDisplay.getMainWindow()
&& event.type == MapNotify )
{
getIntf()->p_sys->p_theme->getWindowManager().showAll();
}
// Find the window to which the event is sent // Find the window to which the event is sent
X11Factory *pFactory = (X11Factory*)X11Factory::instance( getIntf() ); X11Factory *pFactory = (X11Factory*)X11Factory::instance( getIntf() );
GenericWindow *pWin = pFactory->m_windowMap[event.xany.window]; GenericWindow *pWin = pFactory->m_windowMap[event.xany.window];
...@@ -375,9 +385,10 @@ void X11Loop::handleX11Event() ...@@ -375,9 +385,10 @@ void X11Loop::handleX11Event()
break; break;
} }
default: case UnmapNotify:
// XXX // Hack to update the visibility variable if the window
fprintf(stderr, "unknown event: %d\n", event.type ); // is unmapped by the window manager
((VarBoolImpl&)pWin->getVisibleVar()).set( false, false );
break; break;
} }
} }
......
...@@ -64,7 +64,7 @@ X11Window::X11Window( intf_thread_t *pIntf, GenericWindow &rWindow, ...@@ -64,7 +64,7 @@ X11Window::X11Window( intf_thread_t *pIntf, GenericWindow &rWindow,
// Select events received by the window // Select events received by the window
XSelectInput( XDISPLAY, m_wnd, ExposureMask|KeyPressMask| XSelectInput( XDISPLAY, m_wnd, ExposureMask|KeyPressMask|
PointerMotionMask|ButtonPressMask|ButtonReleaseMask| PointerMotionMask|ButtonPressMask|ButtonReleaseMask|
LeaveWindowMask|FocusChangeMask ); LeaveWindowMask|FocusChangeMask|StructureNotifyMask );
// Store a pointer on the generic window in a map // Store a pointer on the generic window in a map
X11Factory *pFactory = (X11Factory*)X11Factory::instance( getIntf() ); X11Factory *pFactory = (X11Factory*)X11Factory::instance( getIntf() );
......
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