[Libreoffice-commits] core.git: 3 commits - include/vcl vcl/source

Maxim Monastirsky momonasmon at gmail.com
Mon Oct 10 21:11:22 UTC 2016


 include/vcl/floatwin.hxx       |    1 -
 include/vcl/syswin.hxx         |    2 +-
 vcl/source/window/dockmgr.cxx  |    8 +++++---
 vcl/source/window/dockwin.cxx  |    6 ++----
 vcl/source/window/floatwin.cxx |   11 -----------
 vcl/source/window/syswin.cxx   |    8 +++-----
 6 files changed, 11 insertions(+), 25 deletions(-)

New commits:
commit b197a47889a81b0181553a2a9c4db9683dd5d760
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date:   Tue Oct 11 00:04:12 2016 +0300

    Height and Width seem to be swapped here
    
    when height takes left-right borders, and width top-bottom.
    And also - Why do we calculate the borders twice - as the call
    to CalcWindowSize does this again?
    
    Change-Id: I63a66939bd526a225ccac9bdd6262feba48da5c2

diff --git a/vcl/source/window/dockwin.cxx b/vcl/source/window/dockwin.cxx
index 8dff109..9a523c7 100644
--- a/vcl/source/window/dockwin.cxx
+++ b/vcl/source/window/dockwin.cxx
@@ -1072,10 +1072,8 @@ Size DockingWindow::GetOptimalSize() const
 
     sal_Int32 nBorderWidth = get_border_width();
 
-    aSize.Height() += mpWindowImpl->mnLeftBorder + mpWindowImpl->mnRightBorder
-        + 2*nBorderWidth;
-    aSize.Width() += mpWindowImpl->mnTopBorder + mpWindowImpl->mnBottomBorder
-        + 2*nBorderWidth;
+    aSize.Height() += 2 * nBorderWidth;
+    aSize.Width()  += 2 * nBorderWidth;
 
     return Window::CalcWindowSize(aSize);
 }
diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx
index f844eef..5e1a372 100644
--- a/vcl/source/window/syswin.cxx
+++ b/vcl/source/window/syswin.cxx
@@ -1091,10 +1091,8 @@ Size SystemWindow::GetOptimalSize() const
 
     sal_Int32 nBorderWidth = get_border_width();
 
-    aSize.Height() += mpWindowImpl->mnLeftBorder + mpWindowImpl->mnRightBorder
-        + 2*nBorderWidth;
-    aSize.Width() += mpWindowImpl->mnTopBorder + mpWindowImpl->mnBottomBorder
-        + 2*nBorderWidth;
+    aSize.Height() += 2 * nBorderWidth;
+    aSize.Width()  += 2 * nBorderWidth;
 
     return Window::CalcWindowSize(aSize);
 }
commit 9079d599baf01cb414ed4cccb22546f1807e5637
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date:   Mon Oct 10 23:36:22 2016 +0300

    Merge SystemWindow and FloatingWindow setPosSizeOnContainee methods
    
    This reverts commit 95942b16f44bc6eac57ad7b579b4158565446884
    ("Resolves: tdf#90481 fix cropped buttons"), and changes the
    code in a way that seems to not crop buttons anymore. Tested
    under gtk3 with File > Digital Signatures... and the toolbar
    underline dropdown.
    
    Change-Id: Idcb680c82f594f630b1dd7c76c42912e6b5a093a

diff --git a/include/vcl/floatwin.hxx b/include/vcl/floatwin.hxx
index 414fcee..680cc13 100644
--- a/include/vcl/floatwin.hxx
+++ b/include/vcl/floatwin.hxx
@@ -103,7 +103,6 @@ private:
 
     SAL_DLLPRIVATE void    ImplCallPopupModeEnd();
     DECL_DLLPRIVATE_LINK(  ImplEndPopupModeHdl, void*, void );
-    virtual void setPosSizeOnContainee(Size aSize, Window &rBox) override;
 
                            FloatingWindow (const FloatingWindow &) = delete;
                            FloatingWindow & operator= (const FloatingWindow &) = delete;
diff --git a/include/vcl/syswin.hxx b/include/vcl/syswin.hxx
index d3a44e7..dd6d9f0 100644
--- a/include/vcl/syswin.hxx
+++ b/include/vcl/syswin.hxx
@@ -177,7 +177,7 @@ public:
 
 private:
     SAL_DLLPRIVATE void ImplMoveToScreen( long& io_rX, long& io_rY, long i_nWidth, long i_nHeight, vcl::Window* i_pConfigureWin );
