[Libreoffice-commits] core.git: vcl/unx

Jan-Marek Glogowski glogow at fbihome.de
Fri Jul 31 05:42:22 PDT 2015


 vcl/unx/kde4/KDESalGraphics.cxx |   20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

New commits:
commit ef126328c3ad35d51395abc461c3d64429f91c26
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Thu Jul 30 18:10:03 2015 +0200

    tdf#92903 KDE4: fix listbox regression from 92115
    
    So at least in case of the CTRL_LISTBOX, getNativeControlRegion is
    called for a type and part unsupported by IsNativeControlSupported.
    
    For whatever reason, this results in broken listboxes drawn in
    Base's "Table Design" dialog, when selecting "field type", which
    draws the listbox on top of the cell.
    
    To make it worse, it seems the listbox is actually drawn to a
    smaller space then the actual requirement. Appearently it seems to
    use the content rect, instead of the bounding rect.
    
    So in addition to fixing the drawing, this patch increases the
    listbox bounding rect, which looks too large in normal dialogs, but
    makes the Base's listbox better readable.
    
    Change-Id: I112ec038fd20ad33facd260d16b5d68b508d2bd0
    Reviewed-on: https://gerrit.libreoffice.org/17438
    Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>
    Tested-by: Katarina Behrens <Katarina.Behrens at cib.de>

diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx
index 3e79e1e..eeb741f 100644
--- a/vcl/unx/kde4/KDESalGraphics.cxx
+++ b/vcl/unx/kde4/KDESalGraphics.cxx
@@ -108,10 +108,7 @@ bool KDESalGraphics::IsNativeControlSupported( ControlType type, ControlPart par
             return true;
 
         case CTRL_LISTBOX:
-            return (part == PART_ENTIRE_CONTROL
-                 || part == PART_SUB_EDIT
-                 || part == PART_WINDOW
-                 || part == PART_BUTTON_DOWN);
+            return (part == PART_ENTIRE_CONTROL || part == HAS_BACKGROUND_TEXTURE);
 
         case CTRL_SPINBOX:
             return (part == PART_ENTIRE_CONTROL || part == HAS_BACKGROUND_TEXTURE);
@@ -650,12 +647,6 @@ bool KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part,
                                              const OUString&,
                                              Rectangle &nativeBoundingRegion, Rectangle &nativeContentRegion )
 {
-    bool nativeSupport = IsNativeControlSupported( type, part );
-    if( ! nativeSupport ) {
-        assert( ! nativeSupport && "drawNativeControl called without native support!" );
-        return false;
-    }
-
     bool retVal = false;
 
     QRect boundingRect = region2QRect( controlRegion );
@@ -753,6 +744,14 @@ bool KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part,
                         int size = QApplication::style()->pixelMetric(QStyle::PM_ComboBoxFrameWidth) - 2;
                         contentRect.adjust(-size,-size,size,size);
                     }
+                    else {
+                        int hmargin = QApplication::style()->pixelMetric(
+                                QStyle::PM_FocusFrameHMargin, &styleOption);
+                        int vmargin = QApplication::style()->pixelMetric(
+                                QStyle::PM_FocusFrameVMargin, &styleOption);
+                        boundingRect.translate( -hmargin, -vmargin );
+                        boundingRect.adjust( -hmargin, -vmargin, 2 * hmargin, 2 * vmargin );
+                    }
                     retVal = true;
                     break;
                 }
@@ -776,7 +775,6 @@ bool KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part,
 
                     contentRect.translate( boundingRect.left() + hmargin, boundingRect.top() + vmargin );
                     contentRect.adjust( 0, 0, -2 * hmargin, -2 * vmargin );
-                    boundingRect = contentRect;
 
                     retVal = true;
                     break;


More information about the Libreoffice-commits mailing list