[ooo-build-commit] .: Branch 'ooo-build-3-2-1' - patches/dev300
Petr Mladek
pmladek at kemper.freedesktop.org
Wed Jun 16 01:47:54 PDT 2010
patches/dev300/kde4-statusbar-redrawing-2.diff | 77 +++++++++++++++++++------
1 file changed, 59 insertions(+), 18 deletions(-)
New commits:
commit 360f9343c84489384de195cc6cf074971ebc97eb
Author: Petr Mladek <pmladek at walk.suse.cz>
Date: Wed Jun 16 10:44:13 2010 +0200
Better fix for the KDE4 crasher by pl and Kendy (bnc#612491, i#112102)
* patches/dev300/kde4-statusbar-redrawing-2.diff: ask a temporary QFrame object
for the real border size; fix by Kendy and pl (bnc#612491, i#112102)
diff --git a/patches/dev300/kde4-statusbar-redrawing-2.diff b/patches/dev300/kde4-statusbar-redrawing-2.diff
index ef475fc..c8c8429 100644
--- a/patches/dev300/kde4-statusbar-redrawing-2.diff
+++ b/patches/dev300/kde4-statusbar-redrawing-2.diff
@@ -1,36 +1,77 @@
---- vcl/unx/kde4/KDESalGraphics.cxx.old 2010-06-14 14:21:03.000000000 +0200
-+++ vcl/unx/kde4/KDESalGraphics.cxx 2010-06-14 17:03:45.000000000 +0200
-@@ -454,15 +454,28 @@ BOOL KDESalGraphics::drawNativeControl(
+--- vcl/unx/kde4/KDESalGraphics.cxx.old 2010-06-14 14:45:21.000000000 +0200
++++ vcl/unx/kde4/KDESalGraphics.cxx 2010-06-16 10:25:12.000000000 +0200
+@@ -171,6 +171,22 @@ namespace
+ QPainter painter(image);
+ kapp->style()->drawComplexControl(element, option, &painter);
+ }
++
++ int getFrameWidth()
++ {
++ static int s_nFrameWidth = -1;
++ if( s_nFrameWidth < 0 )
++ {
++ // fill in a default
++ s_nFrameWidth = 2;
++ QFrame aFrame( NULL );
++ aFrame.setFrameRect( QRect(0, 0, 100, 30) );
++ aFrame.setFrameStyle( QFrame::StyledPanel | QFrame::Sunken );
++ aFrame.ensurePolished();
++ s_nFrameWidth = aFrame.frameWidth();
++ }
++ return s_nFrameWidth;
++ }
+
+ void lcl_drawFrame(QStyle::PrimitiveElement element, QImage* image, QStyle::State state)
+ {
+@@ -454,18 +470,25 @@ BOOL KDESalGraphics::drawNativeControl(
lcl_drawFrame(QStyle::PE_Frame, m_image,
vclStateValue2StateFlag(nControlState, value));
- int size = kapp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin);
+ // draw just the border, see http://qa.openoffice.org/issues/show_bug.cgi?id=107945
-+ // FIXME: how to get the actual frame width? QStyle::PM_DefaultFrameWidth is "1" for Oxygen
-+ // and the frame is 2 pixels in reality
-+ int nFrameWidth = kapp->style()->pixelMetric(QStyle::PM_DefaultFrameWidth) + 1;
++ int nFrameWidth = getFrameWidth();
pTempClipRegion = XCreateRegion();
XRectangle xRect = { widgetRect.left(), widgetRect.top(), widgetRect.width(), widgetRect.height() };
XUnionRectWithRegion( &xRect, pTempClipRegion, pTempClipRegion );
- XLIB_Region pSubtract = XCreateRegion();
+- XLIB_Region pSubtract = XCreateRegion();
- xRect.x += size;
- xRect.y += size;
- xRect.width -= 2* size;
- xRect.height -= 2*size;
+- XUnionRectWithRegion( &xRect, pSubtract, pSubtract );
+- XSubtractRegion( pTempClipRegion, pSubtract, pTempClipRegion );
+- XDestroyRegion( pSubtract );
+ xRect.x += nFrameWidth;
+ xRect.y += nFrameWidth;
+
+ // do not crash for too small widgets, see http://qa.openoffice.org/issues/show_bug.cgi?id=112102
-+ if ( xRect.width > 2*nFrameWidth )
++ if( xRect.width > 2*nFrameWidth && xRect.height > 2*nFrameWidth )
++ {
+ xRect.width -= 2*nFrameWidth;
-+ else
-+ xRect.width = 0;
-+
-+ if (xRect.height > 2*nFrameWidth)
+ xRect.height -= 2*nFrameWidth;
-+ else
-+ xRect.height = 0;
-+
- XUnionRectWithRegion( &xRect, pSubtract, pSubtract );
- XSubtractRegion( pTempClipRegion, pSubtract, pTempClipRegion );
- XDestroyRegion( pSubtract );
++
++ XLIB_Region pSubtract = XCreateRegion();
++ XUnionRectWithRegion( &xRect, pSubtract, pSubtract );
++ XSubtractRegion( pTempClipRegion, pSubtract, pTempClipRegion );
++ XDestroyRegion( pSubtract );
++ }
+ }
+ else if (type == CTRL_FIXEDBORDER)
+ {
+@@ -704,14 +727,14 @@ BOOL KDESalGraphics::getNativeControlReg
+ {
+ if( part == PART_BORDER )
+ {
+- int size = kapp->style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
++ int nFrameWidth = getFrameWidth();
+ USHORT nStyle = val.getNumericVal();
+ if( nStyle & FRAME_DRAW_NODRAW )
+ {
+ // in this case the question is: how thick would a frame be
+ // see brdwin.cxx, decoview.cxx
+ // most probably the behavior in decoview.cxx is wrong.
+- contentRect.adjust(size, size, -size, -size);
++ contentRect.adjust(nFrameWidth, nFrameWidth, -nFrameWidth, -nFrameWidth);
+ }
+ retVal = true;
+ }
More information about the ooo-build-commit
mailing list