[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - vcl/unx

Jan-Marek Glogowski glogow at fbihome.de
Wed Mar 5 06:27:46 PST 2014


 vcl/unx/kde4/KDEData.cxx        |   17 +++++++++++++++++
 vcl/unx/kde4/KDESalGraphics.cxx |   12 ++++--------
 2 files changed, 21 insertions(+), 8 deletions(-)

New commits:
commit 6b6398b72401b35dc0d01de70ee2124a0a4072a8
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Thu Feb 27 08:54:57 2014 +0000

    fdo#45935: try hard to paint a frame for menus
    
    Current Oxygen theme doesn't draw frames for menus, but uses shaped
    and "colored" background images. This workaround paints the window
    and menu frame for menus. Any frame seems to be better then no frame
    at all.
    
    Change-Id: I4d553ea58cac2729826f8395cb2597fa200187b6
    (cherry picked from commit e72849cd435cc50a744dcbcfb422f5600dd0cce9)
    Reviewed-on: https://gerrit.libreoffice.org/8436
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/unx/kde4/KDEData.cxx b/vcl/unx/kde4/KDEData.cxx
index 196f186..ccbbd99 100644
--- a/vcl/unx/kde4/KDEData.cxx
+++ b/vcl/unx/kde4/KDEData.cxx
@@ -17,10 +17,18 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#define Region QtXRegion
+
+#include <QStyle>
+#include <kapplication.h>
+
+#undef Region
+
 #include "KDEData.hxx"
 
 #include "KDEXLib.hxx"
 
+
 KDEData::~KDEData()
 {
 }
@@ -39,6 +47,15 @@ void KDEData::initNWF()
     pSVData->maNWFData.mbDockingAreaSeparateTB = true;
     // no borders for menu, theming does that
     pSVData->maNWFData.mbFlatMenu = true;
+
+    // Styled menus need additional space
+    QStyle *style = kapp->style();
+    pSVData->maNWFData.mnMenuFormatBorderX =
+       style->pixelMetric( QStyle::PM_MenuPanelWidth ) +
+       style->pixelMetric( QStyle::PM_MenuHMargin );
+    pSVData->maNWFData.mnMenuFormatBorderY =
+       style->pixelMetric( QStyle::PM_MenuPanelWidth ) +
+       style->pixelMetric( QStyle::PM_MenuVMargin );
 }
 
 void KDEData::deInitNWF()
diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx
index cf72dcd..967864f 100644
--- a/vcl/unx/kde4/KDESalGraphics.cxx
+++ b/vcl/unx/kde4/KDESalGraphics.cxx
@@ -78,7 +78,7 @@ QRect region2QRect( const Rectangle& rControlRegion )
 }
 
 KDESalGraphics::KDESalGraphics() :
-    m_image(0)
+    m_image(NULL)
 {
 }
 
@@ -130,13 +130,7 @@ sal_Bool KDESalGraphics::IsNativeControlSupported( ControlType type, ControlPart
     if (type == CTRL_SLIDER && (part == PART_TRACK_HORZ_AREA || part == PART_TRACK_VERT_AREA) )
         return true;
 
-    if ( (type == CTRL_PROGRESS)    && (part == PART_ENTIRE_CONTROL) ) return true;
-
-    return false;
-
-    if ( (type == CTRL_TAB_ITEM) && (part == PART_ENTIRE_CONTROL) ) return true;
-    if ( (type == CTRL_TAB_PANE) && (part == PART_ENTIRE_CONTROL) ) return true;
-    // no CTRL_TAB_BODY for KDE
+    if ( (type == CTRL_PROGRESS) && (part == PART_ENTIRE_CONTROL) ) return true;
 
     return false;
 }
@@ -378,8 +372,10 @@ sal_Bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part,
         {
             QStyleOptionMenuItem option;
             draw( QStyle::PE_PanelMenu, &option, m_image, vclStateValue2StateFlag( nControlState, value ));
+            // Try hard to get any frame!
             QStyleOptionFrame frame;
             draw( QStyle::PE_FrameMenu, &frame, m_image, vclStateValue2StateFlag( nControlState, value ));
+            draw( QStyle::PE_FrameWindow, &frame, m_image, vclStateValue2StateFlag( nControlState, value ));
             lastPopupRect = widgetRect;
         }
         else


More information about the Libreoffice-commits mailing list