Hi,

I have just made a patch to fix some glitch with GTK+:
(see this bug: https://bugs.freedesktop.org//show_bug.cgi?id=32186)

- Fix menubar root items (they was disabled, but they work well :) )
- Don't draw anything when a disabled menu is hovered:
        They was drawn using the native GUI engine, which provided bad
        integration. GTK+ just don't react when we move the cursor on
        disabled menu items (at least, on most themes), so, we just draw
        nothing now. (and if we should, drawing nothing for disabled
        menu is better than draw a bad integration for a menu *which is
        not used*). 
- Fix background of GtkEntry/GtkSpinButton:
        gtk_paint_flat_box was used, just replace it by gtk_paint_box.
        gtk_paint_flat_box just draws a… flat rectangle, but the
        background can be rounded. So, on dark theme it could caused
        some glitchs (see screenshot).
- Fix GtkButton/GtkSpinButton background (and maybe some others
widget) :
        In the code, we redrew the background before drawing the
        widgets, because they could be transparent, but it wasn't the
        good style for the background (widgets background instead of
        window background).


Here is a screenshot I made for comparison:
https://bugs.freedesktop.org//attachment.cgi?id=42337


This patch belongs to the libs-gui branch, vcl module.


Lucas
diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
index 41274c7..8015a5d 100644
--- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
@@ -606,10 +606,10 @@ BOOL GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nP
                 (   (nPart == PART_TRACK_HORZ_AREA)
                 ||  (nPart == PART_TRACK_VERT_AREA)
                 )
-        )
+                )                                                   ||
+        ((nType == CTRL_MENUBAR))
         )
         return( TRUE );
-
     return( FALSE );
 }
 
@@ -887,7 +887,7 @@ BOOL GtkSalGraphics::drawNativeControl(	ControlType nType,
     else if( (nType == CTRL_LISTNET) && (nPart == PART_ENTIRE_CONTROL) )
     {
         // don't actually draw anything; gtk treeviews do not draw lines
-        returnVal = true;
+        returnVal = TRUE;
     }
     else if( (nType == CTRL_SLIDER) )
     {
@@ -1228,7 +1228,7 @@ BOOL GtkSalGraphics::NWPaintGTKButton(
         clipRect.height = it->GetHeight();
 
         // Buttons must paint opaque since some themes have alpha-channel enabled buttons
-        gtk_paint_flat_box( gWidgetData[m_nScreen].gBtnWidget->style, gdkDrawable, GTK_STATE_NORMAL, GTK_SHADOW_NONE,
+        gtk_paint_flat_box( m_pWindow->style, gdkDrawable, GTK_STATE_NORMAL, GTK_SHADOW_NONE,
                             &clipRect, m_pWindow, "base", x, y, w, h );
 
         if ( (nState & CTRL_STATE_DEFAULT) && (GTK_BUTTON(gWidgetData[m_nScreen].gBtnWidget)->relief == GTK_RELIEF_NORMAL) )
@@ -1624,7 +1624,7 @@ BOOL GtkSalGraphics::NWPaintGTKScrollbar( ControlType, ControlPart nPart,
     style = GTK_WIDGET( scrollbarWidget )->style;
 
     // ----------------- TROUGH
-    gtk_paint_flat_box( gWidgetData[m_nScreen].gBtnWidget->style, gdkDrawable,
+    gtk_paint_flat_box( m_pWindow->style, gdkDrawable,
                         GTK_STATE_NORMAL, GTK_SHADOW_NONE, gdkRect,
                         m_pWindow, "base", x, y,
                         w, h );
@@ -1928,7 +1928,7 @@ static void NWPaintOneEditBox(	int nScreen,
     }
     NWSetWidgetState( widget, nState, stateType );
 
-    gtk_paint_flat_box( pBGWidget->style, gdkDrawable, stateType, GTK_SHADOW_NONE,
+    gtk_paint_box( pBGWidget->style, gdkDrawable, stateType, GTK_SHADOW_NONE,
                         gdkRect, pBGWidget, "entry_bg",
                         aEditBoxRect.Left(), aEditBoxRect.Top(),
                         aEditBoxRect.GetWidth(), aEditBoxRect.GetHeight() );
@@ -2181,7 +2181,7 @@ BOOL GtkSalGraphics::NWPaintGTKComboBox( GdkDrawable* gdkDrawable,
                                nState, aValue, rCaption );
 
         // Buttons must paint opaque since some themes have alpha-channel enabled buttons
-        gtk_paint_flat_box( gWidgetData[m_nScreen].gBtnWidget->style, gdkDrawable, GTK_STATE_NORMAL, GTK_SHADOW_NONE,
+        gtk_paint_flat_box( m_pWindow->style, gdkDrawable, GTK_STATE_NORMAL, GTK_SHADOW_NONE,
                             &clipRect, m_pWindow, "base",
                             x+(buttonRect.Left() - pixmapRect.Left()),
                             y+(buttonRect.Top() - pixmapRect.Top()),
@@ -2370,8 +2370,8 @@ BOOL GtkSalGraphics::NWPaintGTKTabItem( ControlType nType, ControlPart,
 
             if ( nState & CTRL_STATE_SELECTED )
             {
-                gtk_paint_flat_box( gWidgetData[m_nScreen].gNotebookWidget->style, pixmap, stateType, GTK_SHADOW_NONE, NULL, m_pWindow,
-                    (char *)"base", 0, (pixmapRect.GetHeight() - 1), pixmapRect.GetWidth(), 1 );
+                gtk_paint_flat_box( m_pWindow->style, pixmap, stateType, GTK_SHADOW_NONE, NULL, m_pWindow,
+                    "base", 0, (pixmapRect.GetHeight() - 1), pixmapRect.GetWidth(), 1 );
             }
             break;
 
@@ -2460,7 +2460,7 @@ BOOL GtkSalGraphics::NWPaintGTKListBox( GdkDrawable* gdkDrawable,
         if ( nPart != PART_WINDOW )
         {
             // Listboxes must paint opaque since some themes have alpha-channel enabled bodies
-            gtk_paint_flat_box( gWidgetData[m_nScreen].gBtnWidget->style, gdkDrawable, GTK_STATE_NORMAL, GTK_SHADOW_NONE,
+            gtk_paint_flat_box( m_pWindow->style, gdkDrawable, GTK_STATE_NORMAL, GTK_SHADOW_NONE,
                                 &clipRect, m_pWindow, "base", x, y,
                                 pixmapRect.GetWidth(), pixmapRect.GetHeight() );
             gtk_paint_box( gWidgetData[m_nScreen].gOptionMenuWidget->style, gdkDrawable, stateType, shadowType, &clipRect,
@@ -2703,6 +2703,7 @@ BOOL GtkSalGraphics::NWPaintGTKMenubar(
                            "menubar",
                            x, y, w, h );
         }
+        
         else if( nPart == PART_MENU_ITEM )
         {
             if( nState & (CTRL_STATE_SELECTED|CTRL_STATE_ROLLOVER) )
@@ -2733,7 +2734,7 @@ BOOL GtkSalGraphics::NWPaintGTKPopupMenu(
     // #i50745# gtk does not draw disabled menu entries (and crux theme
     // even crashes), draw them using vcl functionality.
     if( nPart == PART_MENU_ITEM && ! (nState & CTRL_STATE_ENABLED) )
-        return FALSE;
+        return TRUE;
 
     GtkStateType	stateType;
     GtkShadowType	shadowType;
_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to