GtkMenuItem: only set 'separator' class on the separator line
To make the separator line distinguishable from the widget's normal border from css. https://bugzilla.gnome.org/show_bug.cgi?id=719861
This commit is contained in:
parent
9bfe7525ce
commit
d736e8baf9
@ -987,6 +987,9 @@ gtk_menu_item_real_get_height (GtkWidget *widget,
|
|||||||
gboolean wide_separators;
|
gboolean wide_separators;
|
||||||
gint separator_height;
|
gint separator_height;
|
||||||
|
|
||||||
|
gtk_style_context_save (context);
|
||||||
|
gtk_style_context_add_class (context, GTK_STYLE_CLASS_SEPARATOR);
|
||||||
|
|
||||||
gtk_widget_style_get (widget,
|
gtk_widget_style_get (widget,
|
||||||
"wide-separators", &wide_separators,
|
"wide-separators", &wide_separators,
|
||||||
"separator-height", &separator_height,
|
"separator-height", &separator_height,
|
||||||
@ -1007,6 +1010,8 @@ gtk_menu_item_real_get_height (GtkWidget *widget,
|
|||||||
if (nat_height % 2 == 0)
|
if (nat_height % 2 == 0)
|
||||||
nat_height += 1;
|
nat_height += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gtk_style_context_restore (context);
|
||||||
}
|
}
|
||||||
|
|
||||||
accel_width = 0;
|
accel_width = 0;
|
||||||
@ -1696,6 +1701,9 @@ gtk_menu_item_draw (GtkWidget *widget,
|
|||||||
gboolean wide_separators;
|
gboolean wide_separators;
|
||||||
gint separator_height;
|
gint separator_height;
|
||||||
|
|
||||||
|
gtk_style_context_save (context);
|
||||||
|
gtk_style_context_add_class (context, GTK_STYLE_CLASS_SEPARATOR);
|
||||||
|
|
||||||
gtk_widget_style_get (widget,
|
gtk_widget_style_get (widget,
|
||||||
"wide-separators", &wide_separators,
|
"wide-separators", &wide_separators,
|
||||||
"separator-height", &separator_height,
|
"separator-height", &separator_height,
|
||||||
@ -1712,6 +1720,8 @@ gtk_menu_item_draw (GtkWidget *widget,
|
|||||||
y + padding.top,
|
y + padding.top,
|
||||||
x + w - padding.right - 1,
|
x + w - padding.right - 1,
|
||||||
y + padding.top);
|
y + padding.top);
|
||||||
|
|
||||||
|
gtk_style_context_restore (context);
|
||||||
}
|
}
|
||||||
|
|
||||||
GTK_WIDGET_CLASS (gtk_menu_item_parent_class)->draw (widget, cr);
|
GTK_WIDGET_CLASS (gtk_menu_item_parent_class)->draw (widget, cr);
|
||||||
|
@ -51,10 +51,6 @@ gtk_separator_menu_item_class_init (GtkSeparatorMenuItemClass *class)
|
|||||||
static void
|
static void
|
||||||
gtk_separator_menu_item_init (GtkSeparatorMenuItem *item)
|
gtk_separator_menu_item_init (GtkSeparatorMenuItem *item)
|
||||||
{
|
{
|
||||||
GtkStyleContext *context;
|
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (GTK_WIDGET (item));
|
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_SEPARATOR);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user