summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2017-09-17 15:38:06 +0300
committerMaxim Monastirsky <momonasmon@gmail.com>2017-09-24 15:37:27 +0300
commitad769c30d2a709786a769f75fa5e04b33edf0809 (patch)
tree61fbd73f47b8fc5392e600ab33a2456bddc0a07f
parent506f7a5e2b6af0f2bdebab257a0c8ea33e0058fb (diff)
Adjust DockingWindow layout calculation, tdf#106762 prep
This is needed for the color widget to have the correct size at initial show, and to keep this size after selecting a different palette. The parent FloatingWindow will assume that the border width stays outside the space that was allocated to the DockingWindow (see VclContainer::setLayoutPosSize), and yet DockingWindow tries to handle the border width as part of its allocated space. One option could be to let FloatingWindow handle this alone, but this won't work for other possible parents. The current solution is to load and store the border width in a way that can be used internally, but not visible to the outside world via get_border_width(). Change-Id: Id51152cf64eef719368e29253eb93e99834489cd
-rw-r--r--include/vcl/dockwin.hxx2
-rw-r--r--sd/uiconfig/simpress/ui/dockinganimation.ui1
-rw-r--r--starmath/uiconfig/smath/ui/dockingelements.ui1
-rw-r--r--svx/uiconfig/ui/docking3deffects.ui1
-rw-r--r--svx/uiconfig/ui/dockingcolorreplace.ui1
-rw-r--r--svx/uiconfig/ui/dockingfontwork.ui1
-rw-r--r--vcl/source/window/dockwin.cxx58
7 files changed, 22 insertions, 43 deletions
diff --git a/include/vcl/dockwin.hxx b/include/vcl/dockwin.hxx
index 92637db78771..723aef49d4a6 100644
--- a/include/vcl/dockwin.hxx
+++ b/include/vcl/dockwin.hxx
@@ -244,7 +244,7 @@ protected:
private:
SAL_DLLPRIVATE void ImplInitDockingWindowData();
- SAL_DLLPRIVATE void setPosSizeOnContainee(Size aSize, Window &rBox);
+ SAL_DLLPRIVATE void setPosSizeOnContainee();
DECL_DLLPRIVATE_LINK( ImplHandleLayoutTimerHdl, Timer*, void );
DockingWindow (const DockingWindow &) = delete;
diff --git a/sd/uiconfig/simpress/ui/dockinganimation.ui b/sd/uiconfig/simpress/ui/dockinganimation.ui
index 9fc5a1fea4c9..3c44f27cf176 100644
--- a/sd/uiconfig/simpress/ui/dockinganimation.ui
+++ b/sd/uiconfig/simpress/ui/dockinganimation.ui
@@ -55,7 +55,6 @@
<property name="stock">gtk-goto-last</property>
</object>
<object class="GtkWindow" id="DockingAnimation">
- <property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
diff --git a/starmath/uiconfig/smath/ui/dockingelements.ui b/starmath/uiconfig/smath/ui/dockingelements.ui
index 652ae360d439..01ef235c60a6 100644
--- a/starmath/uiconfig/smath/ui/dockingelements.ui
+++ b/starmath/uiconfig/smath/ui/dockingelements.ui
@@ -3,7 +3,6 @@
<interface domain="sm">
<requires lib="gtk+" version="3.0"/>
<object class="GtkWindow" id="DockingElements">
- <property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
diff --git a/svx/uiconfig/ui/docking3deffects.ui b/svx/uiconfig/ui/docking3deffects.ui
index f491b35ed0d7..2e0e47ecc465 100644
--- a/svx/uiconfig/ui/docking3deffects.ui
+++ b/svx/uiconfig/ui/docking3deffects.ui
@@ -256,7 +256,6 @@
<property name="pixbuf">svx/res/normflat.png</property>
</object>
<object class="GtkWindow" id="Docking3DEffects">
- <property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
diff --git a/svx/uiconfig/ui/dockingcolorreplace.ui b/svx/uiconfig/ui/dockingcolorreplace.ui
index 77a44d403feb..1d7454ed3465 100644
--- a/svx/uiconfig/ui/dockingcolorreplace.ui
+++ b/svx/uiconfig/ui/dockingcolorreplace.ui
@@ -10,7 +10,6 @@
<property name="page_increment">10</property>
</object>
<object class="GtkWindow" id="DockingColorReplace">
- <property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
diff --git a/svx/uiconfig/ui/dockingfontwork.ui b/svx/uiconfig/ui/dockingfontwork.ui
index b1abc2dea0fb..b17936df2e43 100644
--- a/svx/uiconfig/ui/dockingfontwork.ui
+++ b/svx/uiconfig/ui/dockingfontwork.ui
@@ -10,7 +10,6 @@
<property name="page_increment">1</property>
</object>
<object class="GtkWindow" id="DockingFontwork">
- <property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
diff --git a/vcl/source/window/dockwin.cxx b/vcl/source/window/dockwin.cxx
index e50bcf08f76b..64a6aa4673c1 100644
--- a/vcl/source/window/dockwin.cxx
+++ b/vcl/source/window/dockwin.cxx
@@ -707,9 +707,12 @@ void DockingWindow::SetFloatingMode( bool bFloatMode )
if ( bFloatMode )
{
- Show( false, ShowFlags::NoFocusChange );
+ // set deferred properties early, so border width will end up
+ // in our mpWindowImpl->mnBorderWidth, not in mpBorderWindow.
+ // (see its usage in setPosSizeOnContainee and GetOptimalSize.)
+ setDeferredProperties();
- sal_Int32 nBorderWidth = get_border_width();
+ Show( false, ShowFlags::NoFocusChange );
maDockPos = Window::GetPosPixel();
@@ -757,19 +760,13 @@ void DockingWindow::SetFloatingMode( bool bFloatMode )
ToggleFloatingMode();
- set_border_width(nBorderWidth);
-
if ( bVisible )
Show();
-
- mpFloatWin->queue_resize();
}
else
{
Show( false, ShowFlags::NoFocusChange );
- sal_Int32 nBorderWidth = get_border_width();
-
// store FloatingData in FloatingWindow
maFloatPos = mpFloatWin->GetPosPixel();
mbDockBtn = mpFloatWin->IsTitleButtonVisible( TitleButton::Docking );
@@ -795,8 +792,6 @@ void DockingWindow::SetFloatingMode( bool bFloatMode )
ToggleFloatingMode();
- set_border_width(nBorderWidth);
-
if ( bVisible )
Show();
}
@@ -844,19 +839,7 @@ void DockingWindow::setPosSizePixel( long nX, long nY,
}
if (::isLayoutEnabled(this))
- {
- Size aSize(GetSizePixel());
-
- sal_Int32 nBorderWidth = get_border_width();
-
- aSize.Width() -= 2 * nBorderWidth;
- aSize.Height() -= 2 * nBorderWidth;
-
- Point aPos(nBorderWidth, nBorderWidth);
- Window *pBox = GetWindow(GetWindowType::FirstChild);
- assert(pBox);
- VclContainer::setLayoutAllocation(*pBox, aPos, aSize);
- }
+ setPosSizeOnContainee();
}
Point DockingWindow::GetPosPixel() const
@@ -998,8 +981,6 @@ void DockingWindow::setOptimalLayoutSize()
maLayoutIdle.Stop();
//resize DockingWindow to fit requisition on initial show
- Window *pBox = GetWindow(GetWindowType::FirstChild);
-
Size aSize = get_preferred_size();
Size aMax(bestmaxFrameSizeForScreenSize(GetDesktopRectPixel().GetSize()));
@@ -1008,19 +989,23 @@ void DockingWindow::setOptimalLayoutSize()
aSize.Height() = std::min(aMax.Height(), aSize.Height());
SetMinOutputSizePixel(aSize);
- SetSizePixel(aSize);
- setPosSizeOnContainee(aSize, *pBox);
+ setPosSizeOnContainee();
}
-void DockingWindow::setPosSizeOnContainee(Size aSize, Window &rBox)
+void DockingWindow::setPosSizeOnContainee()
{
- sal_Int32 nBorderWidth = get_border_width();
+ Size aSize = GetOutputSizePixel();
+
+ // Can't use get_border_width() here, because we don't want
+ // the border to be also visible to the floating window.
+ sal_Int32 nBorderWidth = mpWindowImpl->mnBorderWidth;
aSize.Width() -= 2 * nBorderWidth;
aSize.Height() -= 2 * nBorderWidth;
- Point aPos(nBorderWidth, nBorderWidth);
- VclContainer::setLayoutAllocation(rBox, aPos, aSize);
+ Window* pBox = GetWindow(GetWindowType::FirstChild);
+ assert(pBox);
+ VclContainer::setLayoutAllocation(*pBox, Point(nBorderWidth, nBorderWidth), aSize);
}
Size DockingWindow::GetOptimalSize() const
@@ -1030,12 +1015,14 @@ Size DockingWindow::GetOptimalSize() const
Size aSize = VclContainer::getLayoutRequisition(*GetWindow(GetWindowType::FirstChild));
- sal_Int32 nBorderWidth = get_border_width();
+ // Can't use get_border_width() here, because we don't want
+ // the border to be also visible to the floating window.
+ sal_Int32 nBorderWidth = mpWindowImpl->mnBorderWidth;
aSize.Height() += 2 * nBorderWidth;
aSize.Width() += 2 * nBorderWidth;
- return Window::CalcWindowSize(aSize);
+ return aSize;
}
void DockingWindow::queue_resize(StateChangedType eReason)
@@ -1064,10 +1051,7 @@ IMPL_LINK_NOARG(DockingWindow, ImplHandleLayoutTimerHdl, Timer*, void)
SAL_WARN("vcl.layout", "DockingWindow has become non-layout because extra children have been added directly to it.");
return;
}
-
- Window *pBox = GetWindow(GetWindowType::FirstChild);
- assert(pBox);
- setPosSizeOnContainee(GetSizePixel(), *pBox);
+ setPosSizeOnContainee();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */