From 4f14fc15e6c23fabdb785d94e71cc7bd822f63e0 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Sat, 14 Dec 2002 04:07:08 +0000 Subject: [PATCH] If the screen for the menu changes while the menu is torn off, move the Fri Dec 13 22:55:27 2002 Owen Taylor * gtk/gtkmenu.c (menu_change_screen): If the screen for the menu changes while the menu is torn off, move the tearoff along with it. (#85669) * gtk/gtkmenu.c (gtk_menu_set_tearoff_state): When reattaching, get rid of the get rid of the tearoff window. --- ChangeLog | 9 +++++++++ ChangeLog.pre-2-10 | 9 +++++++++ ChangeLog.pre-2-2 | 9 +++++++++ ChangeLog.pre-2-4 | 9 +++++++++ ChangeLog.pre-2-6 | 9 +++++++++ ChangeLog.pre-2-8 | 9 +++++++++ gtk/gtkmenu.c | 24 +++++++++++++++++++++--- 7 files changed, 75 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3ddadb63a5..6fc79c3bda 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Fri Dec 13 22:55:27 2002 Owen Taylor + + * gtk/gtkmenu.c (menu_change_screen): If the screen + for the menu changes while the menu is torn off, move + the tearoff along with it. (#85669) + + * gtk/gtkmenu.c (gtk_menu_set_tearoff_state): When + reattaching, get rid of the get rid of the tearoff window. + Fri Dec 13 21:35:12 2002 Owen Taylor * gtk/gtkhandlebox.c (gtk_handle_box_motion): Handle diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 3ddadb63a5..6fc79c3bda 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,12 @@ +Fri Dec 13 22:55:27 2002 Owen Taylor + + * gtk/gtkmenu.c (menu_change_screen): If the screen + for the menu changes while the menu is torn off, move + the tearoff along with it. (#85669) + + * gtk/gtkmenu.c (gtk_menu_set_tearoff_state): When + reattaching, get rid of the get rid of the tearoff window. + Fri Dec 13 21:35:12 2002 Owen Taylor * gtk/gtkhandlebox.c (gtk_handle_box_motion): Handle diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 3ddadb63a5..6fc79c3bda 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,12 @@ +Fri Dec 13 22:55:27 2002 Owen Taylor + + * gtk/gtkmenu.c (menu_change_screen): If the screen + for the menu changes while the menu is torn off, move + the tearoff along with it. (#85669) + + * gtk/gtkmenu.c (gtk_menu_set_tearoff_state): When + reattaching, get rid of the get rid of the tearoff window. + Fri Dec 13 21:35:12 2002 Owen Taylor * gtk/gtkhandlebox.c (gtk_handle_box_motion): Handle diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 3ddadb63a5..6fc79c3bda 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,12 @@ +Fri Dec 13 22:55:27 2002 Owen Taylor + + * gtk/gtkmenu.c (menu_change_screen): If the screen + for the menu changes while the menu is torn off, move + the tearoff along with it. (#85669) + + * gtk/gtkmenu.c (gtk_menu_set_tearoff_state): When + reattaching, get rid of the get rid of the tearoff window. + Fri Dec 13 21:35:12 2002 Owen Taylor * gtk/gtkhandlebox.c (gtk_handle_box_motion): Handle diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 3ddadb63a5..6fc79c3bda 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,12 @@ +Fri Dec 13 22:55:27 2002 Owen Taylor + + * gtk/gtkmenu.c (menu_change_screen): If the screen + for the menu changes while the menu is torn off, move + the tearoff along with it. (#85669) + + * gtk/gtkmenu.c (gtk_menu_set_tearoff_state): When + reattaching, get rid of the get rid of the tearoff window. + Fri Dec 13 21:35:12 2002 Owen Taylor * gtk/gtkhandlebox.c (gtk_handle_box_motion): Handle diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 3ddadb63a5..6fc79c3bda 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,12 @@ +Fri Dec 13 22:55:27 2002 Owen Taylor + + * gtk/gtkmenu.c (menu_change_screen): If the screen + for the menu changes while the menu is torn off, move + the tearoff along with it. (#85669) + + * gtk/gtkmenu.c (gtk_menu_set_tearoff_state): When + reattaching, get rid of the get rid of the tearoff window. + Fri Dec 13 21:35:12 2002 Owen Taylor * gtk/gtkhandlebox.c (gtk_handle_box_motion): Handle diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c index ee2f8a0e15..3e93a8e5cf 100644 --- a/gtk/gtkmenu.c +++ b/gtk/gtkmenu.c @@ -530,6 +530,19 @@ gtk_menu_finalize (GObject *object) G_OBJECT_CLASS (parent_class)->finalize (object); } +static void +menu_change_screen (GtkMenu *menu, + GdkScreen *new_screen) +{ + if (menu->torn_off) + { + gtk_window_set_screen (GTK_WINDOW (menu->tearoff_window), new_screen); + gtk_menu_position (menu); + } + + gtk_window_set_screen (GTK_WINDOW (menu->toplevel), new_screen); +} + static void attach_widget_screen_changed (GtkWidget *attach_widget, GdkScreen *previous_screen, @@ -538,8 +551,7 @@ attach_widget_screen_changed (GtkWidget *attach_widget, if (gtk_widget_has_screen (attach_widget) && !g_object_get_data (G_OBJECT (menu), "gtk-menu-explicit-screen")) { - gtk_window_set_screen (GTK_WINDOW (menu->toplevel), - gtk_widget_get_screen (attach_widget)); + menu_change_screen (menu, gtk_widget_get_screen (attach_widget)); } } @@ -1307,6 +1319,12 @@ gtk_menu_set_tearoff_state (GtkMenu *menu, { gtk_widget_hide (menu->tearoff_window); gtk_menu_reparent (menu, menu->toplevel, FALSE); + gtk_widget_destroy (menu->tearoff_window); + + menu->tearoff_window = NULL; + menu->tearoff_hbox = NULL; + menu->tearoff_scrollbar = NULL; + menu->tearoff_adjustment = NULL; } } } @@ -2972,7 +2990,7 @@ gtk_menu_set_screen (GtkMenu *menu, if (screen) { - gtk_window_set_screen (GTK_WINDOW (menu->toplevel), screen); + menu_change_screen (menu, screen); } else {