forked from AuroraMiddleware/gtk
Remove extra padding from comboboxes
We do want to have consistent padding in menus in menubars and context menus, but the menus used in comboboxes don't need the extra padding. Add private GtkMenu API for turning this off. Bug 564063
This commit is contained in:
parent
823151ba8c
commit
8f57c91766
@ -2840,6 +2840,7 @@ gtk_combo_box_menu_setup (GtkComboBox *combo_box,
|
||||
/* create our funky menu */
|
||||
menu = gtk_menu_new ();
|
||||
gtk_widget_set_name (menu, "gtk-combobox-popup-menu");
|
||||
_gtk_menu_set_reserve_toggle_size (GTK_MENU (menu), FALSE);
|
||||
|
||||
g_signal_connect (menu, "key-press-event",
|
||||
G_CALLBACK (gtk_combo_box_menu_key_press), combo_box);
|
||||
@ -2952,6 +2953,7 @@ gtk_combo_box_menu_fill_level (GtkComboBox *combo_box,
|
||||
if (gtk_tree_model_iter_has_child (model, &iter))
|
||||
{
|
||||
submenu = gtk_menu_new ();
|
||||
_gtk_menu_set_reserve_toggle_size (GTK_MENU (submenu), FALSE);
|
||||
gtk_widget_show (submenu);
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), submenu);
|
||||
|
||||
@ -3462,6 +3464,7 @@ gtk_combo_box_menu_row_inserted (GtkTreeModel *model,
|
||||
if (!menu)
|
||||
{
|
||||
menu = gtk_menu_new ();
|
||||
_gtk_menu_set_reserve_toggle_size (GTK_MENU (menu), FALSE);
|
||||
gtk_widget_show (menu);
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (parent), menu);
|
||||
|
||||
|
@ -73,11 +73,9 @@ struct _GtkMenuAttachData
|
||||
|
||||
struct _GtkMenuPrivate
|
||||
{
|
||||
gboolean seen_item_enter;
|
||||
|
||||
gboolean have_position;
|
||||
gint x;
|
||||
gint y;
|
||||
gboolean initially_pushed_in;
|
||||
|
||||
/* info used for the table */
|
||||
guint *heights;
|
||||
@ -86,7 +84,6 @@ struct _GtkMenuPrivate
|
||||
gint monitor_num;
|
||||
|
||||
/* Cached layout information */
|
||||
gboolean have_layout;
|
||||
gint n_rows;
|
||||
gint n_columns;
|
||||
|
||||
@ -96,8 +93,11 @@ struct _GtkMenuPrivate
|
||||
GtkStateType lower_arrow_state;
|
||||
GtkStateType upper_arrow_state;
|
||||
|
||||
gboolean ignore_button_release;
|
||||
gboolean initially_pushed_in;
|
||||
guint have_layout : 1;
|
||||
guint seen_item_enter : 1;
|
||||
guint have_position : 1;
|
||||
guint ignore_button_release : 1;
|
||||
guint no_toggle_size : 1;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
@ -2433,7 +2433,7 @@ gtk_menu_size_request (GtkWidget *widget,
|
||||
|
||||
/* if the menu doesn't include any images or check items
|
||||
* reserve the space so that all menus are consistent */
|
||||
if (max_toggle_size == 0)
|
||||
if (max_toggle_size == 0 && !priv->no_toggle_size)
|
||||
{
|
||||
guint toggle_spacing;
|
||||
guint indicator_size;
|
||||
@ -4139,6 +4139,7 @@ gtk_menu_position (GtkMenu *menu)
|
||||
GtkRequisition requisition;
|
||||
GtkMenuPrivate *private;
|
||||
gint x, y;
|
||||
gboolean initially_pushed_in;
|
||||
gint scroll_offset;
|
||||
gint menu_height;
|
||||
GdkScreen *screen;
|
||||
@ -4184,6 +4185,7 @@ gtk_menu_position (GtkMenu *menu)
|
||||
{
|
||||
(* menu->position_func) (menu, &x, &y, &private->initially_pushed_in,
|
||||
menu->position_func_data);
|
||||
|
||||
if (private->monitor_num < 0)
|
||||
private->monitor_num = gdk_screen_get_monitor_at_point (screen, x, y);
|
||||
|
||||
@ -5277,5 +5279,14 @@ gtk_menu_grab_notify (GtkWidget *widget,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_gtk_menu_set_reserve_toggle_size (GtkMenu *menu,
|
||||
gboolean reserve)
|
||||
{
|
||||
GtkMenuPrivate *priv = gtk_menu_get_private (menu);
|
||||
|
||||
priv->no_toggle_size = !reserve;
|
||||
}
|
||||
|
||||
#define __GTK_MENU_C__
|
||||
#include "gtkaliasdef.c"
|
||||
|
Loading…
Reference in New Issue
Block a user