X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;ds=sidebyside;f=openbox%2Fmenuframe.c;h=7ca2136ca1f13ab98947be969788331ffb36e147;hb=a65b1d202f11a0e1e87b9343a9a620321e84f6cf;hp=2e54ef88cde6dd167e8a82ad9b53948c3b951357;hpb=ff43372da760c84e92ca7a7e9648d09fcfba2cf0;p=chaz%2Fopenbox diff --git a/openbox/menuframe.c b/openbox/menuframe.c index 2e54ef88..7ca2136c 100644 --- a/openbox/menuframe.c +++ b/openbox/menuframe.c @@ -174,15 +174,15 @@ static void menu_entry_frame_free(ObMenuEntryFrame *self) if (self) { XDestroyWindow(ob_display, self->text); XDestroyWindow(ob_display, self->window); - g_hash_table_insert(menu_frame_map, &self->text, self); - g_hash_table_insert(menu_frame_map, &self->window, self); + g_hash_table_remove(menu_frame_map, &self->text); + g_hash_table_remove(menu_frame_map, &self->window); if (self->entry->type == OB_MENU_ENTRY_TYPE_NORMAL) { XDestroyWindow(ob_display, self->icon); - g_hash_table_insert(menu_frame_map, &self->icon, self); + g_hash_table_remove(menu_frame_map, &self->icon); } if (self->entry->type == OB_MENU_ENTRY_TYPE_SUBMENU) { XDestroyWindow(ob_display, self->bullet); - g_hash_table_insert(menu_frame_map, &self->bullet, self); + g_hash_table_remove(menu_frame_map, &self->bullet); } RrAppearanceFree(self->a_normal); @@ -318,6 +318,15 @@ static void menu_entry_frame_render(ObMenuEntryFrame *self) self->a_text_selected : self->a_text_normal)); 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_position > 0)) + { + text_a->texture[0].data.text.shortcut = TRUE; + text_a->texture[0].data.text.shortcut_pos = + self->entry->data.normal.shortcut_position; + } else + text_a->texture[0].data.text.shortcut = FALSE; break; case OB_MENU_ENTRY_TYPE_SUBMENU: text_a = (self == self->frame->selected ? @@ -325,6 +334,13 @@ static void menu_entry_frame_render(ObMenuEntryFrame *self) self->a_text_normal); 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_position > 0)) + { + text_a->texture[0].data.text.shortcut = TRUE; + text_a->texture[0].data.text.shortcut_pos = sub->shortcut_position; + } else + text_a->texture[0].data.text.shortcut = FALSE; break; case OB_MENU_ENTRY_TYPE_SEPARATOR: if (self->entry->data.separator.label != NULL) @@ -886,7 +902,8 @@ static gboolean menu_entry_frame_submenu_timeout(gpointer data) return FALSE; } -void menu_frame_select(ObMenuFrame *self, ObMenuEntryFrame *entry) +void menu_frame_select(ObMenuFrame *self, ObMenuEntryFrame *entry, + gboolean immediate) { ObMenuEntryFrame *old = self->selected; ObMenuFrame *oldchild = self->child; @@ -913,7 +930,7 @@ void menu_frame_select(ObMenuFrame *self, ObMenuEntryFrame *entry) menu_entry_frame_render(self->selected); if (self->selected->entry->type == OB_MENU_ENTRY_TYPE_SUBMENU) { - if (config_submenu_show_delay) { + if (config_submenu_show_delay && !immediate) { /* initiate a new submenu open request */ ob_main_loop_timeout_add(ob_main_loop, config_submenu_show_delay * 1000, @@ -988,7 +1005,7 @@ void menu_frame_select_previous(ObMenuFrame *self) } } } - menu_frame_select(self, it ? it->data : NULL); + menu_frame_select(self, it ? it->data : NULL, TRUE); } void menu_frame_select_next(ObMenuFrame *self) @@ -1014,5 +1031,5 @@ void menu_frame_select_next(ObMenuFrame *self) } } } - menu_frame_select(self, it ? it->data : NULL); + menu_frame_select(self, it ? it->data : NULL, TRUE); }