diff options
author | Dave Davenport <qball@gmpclient.org> | 2016-12-12 08:53:35 +0100 |
---|---|---|
committer | Dave Davenport <qball@gmpclient.org> | 2016-12-12 08:53:35 +0100 |
commit | 6d9ce47974d6545d29f8a0b4a4249623210dddb5 (patch) | |
tree | 17661eee6df69612601b53bdbd18427485eb1fda | |
parent | 6cca2b1ecd7916f47c189f07af4f0c448b122c23 (diff) | |
parent | 47125daecfc9f65c5dca19c798728d2f6f8bac8a (diff) |
Merge remote-tracking branch 'origin/master' into themer
-rw-r--r-- | include/mode.h | 4 | ||||
-rw-r--r-- | include/view.h | 8 | ||||
-rw-r--r-- | source/dialogs/script.c | 4 | ||||
-rw-r--r-- | source/rofi.c | 3 | ||||
-rw-r--r-- | source/view.c | 8 |
5 files changed, 22 insertions, 5 deletions
diff --git a/include/mode.h b/include/mode.h index 59930a60..b8ee36c4 100644 --- a/include/mode.h +++ b/include/mode.h @@ -26,7 +26,9 @@ typedef enum /** Reload current DIALOG */ RELOAD_DIALOG = 1002, /** Previous dialog */ - PREVIOUS_DIALOG = 1003 + PREVIOUS_DIALOG = 1003, + /** Reloads the dialog and unset user input */ + RESET_DIALOG = 1004, } ModeMode; /** diff --git a/include/view.h b/include/view.h index 1a6a00fa..6e30ed8a 100644 --- a/include/view.h +++ b/include/view.h @@ -216,6 +216,13 @@ void rofi_view_switch_mode ( RofiViewState *state, Mode *mode ); void rofi_view_set_overlay ( RofiViewState *state, const char *text ); /** + * @param state The handle to the view. + * + * Clears the user entry box, set selected to 0. + */ +void rofi_view_clear_input ( RofiViewState *state ); + +/** * @param menu_flags The state of the new window. * * Creates the internal 'Cached' window that gets reused between views. @@ -247,6 +254,5 @@ void rofi_view_workers_finalize ( void ); * @returns the xcb_window_t for rofi's view or XCB_WINDOW_NONE. */ xcb_window_t rofi_view_get_window ( void ); - /**@}*/ #endif diff --git a/source/dialogs/script.c b/source/dialogs/script.c index c57fb5bd..dcbed2e3 100644 --- a/source/dialogs/script.c +++ b/source/dialogs/script.c @@ -146,9 +146,7 @@ static ModeMode script_mode_result ( Mode *sw, int mretv, char **input, unsigned rmpd->cmd_list = new_list; rmpd->cmd_list_length = new_length; - g_free ( *input ); - *input = NULL; - retv = RELOAD_DIALOG; + retv = RESET_DIALOG; } return retv; } diff --git a/source/rofi.c b/source/rofi.c index e86c7a7f..15cf75cf 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -216,6 +216,9 @@ void process_result ( RofiViewState *state ) else if ( retv == RELOAD_DIALOG ) { // do nothing. } + else if ( retv == RESET_DIALOG ) { + rofi_view_clear_input ( state ); + } else if ( retv < MODE_EXIT ) { mode = ( retv ) % num_modi; } diff --git a/source/view.c b/source/view.c index f52588c6..9569dc8f 100644 --- a/source/view.c +++ b/source/view.c @@ -1677,6 +1677,14 @@ void rofi_view_set_overlay ( RofiViewState *state, const char *text ) widget_move ( WIDGET ( state->overlay ), x_offset, state->border ); } +void rofi_view_clear_input ( RofiViewState *state ) +{ + if ( state->text ){ + textbox_text ( state->text, ""); + rofi_view_set_selected_line ( state, 0 ); + } +} + void rofi_view_switch_mode ( RofiViewState *state, Mode *mode ) { state->sw = mode; |