Client menus Add "client_menu" to pluginrc to use.
Scott Moynes smoynes@nexus.carleton.ca
7 files changed,
120 insertions(+),
34 deletions(-)
M
openbox/client.c
→
openbox/client.c
@@ -14,6 +14,7 @@ #include "dispatch.h"
#include "openbox.h" #include "group.h" #include "config.h" +#include "menu.h" #include "render/render.h" #include <glib.h>@@ -311,6 +312,13 @@ while (client_list != NULL)
client_unmanage(client_list->data); } +/* called by client_unmanage() to close any menus referencing this client */ +void client_close_menus(gpointer key, gpointer value, gpointer self) +{ + if (((Menu *)value)->client == (Client *)self) + menu_hide((Menu *)value); +} + void client_unmanage(Client *self) { int j;@@ -364,6 +372,10 @@
if (moveresize_client == self) moveresize_end(TRUE); + /* close any windows that are attached to this window */ + g_hash_table_foreach(menu_hash, client_close_menus, self); + + if (focus_client == self) { XEvent e;
M
openbox/event.c
→
openbox/event.c
@@ -34,7 +34,7 @@ static void event_handle_root(XEvent *e);
static void event_handle_dock(Dock *s, XEvent *e); static void event_handle_dockapp(DockApp *app, XEvent *e); static void event_handle_client(Client *c, XEvent *e); -static void event_handle_menu(Menu *menu, XEvent *e); +static void event_handle_menu(Menu *menu, Client *c, XEvent *e); #define INVALID_FOCUSIN(e) ((e)->xfocus.detail == NotifyInferior || \ (e)->xfocus.detail > NotifyNonlinearVirtual)@@ -436,7 +436,7 @@ return;
/* deal with it in the kernel */ if (menu) { - event_handle_menu(menu, e); + event_handle_menu(menu, client, e); return; } else if (client) event_handle_client(client, e);@@ -909,7 +909,7 @@ #endif
} } -static void event_handle_menu(Menu *menu, XEvent *e) +static void event_handle_menu(Menu *menu, Client *client, XEvent *e) { MenuEntry *entry;