diff --git a/include/mode-private.h b/include/mode-private.h index 6ccdee37..63839c80 100644 --- a/include/mode-private.h +++ b/include/mode-private.h @@ -34,13 +34,17 @@ G_BEGIN_DECLS /** ABI version to check if loaded plugin is compatible. */ #define ABI_VERSION 7u +/** + * Indicator what type of mode this is. + * For now it can be the classic switcher, or also implement a completer. + */ typedef enum { - /** Mode type is not set */ - MODE_TYPE_UNSET = 0b0000, - /** A normal mode. */ - MODE_TYPE_SWITCHER = 0b0001, - /** A mode that can be used to completer */ - MODE_TYPE_COMPLETER = 0b0010, + /** Mode type is not set */ + MODE_TYPE_UNSET = 0b0000, + /** A normal mode. */ + MODE_TYPE_SWITCHER = 0b0001, + /** A mode that can be used to completer */ + MODE_TYPE_COMPLETER = 0b0010, } ModeType; /** @@ -160,28 +164,29 @@ typedef char *(*_mode_preprocess_input)(Mode *sw, const char *input); */ typedef char *(*_mode_get_message)(const Mode *sw); - /** * Create a new instance of this mode. * Free (free) result after use, after using mode_destroy. * * @returns Instantiate a new instance of this mode. */ -typedef Mode *(*_mode_create)( void ); +typedef Mode *(*_mode_create)(void); /** * @param sw The #Mode pointer * @param menu_retv The return value * @param input The input string * @param selected_line The selected line - * @param the path that was completed + * @param path the path that was completed * * Handle the user accepting an entry in completion mode. * * @returns the next action to take */ -typedef ModeMode (*_mode_completer_result)(Mode *sw, int menu_retv, char **input, - unsigned int selected_line, char **path); +typedef ModeMode (*_mode_completer_result)(Mode *sw, int menu_retv, + char **input, + unsigned int selected_line, + char **path); /** * Structure defining a switcher. * It consists of a name, callback and if enabled diff --git a/include/mode.h b/include/mode.h index 0a7b839c..55ef750d 100644 --- a/include/mode.h +++ b/include/mode.h @@ -256,7 +256,7 @@ char *mode_get_message(const Mode *mode); Mode *mode_create(const Mode *mode); /** - * @param mode The mode to query + * @param sw The mode to query * @param menu_retv The menu return value. * @param input Pointer to the user input string. [in][out] * @param selected_line the line selected by the user. @@ -270,7 +270,7 @@ ModeMode mode_completer_result(Mode *sw, int menu_retv, char **input, unsigned int selected_line, char **path); /** - * @param mode The mode to query. + * @param sw The mode to query. * * Check if mode is a valid completer. * diff --git a/include/rofi.h b/include/rofi.h index 38f4c44a..dced47c1 100644 --- a/include/rofi.h +++ b/include/rofi.h @@ -104,6 +104,12 @@ void rofi_quit_main_loop(void); */ Mode *rofi_collect_modes_search(const char *name); +/** + * Query the configure file completer. + * + * @returns the Mode that can be used for file completion or NULL when not + * found. + */ const Mode *rofi_get_completer(void); /** Reset terminal */ #define color_reset "\033[0m" diff --git a/include/view.h b/include/view.h index 31373340..783d6f4a 100644 --- a/include/view.h +++ b/include/view.h @@ -356,6 +356,17 @@ void rofi_view_ellipsize_listview(RofiViewState *state, */ gboolean rofi_set_im_window_pos(int new_x, int new_y); +/** + * @param wid to test. + * @param action the action done. + * @param x [unused] + * @param y [unsued] + * @param user_data + * + * textbux widget trigger action function. + * + * @return the result. + */ WidgetTriggerActionResult textbox_button_trigger_action( widget *wid, MouseBindingMouseDefaultAction action, G_GNUC_UNUSED gint x, G_GNUC_UNUSED gint y, G_GNUC_UNUSED void *user_data); diff --git a/source/modes/filebrowser.c b/source/modes/filebrowser.c index b32d83f0..47df4588 100644 --- a/source/modes/filebrowser.c +++ b/source/modes/filebrowser.c @@ -50,6 +50,7 @@ #include "rofi-icon-fetcher.h" #define FILEBROWSER_CACHE_FILE "rofi3.filebrowsercache" +/** The default program used to open the file. */ #define DEFAULT_OPEN "xdg-open" #if defined(__APPLE__) @@ -712,24 +713,22 @@ ModeMode file_browser_mode_completer(Mode *sw, int mretv, char **input, } #endif -Mode file_browser_mode = { - .display_name = NULL, - .abi_version = ABI_VERSION, - .name = "filebrowser", - .cfg_name_key = "display-filebrowser", - ._init = file_browser_mode_init, - ._get_num_entries = file_browser_mode_get_num_entries, - ._result = file_browser_mode_result, - ._destroy = file_browser_mode_destroy, - ._token_match = file_browser_token_match, - ._get_display_value = _get_display_value, - ._get_icon = _get_icon, - ._get_message = _get_message, - ._get_completion = _get_completion, - ._preprocess_input = NULL, - ._create = create_new_file_browser, - ._completer_result = file_browser_mode_completer, - .private_data = NULL, - .free = NULL, - .type = MODE_TYPE_SWITCHER|MODE_TYPE_COMPLETER -}; +Mode file_browser_mode = {.display_name = NULL, + .abi_version = ABI_VERSION, + .name = "filebrowser", + .cfg_name_key = "display-filebrowser", + ._init = file_browser_mode_init, + ._get_num_entries = file_browser_mode_get_num_entries, + ._result = file_browser_mode_result, + ._destroy = file_browser_mode_destroy, + ._token_match = file_browser_token_match, + ._get_display_value = _get_display_value, + ._get_icon = _get_icon, + ._get_message = _get_message, + ._get_completion = _get_completion, + ._preprocess_input = NULL, + ._create = create_new_file_browser, + ._completer_result = file_browser_mode_completer, + .private_data = NULL, + .free = NULL, + .type = MODE_TYPE_SWITCHER | MODE_TYPE_COMPLETER}; diff --git a/source/modes/recursivebrowser.c b/source/modes/recursivebrowser.c index 6c7a5b4f..3e010b41 100644 --- a/source/modes/recursivebrowser.c +++ b/source/modes/recursivebrowser.c @@ -52,6 +52,7 @@ #include "rofi-icon-fetcher.h" +/** The default program used to open the file. */ #define DEFAULT_OPEN "xdg-open" /** diff --git a/source/view.c b/source/view.c index e685f101..143b5af9 100644 --- a/source/view.c +++ b/source/view.c @@ -155,8 +155,11 @@ struct { X11CursorType cursor_type; /** Entry box */ gboolean entry_history_enable; + /** Array with history entriy input. */ EntryHistoryIndex *entry_history; + /** Length of the array */ gssize entry_history_length; + /** The current index being viewed. */ gssize entry_history_index; } CacheState = {.main_window = XCB_WINDOW_NONE, .fake_bg = NULL,