mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 10:50:10 +00:00
Set torn off menus to be transient for the toplevel they were torn off
Wed Nov 5 22:49:36 2003 Matthias Clasen <maclas@gmx.de> * gtk/gtkmenu.c (gtk_menu_set_tearoff_state): Set torn off menus to be transient for the toplevel they were torn off from. (gtk_menu_get_toplevel): Auxiliary function to find the toplevel of a menu. (#54775, Jon-Kare Hellan)
This commit is contained in:
parent
18db2c24e2
commit
3110ca2f17
@ -1,3 +1,10 @@
|
||||
Wed Nov 5 22:49:36 2003 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtkmenu.c (gtk_menu_set_tearoff_state): Set torn off
|
||||
menus to be transient for the toplevel they were torn off from.
|
||||
(gtk_menu_get_toplevel): Auxiliary function to find the
|
||||
toplevel of a menu. (#54775, Jon-Kare Hellan)
|
||||
|
||||
Wed Nov 5 21:07:58 2003 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtkpaned.c (gtk_paned_class_init): Add readonly properties
|
||||
|
@ -1,3 +1,10 @@
|
||||
Wed Nov 5 22:49:36 2003 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtkmenu.c (gtk_menu_set_tearoff_state): Set torn off
|
||||
menus to be transient for the toplevel they were torn off from.
|
||||
(gtk_menu_get_toplevel): Auxiliary function to find the
|
||||
toplevel of a menu. (#54775, Jon-Kare Hellan)
|
||||
|
||||
Wed Nov 5 21:07:58 2003 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtkpaned.c (gtk_paned_class_init): Add readonly properties
|
||||
|
@ -1,3 +1,10 @@
|
||||
Wed Nov 5 22:49:36 2003 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtkmenu.c (gtk_menu_set_tearoff_state): Set torn off
|
||||
menus to be transient for the toplevel they were torn off from.
|
||||
(gtk_menu_get_toplevel): Auxiliary function to find the
|
||||
toplevel of a menu. (#54775, Jon-Kare Hellan)
|
||||
|
||||
Wed Nov 5 21:07:58 2003 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtkpaned.c (gtk_paned_class_init): Add readonly properties
|
||||
|
@ -1,3 +1,10 @@
|
||||
Wed Nov 5 22:49:36 2003 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtkmenu.c (gtk_menu_set_tearoff_state): Set torn off
|
||||
menus to be transient for the toplevel they were torn off from.
|
||||
(gtk_menu_get_toplevel): Auxiliary function to find the
|
||||
toplevel of a menu. (#54775, Jon-Kare Hellan)
|
||||
|
||||
Wed Nov 5 21:07:58 2003 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtkpaned.c (gtk_paned_class_init): Add readonly properties
|
||||
|
@ -1,3 +1,10 @@
|
||||
Wed Nov 5 22:49:36 2003 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtkmenu.c (gtk_menu_set_tearoff_state): Set torn off
|
||||
menus to be transient for the toplevel they were torn off from.
|
||||
(gtk_menu_get_toplevel): Auxiliary function to find the
|
||||
toplevel of a menu. (#54775, Jon-Kare Hellan)
|
||||
|
||||
Wed Nov 5 21:07:58 2003 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtkpaned.c (gtk_paned_class_init): Add readonly properties
|
||||
|
@ -1554,6 +1554,28 @@ gtk_menu_update_title (GtkMenu *menu)
|
||||
}
|
||||
}
|
||||
|
||||
static GtkWidget*
|
||||
gtk_menu_get_toplevel (GtkWidget *menu)
|
||||
{
|
||||
GtkWidget *attach, *toplevel;
|
||||
|
||||
attach = gtk_menu_get_attach_widget (GTK_MENU (menu));
|
||||
|
||||
if (GTK_IS_MENU_ITEM (attach))
|
||||
attach = attach->parent;
|
||||
|
||||
if (GTK_IS_MENU (attach))
|
||||
return gtk_menu_get_toplevel (attach->parent);
|
||||
else if (GTK_IS_WIDGET (attach))
|
||||
{
|
||||
toplevel = gtk_widget_get_toplevel (attach->parent);
|
||||
if (GTK_WIDGET_TOPLEVEL (toplevel))
|
||||
return toplevel;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_menu_set_tearoff_state (GtkMenu *menu,
|
||||
gboolean torn_off)
|
||||
@ -1574,12 +1596,15 @@ gtk_menu_set_tearoff_state (GtkMenu *menu,
|
||||
|
||||
if (!menu->tearoff_window)
|
||||
{
|
||||
GtkWidget *toplevel;
|
||||
|
||||
menu->tearoff_window = gtk_widget_new (GTK_TYPE_WINDOW,
|
||||
"type", GTK_WINDOW_TOPLEVEL,
|
||||
"screen", gtk_widget_get_screen (menu->toplevel),
|
||||
"app_paintable", TRUE,
|
||||
NULL);
|
||||
|
||||
|
||||
gtk_window_set_type_hint (GTK_WINDOW (menu->tearoff_window),
|
||||
GDK_WINDOW_TYPE_HINT_MENU);
|
||||
gtk_window_set_mnemonic_modifier (GTK_WINDOW (menu->tearoff_window), 0);
|
||||
@ -1591,6 +1616,11 @@ gtk_menu_set_tearoff_state (GtkMenu *menu,
|
||||
gtk_menu_update_title (menu);
|
||||
|
||||
gtk_widget_realize (menu->tearoff_window);
|
||||
|
||||
toplevel = gtk_menu_get_toplevel (GTK_WIDGET (menu));
|
||||
if (toplevel != NULL)
|
||||
gtk_window_set_transient_for (GTK_WINDOW (menu->tearoff_window),
|
||||
GTK_WINDOW (toplevel));
|
||||
|
||||
menu->tearoff_hbox = gtk_hbox_new (FALSE, FALSE);
|
||||
gtk_container_add (GTK_CONTAINER (menu->tearoff_window), menu->tearoff_hbox);
|
||||
|
Loading…
Reference in New Issue
Block a user