summaryrefslogtreecommitdiffstats
path: root/widget
diff options
context:
space:
mode:
authortrav90 <travawine@protonmail.ch>2018-04-06 10:30:12 -0500
committertrav90 <travawine@protonmail.ch>2018-04-06 10:30:12 -0500
commitb1f27cb866e0e317a574df81ff101cb2e9ca5217 (patch)
tree24ec15ead90dbaa06df309784c1cff52e49a95d2 /widget
parentb0af6c9827bc40681c3e9509b55c54d4df089d3d (diff)
downloadUXP-b1f27cb866e0e317a574df81ff101cb2e9ca5217.tar
UXP-b1f27cb866e0e317a574df81ff101cb2e9ca5217.tar.gz
UXP-b1f27cb866e0e317a574df81ff101cb2e9ca5217.tar.lz
UXP-b1f27cb866e0e317a574df81ff101cb2e9ca5217.tar.xz
UXP-b1f27cb866e0e317a574df81ff101cb2e9ca5217.zip
[GTK3] With GTK versions < 3.8 draw menuitem background and frame only when in hover and not a separator
Diffstat (limited to 'widget')
-rw-r--r--widget/gtk/gtk3drawing.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/widget/gtk/gtk3drawing.cpp b/widget/gtk/gtk3drawing.cpp
index baf73c859..4363391c9 100644
--- a/widget/gtk/gtk3drawing.cpp
+++ b/widget/gtk/gtk3drawing.cpp
@@ -1825,12 +1825,18 @@ moz_gtk_menu_item_paint(WidgetNodeType widget, cairo_t *cr, GdkRectangle* rect,
GtkWidgetState* state, GtkTextDirection direction)
{
gint x, y, w, h;
-
+ guint minorVersion = gtk_get_minor_version();
GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state);
+
+ // GTK versions prior to 3.8 render the background and frame only when not
+ // a separator and in hover prelight.
+ if (minorVersion < 8 && (widget == MOZ_GTK_MENUSEPARATOR ||
+ !(state_flags & GTK_STATE_FLAG_PRELIGHT)))
+ return MOZ_GTK_SUCCESS;
+
GtkStyleContext* style = ClaimStyleContext(widget, direction, state_flags);
- bool pre_3_6 = gtk_check_version(3, 6, 0) != nullptr;
- if (pre_3_6) {
+ if (minorVersion < 6) {
// GTK+ 3.4 saves the style context and adds the menubar class to
// menubar children, but does each of these only when drawing, not
// during layout.
@@ -1847,7 +1853,7 @@ moz_gtk_menu_item_paint(WidgetNodeType widget, cairo_t *cr, GdkRectangle* rect,
gtk_render_background(style, cr, x, y, w, h);
gtk_render_frame(style, cr, x, y, w, h);
- if (pre_3_6) {
+ if (minorVersion < 6) {
gtk_style_context_restore(style);
}
ReleaseStyleContext(style);