Fix and optimize 20200908 (#1184)

* combi: Reuse own get_num_entries in self-init

* combi_mode_parse_switchers: Remove duplicated mode pointer

* combi_mode_parse_switchers: Regroup mode search lines

* combi_mode_result: Simplify switcher search quit

* mode_result: Check for mode switch actions before hook

These are over-mode actions, which should not be handled
in mode hooks at all.
This commit is contained in:
nick87720z
2020-09-08 20:30:03 +05:00
committed by GitHub
parent 88ac249d36
commit 96cd34d24f
8 changed files with 43 additions and 110 deletions

View File

@@ -278,28 +278,7 @@ static ModeMode script_mode_result ( Mode *sw, int mretv, char **input, unsigned
DmenuScriptEntry *new_list = NULL;
unsigned int new_length = 0;
if ( ( mretv & MENU_NEXT ) ) {
retv = NEXT_DIALOG;
}
else if ( ( mretv & MENU_PREVIOUS ) ) {
retv = PREVIOUS_DIALOG;
}
else if ( ( mretv & MENU_QUICK_SWITCH ) ) {
//retv = 1+( mretv & MENU_LOWER_MASK );
script_mode_reset_highlight ( sw );
if ( selected_line != UINT32_MAX ) {
new_list = execute_executor ( sw, rmpd->cmd_list[selected_line].entry, &new_length, 10 + ( mretv & MENU_LOWER_MASK ), &( rmpd->cmd_list[selected_line] ) );
}
else {
if ( rmpd->no_custom == FALSE ) {
new_list = execute_executor ( sw, *input, &new_length, 10 + ( mretv & MENU_LOWER_MASK ), NULL );
}
else {
return RELOAD_DIALOG;
}
}
}
else if ( ( mretv & MENU_OK ) && rmpd->cmd_list[selected_line].entry != NULL ) {
if ( ( mretv & MENU_OK ) && rmpd->cmd_list[selected_line].entry != NULL ) {
if ( rmpd->cmd_list[selected_line].nonselectable ) {
return RELOAD_DIALOG;
}