Commit 73150d7c authored by Erwan Tulou's avatar Erwan Tulou

skins2: some optimisation and cosmetics when moving/resizing windows

On most WM, move and resize are noop as long as the window is not visible, and
these calls have to be reissued once the window becomes visible.
  - so avoid unnecessary calls when there are known to be noop.
  - remove a move in TopWindow that appears hackish
    (it hides a MoveResize and is actually needed for _all_ windows)
parent 81210652
......@@ -92,27 +92,30 @@ void GenericWindow::move( int left, int top )
m_left = left;
m_top = top;
m_pOsWindow->moveResize( left, top, m_width, m_height );
if( m_pOsWindow && isVisible() )
m_pOsWindow->moveResize( left, top, m_width, m_height );
}
void GenericWindow::resize( int width, int height )
{
// don't try when value is 0 (may crash)
if( !width || ! height )
if( !width || !height )
return;
// Update the window size
m_width = width;
m_height = height;
m_pOsWindow->moveResize( m_left, m_top, width, height );
if( m_pOsWindow && isVisible() )
m_pOsWindow->moveResize( m_left, m_top, width, height );
}
void GenericWindow::raise() const
{
m_pOsWindow->raise();
if( m_pOsWindow )
m_pOsWindow->raise();
}
......@@ -124,7 +127,8 @@ void GenericWindow::setOpacity( uint8_t value )
void GenericWindow::toggleOnTop( bool onTop ) const
{
m_pOsWindow->toggleOnTop( onTop );
if( m_pOsWindow )
m_pOsWindow->toggleOnTop( onTop );
}
......@@ -149,6 +153,7 @@ void GenericWindow::innerShow()
if( m_pOsWindow )
{
m_pOsWindow->show();
m_pOsWindow->moveResize( m_left, m_top, m_width, m_height );
}
}
......
......@@ -134,6 +134,9 @@ protected:
/// Actually hide the window
virtual void innerHide();
///
bool isVisible() const { return m_pVarVisible->get(); }
private:
/// Window position and size
int m_left, m_top, m_width, m_height;
......
......@@ -324,9 +324,6 @@ void TopWindow::innerShow()
// Show the window
GenericWindow::innerShow();
// place the top window on the screen (after show!)
move( getLeft(), getTop() );
}
......
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