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

spl simon at raspberrypi.org
Thu Jul 9 02:52:05 PDT 2015


 vcl/inc/svdata.hxx                       |    1 +
 vcl/source/window/menu.cxx               |    7 +++++--
 vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx |    7 ++++++-
 3 files changed, 12 insertions(+), 3 deletions(-)

New commits:
commit f1faa887c0c934484fb32a8ec5fbbc9e89f38037
Author: spl <simon at raspberrypi.org>
Date:   Wed Jul 8 15:26:15 2015 +0100

    Gaps at end of menu separator lines read from GTK theme.
    
    Change-Id: I3c42d918680ac989c5cd7cd1022e4a6e7b53aa11
    Reviewed-on: https://gerrit.libreoffice.org/16886
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx
index 0485d85..214066b 100644
--- a/vcl/inc/svdata.hxx
+++ b/vcl/inc/svdata.hxx
@@ -255,6 +255,7 @@ struct ImplSVNWFData
     int                     mnStatusBarLowerRightOffset;    // amount in pixel to avoid in the lower righthand corner
     int                     mnMenuFormatBorderX;            // horizontal inner popup menu border
     int                     mnMenuFormatBorderY;            // vertical inner popup menu border
+    int                     mnMenuSeparatorBorderX;         // gap at each side of separator
     ::Color                 maMenuBarHighlightTextColor;    // override higlight text color
                                                             // in menubar if not transparent
     bool                    mbMenuBarDockingAreaCommonBG:1; // e.g. WinXP default theme
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 4e2345a..afe44c6 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -1896,9 +1896,12 @@ void Menu::ImplPaint(vcl::RenderContext& rRenderContext,
                             nState |= ControlState::ENABLED;
                         if (bHighlighted)
                             nState |= ControlState::SELECTED;
+                        int nSepPad = ImplGetSVData()->maNWFData.mnMenuSeparatorBorderX;
+                        Point aMpos (aPos);
+                        aMpos.X() += nSepPad;
                         Size aSz(pData->aSz);
-                        aSz.Width() = aOutSz.Width() - 2 * nOuterSpaceX;
-                        Rectangle aItemRect(aPos, aSz);
+                        aSz.Width() = aOutSz.Width() - 2*nOuterSpaceX - 2 * nSepPad;
+                        Rectangle aItemRect(aMpos, aSz);
                         MenupopupValue aVal(nTextPos - GUTTERBORDER, aItemRect);
                         bNativeOk = rRenderContext.DrawNativeControl(CTRL_MENU_POPUP, PART_MENU_SEPARATOR,
                                                                      aItemRect, nState, aVal, OUString());
diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
index 203ca4c..713cbe5 100644
--- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
@@ -525,16 +525,21 @@ void GtkData::initNWF()
     NWEnsureGTKMenu( SalX11Screen( 0 ) );
     gint horizontal_padding = 1;
     gint vertical_padding = 1;
+    gint separator_padding = 1;
     gtk_widget_style_get( gWidgetData[0].gMenuWidget,
             "horizontal-padding", &horizontal_padding,
             nullptr);
     gtk_widget_style_get( gWidgetData[0].gMenuWidget,
             "vertical-padding", &vertical_padding,
             nullptr);
+    gtk_widget_style_get( gWidgetData[0].gMenuItemSeparatorMenuWidget,
+            "horizontal-padding", &separator_padding,
+            nullptr);
     gint xthickness = gWidgetData[0].gMenuWidget->style->xthickness;
     gint ythickness = gWidgetData[0].gMenuWidget->style->ythickness;
     pSVData->maNWFData.mnMenuFormatBorderX = xthickness + horizontal_padding;
     pSVData->maNWFData.mnMenuFormatBorderY = ythickness + vertical_padding;
+    pSVData->maNWFData.mnMenuSeparatorBorderX = separator_padding;
 
     pSVData->maNWFData.mbCheckBoxNeedsErase = true;
 
@@ -4527,7 +4532,7 @@ static void NWEnsureGTKMenu( SalX11Screen nScreen )
         gWidgetData[nScreen].gMenuItemMenuWidget          = gtk_menu_item_new_with_label( "b" );
         gWidgetData[nScreen].gMenuItemCheckMenuWidget     = gtk_check_menu_item_new_with_label( "b" );
         gWidgetData[nScreen].gMenuItemRadioMenuWidget     = gtk_radio_menu_item_new_with_label( NULL, "b" );
-        gWidgetData[nScreen].gMenuItemSeparatorMenuWidget = gtk_menu_item_new();
+        gWidgetData[nScreen].gMenuItemSeparatorMenuWidget = gtk_separator_menu_item_new();
         gWidgetData[nScreen].gImageMenuItem               = gtk_image_menu_item_new();
 
         g_object_ref_sink (gWidgetData[nScreen].gMenuWidget);


More information about the Libreoffice-commits mailing list