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;
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
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;
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)
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;
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;
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;
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;
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,
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;
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;
{
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;
}
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);