[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - vcl/unx

Jan-Marek Glogowski glogow at fbihome.de
Wed Aug 5 01:08:44 PDT 2015


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

New commits:
commit 4701f6b95d48cc8f253a26d0ed0d9b32d51e6bee
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>
    (cherry picked from commit ef126328c3ad35d51395abc461c3d64429f91c26)
    Reviewed-on: https://gerrit.libreoffice.org/17448
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx
index e4412e2..7e1a881 100644
--- a/vcl/unx/kde4/KDESalGraphics.cxx
+++ b/vcl/unx/kde4/KDESalGraphics.cxx
@@ -109,10 +109,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);
@@ -653,12 +650,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 );
@@ -756,6 +747,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;
                 }
@@ -779,7 +778,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