diff options
author | Dave Davenport <qball@blame.services> | 2021-08-19 13:34:01 +0200 |
---|---|---|
committer | Dave Davenport <qball@blame.services> | 2021-08-19 13:34:01 +0200 |
commit | 8d0dd01997c1038623c5b5f71023746d8b42e68d (patch) | |
tree | 5e70f15f20cd4108ec88abcb4932c0969dd1a613 | |
parent | c5246a6bc7c5d661663640b229d913c021653117 (diff) |
Cleanup, update header files using clang-tidy.
-rw-r--r-- | include/dialogs/combi.h | 1 | ||||
-rw-r--r-- | include/dialogs/dialogs.h | 12 | ||||
-rw-r--r-- | include/dialogs/dmenu.h | 4 | ||||
-rw-r--r-- | include/dialogs/dmenuscriptshared.h | 35 | ||||
-rw-r--r-- | include/dialogs/run.h | 2 | ||||
-rw-r--r-- | include/dialogs/ssh.h | 4 | ||||
-rw-r--r-- | include/helper-theme.h | 12 | ||||
-rw-r--r-- | include/history.h | 9 | ||||
-rw-r--r-- | include/keyb.h | 228 | ||||
-rw-r--r-- | include/mode-private.h | 127 | ||||
-rw-r--r-- | include/mode.h | 126 | ||||
-rw-r--r-- | include/rofi-icon-fetcher.h | 23 | ||||
-rw-r--r-- | include/rofi.h | 56 | ||||
-rw-r--r-- | include/settings.h | 270 | ||||
-rw-r--r-- | include/theme.h | 168 | ||||
-rw-r--r-- | include/view-internal.h | 173 | ||||
-rw-r--r-- | include/view.h | 110 | ||||
-rw-r--r-- | include/widgets/box.h | 12 | ||||
-rw-r--r-- | include/widgets/container.h | 4 | ||||
-rw-r--r-- | include/widgets/icon.h | 6 | ||||
-rw-r--r-- | include/widgets/listview.h | 73 | ||||
-rw-r--r-- | include/widgets/scrollbar.h | 27 | ||||
-rw-r--r-- | include/widgets/textbox.h | 191 | ||||
-rw-r--r-- | include/widgets/widget-internal.h | 154 | ||||
-rw-r--r-- | include/widgets/widget.h | 144 | ||||
-rw-r--r-- | include/xcb-internal.h | 47 | ||||
-rw-r--r-- | include/xcb.h | 126 | ||||
-rw-r--r-- | include/xrmoptions.h | 55 |
28 files changed, 1126 insertions, 1073 deletions
diff --git a/include/dialogs/combi.h b/include/dialogs/combi.h index 9b583f75..2fe39b3b 100644 --- a/include/dialogs/combi.h +++ b/include/dialogs/combi.h @@ -27,6 +27,7 @@ #ifndef ROFI_DIALOG_COMBI_H #define ROFI_DIALOG_COMBI_H +#include "mode.h" /** * @defgroup COBIMode Combi diff --git a/include/dialogs/dialogs.h b/include/dialogs/dialogs.h index 6084711c..09734f6b 100644 --- a/include/dialogs/dialogs.h +++ b/include/dialogs/dialogs.h @@ -35,13 +35,13 @@ * List of available dialogs. */ -#include "dialogs/run.h" -#include "dialogs/ssh.h" -#include "dialogs/drun.h" +#include "dialogs/combi.h" #include "dialogs/dmenu.h" +#include "dialogs/drun.h" +#include "dialogs/filebrowser.h" +#include "dialogs/help-keys.h" +#include "dialogs/run.h" #include "dialogs/script.h" +#include "dialogs/ssh.h" #include "dialogs/window.h" -#include "dialogs/combi.h" -#include "dialogs/help-keys.h" -#include "dialogs/filebrowser.h" #endif // ROFI_DIALOGS_DIALOGS_H diff --git a/include/dialogs/dmenu.h b/include/dialogs/dmenu.h index 577070d9..c816fe2c 100644 --- a/include/dialogs/dmenu.h +++ b/include/dialogs/dmenu.h @@ -40,12 +40,12 @@ * * @returns TRUE if script was successful. */ -int dmenu_switcher_dialog ( void ); +int dmenu_switcher_dialog(void); /** * Print dmenu mode commandline options to stdout, for use in help menu. */ -void print_dmenu_options ( void ); +void print_dmenu_options(void); /**@}*/ #endif // ROFI_DIALOG_DMENU_H diff --git a/include/dialogs/dmenuscriptshared.h b/include/dialogs/dmenuscriptshared.h index 951d2b55..27247fa5 100644 --- a/include/dialogs/dmenuscriptshared.h +++ b/include/dialogs/dmenuscriptshared.h @@ -1,22 +1,25 @@ #ifndef ROFI_DIALOGS_DMENU_SCRIPT_SHARED_H #define ROFI_DIALOGS_DMENU_SCRIPT_SHARED_H -typedef struct -{ - /** Entry content. (visible part) */ - char *entry; - /** Icon name to display. */ - char *icon_name; - /** Async icon fetch handler. */ - uint32_t icon_fetch_uid; - /** Hidden meta keywords. */ - char *meta; +#include <glib.h> +#include <mode.h> +#include <stdint.h> - /** info */ - char *info; +typedef struct { + /** Entry content. (visible part) */ + char *entry; + /** Icon name to display. */ + char *icon_name; + /** Async icon fetch handler. */ + uint32_t icon_fetch_uid; + /** Hidden meta keywords. */ + char *meta; - /** non-selectable */ - gboolean nonselectable; + /** info */ + char *info; + + /** non-selectable */ + gboolean nonselectable; } DmenuScriptEntry; /** * @param sw Unused @@ -26,5 +29,7 @@ typedef struct * * Updates entry with the parsed values from buffer. */ -void dmenuscript_parse_entry_extras ( G_GNUC_UNUSED Mode *sw, DmenuScriptEntry *entry, char *buffer, size_t length ); +void dmenuscript_parse_entry_extras(G_GNUC_UNUSED Mode *sw, + DmenuScriptEntry *entry, char *buffer, + size_t length); #endif // ROFI_DIALOGS_DMENU_SCRIPT_SHARED_H diff --git a/include/dialogs/run.h b/include/dialogs/run.h index bec0d39a..015f5054 100644 --- a/include/dialogs/run.h +++ b/include/dialogs/run.h @@ -28,6 +28,8 @@ #ifndef ROFI_DIALOG_RUN_H #define ROFI_DIALOG_RUN_H +#include "mode.h" + /** * @defgroup RUNMode Run * @ingroup MODES diff --git a/include/dialogs/ssh.h b/include/dialogs/ssh.h index ab95022b..6cb892a6 100644 --- a/include/dialogs/ssh.h +++ b/include/dialogs/ssh.h @@ -33,8 +33,8 @@ * @ingroup MODES * * SSH Mode, returns a list of known SSH hosts the user can log into. - * It does this by parsing the SSH config file and optional the known host and host list - * It also keeps history of the last chosen hosts. + * It does this by parsing the SSH config file and optional the known host and + * host list It also keeps history of the last chosen hosts. * * This mode uses the following options from the #config object: * * #Settings::ssh_command diff --git a/include/helper-theme.h b/include/helper-theme.h index 4ee69b14..07c0cf9f 100644 --- a/include/helper-theme.h +++ b/include/helper-theme.h @@ -27,8 +27,8 @@ #ifndef ROFI_HELPER_THEME_H #define ROFI_HELPER_THEME_H -#include <pango/pango.h> #include "theme.h" +#include <pango/pango.h> /** * @defgroup HELPERS Helpers * @{ @@ -39,11 +39,15 @@ * @param input The input string to find the matches on * @param retv The Attribute list to update with matches * - * Creates a set of pango attributes highlighting the matches found in the input string. + * Creates a set of pango attributes highlighting the matches found in the input + * string. * * @returns the updated retv list. */ -PangoAttrList *helper_token_match_get_pango_attr ( RofiHighlightColorStyle th, rofi_int_matcher **tokens, const char *input, PangoAttrList *retv ); +PangoAttrList *helper_token_match_get_pango_attr(RofiHighlightColorStyle th, + rofi_int_matcher **tokens, + const char *input, + PangoAttrList *retv); /** * @param pfd Pango font description to validate. @@ -51,6 +55,6 @@ PangoAttrList *helper_token_match_get_pango_attr ( RofiHighlightColorStyle th, r * * @returns true if font is valid. */ -gboolean helper_validate_font ( PangoFontDescription *pfd, const char *font ); +gboolean helper_validate_font(PangoFontDescription *pfd, const char *font); /** @} */ #endif // ROFI_HELPER_THEME_H diff --git a/include/history.h b/include/history.h index 604e2943..eea98f65 100644 --- a/include/history.h +++ b/include/history.h @@ -48,7 +48,8 @@ * Sets the entry in the history, if it exists its use-count is incremented. * */ -void history_set ( const char *filename, const char *entry ) __attribute__( ( nonnull ) ); +void history_set(const char *filename, const char *entry) + __attribute__((nonnull)); /** * @param filename The filename of the history cache. @@ -56,7 +57,8 @@ void history_set ( const char *filename, const char *entry ) __attribute__( ( no * * Removes the entry from the history. */ -void history_remove ( const char *filename, const char *entry ) __attribute__( ( nonnull ) ); +void history_remove(const char *filename, const char *entry) + __attribute__((nonnull)); /** * @param filename The filename of the history cache. @@ -65,7 +67,8 @@ void history_remove ( const char *filename, const char *entry ) __attribute__( ( * Gets the entries in the list (in order of usage) * @returns a list of entries length long. (and NULL terminated). */ -char ** history_get_list ( const char *filename, unsigned int * length ) __attribute__( ( nonnull ) ); +char **history_get_list(const char *filename, unsigned int *length) + __attribute__((nonnull)); /**@}*/ #endif // ROFI_HISTORY_H diff --git a/include/keyb.h b/include/keyb.h index 1cf33254..d6dc4c51 100644 --- a/include/keyb.h +++ b/include/keyb.h @@ -28,7 +28,8 @@ #ifndef ROFI_KEYB_H #define ROFI_KEYB_H -#include "nkutils-bindings.h" +#include <glib.h> +#include <nkutils-bindings.h> /** * @defgroup KEYB KeyboardBindings @@ -39,158 +40,153 @@ /** * List of all scopes the mouse can interact on. */ -typedef enum -{ - SCOPE_GLOBAL, - SCOPE_MOUSE_LISTVIEW, - SCOPE_MOUSE_LISTVIEW_ELEMENT, +typedef enum { + SCOPE_GLOBAL, + SCOPE_MOUSE_LISTVIEW, + SCOPE_MOUSE_LISTVIEW_ELEMENT, -#define SCOPE_MIN_FIXED SCOPE_MOUSE_EDITBOX - SCOPE_MOUSE_EDITBOX, - SCOPE_MOUSE_SCROLLBAR, - SCOPE_MOUSE_MODE_SWITCHER, -#define SCOPE_MAX_FIXED SCOPE_MOUSE_MODE_SWITCHER +#define SCOPE_MIN_FIXED SCOPE_MOUSE_EDITBOX + SCOPE_MOUSE_EDITBOX, + SCOPE_MOUSE_SCROLLBAR, + SCOPE_MOUSE_MODE_SWITCHER, +#define SCOPE_MAX_FIXED SCOPE_MOUSE_MODE_SWITCHER } BindingsScope; /** * List of all possible actions that can be triggered by a keybinding. */ -typedef enum -{ - /** Paste from primary clipboard */ - PASTE_PRIMARY = 1, - /** Paste from secondary clipboard */ - PASTE_SECONDARY, - /** Clear the entry box. */ - CLEAR_LINE, - /** Move to front of text */ - MOVE_FRONT, - /** Move to end of text */ - MOVE_END, - /** Move on word back */ - MOVE_WORD_BACK, - /** Move on word forward */ - MOVE_WORD_FORWARD, - /** Move character back */ - MOVE_CHAR_BACK, - /** Move character forward */ - MOVE_CHAR_FORWARD, - /** Remove previous word */ - REMOVE_WORD_BACK, - /** Remove next work */ - REMOVE_WORD_FORWARD, - /** Remove next character */ - REMOVE_CHAR_FORWARD, - /** Remove previous character */ - REMOVE_CHAR_BACK, - /** Remove till EOL */ - REMOVE_TO_EOL, - /** Remove till SOL */ - REMOVE_TO_SOL, - /** Accept the current selected entry */ - ACCEPT_ENTRY, - ACCEPT_ALT, - ACCEPT_CUSTOM, - ACCEPT_CUSTOM_ALT, - MODE_NEXT, - MODE_COMPLETE, - MODE_PREVIOUS, - TOGGLE_CASE_SENSITIVITY, - DELETE_ENTRY, - ROW_LEFT, - ROW_RIGHT, - ROW_UP, - ROW_DOWN, - ROW_TAB, - PAGE_PREV, - PAGE_NEXT, - ROW_FIRST, - ROW_LAST, - ROW_SELECT, - CANCEL, - CUSTOM_1, - CUSTOM_2, - CUSTOM_3, - CUSTOM_4, - CUSTOM_5, - CUSTOM_6, - CUSTOM_7, - CUSTOM_8, - CUSTOM_9, - CUSTOM_10, - CUSTOM_11, - CUSTOM_12, - CUSTOM_13, - CUSTOM_14, - CUSTOM_15, - CUSTOM_16, - CUSTOM_17, - CUSTOM_18, - CUSTOM_19, - SCREENSHOT, - CHANGE_ELLIPSIZE, - TOGGLE_SORT, - SELECT_ELEMENT_1, - SELECT_ELEMENT_2, - SELECT_ELEMENT_3, - SELECT_ELEMENT_4, - SELECT_ELEMENT_5, - SELECT_ELEMENT_6, - SELECT_ELEMENT_7, - SELECT_ELEMENT_8, - SELECT_ELEMENT_9, - SELECT_ELEMENT_10, +typedef enum { + /** Paste from primary clipboard */ + PASTE_PRIMARY = 1, + /** Paste from secondary clipboard */ + PASTE_SECONDARY, + /** Clear the entry box. */ + CLEAR_LINE, + /** Move to front of text */ + MOVE_FRONT, + /** Move to end of text */ + MOVE_END, + /** Move on word back */ + MOVE_WORD_BACK, + /** Move on word forward */ + MOVE_WORD_FORWARD, + /** Move character back */ + MOVE_CHAR_BACK, + /** Move character forward */ + MOVE_CHAR_FORWARD, + /** Remove previous word */ + REMOVE_WORD_BACK, + /** Remove next work */ + REMOVE_WORD_FORWARD, + /** Remove next character */ + REMOVE_CHAR_FORWARD, + /** Remove previous character */ + REMOVE_CHAR_BACK, + /** Remove till EOL */ + REMOVE_TO_EOL, + /** Remove till SOL */ + REMOVE_TO_SOL, + /** Accept the current selected entry */ + ACCEPT_ENTRY, + ACCEPT_ALT, + ACCEPT_CUSTOM, + ACCEPT_CUSTOM_ALT, + MODE_NEXT, + MODE_COMPLETE, + MODE_PREVIOUS, + TOGGLE_CASE_SENSITIVITY, + DELETE_ENTRY, + ROW_LEFT, + ROW_RIGHT, + ROW_UP, + ROW_DOWN, + ROW_TAB, + PAGE_PREV, + PAGE_NEXT, + ROW_FIRST, + ROW_LAST, + ROW_SELECT, + CANCEL, + CUSTOM_1, + CUSTOM_2, + CUSTOM_3, + CUSTOM_4, + CUSTOM_5, + CUSTOM_6, + CUSTOM_7, + CUSTOM_8, + CUSTOM_9, + CUSTOM_10, + CUSTOM_11, + CUSTOM_12, + CUSTOM_13, + CUSTOM_14, + CUSTOM_15, + CUSTOM_16, + CUSTOM_17, + CUSTOM_18, + CUSTOM_19, + SCREENSHOT, + CHANGE_ELLIPSIZE, + TOGGLE_SORT, + SELECT_ELEMENT_1, + SELECT_ELEMENT_2, + SELECT_ELEMENT_3, + SELECT_ELEMENT_4, + SELECT_ELEMENT_5, + SELECT_ELEMENT_6, + SELECT_ELEMENT_7, + SELECT_ELEMENT_8, + SELECT_ELEMENT_9, + SELECT_ELEMENT_10, } KeyBindingAction; /** * Actions mouse can take on the ListView. */ -typedef enum -{ - SCROLL_LEFT = 1, - SCROLL_RIGHT, - SCROLL_DOWN, - SCROLL_UP, +typedef enum { + SCROLL_LEFT = 1, + SCROLL_RIGHT, + SCROLL_DOWN, + SCROLL_UP, } MouseBindingListviewAction; /** * Actions mouse can take on the ListView element. */ -typedef enum -{ - SELECT_HOVERED_ENTRY = 1, - ACCEPT_HOVERED_ENTRY, - ACCEPT_HOVERED_CUSTOM, +typedef enum { + SELECT_HOVERED_ENTRY = 1, + ACCEPT_HOVERED_ENTRY, + ACCEPT_HOVERED_CUSTOM, } MouseBindingListviewElementAction; /** * Default mouse actions. */ -typedef enum -{ - MOUSE_CLICK_DOWN = 1, - MOUSE_CLICK_UP, - MOUSE_DCLICK_DOWN, - MOUSE_DCLICK_UP, +typedef enum { + MOUSE_CLICK_DOWN = 1, + MOUSE_CLICK_UP, + MOUSE_DCLICK_DOWN, + MOUSE_DCLICK_UP, } MouseBindingMouseDefaultAction; /** * Parse the keybindings. * This should be called after the setting system is initialized. */ -gboolean parse_keys_abe ( NkBindings *bindings ); +gboolean parse_keys_abe(NkBindings *bindings); /** * Setup the keybindings * This adds all the entries to the settings system. */ -void setup_abe ( void ); +void setup_abe(void); /** * @param name Don't have the name. * * @returns id, or UINT32_MAX if not found. */ -guint key_binding_get_action_from_name ( const char *name ); +guint key_binding_get_action_from_name(const char *name); /**@}*/ #endif // ROFI_KEYB_H diff --git a/include/mode-private.h b/include/mode-private.h index 6d2ff74e..1fd46b4a 100644 --- a/include/mode-private.h +++ b/include/mode-private.h @@ -31,27 +31,30 @@ G_BEGIN_DECLS /** ABI version to check if loaded plugin is compatible. */ -#define ABI_VERSION 0x00000006 +#define ABI_VERSION 0x00000006 /** * @param data Pointer to #Mode object. * * Mode free function. */ -typedef void ( *_mode_free )( Mode *data ); +typedef void (*_mode_free)(Mode *data); /** * @param sw The #Mode pointer * @param selected_line The selected line * @param state The state to display [out] - * @param attribute_list List of extra (pango) attribute to apply when displaying. [out][null] + * @param attribute_list List of extra (pango) attribute to apply when + * displaying. [out][null] * @param get_entry if it should only return the state * * Get the value for displaying. * * @return the string and state for displaying. */ -typedef char * ( *_mode_get_display_value )( const Mode *sw, unsigned int selected_line, int *state, GList **attribute_list, int get_entry ); +typedef char *(*_mode_get_display_value)(const Mode *sw, + unsigned int selected_line, int *state, + GList **attribute_list, int get_entry); /** * @param sw The #Mode pointer @@ -61,7 +64,9 @@ typedef char * ( *_mode_get_display_value )( const Mode *sw, unsigned int select * * @return Get the icon */ -typedef cairo_surface_t * ( *_mode_get_icon )( const Mode *sw, unsigned int selected_line, int height ); +typedef cairo_surface_t *(*_mode_get_icon)(const Mode *sw, + unsigned int selected_line, + int height); /** * @param sw The #Mode pointer @@ -71,7 +76,8 @@ typedef cairo_surface_t * ( *_mode_get_icon )( const Mode *sw, unsigned int sele * * @return Get the completion string */ -typedef char * ( *_mode_get_completion )( const Mode *sw, unsigned int selected_line ); +typedef char *(*_mode_get_completion)(const Mode *sw, + unsigned int selected_line); /** * @param tokens List of (input) tokens to match. @@ -84,7 +90,8 @@ typedef char * ( *_mode_get_completion )( const Mode *sw, unsigned int selected_ * * @returns 1 when it matches, 0 if not. */ -typedef int ( *_mode_token_match )( const Mode *data, rofi_int_matcher **tokens, unsigned int index ); +typedef int (*_mode_token_match)(const Mode *data, rofi_int_matcher **tokens, + unsigned int index); /** * @param sw The #Mode pointer @@ -93,7 +100,7 @@ typedef int ( *_mode_token_match )( const Mode *data, rofi_int_matcher **tokens, * * @returns TRUE is successful */ -typedef int ( *__mode_init )( Mode *sw ); +typedef int (*__mode_init)(Mode *sw); /** * @param sw The #Mode pointer @@ -102,7 +109,7 @@ typedef int ( *__mode_init )( Mode *sw ); * * @returns the number of entries */ -typedef unsigned int ( *__mode_get_num_entries )( const Mode *sw ); +typedef unsigned int (*__mode_get_num_entries)(const Mode *sw); /** * @param sw The #Mode pointer @@ -110,7 +117,7 @@ typedef unsigned int ( *__mode_get_num_entries )( const Mode *sw ); * Destroy the current mode. Still ready to restart. * */ -typedef void ( *__mode_destroy )( Mode *sw ); +typedef void (*__mode_destroy)(Mode *sw); /** * @param sw The #Mode pointer @@ -122,7 +129,8 @@ typedef void ( *__mode_destroy )( Mode *sw ); * * @returns the next action to take */ -typedef ModeMode ( *_mode_result )( Mode *sw, int menu_retv, char **input, unsigned int selected_line ); +typedef ModeMode (*_mode_result)(Mode *sw, int menu_retv, char **input, + unsigned int selected_line); /** * @param sw The #Mode pointer @@ -132,7 +140,7 @@ typedef ModeMode ( *_mode_result )( Mode *sw, int menu_retv, char **input, unsig * * @returns Entry stripped from markup for sorting */ -typedef char* ( *_mode_preprocess_input )( Mode *sw, const char *input ); +typedef char *(*_mode_preprocess_input)(Mode *sw, const char *input); /** * @param sw The #Mode pointer @@ -141,60 +149,59 @@ typedef char* ( *_mode_preprocess_input )( Mode *sw, const char *input ); * * @returns the (valid pango markup) message to display. */ -typedef char * ( *_mode_get_message )( const Mode *sw ); +typedef char *(*_mode_get_message)(const Mode *sw); /** * Structure defining a switcher. * It consists of a name, callback and if enabled * a textbox for the sidebar-mode. */ -struct rofi_mode -{ - /** Used for external plugins. */ - unsigned int abi_version; - /** Name (max 31 char long) */ - char *name; - char cfg_name_key[128]; - char *display_name; - - /** - * A switcher normally consists of the following parts: - */ - /** Initialize the Mode */ - __mode_init _init; - /** Destroy the switcher, e.g. free all its memory. */ - __mode_destroy _destroy; - /** Get number of entries to display. (unfiltered). */ - __mode_get_num_entries _get_num_entries; - /** Process the result of the user selection. */ - _mode_result _result; - /** Token match. */ - _mode_token_match _token_match; - /** Get the string to display for the entry. */ - _mode_get_display_value _get_display_value; - /** Get the icon for the entry. */ - _mode_get_icon _get_icon; - /** Get the 'completed' entry. */ - _mode_get_completion _get_completion; - - _mode_preprocess_input _preprocess_input; - - _mode_get_message _get_message; - - /** Pointer to private data. */ - void *private_data; - - /** - * Free SWitcher - * Only to be used when the switcher object itself is dynamic. - * And has data in `ed` - */ - _mode_free free; - /** Extra fields for script */ - void *ed; - - /** Module */ - GModule *module; +struct rofi_mode { + /** Used for external plugins. */ + unsigned int abi_version; + /** Name (max 31 char long) */ + char *name; + char cfg_name_key[128]; + char *display_name; + + /** + * A switcher normally consists of the following parts: + */ + /** Initialize the Mode */ + __mode_init _init; + /** Destroy the switcher, e.g. free all its memory. */ + __mode_destroy _destroy; + /** Get number of entries to display. (unfiltered). */ + __mode_get_num_entries _get_num_entries; + /** Process the result of the user selection. */ + _mode_result _result; + /** Token match. */ + _mode_token_match _token_match; + /** Get the string to display for the entry. */ + _mode_get_display_value _get_display_value; + /** Get the icon for the entry. */ + _mode_get_icon _get_icon; + /** Get the 'completed' entry. */ + _mode_get_completion _get_completion; + + _mode_preprocess_input _preprocess_input; + + _mode_get_message _get_message; + + /** Pointer to private data. */ + void *private_data; + + /** + * Free SWitcher + * Only to be used when the switcher object itself is dynamic. + * And has data in `ed` + */ + _mode_free free; + /** Extra fields for script */ + void *ed; + + /** Module */ + GModule *module; }; G_END_DECLS #endif // ROFI_MODE_PRIVATE_H diff --git a/include/mode.h b/include/mode.h index 513dd6ff..1931ac78 100644 --- a/include/mode.h +++ b/include/mode.h @@ -27,8 +27,8 @@ #ifndef ROFI_MODE_H #define ROFI_MODE_H -#include <cairo.h> #include "rofi-types.h" +#include <cairo.h> G_BEGIN_DECLS /** * @defgroup MODE Mode @@ -46,47 +46,45 @@ typedef struct rofi_mode Mode; /** * Enum used to sum the possible states of ROFI. */ -typedef enum -{ - /** Exit. */ - MODE_EXIT = 1000, - /** Skip to the next cycle-able dialog. */ - NEXT_DIALOG = 1001, - /** Reload current DIALOG */ - RELOAD_DIALOG = 1002, - /** Previous dialog */ - PREVIOUS_DIALOG = 1003, - /** Reloads the dialog and unset user input */ - RESET_DIALOG = 1004, +typedef enum { + /** Exit. */ + MODE_EXIT = 1000, + /** Skip to the next cycle-able dialog. */ + NEXT_DIALOG = 1001, + /** Reload current DIALOG */ + RELOAD_DIALOG = 1002, + /** Previous dialog */ + PREVIOUS_DIALOG = 1003, + /** Reloads the dialog and unset user input */ + RESET_DIALOG = 1004, } ModeMode; /** * State returned by the rofi window. */ -typedef enum -{ - /** Entry is selected. */ - MENU_OK = 0x00010000, - /** User canceled the operation. (e.g. pressed escape) */ - MENU_CANCEL = 0x00020000, - /** User requested a mode switch */ - MENU_NEXT = 0x00040000, - /** Custom (non-matched) input was entered. */ - MENU_CUSTOM_INPUT = 0x00080000, - /** User wanted to delete entry from history. */ - MENU_ENTRY_DELETE = 0x00100000, - /** User wants to jump to another switcher. */ - MENU_QUICK_SWITCH = 0x00200000, - /** User wants to jump to custom command. */ - MENU_CUSTOM_COMMAND = 0x00800000, - /** Go to the previous menu. */ - MENU_PREVIOUS = 0x00400000, - /** Go to the complete. */ - MENU_COMPLETE = 0x01000000, - /** Bindings specifics */ - MENU_CUSTOM_ACTION = 0x10000000, - /** Mask */ - MENU_LOWER_MASK = 0x0000FFFF +typedef enum { + /** Entry is selected. */ + MENU_OK = 0x00010000, + /** User canceled the operation. (e.g. pressed escape) */ + MENU_CANCEL = 0x00020000, + /** User requested a mode switch */ + MENU_NEXT = 0x00040000, + /** Custom (non-matched) input was entered. */ + MENU_CUSTOM_INPUT = 0x00080000, + /** User wanted to delete entry from history. */ + MENU_ENTRY_DELETE = 0x00100000, + /** User wants to jump to another switcher. */ + MENU_QUICK_SWITCH = 0x00200000, + /** User wants to jump to custom command. */ + MENU_CUSTOM_COMMAND = 0x00800000, + /** Go to the previous menu. */ + MENU_PREVIOUS = 0x00400000, + /** Go to the complete. */ + MENU_COMPLETE = 0x01000000, + /** Bindings specifics */ + MENU_CUSTOM_ACTION = 0x10000000, + /** Mask */ + MENU_LOWER_MASK = 0x0000FFFF } MenuReturn; /** @@ -96,14 +94,14 @@ typedef enum * * @returns FALSE if there was a failure, TRUE if successful */ -int mode_init ( Mode *mode ); +int mode_init(Mode *mode); /** * @param mode The mode to destroy * * Destroy the mode */ -void mode_destroy ( Mode *mode ); +void mode_destroy(Mode *mode); /** * @param mode The mode to query @@ -112,20 +110,24 @@ void mode_destroy ( Mode *mode ); * * @returns an unsigned int with the number of entries. */ -unsigned int mode_get_num_entries ( const Mode *mode ); +unsigned int mode_get_num_entries(const Mode *mode); /** * @param mode The mode to query * @param selected_line The entry to query * @param state The state of the entry [out] - * @param attribute_list List of extra (pango) attribute to apply when displaying. [out][null] + * @param attribute_list List of extra (pango) attribute to apply when + * displaying. [out][null] * @param get_entry If the should be returned. * - * Returns the string as it should be displayed for the entry and the state of how it should be displayed. + * Returns the string as it should be displayed for the entry and the state of + * how it should be displayed. * - * @returns allocated new string and state when get_entry is TRUE otherwise just the state. + * @returns allocated new string and state when get_entry is TRUE otherwise just + * the state. */ -char * mode_get_display_value ( const Mode *mode, unsigned int selected_line, int *state, GList **attribute_list, int get_entry ); +char *mode_get_display_value(const Mode *mode, unsigned int selected_line, + int *state, GList **attribute_list, int get_entry); /** * @param mode The mode to query @@ -136,17 +138,19 @@ char * mode_get_display_value ( const Mode *mode, unsigned int selected_line, in * * @returns allocated new cairo_surface_t if applicable */ -cairo_surface_t * mode_get_icon ( const Mode *mode, unsigned int selected_line, int height ); +cairo_surface_t *mode_get_icon(const Mode *mode, unsigned int selected_line, + int height); /** * @param mode The mode to query * @param selected_line The entry to query * - * Return a string that can be used for completion. It has should have no markup. + * Return a string that can be used for completion. It has should have no + * markup. * * @returns allocated string. */ -char * mode_get_completion ( const Mode *mode, unsigned int selected_line ); +char *mode_get_completio |