store the window menu on the display and blow it away when a window

2002-10-28  Havoc Pennington  <hp@pobox.com>

	* src/window.c, src/display.c: store the window menu on the
	display and blow it away when a window closes, so we don't
	get funny stuck menus. Patch from Martin Garton #87514
This commit is contained in:
Havoc Pennington 2002-10-28 05:35:30 +00:00 committed by Havoc Pennington
parent c9c67387ce
commit effec94613
4 changed files with 30 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2002-10-28 Havoc Pennington <hp@pobox.com>
* src/window.c, src/display.c: store the window menu on the
display and blow it away when a window closes, so we don't
get funny stuck menus. Patch from Martin Garton #87514
2002-10-27 Anders Carlsson <andersca@gnu.org>
* configure.in: Make XRandr detection work better.

View File

@ -394,6 +394,9 @@ meta_display_open (const char *name)
display->groups_by_leader = NULL;
display->window_with_menu = NULL;
display->window_menu = NULL;
display->screens = NULL;
#ifdef HAVE_STARTUP_NOTIFICATION

View File

@ -259,6 +259,9 @@ struct _MetaDisplay
/* Managed by group.c */
GHashTable *groups_by_leader;
/* currently-active window menu if any */
MetaWindowMenu *window_menu;
MetaWindow *window_with_menu;
#ifdef HAVE_STARTUP_NOTIFICATION
/* This is at the end in case someone doesn't include config.h before this file

View File

@ -820,6 +820,13 @@ meta_window_free (MetaWindow *window)
meta_verbose ("Unmanaging 0x%lx\n", window->xwindow);
if (window->display->window_with_menu == window)
{
meta_ui_window_menu_free (window->display->window_menu);
window->display->window_menu = NULL;
window->display->window_with_menu = NULL;
}
if (destroying_windows_disallowed > 0)
meta_bug ("Tried to destroy window %s while destruction was not allowed\n",
window->desc);
@ -5885,6 +5892,12 @@ menu_callback (MetaWindowMenu *menu,
meta_verbose ("Menu callback on nonexistent window\n");
}
if (display->window_menu == menu)
{
display->window_menu = NULL;
display->window_with_menu = NULL;
}
meta_ui_window_menu_free (menu);
}
@ -5950,7 +5963,11 @@ meta_window_show_menu (MetaWindow *window,
menu_callback,
NULL);
window->display->window_menu = menu;
window->display->window_with_menu = window;
meta_verbose ("Popping up window menu for %s\n", window->desc);
meta_ui_window_menu_popup (menu, root_x, root_y, button, timestamp);
}