From 62b7ea7611a9719212a1fca45fa378b48ff70be5 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 1 May 2019 21:49:25 +0000 Subject: [PATCH] Remove gtk_menu_set_display Menus should always be attached to a toplevel, in which case they get their display that way. --- docs/reference/gtk/gtk4-sections.txt | 1 - gtk/gtkmenu.c | 34 ++-------------------------- gtk/gtkmenu.h | 4 ---- 3 files changed, 2 insertions(+), 37 deletions(-) diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt index f41587c176..64a14c44fa 100644 --- a/docs/reference/gtk/gtk4-sections.txt +++ b/docs/reference/gtk/gtk4-sections.txt @@ -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 diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c index 820fcdd9c7..f7d3ab2ff2 100644 --- a/gtk/gtkmenu.c +++ b/gtk/gtkmenu.c @@ -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) { diff --git a/gtk/gtkmenu.h b/gtk/gtkmenu.h index f9aa977b65..eec8b531b8 100644 --- a/gtk/gtkmenu.h +++ b/gtk/gtkmenu.h @@ -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);