all repos — openbox @ e0e1d4ba7e150b215b55029ddbff3c824b94caf7

openbox fork - make it a bit more like ryudo

don't show the client menu when its for an invalid window
Dana Jansens danakj@orodu.net
commit

e0e1d4ba7e150b215b55029ddbff3c824b94caf7

parent

53975abf1220c36ebbab455299a9915477c5a6b8

M openbox/client_list_combined_menu.copenbox/client_list_combined_menu.c

@@ -33,7 +33,7 @@ #define MENU_NAME "client-list-combined-menu"

ObMenu *combined_menu; -static void self_update(ObMenuFrame *frame, gpointer data) +static gboolean self_update(ObMenuFrame *frame, gpointer data) { ObMenu *menu = frame->menu; ObMenuEntry *e;

@@ -104,6 +104,7 @@ if (desktop == screen_desktop)

e->data.normal.enabled = FALSE; } } + return TRUE; /* always show the menu */ } /* executes it using the client in the actions, since we set that
M openbox/client_list_menu.copenbox/client_list_menu.c

@@ -38,7 +38,7 @@ {

guint desktop; } DesktopData; -static void desk_menu_update(ObMenuFrame *frame, gpointer data) +static gboolean desk_menu_update(ObMenuFrame *frame, gpointer data) { ObMenu *menu = frame->menu; DesktopData *d = data;

@@ -105,6 +105,7 @@ e = menu_add_normal(menu, 0, _("Go there..."), acts, TRUE);

if (d->desktop == screen_desktop) e->data.normal.enabled = FALSE; } + return TRUE; /* always show */ } /* executes it using the client in the actions, since we set that

@@ -129,7 +130,7 @@

desktop_menus = g_slist_remove(desktop_menus, menu); } -static void self_update(ObMenuFrame *frame, gpointer data) +static gboolean self_update(ObMenuFrame *frame, gpointer data) { ObMenu *menu = frame->menu; guint i;

@@ -162,6 +163,8 @@ menu_free(it->data);

desktop_menus = g_slist_delete_link(desktop_menus, it); menu_entry_remove(menu_find_entry_id(menu, i)); } + + return TRUE; /* always show */ } static void client_dest(ObClient *client, gpointer data)
M openbox/client_menu.copenbox/client_menu.c

@@ -51,21 +51,21 @@ CLIENT_RESIZE,

