Fix shadowed variables
[mikachu/openbox.git] / openbox / menuframe.c
index 4cdf6a3..944fa2e 100644 (file)
@@ -401,6 +401,7 @@ static void menu_entry_frame_render(ObMenuEntryFrame *self)
         text_a->texture[0].data.text.string = self->entry->data.normal.label;
         if (self->entry->data.normal.shortcut &&
             (self->frame->menu->show_all_shortcuts ||
+             self->entry->data.normal.shortcut_always_show ||
              self->entry->data.normal.shortcut_position > 0))
         {
             text_a->texture[0].data.text.shortcut = TRUE;
@@ -416,6 +417,7 @@ static void menu_entry_frame_render(ObMenuEntryFrame *self)
         sub = self->entry->data.submenu.submenu;
         text_a->texture[0].data.text.string = sub ? sub->title : "";
         if (sub->shortcut && (self->frame->menu->show_all_shortcuts ||
+                              sub->shortcut_always_show ||
                               sub->shortcut_position > 0))
         {
             text_a->texture[0].data.text.shortcut = TRUE;
@@ -603,7 +605,7 @@ static gint menu_entry_frame_get_height(ObMenuEntryFrame *self,
         if (self->entry->data.separator.label != NULL) {
             h += ob_rr_theme->menu_title_height +
                 (ob_rr_theme->mbwidth - PADDING) * 2;
+
             /* if the first entry is a labeled separator, then make its border
                overlap with the menu's outside border */
             if (first_entry)
@@ -635,9 +637,9 @@ void menu_frame_render(ObMenuFrame *self)
     STRUT_SET(self->item_margin, 0, 0, 0, 0);
 
     if (self->entries) {
-        ObMenuEntryFrame *e = self->entries->data;
         gint l, t, r, b;
 
+        e = self->entries->data;
         e->a_text_normal->texture[0].data.text.string = "";
         tw = RrMinWidth(e->a_text_normal);
         tw += 2*PADDING;
@@ -692,7 +694,8 @@ void menu_frame_render(ObMenuFrame *self)
         }
 
         RECT_SET_POINT(e->area, 0, h+e->border);
-        XMoveWindow(ob_display, e->window, e->area.x-e->border, e->area.y-e->border);
+        XMoveWindow(ob_display, e->window,
+                    e->area.x-e->border, e->area.y-e->border);
         XSetWindowBorderWidth(ob_display, e->window, e->border);
         XSetWindowBorder(ob_display, e->window,
                          RrColorPixel(ob_rr_theme->menu_border_color));
@@ -885,7 +888,7 @@ static void menu_frame_update(ObMenuFrame *self)
             more_frame = menu_entry_frame_new(more_entry, self);
             /* make it get deleted when the menu frame goes away */
             menu_entry_unref(more_entry);
-                                       
+
             /* add our More... entry to the frame */
             self->entries = g_list_append(self->entries, more_frame);
         }
@@ -1072,8 +1075,14 @@ void menu_frame_hide_all_client(ObClient *client)
     GList *it = g_list_last(menu_frame_visible);
     if (it) {
         ObMenuFrame *f = it->data;
-        if (f->client == client)
+        if (f->client == client) {
+            if (config_submenu_show_delay) {
+                /* remove any submenu open requests */
+                ob_main_loop_timeout_remove(ob_main_loop,
+                                            menu_entry_frame_submenu_timeout);
+            }
             menu_frame_hide(f);
+        }
     }
 }
 
@@ -1118,6 +1127,7 @@ ObMenuEntryFrame* menu_entry_frame_under(gint x, gint y)
 
 static gboolean menu_entry_frame_submenu_timeout(gpointer data)
 {
+    g_assert(menu_frame_visible);
     menu_entry_frame_show_submenu((ObMenuEntryFrame*)data);
     return FALSE;
 }
@@ -1132,8 +1142,8 @@ void menu_frame_select(ObMenuFrame *self, ObMenuEntryFrame *entry,
         entry = old;
 
     if (old == entry) return;
-   
-    if (config_submenu_show_delay) { 
+
+    if (config_submenu_show_delay) {
         /* remove any submenu open requests */
         ob_main_loop_timeout_remove(ob_main_loop,
                                     menu_entry_frame_submenu_timeout);
@@ -1179,7 +1189,7 @@ void menu_entry_frame_show_submenu(ObMenuEntryFrame *self)
     menu_frame_show_submenu(f, self->frame, self);
 }
 
-void menu_entry_frame_execute(ObMenuEntryFrame *self, guint state, Time time)
+void menu_entry_frame_execute(ObMenuEntryFrame *self, guint state)
 {
     if (self->entry->type == OB_MENU_ENTRY_TYPE_NORMAL &&
         self->entry->data.normal.enabled)
@@ -1200,11 +1210,10 @@ void menu_entry_frame_execute(ObMenuEntryFrame *self, guint state, Time time)
         }
 
         if (func)
-            func(entry, frame, client, state, data, time);
+            func(entry, frame, client, state, data);
         else
             actions_run_acts(acts, OB_USER_ACTION_MENU_SELECTION,
-                             time, state, -1, -1, OB_FRAME_CONTEXT_NONE,
-                             client);
+                             state, -1, -1, 0, OB_FRAME_CONTEXT_NONE, client);
     }
 }