summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-11-14 12:20:57 +0000
committerCaolán McNamara <caolanm@redhat.com>2012-11-14 13:18:10 +0000
commit18f08d180db8e821f5c39359e08c177bcfecb58b (patch)
treef5856068bcb5c66192c97ae657172cc1491ace02
parenta857cd94f558e9215f48601197939356ed774faf (diff)
Resolves: fdo#57090 visual glitches on MacOSX with borders + layout
We need to force a resync of the borders of a borderwindow onto its client window when the borders change when layout is active, otherwise we are doing out calculations using the old borders and it all turns into a pile of junk Change-Id: I7dbff0b30aad41779f0f295498af6a492ddf5430
-rw-r--r--vcl/inc/vcl/window.hxx18
-rw-r--r--vcl/source/window/brdwin.cxx31
-rw-r--r--vcl/source/window/window2.cxx12
3 files changed, 47 insertions, 14 deletions
diff --git a/vcl/inc/vcl/window.hxx b/vcl/inc/vcl/window.hxx
index 98bcdc4d5796..9a96e7d09ad0 100644
--- a/vcl/inc/vcl/window.hxx
+++ b/vcl/inc/vcl/window.hxx
@@ -577,15 +577,6 @@ protected:
void CallEventListeners( sal_uLong nEvent, void* pData = NULL );
void FireVclEvent( VclSimpleEvent* pEvent );
- /*
- * Widgets call this to inform their owner container that the widget wants
- * to renegotiate its size. Should be called when a widget has a new size
- * request. e.g. a FixedText Control gets a new label.
- *
- * akin to gtk_widget_queue_resize
- */
- SAL_DLLPRIVATE void queue_resize();
-
sal_Int32 get_height_request() const;
sal_Int32 get_width_request() const;
@@ -1077,6 +1068,15 @@ public:
virtual Size GetOptimalSize(WindowSizeType eType) const;
/*
+ * Widgets call this to inform their owner container that the widget wants
+ * to renegotiate its size. Should be called when a widget has a new size
+ * request. e.g. a FixedText Control gets a new label.
+ *
+ * akin to gtk_widget_queue_resize
+ */
+ void queue_resize();
+
+ /*
* Sets the "width-request" property
*
* Override for width request of the widget, or -1 if natural request
diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx
index 8f7ea254990e..5de8938320ea 100644
--- a/vcl/source/window/brdwin.cxx
+++ b/vcl/source/window/brdwin.cxx
@@ -1077,6 +1077,18 @@ void ImplSmallBorderWindowView::Init( OutputDevice* pDev, long nWidth, long nHei
mnHeight = nHeight;
mbNWFBorder = false;
+ Window *pWin = NULL, *pCtrl = NULL;
+ if (mpOutDev->GetOutDevType() == OUTDEV_WINDOW)
+ pWin = (Window*) mpOutDev;
+
+ if (pWin)
+ pCtrl = mpBorderWindow->GetWindow(WINDOW_CLIENT);
+
+ long nOrigLeftBorder = mnLeftBorder;
+ long nOrigTopBorder = mnTopBorder;
+ long nOrigRightBorder = mnRightBorder;
+ long nOrigBottomBorder = mnBottomBorder;
+
sal_uInt16 nBorderStyle = mpBorderWindow->GetBorderStyle();
if ( nBorderStyle & WINDOW_BORDER_NOBORDER )
{
@@ -1093,12 +1105,8 @@ void ImplSmallBorderWindowView::Init( OutputDevice* pDev, long nWidth, long nHei
{
// for native widget drawing we must find out what
// control this border belongs to
- Window *pWin = NULL, *pCtrl = NULL;
- if( mpOutDev->GetOutDevType() == OUTDEV_WINDOW )
- pWin = (Window*) mpOutDev;
-
ControlType aCtrlType = 0;
- if( pWin && (pCtrl = mpBorderWindow->GetWindow( WINDOW_CLIENT )) != NULL )
+ if (pCtrl)
{
switch( pCtrl->GetType() )
{
@@ -1207,6 +1215,19 @@ void ImplSmallBorderWindowView::Init( OutputDevice* pDev, long nWidth, long nHei
mnBottomBorder = aRect.Bottom()-aCalcRect.Bottom();
}
}
+
+ if (pCtrl)
+ {
+ //fdo#57090 If the borders have changed, then trigger a queue_resize on
+ //the bordered window, which will resync its borders at that point
+ if (nOrigLeftBorder != mnLeftBorder ||
+ nOrigTopBorder != mnTopBorder ||
+ nOrigRightBorder != mnRightBorder ||
+ nOrigBottomBorder != mnBottomBorder)
+ {
+ pCtrl->queue_resize();
+ }
+ }
}
// -----------------------------------------------------------------------
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index f816d2a3630a..be8c8baf5056 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -1746,6 +1746,8 @@ void Window::SetBackgroundBitmap( const BitmapEx& rBitmapEx )
//as dirty for the size remains unchanged, but layout changed circumstances
void Window::queue_resize()
{
+ bool bSomeoneCares = false;
+
Dialog *pDialog = NULL;
Window *pWindow = this;
@@ -1756,6 +1758,7 @@ void Window::queue_resize()
{
VclContainer *pContainer = static_cast<VclContainer*>(pWindow);
pContainer->markLayoutDirty();
+ bSomeoneCares = true;
}
else if (pWindow->GetType() == WINDOW_TABCONTROL)
{
@@ -1770,6 +1773,15 @@ void Window::queue_resize()
pWindow = pWindow->GetParent();
}
+ if (bSomeoneCares)
+ {
+ //fdo#57090 force a resync of the borders of the borderwindow onto this
+ //window in case they have changed
+ Window* pBorderWindow = ImplGetBorderWindow();
+ if (pBorderWindow)
+ pBorderWindow->Resize();
+ }
+
if (!pDialog || pDialog == this)
return;
pDialog->queue_layout();