forked from Mirrors/sngrep
Merge branch 'master' into experimental
This commit is contained in:
commit
a935290cb1
|
@ -1060,6 +1060,10 @@ call_flow_handle_key(ui_t *ui, int key)
|
|||
call_raw_set_group(info->group);
|
||||
call_raw_set_msg(call_flow_arrow_message(vector_item(info->darrows, info->cur_arrow)));
|
||||
break;
|
||||
case ACTION_CLEAR_CALLS:
|
||||
// Propagate the key to the previous panel
|
||||
return KEY_PROPAGATED;
|
||||
|
||||
default:
|
||||
// Parse next action
|
||||
continue;
|
||||
|
@ -1114,20 +1118,21 @@ call_flow_help(ui_t *ui)
|
|||
// A list of available keys in this window
|
||||
mvwprintw(help_win, 8, 2, "Available keys:");
|
||||
mvwprintw(help_win, 9, 2, "Esc/Q Go back to Call list window");
|
||||
mvwprintw(help_win, 10, 2, "Enter Show current message Raw");
|
||||
mvwprintw(help_win, 11, 2, "F1/h Show this screen");
|
||||
mvwprintw(help_win, 12, 2, "F2/d Toggle SDP Address:Port info");
|
||||
mvwprintw(help_win, 13, 2, "F3/m Toggle RTP arrows display");
|
||||
mvwprintw(help_win, 14, 2, "F4/X Show call-flow with X-CID/X-Call-ID dialog");
|
||||
mvwprintw(help_win, 15, 2, "F5/s Toggle compressed view (One address <=> one column");
|
||||
mvwprintw(help_win, 16, 2, "F6/R Show original call messages in raw mode");
|
||||
mvwprintw(help_win, 17, 2, "F7/c Cycle between available color modes");
|
||||
mvwprintw(help_win, 18, 2, "F8/C Turn on/off message syntax highlighting");
|
||||
mvwprintw(help_win, 19, 2, "9/0 Increase/Decrease raw preview size");
|
||||
mvwprintw(help_win, 20, 2, "t Toggle raw preview display");
|
||||
mvwprintw(help_win, 21, 2, "T Restore raw preview size");
|
||||
mvwprintw(help_win, 22, 2, "D Only show SDP messages");
|
||||
|
||||
mvwprintw(help_win, 10, 2, "F5/Ctrl-L Leave screen and clear call list");
|
||||
mvwprintw(help_win, 11, 2, "Enter Show current message Raw");
|
||||
mvwprintw(help_win, 12, 2, "F1/h Show this screen");
|
||||
mvwprintw(help_win, 13, 2, "F2/d Toggle SDP Address:Port info");
|
||||
mvwprintw(help_win, 14, 2, "F3/m Toggle RTP arrows display");
|
||||
mvwprintw(help_win, 15, 2, "F4/X Show call-flow with X-CID/X-Call-ID dialog");
|
||||
mvwprintw(help_win, 16, 2, "F5/s Toggle compressed view (One address <=> one column");
|
||||
mvwprintw(help_win, 17, 2, "F6/R Show original call messages in raw mode");
|
||||
mvwprintw(help_win, 18, 2, "F7/c Cycle between available color modes");
|
||||
mvwprintw(help_win, 19, 2, "F8/C Turn on/off message syntax highlighting");
|
||||
mvwprintw(help_win, 20, 2, "F9/l Turn on/off resolved addresses");
|
||||
mvwprintw(help_win, 21, 2, "9/0 Increase/Decrease raw preview size");
|
||||
mvwprintw(help_win, 22, 2, "t Toggle raw preview display");
|
||||
mvwprintw(help_win, 23, 2, "T Restore raw preview size");
|
||||
mvwprintw(help_win, 24, 2, "D Only show SDP messages");
|
||||
|
||||
// Press any key to close
|
||||
wgetch(help_win);
|
||||
|
|
|
@ -312,8 +312,8 @@ call_flow_draw_raw_rtcp(ui_t *ui, rtp_stream_t *rtcp);
|
|||
* @brief Handle Call flow extended key strokes
|
||||
*
|
||||
* This function will manage the custom keybindings of the panel. If this
|
||||
* function returns -1, the ui manager will check if the pressed key
|
||||
* is one of the common ones (like toggle colors and so).
|
||||
* function returns -1, the ui manager will destroy the current panel and
|
||||
* pass the key to the previous panel.
|
||||
*
|
||||
* @param panel Ncurses panel pointer
|
||||
* @param key Pressed keycode
|
||||
|
|
|
@ -756,7 +756,7 @@ call_list_help(ui_t *ui)
|
|||
mvwprintw(help_win, 14, 2, "F2/S Save captured packages to a file");
|
||||
mvwprintw(help_win, 15, 2, "F3// Display filtering (match string case insensitive)");
|
||||
mvwprintw(help_win, 16, 2, "F4/X Show selected call-flow (Extended) if available");
|
||||
mvwprintw(help_win, 17, 2, "F5 Clear call list (can not be undone!)");
|
||||
mvwprintw(help_win, 17, 2, "F5/Ctrl-L Clear call list (can not be undone!)");
|
||||
mvwprintw(help_win, 18, 2, "F6/R Show selected call messages in raw mode");
|
||||
mvwprintw(help_win, 19, 2, "F7/F Show filter options");
|
||||
mvwprintw(help_win, 20, 2, "F8/c Turn on/off window colours");
|
||||
|
|
|
@ -249,6 +249,9 @@ call_raw_handle_key(ui_t *ui, int key)
|
|||
call_raw_set_msg(info->msg);
|
||||
}
|
||||
break;
|
||||
case ACTION_CLEAR_CALLS:
|
||||
// Propagate the key to the previous panel
|
||||
return KEY_PROPAGATED;
|
||||
default:
|
||||
// Parse next action
|
||||
continue;
|
||||
|
|
|
@ -114,8 +114,9 @@ call_raw_print_msg(ui_t *ui, sip_msg_t *msg);
|
|||
* @brief Handle Call Raw key strokes
|
||||
*
|
||||
* This function will manage the custom keybindings of the panel. If this
|
||||
* function returns -1, the ui manager will check if the pressed key
|
||||
* is one of the common ones (like toggle colors and so).
|
||||
* function returns -1, the ui manager will destroy the current panel and
|
||||
* pass the key to the previous panel.
|
||||
|
||||
*
|
||||
* @param panel Ncurses panel pointer
|
||||
* @param key Pressed keycode
|
||||
|
|
|
@ -227,17 +227,29 @@ wait_for_input()
|
|||
if (c == ERR)
|
||||
continue;
|
||||
|
||||
// Check if current panel has custom bindings for that key
|
||||
capture_lock();
|
||||
if ((c = ui_handle_key(ui, c)) == 0) {
|
||||
capture_unlock();
|
||||
// Key has been handled by panel
|
||||
continue;
|
||||
// Handle received key
|
||||
int key = c;
|
||||
while (c != KEY_HANDLED) {
|
||||
// Check if current panel has custom bindings for that key
|
||||
c = ui_handle_key(ui, c);
|
||||
|
||||
if (c == KEY_HANDLED) {
|
||||
// Panel handled this key
|
||||
continue;
|
||||
} else if (c == KEY_PROPAGATED) {
|
||||
// restore the key value
|
||||
c = key;
|
||||
// Destroy current panel
|
||||
ui_destroy(ui);
|
||||
// Try to handle this key with the previus panel
|
||||
ui = ui_find_by_panel(panel_below(NULL));
|
||||
} else {
|
||||
// Key not handled by UI nor propagated. Use default handler
|
||||
c = default_handle_key(ui, c);
|
||||
}
|
||||
}
|
||||
capture_unlock();
|
||||
|
||||
// Key not handled by UI, try default handler
|
||||
default_handle_key(ui, c);
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
@ -288,8 +300,8 @@ default_handle_key(ui_t *ui, int key)
|
|||
break;
|
||||
}
|
||||
|
||||
// Return this is a valid handled key
|
||||
return (action == ERR) ? key : 0;
|
||||
// Consider the key handled at this point
|
||||
return KEY_HANDLED;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -49,6 +49,9 @@
|
|||
#define DIALOG_MAX_WIDTH 100
|
||||
#define DIALOG_MIN_WIDTH 40
|
||||
|
||||
//! Possible key handler results
|
||||
#define KEY_HANDLED 0
|
||||
#define KEY_PROPAGATED -1
|
||||
|
||||
/**
|
||||
* Define existing panels
|
||||
|
@ -121,7 +124,7 @@ wait_for_input();
|
|||
/**
|
||||
* @brief Default handler for keys
|
||||
*
|
||||
* If ui doesn't handle the given key (ui_handle_key returns -1)
|
||||
* If ui doesn't handle the given key (ui_handle_key returns the key value)
|
||||
* then the default handler will be invoked
|
||||
*
|
||||
* @param ui Current displayed UI structure
|
||||
|
|
|
@ -54,7 +54,7 @@ key_binding_t bindings[ACTION_SENTINEL] = {
|
|||
{ ACTION_NEXT_FIELD, "nfield", { KEY_DOWN, KEY_TAB }, 2 },
|
||||
{ ACTION_RESIZE_SCREEN, "", { KEY_RESIZE }, 1 },
|
||||
{ ACTION_CLEAR, "clear", { KEY_CTRL('U'), KEY_CTRL('W')}, 2 },
|
||||
{ ACTION_CLEAR_CALLS, "clearcalls", { KEY_F(5) }, 1 },
|
||||
{ ACTION_CLEAR_CALLS, "clearcalls", { KEY_F(5), KEY_CTRL('L')}, 2 },
|
||||
{ ACTION_SEARCH_XCALL, "searchxcall", { 'X' }, 1 },
|
||||
{ ACTION_TOGGLE_SYNTAX, "togglesyntax", { KEY_F(8), 'C' }, 2 },
|
||||
{ ACTION_CYCLE_COLOR, "colormode", { 'c' }, 1 },
|
||||
|
|
Loading…
Reference in New Issue