Removed GtkMenuItem->show_submenu_indicator flag
The show_submenu_indicator flag was explicitly set in various places from GtkMenu/GtkMenuBar at request times, since the GtkMenuItem already checks the parent type for GTK_IS_MENU_BAR() in various places, removed this flag in favor of just checking the parent type (only in the interest of better readable code).
This commit is contained in:
@ -3033,7 +3033,6 @@ gtk_menu_get_preferred_width (GtkWidget *widget,
|
|||||||
* case the toggle size request depends on the size
|
* case the toggle size request depends on the size
|
||||||
* request of a child of the child (e.g. for ImageMenuItem)
|
* request of a child of the child (e.g. for ImageMenuItem)
|
||||||
*/
|
*/
|
||||||
GTK_MENU_ITEM (child)->priv->show_submenu_indicator = TRUE;
|
|
||||||
gtk_widget_get_preferred_width (child, &child_min, &child_nat);
|
gtk_widget_get_preferred_width (child, &child_min, &child_nat);
|
||||||
|
|
||||||
gtk_menu_item_toggle_size_request (GTK_MENU_ITEM (child), &toggle_size);
|
gtk_menu_item_toggle_size_request (GTK_MENU_ITEM (child), &toggle_size);
|
||||||
|
|||||||
@ -313,7 +313,6 @@ gtk_menu_bar_size_request (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
gint toggle_size;
|
gint toggle_size;
|
||||||
|
|
||||||
GTK_MENU_ITEM (child)->priv->show_submenu_indicator = FALSE;
|
|
||||||
gtk_widget_get_preferred_size (child, &child_requisition, NULL);
|
gtk_widget_get_preferred_size (child, &child_requisition, NULL);
|
||||||
gtk_menu_item_toggle_size_request (GTK_MENU_ITEM (child),
|
gtk_menu_item_toggle_size_request (GTK_MENU_ITEM (child),
|
||||||
&toggle_size);
|
&toggle_size);
|
||||||
|
|||||||
@ -422,10 +422,12 @@ gtk_menu_item_init (GtkMenuItem *menu_item)
|
|||||||
|
|
||||||
gtk_widget_set_has_window (GTK_WIDGET (menu_item), FALSE);
|
gtk_widget_set_has_window (GTK_WIDGET (menu_item), FALSE);
|
||||||
|
|
||||||
priv->submenu = NULL;
|
priv->action = NULL;
|
||||||
priv->toggle_size = 0;
|
priv->use_action_appearance = TRUE;
|
||||||
priv->accelerator_width = 0;
|
|
||||||
priv->show_submenu_indicator = FALSE;
|
menu_item->submenu = NULL;
|
||||||
|
menu_item->toggle_size = 0;
|
||||||
|
menu_item->accelerator_width = 0;
|
||||||
if (gtk_widget_get_direction (GTK_WIDGET (menu_item)) == GTK_TEXT_DIR_RTL)
|
if (gtk_widget_get_direction (GTK_WIDGET (menu_item)) == GTK_TEXT_DIR_RTL)
|
||||||
priv->submenu_direction = GTK_DIRECTION_LEFT;
|
priv->submenu_direction = GTK_DIRECTION_LEFT;
|
||||||
else
|
else
|
||||||
@ -711,7 +713,7 @@ gtk_menu_item_get_preferred_width (GtkWidget *widget,
|
|||||||
|
|
||||||
gtk_widget_get_preferred_width (child, &child_min, &child_nat);
|
gtk_widget_get_preferred_width (child, &child_min, &child_nat);
|
||||||
|
|
||||||
if (priv->submenu && priv->show_submenu_indicator)
|
if (menu_item->submenu && !GTK_IS_MENU_BAR (parent))
|
||||||
{
|
{
|
||||||
guint arrow_spacing;
|
guint arrow_spacing;
|
||||||
gint arrow_size;
|
gint arrow_size;
|
||||||
@ -722,6 +724,12 @@ gtk_menu_item_get_preferred_width (GtkWidget *widget,
|
|||||||
|
|
||||||
get_arrow_size (widget, child, &arrow_size);
|
get_arrow_size (widget, child, &arrow_size);
|
||||||
|
|
||||||
|
gtk_widget_style_get (widget,
|
||||||
|
"arrow-spacing", &arrow_spacing,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
get_arrow_size (widget, child, &arrow_size);
|
||||||
|
|
||||||
min_width += arrow_size;
|
min_width += arrow_size;
|
||||||
min_width += arrow_spacing;
|
min_width += arrow_spacing;
|
||||||
|
|
||||||
@ -806,7 +814,7 @@ gtk_menu_item_get_preferred_height (GtkWidget *widget,
|
|||||||
min_height += child_min;
|
min_height += child_min;
|
||||||
nat_height += child_nat;
|
nat_height += child_nat;
|
||||||
|
|
||||||
if (priv->submenu && priv->show_submenu_indicator)
|
if (menu_item->submenu && !GTK_IS_MENU_BAR (parent))
|
||||||
{
|
{
|
||||||
gint arrow_size;
|
gint arrow_size;
|
||||||
|
|
||||||
@ -911,7 +919,7 @@ gtk_menu_item_get_preferred_height_for_width (GtkWidget *widget,
|
|||||||
gint child_min, child_nat;
|
gint child_min, child_nat;
|
||||||
gint arrow_size = 0;
|
gint arrow_size = 0;
|
||||||
|
|
||||||
if (priv->submenu && priv->show_submenu_indicator)
|
if (menu_item->submenu && !GTK_IS_MENU_BAR (parent))
|
||||||
{
|
{
|
||||||
guint arrow_spacing;
|
guint arrow_spacing;
|
||||||
|
|
||||||
@ -933,7 +941,7 @@ gtk_menu_item_get_preferred_height_for_width (GtkWidget *widget,
|
|||||||
min_height += child_min;
|
min_height += child_min;
|
||||||
nat_height += child_nat;
|
nat_height += child_nat;
|
||||||
|
|
||||||
if (priv->submenu && priv->show_submenu_indicator)
|
if (menu_item->submenu && !GTK_IS_MENU_BAR (parent))
|
||||||
{
|
{
|
||||||
min_height = MAX (min_height, arrow_size);
|
min_height = MAX (min_height, arrow_size);
|
||||||
nat_height = MAX (nat_height, arrow_size);
|
nat_height = MAX (nat_height, arrow_size);
|
||||||
@ -1385,7 +1393,7 @@ gtk_menu_item_size_allocate (GtkWidget *widget,
|
|||||||
child_allocation.y += allocation->y;
|
child_allocation.y += allocation->y;
|
||||||
|
|
||||||
gtk_widget_get_preferred_size (child, &child_requisition, NULL);
|
gtk_widget_get_preferred_size (child, &child_requisition, NULL);
|
||||||
if (priv->submenu && priv->show_submenu_indicator)
|
if (menu_item->submenu && !GTK_IS_MENU_BAR (parent))
|
||||||
{
|
{
|
||||||
if (direction == GTK_TEXT_DIR_RTL)
|
if (direction == GTK_TEXT_DIR_RTL)
|
||||||
child_allocation.x += child_requisition.height;
|
child_allocation.x += child_requisition.height;
|
||||||
@ -1509,7 +1517,7 @@ gtk_menu_item_draw (GtkWidget *widget,
|
|||||||
GtkStateType state_type;
|
GtkStateType state_type;
|
||||||
GtkShadowType shadow_type, selected_shadow_type;
|
GtkShadowType shadow_type, selected_shadow_type;
|
||||||
GtkStyle *style;
|
GtkStyle *style;
|
||||||
GtkWidget *child;
|
GtkWidget *child, *parent;
|
||||||
GdkWindow *window;
|
GdkWindow *window;
|
||||||
gint x, y, w, h, width, height;
|
gint x, y, w, h, width, height;
|
||||||
guint border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
guint border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||||
@ -1526,6 +1534,7 @@ gtk_menu_item_draw (GtkWidget *widget,
|
|||||||
h = height - border_width * 2;
|
h = height - border_width * 2;
|
||||||
|
|
||||||
child = gtk_bin_get_child (GTK_BIN (menu_item));
|
child = gtk_bin_get_child (GTK_BIN (menu_item));
|
||||||
|
parent = gtk_widget_get_parent (widget);
|
||||||
|
|
||||||
if (child && state_type == GTK_STATE_PRELIGHT)
|
if (child && state_type == GTK_STATE_PRELIGHT)
|
||||||
{
|
{
|
||||||
@ -1540,7 +1549,7 @@ gtk_menu_item_draw (GtkWidget *widget,
|
|||||||
x, y, w, h);
|
x, y, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->submenu && priv->show_submenu_indicator)
|
if (menu_item->submenu && !GTK_IS_MENU_BAR (parent))
|
||||||
{
|
{
|
||||||
gint arrow_x, arrow_y;
|
gint arrow_x, arrow_y;
|
||||||
gint arrow_size;
|
gint arrow_size;
|
||||||
|
|||||||
Reference in New Issue
Block a user