https://bugs.documentfoundation.org/show_bug.cgi?id=92244

            Bug ID: 92244
           Summary: Menu separator spacing incorrect in libreoffice-gtk
           Product: LibreOffice
           Version: 4.3.3.2 release
          Hardware: Other
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: UI
          Assignee: libreoffice-bugs@lists.freedesktop.org
          Reporter: si...@raspberrypi.org

If the libreoffice-gtk library is used, the appearance of menu separator lines
does not match that in native GTK applications; specifically with regards the
gap at the start and end of the line. This is largely caused by the menu
separator widget not being treated differently from the menu item widget when
the parameters are read in from the GTK theme.

Patch as follows. This introduces a new parameter in the ImplSVNWFData
structure which stores the menu separator border read from the GTK theme, which
is then used when the separator is drawn.

diff --git vcl/inc/svdata.hxx vcl/inc/svdata.hxx
index 7fa60e3..538f7a7 100644
--- vcl/inc/svdata.hxx
+++ vcl/inc/svdata.hxx
@@ -253,6 +253,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 vcl/source/window/menu.cxx vcl/source/window/menu.cxx
index 9a7e73b..b3b4ed3 100644
--- vcl/source/window/menu.cxx
+++ vcl/source/window/menu.cxx
@@ -2682,9 +2684,12 @@ void Menu::ImplPaint( Window* pWin, sal_uInt16 nBorder,
long nStartY, MenuItemDa
                             nState |= CTRL_STATE_ENABLED;
                         if ( bHighlighted )
                             nState |= CTRL_STATE_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 = pWin->DrawNativeControl( CTRL_MENU_POPUP,
PART_MENU_SEPARATOR,
                                                              aItemRect,
diff --git vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
index b1e7e23..1d9cf11 100644
--- vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
+++ vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
@@ -430,16 +430,21 @@ void GtkData::initNWF( void )
     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,
             (char *)NULL);
     gtk_widget_style_get( gWidgetData[0].gMenuWidget,
             "vertical-padding", &vertical_padding,
             (char *)NULL);
+    gtk_widget_style_get( gWidgetData[0].gMenuItemSeparatorMenuWidget,
+            "horizontal-padding", &separator_padding,
+            (char *)NULL);
     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;

     if( SalGetDesktopEnvironment() == "KDE" )
     {
@@ -4384,7 +4387,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();

         gtk_menu_shell_append( GTK_MENU_SHELL(
gWidgetData[nScreen].gMenuWidget ), gWidgetData[nScreen].gMenuItemMenuWidget );

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to