summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--openbox/client_list_combined_menu.c3
-rw-r--r--openbox/client_list_menu.c7
-rw-r--r--openbox/client_menu.c33
-rw-r--r--openbox/menu.h3
-rw-r--r--openbox/menuframe.c23
5 files changed, 39 insertions, 30 deletions
diff --git a/openbox/client_list_combined_menu.c b/openbox/client_list_combined_menu.c
index 9dd56e0a..fcc95f69 100644
--- a/openbox/client_list_combined_menu.c
+++ b/openbox/client_list_combined_menu.c
@@ -33,7 +33,7 @@
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 @@ static void self_update(ObMenuFrame *frame, gpointer data)
e->data.normal.enabled = FALSE;
}
}
+ return TRUE; /* always show the menu */
}
/* executes it using the client in the actions, since we set that
diff --git a/openbox/client_list_menu.c b/openbox/client_list_menu.c
index 86a70af4..12c16815 100644
--- a/openbox/client_list_menu.c
+++ b/openbox/client_list_menu.c
@@ -38,7 +38,7 @@ typedef struct
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 @@ static void desk_menu_update(ObMenuFrame *frame, gpointer data)
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 @@ static void desk_menu_destroy(ObMenu *menu, gpointer data)
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 @@ static void self_update(ObMenuFrame *frame, gpointer 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)
diff --git a/openbox/client_menu.c b/openbox/client_menu.c
index 4efef8a8..011e3ec1 100644
--- a/openbox/client_menu.c
+++ b/openbox/client_menu.c
@@ -51,21 +51,21 @@ enum {
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,23 +91,24 @@ static void client_update(ObMenuFrame *frame, gpointer data)
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 @@ static void layer_update(ObMenuFrame *frame, gpointer data)
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 @@ static void send_to_update(ObMenuFrame *frame, gpointer data)
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 @@ static void send_to_update(ObMenuFrame *frame, gpointer data)
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 @@ void client_menu_startup()
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 @@ void client_menu_startup()
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;
diff --git a/openbox/menu.h b/openbox/menu.h
index fc859a8b..b08f7c95 100644
--- a/openbox/menu.h
+++ b/openbox/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);
diff --git a/openbox/menuframe.c b/openbox/menuframe.c
index 6f8ecad0..a95e46fc 100644
--- a/openbox/menuframe.c
+++ b/openbox/menuframe.c
@@ -751,16 +751,6 @@ static gboolean menu_frame_show(ObMenuFrame *self)
{
GList *it;
- if (menu_frame_visible == NULL) {
- /* no menus shown yet */
- if (!grab_pointer(TRUE, TRUE, OB_CURSOR_POINTER))
- return FALSE;
- 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;
@@ -769,7 +759,18 @@ static gboolean menu_frame_show(ObMenuFrame *self)
}
if (!it) {
if (self->menu->update_func)
- self->menu->update_func(self, self->menu->data);
+ 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))
+ return FALSE;
+ if (!grab_keyboard(TRUE)) {
+ grab_pointer(FALSE, TRUE, OB_CURSOR_POINTER);
+ return FALSE;
+ }
}
menu_frame_update(self);