-    virtual void setPosSizeOnContainee(Size aSize, Window &rBox);
+    SAL_DLLPRIVATE void setPosSizeOnContainee(Size aSize, Window &rBox);
     DECL_DLLPRIVATE_LINK( ImplHandleLayoutTimerHdl, Idle*, void );
 
 protected:
diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
index f9c4513..465177e 100644
--- a/vcl/source/window/floatwin.cxx
+++ b/vcl/source/window/floatwin.cxx
@@ -827,15 +827,4 @@ void FloatingWindow::AddPopupModeWindow( vcl::Window* pWindow )
     mpFirstPopupModeWin = pWindow;
 }
 
-void FloatingWindow::setPosSizeOnContainee(Size aSize, Window &rBox)
-{
-    sal_Int32 nBorderWidth = get_border_width();
-
-    aSize.Width() -= mpWindowImpl->mnLeftBorder + mpWindowImpl->mnRightBorder + 2 * nBorderWidth;
-    aSize.Height() -= nBorderWidth + mpWindowImpl->mnTopBorder + mpWindowImpl->mnBottomBorder + 2 * nBorderWidth;
-
-    Point aPos(nBorderWidth, nBorderWidth);
-    VclContainer::setLayoutAllocation(rBox, aPos, aSize);
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx
index dca00fd..f844eef 100644
--- a/vcl/source/window/syswin.cxx
+++ b/vcl/source/window/syswin.cxx
@@ -1107,7 +1107,7 @@ void SystemWindow::setPosSizeOnContainee(Size aSize, Window &rBox)
     aSize.Height() -= 2 * nBorderWidth;
 
     Point aPos(nBorderWidth, nBorderWidth);
-    VclContainer::setLayoutAllocation(rBox, aPos, aSize);
+    VclContainer::setLayoutAllocation(rBox, aPos, CalcOutputSize(aSize));
 }
 
 IMPL_LINK_NOARG( SystemWindow, ImplHandleLayoutTimerHdl, Idle*, void )
commit e48d1086d79c319b31d48b984840a424780deefa
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date:   Sun Oct 9 10:13:12 2016 +0300

    The key event is not needed for the non-ToolBox case
    
    Change-Id: I8d593665f1c2bcafa583eca311cd86ab618dec3d

diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx
index 8a82de7..497d316 100644
--- a/vcl/source/window/dockmgr.cxx
+++ b/vcl/source/window/dockmgr.cxx
@@ -1043,10 +1043,12 @@ void ImplDockingWindowWrapper::StartPopupMode( ToolBox *pParentToolBox, FloatWin
     if( mpOldBorderWin.get() == GetWindow() )
         mpOldBorderWin = nullptr;  // no border window found
 
+    bool bAllowTearOff = bool( nFlags & FloatWinPopupFlags::AllowTearOff );
+    bool bIsToolBox = GetWindow()->GetType() == WINDOW_TOOLBOX;
+
     // the new parent for popup mode
     VclPtr<FloatingWindow> pWin;
-    bool bAllowTearOff = bool( nFlags & FloatWinPopupFlags::AllowTearOff );
-    if ( bAllowTearOff && !dynamic_cast< ToolBox* >( GetWindow() ) )
+    if ( bAllowTearOff && !bIsToolBox )
         pWin = VclPtr<FloatingWindow>::Create( mpParent, WB_STDPOPUP );
     else
         pWin = VclPtr<ImplPopupFloatWin>::Create( mpParent, this, bAllowTearOff );
@@ -1087,7 +1089,7 @@ void ImplDockingWindowWrapper::StartPopupMode( ToolBox *pParentToolBox, FloatWin
     mpFloatWin->StartPopupMode( pParentToolBox, nFlags );
     GetWindow()->Show();
 
-    if( pParentToolBox->IsKeyEvent() )
+    if( bIsToolBox && pParentToolBox->IsKeyEvent() )
     {
         // send HOME key to subtoolbar in order to select first item
         KeyEvent aEvent( 0, vcl::KeyCode( KEY_HOME ) );


More information about the Libreoffice-commits mailing list