CLIENT_CLOSE }; -static void client_update(ObMenuFrame *frame, gpointer data) +static gboolean client_update(ObMenuFrame *frame, gpointer data) { ObMenu *menu = frame->menu; ObMenuEntry *e; GList *it; + + if (frame->client == NULL || !client_normal(frame->client)) + return FALSE; /* don't show the menu */ for (it = menu->entries; it; it = g_list_next(it)) { e = it->data; if (e->type == OB_MENU_ENTRY_TYPE_NORMAL) - e->data.normal.enabled = !!frame->client; + e->data.normal.enabled = TRUE; } - if (!frame->client) - return; - e = menu_find_entry_id(menu, CLIENT_ICONIFY); e->data.normal.enabled = frame->client->functions & OB_CLIENT_FUNC_ICONIFY;

@@ -91,22 +91,23 @@ e->data.normal.enabled = frame->client->functions & OB_CLIENT_FUNC_CLOSE;

e = menu_find_entry_id(menu, CLIENT_DECORATE); e->data.normal.enabled = client_normal(frame->client); + return TRUE; /* show the menu */ } -static void layer_update(ObMenuFrame *frame, gpointer data) +static gboolean layer_update(ObMenuFrame *frame, gpointer data) { ObMenu *menu = frame->menu; ObMenuEntry *e; GList *it; + if (frame->client == NULL || !client_normal(frame->client)) + return FALSE; /* don't show the menu */ + for (it = menu->entries; it; it = g_list_next(it)) { e = it->data; if (e->type == OB_MENU_ENTRY_TYPE_NORMAL) - e->data.normal.enabled = !!frame->client; + e->data.normal.enabled = TRUE; } - - if (!frame->client) - return; e = menu_find_entry_id(menu, LAYER_TOP); e->data.normal.enabled = !frame->client->above;

@@ -116,9 +117,10 @@ e->data.normal.enabled = (frame->client->above || frame->client->below);

e = menu_find_entry_id(menu, LAYER_BOTTOM); e->data.normal.enabled = !frame->client->below; + return TRUE; /* show the menu */ } -static void send_to_update(ObMenuFrame *frame, gpointer data) +static gboolean send_to_update(ObMenuFrame *frame, gpointer data) { ObMenu *menu = frame->menu; guint i;

@@ -128,8 +130,8 @@ ObMenuEntry *e;;

menu_clear_entries(menu); - if (!frame->client) - return; + if (frame->client == NULL || !client_normal(frame->client)) + return FALSE; /* don't show the menu */ for (i = 0; i <= screen_num_desktops; ++i) { const gchar *name;

@@ -155,6 +157,7 @@

if (frame->client->desktop == desk) e->data.normal.enabled = FALSE; } + return TRUE; /* show the menu */ } static void client_menu_place(ObMenuFrame *frame, gint *x, gint *y,

@@ -269,7 +272,7 @@

acts = g_slist_prepend(NULL, action_from_string ("ToggleMaximizeFull", OB_USER_ACTION_MENU_SELECTION)); - e = menu_add_normal(menu, CLIENT_MAXIMIZE, "MAXIMIZE", acts, TRUE); + e = menu_add_normal(menu, CLIENT_MAXIMIZE, _("Maximiz&e"), acts, TRUE); e->data.normal.mask = ob_rr_theme->max_mask; e->data.normal.mask_normal_color = ob_rr_theme->menu_color; e->data.normal.mask_disabled_color = ob_rr_theme->menu_disabled_color;

@@ -285,7 +288,7 @@ menu_add_normal(menu, CLIENT_LOWER, _("Lower to &bottom"),acts, TRUE);

acts = g_slist_prepend(NULL, action_from_string ("ToggleShade", OB_USER_ACTION_MENU_SELECTION)); - e = menu_add_normal(menu, CLIENT_SHADE, "SHADE", acts, TRUE); + e = menu_add_normal(menu, CLIENT_SHADE, _("&Roll up"), acts, TRUE); e->data.normal.mask = ob_rr_theme->shade_mask; e->data.normal.mask_normal_color = ob_rr_theme->menu_color; e->data.normal.mask_disabled_color = ob_rr_theme->menu_disabled_color;
M openbox/menu.hopenbox/menu.h

@@ -37,7 +37,8 @@ typedef struct _ObNormalMenuEntry ObNormalMenuEntry;

typedef struct _ObSubmenuMenuEntry ObSubmenuMenuEntry; typedef struct _ObSeparatorMenuEntry ObSeparatorMenuEntry; -typedef void (*ObMenuUpdateFunc)(struct _ObMenuFrame *frame, gpointer data); +typedef gboolean (*ObMenuUpdateFunc)(struct _ObMenuFrame *frame, + gpointer data); typedef void (*ObMenuExecuteFunc)(struct _ObMenuEntry *entry, guint state, gpointer data, Time time); typedef void (*ObMenuDestroyFunc)(struct _ObMenu *menu, gpointer data);
M openbox/menuframe.copenbox/menuframe.c

@@ -751,6 +751,18 @@ static gboolean menu_frame_show(ObMenuFrame *self)

{ GList *it; + /* determine if the underlying menu is already visible */ + for (it = menu_frame_visible; it; it = g_list_next(it)) { + ObMenuFrame *f = it->data; + if (f->menu == self->menu) + break; + } + if (!it) { + if (self->menu->update_func) + if (!self->menu->update_func(self, self->menu->data)) + return FALSE; + } + if (menu_frame_visible == NULL) { /* no menus shown yet */ if (!grab_pointer(TRUE, TRUE, OB_CURSOR_POINTER))

@@ -759,17 +771,6 @@ if (!grab_keyboard(TRUE)) {

grab_pointer(FALSE, TRUE, OB_CURSOR_POINTER); return FALSE; } - } - - /* determine if the underlying menu is already visible */ - for (it = menu_frame_visible; it; it = g_list_next(it)) { - ObMenuFrame *f = it->data; - if (f->menu == self->menu) - break; - } - if (!it) { - if (self->menu->update_func) - self->menu->update_func(self, self->menu->data); } menu_frame_update(self);