Remove gtk_menu_set_display

Menus should always be attached to a toplevel,
in which case they get their display that way.
This commit is contained in:
Matthias Clasen 2019-05-01 21:49:25 +00:00
parent c9eca55c5e
commit 62b7ea7611
3 changed files with 2 additions and 37 deletions

View File

@ -1779,7 +1779,6 @@ GtkMenu
GtkArrowPlacement
gtk_menu_new
gtk_menu_new_from_model
gtk_menu_set_display
gtk_menu_reorder_child
gtk_menu_popup_at_rect
gtk_menu_popup_at_widget

View File

@ -1050,8 +1050,7 @@ attach_widget_display_changed (GtkWidget *attach_widget,
GdkDisplay *previous_display,
GtkMenu *menu)
{
if (!g_object_get_data (G_OBJECT (menu), "gtk-menu-explicit-display"))
menu_change_display (menu, gtk_widget_get_display (attach_widget));
menu_change_display (menu, gtk_widget_get_display (attach_widget));
}
static void
@ -1437,7 +1436,7 @@ gtk_menu_popup_internal (GtkMenu *menu,
parent_toplevel = NULL;
if (parent_menu_shell)
parent_toplevel = gtk_widget_get_toplevel (parent_menu_shell);
else if (!g_object_get_data (G_OBJECT (menu), "gtk-menu-explicit-display"))
else
{
GtkWidget *attach_widget = gtk_menu_get_attach_widget (menu);
if (attach_widget)
@ -3604,35 +3603,6 @@ gtk_menu_select_item (GtkMenuShell *menu_shell,
GTK_MENU_SHELL_CLASS (gtk_menu_parent_class)->select_item (menu_shell, menu_item);
}
/**
* gtk_menu_set_display:
* @menu: a #GtkMenu
* @display: (allow-none): a #GdkDisplay, or %NULL if the display should be
* determined by the widget the menu is attached to
*
* Sets the #GdkDisplay on which the menu will be displayed.
*/
void
gtk_menu_set_display (GtkMenu *menu,
GdkDisplay *display)
{
g_return_if_fail (GTK_IS_MENU (menu));
g_return_if_fail (display == NULL || GDK_IS_DISPLAY (display));
g_object_set_data (G_OBJECT (menu), I_("gtk-menu-explicit-display"), display);
if (display)
{
menu_change_display (menu, display);
}
else
{
GtkWidget *attach_widget = gtk_menu_get_attach_widget (menu);
if (attach_widget)
attach_widget_display_changed (attach_widget, NULL, menu);
}
}
static gint
gtk_menu_get_popup_delay (GtkMenuShell *menu_shell)
{

View File

@ -172,10 +172,6 @@ void gtk_menu_reorder_child (GtkMenu *menu,
GtkWidget *child,
gint position);
GDK_AVAILABLE_IN_ALL
void gtk_menu_set_display (GtkMenu *menu,
GdkDisplay *display);
GDK_AVAILABLE_IN_ALL
void gtk_menu_set_monitor (GtkMenu *menu,
gint monitor_num);