Cleanup, update header files using clang-tidy.

This commit is contained in:
Dave Davenport 2021-08-19 13:34:01 +02:00 committed by Dave Davenport
parent 23c48045b4
commit e5847ce0c5
28 changed files with 1101 additions and 1048 deletions

View File

@ -27,6 +27,7 @@
#ifndef ROFI_DIALOG_COMBI_H
#define ROFI_DIALOG_COMBI_H
#include "mode.h"
/**
* @defgroup COBIMode Combi

View File

@ -35,13 +35,13 @@
* List of available dialogs.
*/
#include "dialogs/run.h"
#include "dialogs/ssh.h"
#include "dialogs/drun.h"
#include "dialogs/dmenu.h"
#include "dialogs/script.h"
#include "dialogs/window.h"
#include "dialogs/combi.h"
#include "dialogs/help-keys.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"
#endif // ROFI_DIALOGS_DIALOGS_H

View File

@ -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

View File

@ -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

View File

@ -28,6 +28,8 @@
#ifndef ROFI_DIALOG_RUN_H
#define ROFI_DIALOG_RUN_H
#include "mode.h"
/**
* @defgroup RUNMode Run
* @ingroup MODES

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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;
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;
/**
* 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_preprocess_input _preprocess_input;
_mode_get_message _get_message;
_mode_get_message _get_message;
/** Pointer to private data. */
void *private_data;
/** 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;
/**
* 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;
/** Module */
GModule *module;
};
G_END_DECLS
#endif // ROFI_MODE_PRIVATE_H

View File

@ -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_completion(const Mode *mode, unsigned int selected_line);
/**
* @param mode The mode to query
@ -158,7 +162,8 @@ char * mode_get_completion ( const Mode *mode, unsigned int selected_line );
*
* @returns the next #ModeMode.
*/
ModeMode mode_result ( Mode *mode, int menu_retv, char **input, unsigned int selected_line );
ModeMode mode_result(Mode *mode, int menu_retv, char **input,
unsigned int selected_line);
/**
* @param mode The mode to query
@ -169,7 +174,8 @@ ModeMode mode_result ( Mode *mode, int menu_retv, char **input, unsigned int sel
*
* @returns TRUE if matches
*/
int mode_token_match ( const Mode *mode, rofi_int_matcher **tokens, unsigned int selected_line );
int mode_token_match(const Mode *mode, rofi_int_matcher **tokens,
unsigned int selected_line);
/**
* @param mode The mode to query
@ -178,14 +184,14 @@ int mode_token_match ( const Mode *mode, rofi_int_matcher **tokens, unsigned int
*
* @returns the name of the mode.
*/
const char * mode_get_name ( const Mode *mode );
const char *mode_get_name(const Mode *mode);
/**
* @param mode The mode to query
*
* Free the resources allocated for this mode.
*/
void mode_free ( Mode **mode );
void mode_free(Mode **mode);
/**
* @param mode The mode to query
@ -193,7 +199,7 @@ void mode_free ( Mode **mode );
* Helper functions for mode.
* Get the private data object.
*/
void *mode_get_private_data ( const Mode *mode );
void *mode_get_private_data(const Mode *mode);
/**
* @param mode The mode to query
@ -202,7 +208,7 @@ void *mode_get_private_data ( const Mode *mode );
* Helper functions for mode.
* Set the private data object.
*/
void mode_set_private_data ( Mode *mode, void *pd );
void mode_set_private_data(Mode *mode, void *pd);
/**
* @param mode The mode to query
@ -211,14 +217,15 @@ void mode_set_private_data ( Mode *mode, void *pd );
*
* @return the user visible name of the mode
*/
const char *mode_get_display_name ( const Mode *mode );
const char *mode_get_display_name(const Mode *mode);
/**
* @param mode The mode to query
*
* Should be called once for each mode. This adds the display-name configuration option for the mode.
* Should be called once for each mode. This adds the display-name configuration
* option for the mode.
*/
void mode_set_config ( Mode *mode );
void mode_set_config(Mode *mode);
/**
* @param mode The mode to query
@ -229,16 +236,17 @@ void mode_set_config ( Mode *mode );
*
* @returns a newly allocated string
*/
char * mode_preprocess_input ( Mode *mode, const char *input );
char *mode_preprocess_input(Mode *mode, const char *input);
/**
* @param mode The mode to query
*
* Query the mode for a user display.
*
* @return a new allocated (valid pango markup) message to display (user should free).
* @return a new allocated (valid pango markup) message to display (user should
* free).
*/
char *mode_get_message ( const Mode *mode );
char *mode_get_message(const Mode *mode);
/**@}*/
G_END_DECLS
#endif

View File

@ -1,9 +1,9 @@
#ifndef ROFI_ICON_FETCHER_H
#define ROFI_ICON_FETCHER_H
#include <cairo.h>
#include <glib.h>
#include <stdint.h>
#include <cairo.h>
/**
* @defgroup ICONFETCHER IconFetcher
@ -16,25 +16,26 @@
/**
* Initialize the icon fetcher.
*/
void rofi_icon_fetcher_init ( void );
void rofi_icon_fetcher_init(void);
/**
* Destroy and free the memory used by the icon fetcher.
*/
void rofi_icon_fetcher_destroy ( void );
void rofi_icon_fetcher_destroy(void);
/**
* @param name The name of the icon to fetch.
* @param size The size of the icon to fetch.
*
* Query the icon-theme for icon with name and size.
* The returned icon will be the best match for the requested size, it should still be resized to the actual size.
* The returned icon will be the best match for the requested size, it should
* still be resized to the actual size.
*
* name can also be a full path, if prefixed with file://.
*
* @returns the uid identifying the request.
*/
uint32_t rofi_icon_fetcher_query ( const char *name, const int size );
uint32_t rofi_icon_fetcher_query(const char *name, const int size);
/**
* @param name The name of the icon to fetch.
@ -42,14 +43,16 @@ uint32_t rofi_icon_fetcher_query ( const char *name, const int size );
* @param hsize The height of the icon to fetch.
*
* Query the icon-theme for icon with name and size.
* The returned icon will be the best match for the requested size, it should still be resized to the actual size.
* For icons it will take the min of wsize and hsize.
* The returned icon will be the best match for the requested size, it should
* still be resized to the actual size. For icons it will take the min of wsize
* and hsize.
*
* name can also be a full path, if prefixed with file://.
*
* @returns the uid identifying the request.
*/
uint32_t rofi_icon_fetcher_query_advanced ( const char *name, const int wsize, const int hsize );
uint32_t rofi_icon_fetcher_query_advanced(const char *name, const int wsize,
const int hsize);
/**
* @param uid The unique id representing the matching request.
@ -58,7 +61,7 @@ uint32_t rofi_icon_fetcher_query_advanced ( const char *name, const int wsize, c
*
* @returns the surface with the icon, NULL when not found.
*/
cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid );
cairo_surface_t *rofi_icon_fetcher_get(const uint32_t uid);
/**
* @param path the image path to check.
@ -67,6 +70,6 @@ cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid );
*
* @returns true if image, false otherwise.
*/
gboolean rofi_icon_fetcher_file_is_image ( const char * const path );
gboolean rofi_icon_fetcher_file_is_image(const char *const path);
/** @} */
#endif // ROFI_ICON_FETCHER_H

View File

@ -27,15 +27,15 @@
#ifndef ROFI_MAIN_H
#define ROFI_MAIN_H
#include <xcb/xcb.h>
#include <xkbcommon/xkbcommon.h>
#include <glib.h>
#include <string.h>
#include <stdlib.h>
#include "rofi-types.h"
#include "keyb.h"
#include "mode.h"
#include "rofi-types.h"
#include "view.h"
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <xcb/xcb.h>
#include <xkbcommon/xkbcommon.h>
/**
* @defgroup Main Main
@ -52,62 +52,64 @@ extern const char *cache_dir;
*
* @returns the number of enabled modi.
*/
unsigned int rofi_get_num_enabled_modi ( void );
unsigned int rofi_get_num_enabled_modi(void);
/**
* @param index The mode to return. (should be smaller then rofi_get_num_enabled_mode)
* @param index The mode to return. (should be smaller then
* rofi_get_num_enabled_mode)
*
* Get an enabled mode handle.
*
* @returns a Mode handle.
*/
const Mode * rofi_get_mode ( unsigned int index );
const Mode *rofi_get_mode(unsigned int index);
/**
* @param str A GString with an error message to display.
*
* Queue an error.
*/
void rofi_add_error_message ( GString *str );
void rofi_add_error_message(GString *str);
void rofi_clear_error_messages ( void );
void rofi_clear_error_messages(void);
/**
* @param code the code to return
*
* Return value are used for integrating dmenu rofi in scripts.
* This function sets the code that rofi will return on exit.
*/
void rofi_set_return_code ( int code );
void rofi_set_return_code(int code);
void rofi_quit_main_loop ( void );
void rofi_quit_main_loop(void);
/**
* @param name Search for mode with this name.
*
* @return returns Mode * when found, NULL if not.
*/
Mode * rofi_collect_modi_search ( const char *name );
Mode *rofi_collect_modi_search(const char *name);
/** Reset terminal */
#define color_reset "\033[0m"
#define color_reset "\033[0m"
/** Set terminal text bold */
#define color_bold "\033[1m"
#define color_bold "\033[1m"
/** Set terminal text italic */
#define color_italic "\033[2m"
#define color_italic "\033[2m"
/** Set terminal foreground text green */
#define color_green "\033[0;32m"
#define color_green "\033[0;32m"
/** Set terminal foreground text red */
#define color_red "\033[0;31m"
#define color_red "\033[0;31m"
/** Appends instructions on how to report an error. */
#define ERROR_MSG( a ) a "\n" \
"If you suspect this is caused by a bug in rofi,\n" \
"please report the following information to rofi's github page:\n" \
" * The generated commandline output when the error occurred.\n" \
" * Output of -dump-xresource\n" \
" * Steps to reproduce\n" \
" * The version of rofi you are running\n\n" \
#define ERROR_MSG(a) \
a "\n" \
"If you suspect this is caused by a bug in rofi,\n" \
"please report the following information to rofi's github page:\n" \
" * The generated commandline output when the error occurred.\n" \
" * Output of -dump-xresource\n" \
" * Steps to reproduce\n" \
" * The version of rofi you are running\n\n" \
" <i>https://github.com/davatorium/rofi/</i>"
/** Indicates if ERROR_MSG uses pango markup */
#define ERROR_MSG_MARKUP TRUE
#define ERROR_MSG_MARKUP TRUE
/**@}*/
#endif

View File

@ -35,157 +35,151 @@
*
* @ingroup CONFIGURATION
*/
typedef enum
{
MM_NORMAL = 0,
MM_REGEX = 1,
MM_GLOB = 2,
MM_FUZZY = 3,
MM_PREFIX = 4
typedef enum {
MM_NORMAL = 0,
MM_REGEX = 1,
MM_GLOB = 2,
MM_FUZZY = 3,
MM_PREFIX = 4
} MatchingMethod;
/**
* Possible sorting methods for listview.
*/
typedef enum
{
SORT_NORMAL = 0,
SORT_FZF = 1
} SortingMethod;
typedef enum { SORT_NORMAL = 0, SORT_FZF = 1 } SortingMethod;
/**
* Settings structure holding all (static) configurable options.
* @ingroup CONFIGURATION
*/
typedef struct
{
/** List of enabled modi */
char *modi;
/** Font string (pango format) */
char * menu_font;
typedef struct {
/** List of enabled modi */
char *modi;
/** Font string (pango format) */
char *menu_font;
/** Whether to load and show icons */
gboolean show_icons;
/** Whether to load and show icons */
gboolean show_icons;
/** Terminal to use */
char * terminal_emulator;
/** SSH client to use */
char * ssh_client;
/** Command to execute when ssh session is selected */
char * ssh_command;
/** Command for executing an application */
char * run_command;
/** Command for executing an application in a terminal */
char * run_shell_command;
/** Command for listing executables */
char * run_list_command;
/** Command for window */
char * window_command;
/** Window fields to match in window mode */
char * window_match_fields;
/** Theme for icons */
char * icon_theme;
/** Terminal to use */
char *terminal_emulator;
/** SSH client to use */
char *ssh_client;
/** Command to execute when ssh session is selected */
char *ssh_command;
/** Command for executing an application */
char *run_command;
/** Command for executing an application in a terminal */
char *run_shell_command;
/** Command for listing executables */
char *run_list_command;
/** Command for window */
char *window_command;
/** Window fields to match in window mode */
char *window_match_fields;
/** Theme for icons */
char *icon_theme;
/** Windows location/gravity */
WindowLocation location;
/** Y offset */
int y_offset;
/** X offset */
int x_offset;
/** Always should config.menu_lines lines, even if less lines are available */
unsigned int fixed_num_lines;
/** Do not use history */
unsigned int disable_history;
/** Programs ignored for history */
char * ignored_prefixes;
/** Toggle to enable sorting. */
unsigned int sort;
/** Sorting method. */
SortingMethod sorting_method_enum;
/** Sorting method. */
char * sorting_method;
/** Windows location/gravity */
WindowLocation location;
/** Y offset */
int y_offset;
/** X offset */
int x_offset;
/** Always should config.menu_lines lines, even if less lines are available */
unsigned int fixed_num_lines;
/** Do not use history */
unsigned int disable_history;
/** Programs ignored for history */
char *ignored_prefixes;
/** Toggle to enable sorting. */
unsigned int sort;
/** Sorting method. */
SortingMethod sorting_method_enum;
/** Sorting method. */
char *sorting_method;
/** Desktop entries to match in drun */
char * drun_match_fields;
/** Only show entries in this category */
char * drun_categories;
/** Desktop entry show actions */
unsigned int drun_show_actions;
/** Desktop format display */
char * drun_display_format;
/** Desktop Link launch command */
char * drun_url_launcher;
/** Desktop entries to match in drun */
char *drun_match_fields;
/** Only show entries in this category */
char *drun_categories;
/** Desktop entry show actions */
unsigned int drun_show_actions;
/** Desktop format display */
char *drun_display_format;
/** Desktop Link launch command */
char *drun_url_launcher;
/** Search case sensitivity */
unsigned int case_sensitive;
/** Cycle through in the element list */
unsigned int cycle;
/** Height of an element in number of rows */
int element_height;
/** Sidebar mode, show the modi */
unsigned int sidebar_mode;
/** Mouse hover automatically selects */
gboolean hover_select;
/** Lazy filter limit. */
unsigned int lazy_filter_limit;
/** Auto select. */
unsigned int auto_select;
/** Hosts file parsing */
unsigned int parse_hosts;
/** Knonw_hosts file parsing */
unsigned int parse_known_hosts;
/** Combi Modes */
char *combi_modi;
char *matching;
MatchingMethod matching_method;
unsigned int tokenize;
/** Monitors */
char *monitor;
/** filter */
char *filter;
/** dpi */
int dpi;
/** Number threads (1 to disable) */
unsigned int threads;
unsigned int scroll_method;
/** Search case sensitivity */
unsigned int case_sensitive;
/** Cycle through in the element list */
unsigned int cycle;
/** Height of an element in number of rows */
int element_height;
/** Sidebar mode, show the modi */
unsigned int sidebar_mode;
/** Mouse hover automatically selects */
gboolean hover_select;
/** Lazy filter limit. */
unsigned int lazy_filter_limit;
/** Auto select. */
unsigned int auto_select;
/** Hosts file parsing */
unsigned int parse_hosts;
/** Knonw_hosts file parsing */
unsigned int parse_known_hosts;
/** Combi Modes */
char *combi_modi;
char *matching;
MatchingMethod matching_method;
unsigned int tokenize;
/** Monitors */
char *monitor;
/** filter */
char *filter;
/** dpi */
int dpi;
/** Number threads (1 to disable) */
unsigned int threads;
unsigned int scroll_method;
char *window_format;
/** Click outside the window to exit */
int click_to_exit;
char *window_format;
/** Click outside the window to exit */
int click_to_exit;
char *theme;
/** Path where plugins can be found. */
char * plugin_path;
char *theme;
/** Path where plugins can be found. */
char *plugin_path;
/** Maximum history length per mode. */
unsigned int max_history_size;
gboolean combi_hide_mode_prefix;
/** Maximum history length per mode. */
unsigned int max_history_size;
gboolean combi_hide_mode_prefix;
char matching_negate_char;
char matching_negate_char;
/** Cache directory. */
char *cache_dir;
/** Cache directory. */
char *cache_dir;
/** Window Thumbnails */
gboolean window_thumbnail;
/** Window Thumbnails */
gboolean window_thumbnail;
/** drun cache */
gboolean drun_use_desktop_cache;
gboolean drun_reload_desktop_cache;
/** drun cache */
gboolean drun_use_desktop_cache;
gboolean drun_reload_desktop_cache;
/** Benchmark */
gboolean benchmark_ui;
/** Benchmark */
gboolean benchmark_ui;
gboolean normalize_match;
/** Steal focus */
gboolean steal_focus;
/** fallback icon */
char *application_fallback_icon;
gboolean normalize_match;
/** Steal focus */
gboolean steal_focus;
/** fallback icon */
char *application_fallback_icon;
} Settings;
#define DEFAULT_MENU_LINES 15
#define DEFAULT_MENU_LINES 15
#define DEFAULT_MENU_COLUMNS 1
#define DEFAULT_MENU_WIDTH 50.0f
#define DEFAULT_MENU_WIDTH 50.0f
/** Global Settings structure. */
extern Settings config;

View File

@ -27,59 +27,56 @@
#ifndef THEME_H
#define THEME_H
#include <glib.h>
#include <cairo.h>
#include <widgets/widget.h>
#include "rofi-types.h"
#include <cairo.h>
#include <glib.h>
#include <widgets/widget.h>
/**
* Describe the media constraint type.
*/
typedef enum
{
/** Minimum width constraint. */
THEME_MEDIA_TYPE_MIN_WIDTH,
/** Maximum width constraint. */
THEME_MEDIA_TYPE_MAX_WIDTH,
/** Minimum height constraint. */
THEME_MEDIA_TYPE_MIN_HEIGHT,
/** Maximum height constraint. */
THEME_MEDIA_TYPE_MAX_HEIGHT,
/** Monitor id constraint. */
THEME_MEDIA_TYPE_MON_ID,
/** Minimum aspect ratio constraint. */
THEME_MEDIA_TYPE_MIN_ASPECT_RATIO,
/** Maximum aspect ratio constraint. */
THEME_MEDIA_TYPE_MAX_ASPECT_RATIO,
/** Invalid entry. */
THEME_MEDIA_TYPE_INVALID,
typedef enum {
/** Minimum width constraint. */
THEME_MEDIA_TYPE_MIN_WIDTH,
/** Maximum width constraint. */
THEME_MEDIA_TYPE_MAX_WIDTH,
/** Minimum height constraint. */
THEME_MEDIA_TYPE_MIN_HEIGHT,
/** Maximum height constraint. */
THEME_MEDIA_TYPE_MAX_HEIGHT,
/** Monitor id constraint. */
THEME_MEDIA_TYPE_MON_ID,
/** Minimum aspect ratio constraint. */
THEME_MEDIA_TYPE_MIN_ASPECT_RATIO,
/** Maximum aspect ratio constraint. */
THEME_MEDIA_TYPE_MAX_ASPECT_RATIO,
/** Invalid entry. */
THEME_MEDIA_TYPE_INVALID,
} ThemeMediaType;
/**
* Theme Media description.
*/
typedef struct ThemeMedia
{
ThemeMediaType type;
double value;
typedef struct ThemeMedia {
ThemeMediaType type;
double value;
} ThemeMedia;
/**
* ThemeWidget.
*/
typedef struct ThemeWidget
{
int set;
char *name;
typedef struct ThemeWidget {
int set;
char *name;
unsigned int num_widgets;
struct ThemeWidget **widgets;
unsigned int num_widgets;
struct ThemeWidget **widgets;
ThemeMedia *media;
ThemeMedia *media;
GHashTable *properties;
GHashTable *properties;
struct ThemeWidget *parent;
struct ThemeWidget *parent;
} ThemeWidget;
/**
@ -102,15 +99,16 @@ extern ThemeWidget *rofi_configuration;
*
* @returns handle to the new entry.
*/
ThemeWidget *rofi_theme_find_or_create_name ( ThemeWidget *base, const char *name );
ThemeWidget *rofi_theme_find_or_create_name(ThemeWidget *base,
const char *name);
/**
* @param widget The widget handle.
*
* Print out the widget to the commandline.
*/
void rofi_theme_print ( ThemeWidget *widget );
void rofi_theme_print_index ( ThemeWidget *widget, int index );
void rofi_theme_print(ThemeWidget *widget);
void rofi_theme_print_index(ThemeWidget *widget, int index);
/**
* @param type The type of the property to create.
@ -119,27 +117,27 @@ void rofi_theme_print_index ( ThemeWidget *widget, int index );
*
* @returns a new property.
*/
Property *rofi_theme_property_create ( PropertyType type );
Property *rofi_theme_property_create(PropertyType type);
/**
* @param p The property to free.
*
* Free the content of the property.
*/
void rofi_theme_property_free ( Property *p );
void rofi_theme_property_free(Property *p);
/**
* @param p The property to free.
*
* @returns a copy of p
*/
Property* rofi_theme_property_copy ( const Property *p );
Property *rofi_theme_property_copy(const Property *p);
/**
* @param widget
*
* Free the widget and alll children.
*/
void rofi_theme_free ( ThemeWidget *widget );
void rofi_theme_free(ThemeWidget *widget);
/**
* @param file filename to parse.
@ -148,7 +146,7 @@ void rofi_theme_free ( ThemeWidget *widget );
*
* @returns returns TRUE when error.
*/
gboolean rofi_theme_parse_file ( const char *file );
gboolean rofi_theme_parse_file(const char *file);
/**
* @param string to parse.
@ -157,7 +155,7 @@ gboolean rofi_theme_parse_file ( const char *file );
*
* @returns returns TRUE when error.
*/
gboolean rofi_theme_parse_string ( const char *string );
gboolean rofi_theme_parse_string(const char *string);
/**
* @param widget The widget handle.
@ -165,7 +163,7 @@ gboolean rofi_theme_parse_string ( const char *string );
*
* Merge properties with widgets current property.
*/
void rofi_theme_widget_add_properties ( ThemeWidget *widget, GHashTable *table );
void rofi_theme_widget_add_properties(ThemeWidget *widget, GHashTable *table);
/**
* Public API
@ -180,7 +178,8 @@ void rofi_theme_widget_add_properties ( ThemeWidget *widget, GHashTable *table )
*
* @returns The distance value of this property for this widget.
*/
RofiDistance rofi_theme_get_distance ( const widget *widget, const char *property, int def );
RofiDistance rofi_theme_get_distance(const widget *widget, const char *property,
int def);
/**
* @param widget The widget to query
@ -191,7 +190,7 @@ RofiDistance rofi_theme_get_distance ( const widget *widget, const char *propert
*
* @returns The integer value of this property for this widget.
*/
int rofi_theme_get_integer ( const widget *widget, const char *property, int def );
int rofi_theme_get_integer(const widget *widget, const char *property, int def);
/**
* @param widget The widget to query
@ -202,7 +201,8 @@ int rofi_theme_get_integer ( const widget *widget, const char *property, int def
*
* @returns The position value of this property for this widget.
*/
int rofi_theme_get_position ( const widget *widget, const char *property, int def );
int rofi_theme_get_position(const widget *widget, const char *property,
int def);
/**
* @param widget The widget to query
@ -213,7 +213,7 @@ int rofi_theme_get_position ( const widget *widget, const char *property, int de
*
* @returns The boolean value of this property for this widget.
*/
int rofi_theme_get_boolean ( const widget *widget, const char *property, int def );
int rofi_theme_get_boolean(const widget *widget, const char *property, int def);
/**
* @param widget The widget to query
@ -224,7 +224,9 @@ int rofi_theme_get_boolean ( const widget *widget, const char *property, int def
*
* @returns The orientation of this property for this widget or %def not found.
*/
RofiOrientation rofi_theme_get_orientation ( const widget *widget, const char *property, RofiOrientation def );
RofiOrientation rofi_theme_get_orientation(const widget *widget,
const char *property,
RofiOrientation def);
/**
* @param widget The widget to query
@ -235,7 +237,9 @@ RofiOrientation rofi_theme_get_orientation ( const widget *widget, const char *p
*
* @returns The cursor for this widget or %def if not found.
*/
RofiCursorType rofi_theme_get_cursor_type ( const widget *widget, const char *property, RofiCursorType def );
RofiCursorType rofi_theme_get_cursor_type(const widget *widget,
const char *property,
RofiCursorType def);
/**
* @param widget The widget to query
* @param property The property to query.
@ -245,7 +249,8 @@ RofiCursorType rofi_theme_get_cursor_type ( const widget *widget, const char *pr
*
* @returns The string value of this property for this widget.
*/
const char *rofi_theme_get_string ( const widget *widget, const char *property, const char *def );
const char *rofi_theme_get_string(const widget *widget, const char *property,
const char *def);
/**
* @param widget The widget to query
@ -256,7 +261,8 @@ const char *rofi_theme_get_string ( const widget *widget, const char *property,
*
* @returns The double value of this property for this widget.
*/
double rofi_theme_get_double ( const widget *widget, const char *property, double def );
double rofi_theme_get_double(const widget *widget, const char *property,
double def);
/**
* @param widget The widget to query
@ -266,7 +272,8 @@ double rofi_theme_get_double ( const widget *widget, const char *property, doubl
* Obtain the color of the widget and applies this to the drawable d.
*
*/
void rofi_theme_get_color ( const widget *widget, const char *property, cairo_t *d );
void rofi_theme_get_color(const widget *widget, const char *property,
cairo_t *d);
/**
* @param widget The widget to query
@ -277,7 +284,8 @@ void rofi_theme_get_color ( const widget *widget, const char *property, cairo_t
*
* @return true if image is set.
*/
gboolean rofi_theme_get_image ( const widget *widget, const char *property, cairo_t *d );
gboolean rofi_theme_get_image(const widget *widget, const char *property,
cairo_t *d);
/**
* @param widget The widget to query
@ -286,7 +294,7 @@ gboolean rofi_theme_get_image ( const widget *widget, const char *property, cair
* Check if a rofi theme has a property set.
*
*/
gboolean rofi_theme_has_property ( const widget *widget, const char *property );
gboolean rofi_theme_has_property(const widget *widget, const char *property);
/**
* @param widget The widget to query
@ -297,7 +305,8 @@ gboolean rofi_theme_has_property ( const widget *widget, const char *property );
*
* @returns The padding of this property for this widget.
*/
RofiPadding rofi_theme_get_padding ( const widget *widget, const char *property, RofiPadding pad );
RofiPadding rofi_theme_get_padding(const widget *widget, const char *property,
RofiPadding pad);
/**
* @param widget The widget to query
@ -308,7 +317,9 @@ RofiPadding rofi_theme_get_padding ( const widget *widget, const char *property,
*
* @returns The highlight of this property for this widget.
*/
RofiHighlightColorStyle rofi_theme_get_highlight ( widget *widget, const char *property, RofiHighlightColorStyle th );
RofiHighlightColorStyle rofi_theme_get_highlight(widget *widget,
const char *property,
RofiHighlightColorStyle th);
/**
* @param d The distance handle.
@ -317,14 +328,14 @@ RofiHighlightColorStyle rofi_theme_get_highlight ( widget *widget, const char *p
* Convert RofiDistance into pixels.
* @returns the number of pixels this distance represents.
*/
int distance_get_pixel ( RofiDistance d, RofiOrientation ori );
int distance_get_pixel(RofiDistance d, RofiOrientation ori);
/**
* @param d The distance handle.
* @param draw The cairo drawable.
*
* Set linestyle.
*/
void distance_get_linestyle ( RofiDistance d, cairo_t *draw );
void distance_get_linestyle(RofiDistance d, cairo_t *draw);
/**
* Low-level functions.
@ -335,24 +346,30 @@ void distance_get_linestyle ( RofiDistance d, cairo_t *draw );
* @param state The state of the element.
* @param exact If the match should be exact, or parent can be included.
*
* Find the theme element. If not exact, the closest specified element is returned.
* Find the theme element. If not exact, the closest specified element is
* returned.
*
* @returns the ThemeWidget if found, otherwise NULL.
*/
ThemeWidget *rofi_theme_find_widget ( const char *name, const char *state, gboolean exact );
ThemeWidget *rofi_config_find_widget ( const char *name, const char *state, gboolean exact );
ThemeWidget *rofi_theme_find_widget(const char *name, const char *state,
gboolean exact);
ThemeWidget *rofi_config_find_widget(const char *name, const char *state,
gboolean exact);
/**
* @param widget The widget to find the property on.
* @param type The %PropertyType to find.
* @param property The property to find.
* @param exact If the property should only be found on this widget, or on parents if not found.
* @param exact If the property should only be found on this widget, or on
* parents if not found.
*
* Find the property on the widget. If not exact, the parents are searched recursively until match is found.
* Find the property on the widget. If not exact, the parents are searched
* recursively until match is found.
*
* @returns the Property if found, otherwise NULL.
*/
Property *rofi_theme_find_property ( ThemeWidget *widget, PropertyType type, const char *property, gboolean exact );
Property *rofi_theme_find_property(ThemeWidget *widget, PropertyType type,
const char *property, gboolean exact);
/**
* @param widget The widget to query
@ -361,20 +378,21 @@ Property *rofi_theme_find_property ( ThemeWidget *widget, PropertyType type, con
*
* Obtain list of elements (strings) of the widget.
*
* @returns a GList holding the names in the list of this property for this widget.
* @returns a GList holding the names in the list of this property for this
* widget.
*/
GList *rofi_theme_get_list ( const widget *widget, const char * property, const char *defaults );
GList *rofi_theme_get_list(const widget *widget, const char *property,
const char *defaults);
/**
* Checks if a theme is set, or is empty.
* @returns TRUE when empty.
*/
gboolean rofi_theme_is_empty ( void );
gboolean rofi_theme_is_empty(void);
/**
* Reset the current theme.
*/
void rofi_theme_reset ( void );
void rofi_theme_reset(void);
/**
* @param file File name to prepare.
@ -384,12 +402,12 @@ void rofi_theme_reset ( void );
*
* @returns full path to file.
*/
char * rofi_theme_parse_prepare_file ( const char *file, const char *parent_file );
char *rofi_theme_parse_prepare_file(const char *file, const char *parent_file);
/**
* Process conditionals.
*/
void rofi_theme_parse_process_conditionals ( void );
void rofi_theme_parse_process_conditionals(void);
/**
* @param parent target theme tree
@ -397,27 +415,27 @@ void rofi_theme_parse_process_conditionals ( void );
*
* Merge all the settings from child into parent.
*/
void rofi_theme_parse_merge_widgets ( ThemeWidget *parent, ThemeWidget *child );
void rofi_theme_parse_merge_widgets(ThemeWidget *parent, ThemeWidget *child);
/**
* @param type the media type to parse.
*
* Returns the media type described by type.
*/
ThemeMediaType rofi_theme_parse_media_type ( const char *type );
ThemeMediaType rofi_theme_parse_media_type(const char *type);
/**
* @param distance The distance object to copy.
*
* @returns a copy of the distance.
*/
RofiDistance rofi_theme_property_copy_distance ( RofiDistance const distance );
RofiDistance rofi_theme_property_copy_distance(RofiDistance const distance);
/**
* @param filename The file to validate.
*
* @returns the program exit code.
*/
int rofi_theme_rasi_validate ( const char *filename );
int rofi_theme_rasi_validate(const char *filename);
#endif

View File

@ -27,15 +27,16 @@
#ifndef ROFI_VIEW_INTERNAL_H
#define ROFI_VIEW_INTERNAL_H
#include "widgets/container.h"
#include "widgets/widget.h"
#include "widgets/textbox.h"
#include "keyb.h"
#include "mode.h"
#include "theme.h"
#include "widgets/box.h"
#include "widgets/container.h"
#include "widgets/icon.h"
#include "widgets/listview.h"
#include "keyb.h"
#include "widgets/textbox.h"
#include "widgets/widget.h"
#include "xcb.h"
#include "theme.h"
/**
* @ingroup ViewHandle
@ -44,100 +45,98 @@
*/
// State of the menu.
struct RofiViewState
{
/** #Mode bound to to this view. */
Mode *sw;
struct RofiViewState {
/** #Mode bound to to this view. */
Mode *sw;
/** Flag indicating if view needs to be refiltered. */
int refilter;
/** Widget representing the main container. */
box *main_window;
/** #textbox showing the prompt in the input bar. */
textbox *prompt;
/** #textbox with the user input in the input bar. */
textbox *text;
/** #textbox showing the state of the case sensitive and sortng. */
textbox *case_indicator;
/** Flag indicating if view needs to be refiltered. */
int refilter;
/** Widget representing the main container. */
box *main_window;
/** #textbox showing the prompt in the input bar. */
textbox *prompt;
/** #textbox with the user input in the input bar. */
textbox *text;
/** #textbox showing the state of the case sensitive and sortng. */
textbox *case_indicator;
/** #listview holding the displayed elements. */
listview *list_view;
/** #textbox widget showing the overlay. */
textbox *overlay;
/** #container holding the message box */
container *mesg_box;
/** #textbox containing the message entry */
textbox *mesg_tb;
/** #listview holding the displayed elements. */
listview *list_view;
/** #textbox widget showing the overlay. */
textbox *overlay;
/** #container holding the message box */
container *mesg_box;
/** #textbox containing the message entry */
textbox *mesg_tb;
/** Array with the levenshtein distance for each element. */
int *distance;
/** Array with the translation between the filtered and unfiltered list. */
unsigned int *line_map;
/** number of (unfiltered) elements to show. */
unsigned int num_lines;
/** Array with the levenshtein distance for each element. */
int *distance;
/** Array with the translation between the filtered and unfiltered list. */
unsigned int *line_map;
/** number of (unfiltered) elements to show. */
unsigned int num_lines;
/** number of (filtered) elements to show. */
unsigned int filtered_lines;
/** number of (filtered) elements to show. */
unsigned int filtered_lines;
/** Previously called key action. */
KeyBindingAction prev_action;
/** Time previous key action was executed. */
xcb_timestamp_t last_button_press;
/** Previously called key action. */
KeyBindingAction prev_action;
/** Time previous key action was executed. */
xcb_timestamp_t last_button_press;
/** Indicate view should terminate */
int quit;
/** Indicate if we should absorb the key release */
int skip_absorb;
/** The selected line (in the unfiltered list) */
unsigned int selected_line;
/** The return state of the view */
MenuReturn retv;
/** Monitor #workarea the view is displayed on */
workarea mon;
/** Indicate view should terminate */
int quit;
/** Indicate if we should absorb the key release */
int skip_absorb;
/** The selected line (in the unfiltered list) */
unsigned int selected_line;
/** The return state of the view */
MenuReturn retv;
/** Monitor #workarea the view is displayed on */
workarea mon;
/** #box holding the different modi buttons */
box *sidebar_bar;
/** number of modi to display */
unsigned int num_modi;
/** Array of #textbox that act as buttons for switching modi */
textbox **modi;
/** #box holding the different modi buttons */
box *sidebar_bar;
/** number of modi to display */
unsigned int num_modi;
/** Array of #textbox that act as buttons for switching modi */
textbox **modi;
/** Total rows. */
textbox *tb_total_rows;
/** filtered rows */
textbox *tb_filtered_rows;
/** Total rows. */
textbox *tb_total_rows;
/** filtered rows */
textbox *tb_filtered_rows;
/** Settings of the menu */
MenuFlags menu_flags;
/** If mouse was within view previously */
int mouse_seen;
/** Flag indicating if view needs to be reloaded. */
int reload;
/** The function to be called when finalizing this view */
void ( *finalize )( struct RofiViewState *state );
/** Settings of the menu */
MenuFlags menu_flags;
/** If mouse was within view previously */
int mouse_seen;
/** Flag indicating if view needs to be reloaded. */
int reload;
/** The function to be called when finalizing this view */
void (*finalize)(struct RofiViewState *state);
/** Width of the view */
int width;
/** Height of the view */
int height;
/** X position of the view */
int x;
/** Y position of the view */
int y;
/** Width of the view */
int width;
/** Height of the view */
int height;
/** X position of the view */
int x;
/** Y position of the view */
int y;
/** Position and target of the mouse. */
struct
{
/** X position */
int x;
/** Y position */
int y;
/** Widget being targeted. */
widget *motion_target;
} mouse;
/** Position and target of the mouse. */
struct {
/** X position */
int x;
/** Y position */
int y;
/** Widget being targeted. */
widget *motion_target;
} mouse;
/** Regexs used for matching */
rofi_int_matcher **tokens;
/** Regexs used for matching */
rofi_int_matcher **tokens;
};
/** @} */
#endif

View File

@ -27,8 +27,9 @@
#ifndef ROFI_VIEW_H
#define ROFI_VIEW_H
#include "mode.h"
#include "mode.h"
#include <xcb/xcb.h>
/**
* @defgroup View View
*
@ -44,18 +45,17 @@
* @{
*/
typedef struct RofiViewState RofiViewState;
typedef enum
{
/** Create a menu for entering text */
MENU_NORMAL = 0,
/** Create a menu for entering passwords */
MENU_PASSWORD = 1,
/** Create amanaged window. */
MENU_NORMAL_WINDOW = 2,
/** ERROR dialog */
MENU_ERROR_DIALOG = 4,
/** INDICATOR */
MENU_INDICATOR = 8,
typedef enum {
/** Create a menu for entering text */
MENU_NORMAL = 0,
/** Create a menu for entering passwords */
MENU_PASSWORD = 1,
/** Create amanaged window. */
MENU_NORMAL_WINDOW = 2,
/** ERROR dialog */
MENU_ERROR_DIALOG = 4,
/** INDICATOR */
MENU_INDICATOR = 8,
} MenuFlags;
/**
@ -68,14 +68,16 @@ typedef enum
*
* @returns The command issued (see MenuReturn)
*/
RofiViewState *rofi_view_create ( Mode *sw, const char *input, MenuFlags menu_flags, void ( *finalize )( RofiViewState * ) );
RofiViewState *rofi_view_create(Mode *sw, const char *input,
MenuFlags menu_flags,
void (*finalize)(RofiViewState *));
/**
* @param state The Menu Handle
*
* Check if a finalize function is set, and if sets executes it.
*/
void rofi_view_finalize ( RofiViewState *state );
void rofi_view_finalize(RofiViewState *state);
/**
* @param state the Menu handle
@ -84,7 +86,7 @@ void rofi_view_finalize ( RofiViewState *state );
*
* @returns the return value
*/
MenuReturn rofi_view_get_return_value ( const RofiViewState *state );
MenuReturn rofi_view_get_return_value(const RofiViewState *state);
/**
* @param state the Menu handle
*
@ -92,14 +94,14 @@ MenuReturn rofi_view_get_return_value ( const RofiViewState *state );
*
* @return the next position.
*/
unsigned int rofi_view_get_next_position ( const RofiViewState *state );
unsigned int rofi_view_get_next_position(const RofiViewState *state);
/**
* @param state the Menu handle
* @param text The text to add to the input box
*
* Update the state if needed.
*/
void rofi_view_handle_text ( RofiViewState *state, char *text );
void rofi_view_handle_text(RofiViewState *state, char *text);
/**
* @param state the Menu handle
* @param x The X coordinates of the motion
@ -108,31 +110,33 @@ void rofi_view_handle_text ( RofiViewState *state, char *text );
*
* Update the state if needed.
*/
void rofi_view_handle_mouse_motion ( RofiViewState *state, gint x, gint y, gboolean find_mouse_target );
void rofi_view_handle_mouse_motion(RofiViewState *state, gint x, gint y,
gboolean find_mouse_target);
/**
* @param state the Menu handle
*
* Update the state if needed.
*/
void rofi_view_maybe_update ( RofiViewState *state );
void rofi_view_temp_configure_notify ( RofiViewState *state, xcb_configure_notify_event_t *xce );
void rofi_view_temp_click_to_exit ( RofiViewState *state, xcb_window_t target );
void rofi_view_maybe_update(RofiViewState *state);
void rofi_view_temp_configure_notify(RofiViewState *state,
xcb_configure_notify_event_t *xce);
void rofi_view_temp_click_to_exit(RofiViewState *state, xcb_window_t target);
/**
* Update the state if needed.
*/
void rofi_view_frame_callback ( void );
void rofi_view_frame_callback(void);
/**
* @param state the Menu handle
*
* @returns returns if this state is completed.
*/
unsigned int rofi_view_get_completed ( const RofiViewState *state );
unsigned int rofi_view_get_completed(const RofiViewState *state);
/**
* @param state the Menu handle
*
* @returns the raw user input.
*/
const char * rofi_view_get_user_input ( const RofiViewState *state );
const char *rofi_view_get_user_input(const RofiViewState *state);
/**
* @param state The Menu Handle
@ -140,7 +144,8 @@ const char * rofi_view_get_user_input ( const RofiViewState *state );
*
* Select a line.
*/
void rofi_view_set_selected_line ( RofiViewState *state, unsigned int selected_line );
void rofi_view_set_selected_line(RofiViewState *state,
unsigned int selected_line);
/**
* @param state The Menu Handle
@ -149,14 +154,14 @@ void rofi_view_set_selected_line ( RofiViewState *state, unsigned int selected_l
*
* @returns the selected line or UINT32_MAX if none selected.
*/
unsigned int rofi_view_get_selected_line ( const RofiViewState *state );
unsigned int rofi_view_get_selected_line(const RofiViewState *state);
/**
* @param state The Menu Handle
*
* Restart the menu so it can be displayed again.
* Resets RofiViewState::quit and RofiViewState::retv.
*/
void rofi_view_restart ( RofiViewState *state );
void rofi_view_restart(RofiViewState *state);
/**
* @param state The handle to the view
@ -165,7 +170,8 @@ void rofi_view_restart ( RofiViewState *state );
*
* @returns TRUE if action was handled.
*/
gboolean rofi_view_trigger_action ( RofiViewState *state, BindingsScope scope, guint action );
gboolean rofi_view_trigger_action(RofiViewState *state, BindingsScope scope,
guint action);
/**
* @param state The handle to the view
@ -173,7 +179,7 @@ gboolean rofi_view_trigger_action ( RofiViewState *state, BindingsScope scope, g
* Free's the memory allocated for this handle.
* After a call to this function, state is invalid and can no longer be used.
*/
void rofi_view_free ( RofiViewState *state );
void rofi_view_free(RofiViewState *state);
/** @} */
/**
* @defgroup ViewGlobal ViewGlobal
@ -189,7 +195,7 @@ void rofi_view_free ( RofiViewState *state );
*
* @returns the active view handle or NULL
*/
RofiViewState * rofi_view_get_active ( void );
RofiViewState *rofi_view_get_active(void);
/**
* @param state the new active view handle.
@ -199,7 +205,7 @@ RofiViewState * rofi_view_get_active ( void );
*
*/
void rofi_view_set_active ( RofiViewState *state );
void rofi_view_set_active(RofiViewState *state);
/**
* @param state remove view handle.
@ -208,25 +214,25 @@ void rofi_view_set_active ( RofiViewState *state );
* stack.
*
*/
void rofi_view_remove_active ( RofiViewState *state );
void rofi_view_remove_active(RofiViewState *state);
/**
* @param msg The error message to show.
* @param markup The error message uses pango markup.
*
* The error message to show.
*/
int rofi_view_error_dialog ( const char *msg, int markup );
int rofi_view_error_dialog(const char *msg, int markup);
/**
* Queue a redraw.
* This triggers a X11 Expose Event.
*/
void rofi_view_queue_redraw ( void );
void rofi_view_queue_redraw(void);
/**
* Cleanup internal data of the view.
*/
void rofi_view_cleanup ( void );
void rofi_view_cleanup(void);
/**
* @param state The handle to the view
@ -235,12 +241,12 @@ void rofi_view_cleanup ( void );
*
* @returns the mode currently displayed by the view
*/
Mode * rofi_view_get_mode ( RofiViewState *state );
Mode *rofi_view_get_mode(RofiViewState *state);
/**
* Unmap the current view.
*/
void rofi_view_hide ( void );
void rofi_view_hide(void);
/**
* Indicate the current view needs to reload its data.
@ -248,7 +254,7 @@ void rofi_view_hide ( void );
*
* The reloading happens 'lazy', multiple calls might be handled at once.
*/
void rofi_view_reload ( void );
void rofi_view_reload(void);
/**
* @param state The handle to the view
@ -256,7 +262,7 @@ void rofi_view_reload ( void );
*
* Change the current view to show a different mode.
*/
void rofi_view_switch_mode ( RofiViewState *state, Mode *mode );
void rofi_view_switch_mode(RofiViewState *state, Mode *mode);
/**
* @param state The handle to the view
@ -264,14 +270,14 @@ void rofi_view_switch_mode ( RofiViewState *state, Mode *mode );
*
* Overlays text over the current view. Passing NULL for text hides the overlay.
*/
void rofi_view_set_overlay ( RofiViewState *state, const char *text );
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 );
void rofi_view_clear_input(RofiViewState *state);
/**
* @param menu_flags The state of the new window.
@ -279,33 +285,33 @@ void rofi_view_clear_input ( RofiViewState *state );
* Creates the internal 'Cached' window that gets reused between views.
* TODO: Internal call to view exposed.
*/
void __create_window ( MenuFlags menu_flags );
void __create_window(MenuFlags menu_flags);
/**
* Get the handle of the main window.
*
* @returns the xcb_window_t for rofi's view or XCB_WINDOW_NONE.
*/
xcb_window_t rofi_view_get_window ( void );
xcb_window_t rofi_view_get_window(void);
/** @} */
/***
* @defgroup ViewThreadPool ViewThreadPool
* @ingroup View
*
* The view can (optionally) keep a set of worker threads around to parallize work.
* This includes filtering and sorting.
* The view can (optionally) keep a set of worker threads around to parallize
* work. This includes filtering and sorting.
*
* @{
*/
/**
* Initialize the threadpool
*/
void rofi_view_workers_initialize ( void );
void rofi_view_workers_initialize(void);
/**
* Stop all threads and free the resources used by the threadpool
*/
void rofi_view_workers_finalize ( void );
void rofi_view_workers_finalize(void);
/**
* @param width the width of the monitor.
@ -314,20 +320,20 @@ void rofi_view_workers_finalize ( void );
* Return the current monitor workarea.
*
*/
void rofi_view_get_current_monitor ( int *width, int *height );
void rofi_view_get_current_monitor(int *width, int *height);
/**
* Takes a screenshot.
*/
void rofi_capture_screenshot ( void );
void rofi_capture_screenshot(void);
/**
* Set the window title.
*/
void rofi_view_set_window_title ( const char * title );
void rofi_view_set_window_title(const char *title);
/**
* set ellipsize mode to start.
*/
void rofi_view_ellipsize_start ( RofiViewState *state );
void rofi_view_ellipsize_start(RofiViewState *state);
/** @} */
#endif

View File

@ -28,17 +28,17 @@
#ifndef ROFI_HBOX_H
#define ROFI_HBOX_H
#include "widget.h"
#include "rofi-types.h"
#include "widget.h"
/**
* @defgroup box box
* @ingroup widget
*
* Widget used to pack multiple widgets either horizontally or vertically.
* It supports packing widgets horizontally or vertically. Child widgets are always
* expanded to the maximum size in the opposite direction of the packing direction.
* e.g. vertically packed widgets use the full box width.
* It supports packing widgets horizontally or vertically. Child widgets are
* always expanded to the maximum size in the opposite direction of the packing
* direction. e.g. vertically packed widgets use the full box width.
*
* @{
*/
@ -55,7 +55,7 @@ typedef struct _box box;
*
* @returns a newly created box, free with #widget_free
*/
box * box_create ( widget *parent, const char *name, RofiOrientation type );
box *box_create(widget *parent, const char *name, RofiOrientation type);
/**
* @param box Handle to the box widget.
@ -64,6 +64,6 @@ box * box_create ( widget *parent, const char *name, RofiOrientation type );
*
* Add a widget to the box.
*/
void box_add ( box *box, widget *child, gboolean expand );
void box_add(box *box, widget *child, gboolean expand);
/**@}*/
#endif // ROFI_HBOX_H

View File

@ -49,7 +49,7 @@ typedef struct _container container;
*
* @returns a newly created container, free with #widget_free
*/
container * container_create ( widget *parent, const char *name );
container *container_create(widget *parent, const char *name);
/**
* @param container Handle to the container widget.
@ -57,6 +57,6 @@ container * container_create ( widget *parent, const char *name );
*
* Add a widget to the container.
*/
void container_add ( container *container, widget *child );
void container_add(container *container, widget *child);
/**@}*/
#endif // ROFI_CONTAINER_H

View File

@ -49,19 +49,19 @@ typedef struct _icon icon;
*
* @returns a newly created icon, free with #widget_free
*/
icon * icon_create ( widget *parent, const char *name );
icon *icon_create(widget *parent, const char *name);
/**
* @param icon The icon widget handle.
* @param size The size of the icon.
*
*/
void icon_set_size ( widget *icon, const int size );
void icon_set_size(widget *icon, const int size);
/**
* @param icon The icon widget handle.
* @param surf The surface to display.
*/
void icon_set_surface ( icon *icon, cairo_surface_t *surf );
void icon_set_surface(icon *icon, cairo_surface_t *surf);
/**@}*/
#endif // ROFI_ICON_H

View File

@ -46,29 +46,31 @@ typedef struct _listview listview;
/**
* The scrolling type used in the list view
*/
typedef enum
{
/** Flip through the pages. */
LISTVIEW_SCROLL_PER_PAGE,
/** keep selected item centered */
LISTVIEW_SCROLL_CONTINIOUS
typedef enum {
/** Flip through the pages. */
LISTVIEW_SCROLL_PER_PAGE,
/** keep selected item centered */
LISTVIEW_SCROLL_CONTINIOUS
} ScrollType;
/**
* @param tb The textbox to set
* @param entry The position of the textbox
* @param udata User data
* @param type The textbox font style to apply to this entry (normal, selected, alternative row)
* @param type The textbox font style to apply to this entry (normal, selected,
* alternative row)
* @param full If true Set both text and style.
*
* Update callback, this is called to set the value of each (visible) element.
*/
typedef void ( *listview_update_callback )( textbox *tb, icon *ico, unsigned int entry, void *udata, TextBoxFontType *type, gboolean full );
typedef void (*listview_update_callback)(textbox *tb, icon *ico,
unsigned int entry, void *udata,
TextBoxFontType *type, gboolean full);
/**
* Callback when a element is activated.
*/
typedef void ( *listview_mouse_activated_cb )( listview *, gboolean, void * );
typedef void (*listview_mouse_activated_cb)(listview *, gboolean, void *);
/**
* @param parent The widget's parent.
@ -80,7 +82,9 @@ typedef void ( *listview_mouse_activated_cb )( listview *, gboolean, void * );
*
* @returns a new listview
*/
listview *listview_create ( widget *parent, const char *name, listview_update_callback cb, void *udata, unsigned int eh, gboolean reverse );
listview *listview_create(widget *parent, const char *name,
listview_update_callback cb, void *udata,
unsigned int eh, gboolean reverse);
/**
* @param lv The listview handle
@ -88,7 +92,7 @@ listview *listview_create ( widget *parent, const char *name, listview_update_ca
*
* Set the maximum number of elements to display.
*/
void listview_set_num_elements ( listview *lv, unsigned int rows );
void listview_set_num_elements(listview *lv, unsigned int rows);
/**
* @param lv The listview handle
@ -96,7 +100,7 @@ void listview_set_num_elements ( listview *lv, unsigned int rows );
*
* Select the row, if selected > the number of rows, it selects the last one.
*/
void listview_set_selected ( listview *lv, unsigned int selected );
void listview_set_selected(listview *lv, unsigned int selected);
/**
* @param lv The listview handle
@ -105,7 +109,7 @@ void listview_set_selected ( listview *lv, unsigned int selected );
*
* @returns the selected row.
*/
unsigned int listview_get_selected ( listview *lv );
unsigned int listview_get_selected(listview *lv);
/**
* @param lv The listview handle
@ -113,14 +117,14 @@ unsigned int listview_get_selected ( listview *lv );
* Move the selection one row up.
* - Wrap around.
*/
void listview_nav_up ( listview *lv );
void listview_nav_up(listview *lv);
/**
* @param lv listview handle.
*
* Move the selection one row down.
* - Wrap around.
*/
void listview_nav_down ( listview *lv );
void listview_nav_down(listview *lv);
/**
* @param lv The listview handle
*
@ -128,14 +132,14 @@ void listview_nav_down ( listview *lv );
* - No wrap around.
* - Do not move to top row when at start.
*/
void listview_nav_right ( listview *lv );
void listview_nav_right(listview *lv);
/**
* @param lv The listview handle
*
* Move the selection one column to the left.
* - No wrap around.
*/
void listview_nav_left ( listview *lv );
void listview_nav_left(listview *lv);
/**
* @param lv The listview handle
*
@ -143,7 +147,7 @@ void listview_nav_left ( listview *lv );
* - No wrap around.
* - Clip at top/bottom
*/
void listview_nav_page_next ( listview *lv );
void listview_nav_page_next(listview *lv);
/**
* @param lv The listview handle
@ -152,7 +156,7 @@ void listview_nav_page_next ( listview *lv );
* - No wrap around.
* - Clip at top/bottom
*/
void listview_nav_page_prev ( listview *lv );
void listview_nav_page_prev(listview *lv);
/**
* @param lv Handler to the listview object
@ -160,14 +164,14 @@ void listview_nav_page_prev ( listview *lv );
*
* Hide the scrollbar.
*/
void listview_set_show_scrollbar ( listview *lv, gboolean enabled );
void listview_set_show_scrollbar(listview *lv, gboolean enabled);
/**
* @param lv Handler to the listview object
* @param width Width in pixels
*
* Set the width of the scrollbar
*/
void listview_set_scrollbar_width ( listview *lv, unsigned int width );
void listview_set_scrollbar_width(listview *lv, unsigned int width);
/**
* @param lv Handler to the listview object
@ -175,14 +179,15 @@ void listview_set_scrollbar_width ( listview *lv, unsigned int width );
*
* Set cycle mode. On last entry go to first.
*/
void listview_set_cycle ( listview *lv, gboolean cycle );
void listview_set_cycle(listview *lv, gboolean cycle);
/**
* @param lv Handler to the listview object
* @param type ScrollType
*
* Set the scroll type ScrollType::LISTVIEW_SCROLL_CONTINIOUS or ScrollType::LISTVIEW_SCROLL_PER_PAGE
* Set the scroll type ScrollType::LISTVIEW_SCROLL_CONTINIOUS or
* ScrollType::LISTVIEW_SCROLL_PER_PAGE
*/
void listview_set_scroll_type ( listview *lv, ScrollType type );
void listview_set_scroll_type(listview *lv, ScrollType type);
/**
* @param lv Handler to the listview object
@ -191,21 +196,23 @@ void listview_set_scroll_type ( listview *lv, ScrollType type );
*
* Set the mouse activated callback.
*/
void listview_set_mouse_activated_cb ( listview *lv, listview_mouse_activated_cb cb, void *udata );
void listview_set_mouse_activated_cb(listview *lv,
listview_mouse_activated_cb cb,
void *udata);
/**
* @param lv Handler to the listview object
* @param enable boolean to enable/disable multi-select
*
* Enable,disable multi-select.
*/
void listview_set_multi_select ( listview *lv, gboolean enable );
void listview_set_multi_select(listview *lv, gboolean enable);
/**
* @param lv Handler to the listview object.
* @param num_lines the maximum number of lines to display.
*
* Set the maximum number of lines to display.
*/
void listview_set_num_lines ( listview *lv, unsigned int num_lines );
void listview_set_num_lines(listview *lv, unsigned int num_lines);
/**
* @param lv Handler to the listview object.
@ -214,7 +221,7 @@ void listview_set_num_lines ( listview *lv, unsigned int num_lines );
*
* @returns get the number of lines to display.
*/
unsigned int listview_get_num_lines ( listview *lv );
unsigned int listview_get_num_lines(listview *lv);
/**
* @param lv Handler to the listview object.
@ -223,14 +230,14 @@ unsigned int listview_get_num_lines ( listview *lv );
*
* @returns get fixed-height.
*/
gboolean listview_get_fixed_num_lines ( listview *lv );
gboolean listview_get_fixed_num_lines(listview *lv);
/**
* @param lv Handler to the listview object.
*
* Set fixed num lines mode.
*/
void listview_set_fixed_num_lines ( listview *lv );
void listview_set_fixed_num_lines(listview *lv);
/**
* @param lv Handler to the listview object.
@ -238,14 +245,14 @@ void listview_set_fixed_num_lines ( listview *lv );
*
* Set the maximum number of lines to display.
*/
void listview_set_max_lines ( listview *lv, unsigned int max_lines );
void listview_set_max_lines(listview *lv, unsigned int max_lines);
/**
* @param lv Handler to the listview object.
*
* Set ellipsize mode.
*/
void listview_toggle_ellipsizing ( listview *lv );
void listview_toggle_ellipsizing(listview *lv);
/**
* @param lv Handler to the listview object.
@ -253,7 +260,7 @@ void listview_toggle_ellipsizing ( listview *lv );
* Set ellipsize mode to start.
*/
void listview_set_ellipsize_start ( listview *lv );
void listview_set_ellipsize_start(listview *lv);
/** @} */
#endif // ROFI_LISTVIEW_H

View File

@ -27,9 +27,9 @@
#ifndef ROFI_SCROLLBAR_H
#define ROFI_SCROLLBAR_H
#include <cairo.h>
#include "widgets/widget.h"
#include "widgets/widget-internal.h"
#include "widgets/widget.h"
#include <cairo.h>
/**
* @defgroup Scrollbar Scrollbar
@ -40,13 +40,12 @@
/**
* Internal structure for the scrollbar.
*/
typedef struct _scrollbar
{
widget widget;
unsigned int length;
unsigned int pos;
unsigned int pos_length;
RofiDistance width;
typedef struct _scrollbar {
widget widget;
unsigned int length;
unsigned int pos;
unsigned int pos_length;
RofiDistance width;
} scrollbar;
/**
@ -57,7 +56,7 @@ typedef struct _scrollbar
*
* @returns the scrollbar object.
*/
scrollbar *scrollbar_create ( widget *parent, const char *name );
scrollbar *scrollbar_create(widget *parent, const char *name);
/**
* @param sb scrollbar object
@ -65,7 +64,7 @@ scrollbar *scrollbar_create ( widget *parent, const char *name );
*
* set the length of the handle relative to the max value of bar.
*/
void scrollbar_set_handle_length ( scrollbar *sb, unsigned int pos_length );
void scrollbar_set_handle_length(scrollbar *sb, unsigned int pos_length);
/**
* @param sb scrollbar object
@ -73,7 +72,7 @@ void scrollbar_set_handle_length ( scrollbar *sb, unsigned int pos_length );
*
* set the position of the handle relative to the set max value of bar.
*/
void scrollbar_set_handle ( scrollbar *sb, unsigned int pos );
void scrollbar_set_handle(scrollbar *sb, unsigned int pos);
/**
* @param sb scrollbar object
@ -81,7 +80,7 @@ void scrollbar_set_handle ( scrollbar *sb, unsigned int pos );
*
* set the max value of the bar.
*/
void scrollbar_set_max_value ( scrollbar *sb, unsigned int max );
void scrollbar_set_max_value(scrollbar *sb, unsigned int max);
/**
* @param sb scrollbar object
@ -89,7 +88,7 @@ void scrollbar_set_max_value ( scrollbar *sb, unsigned int max );
*
* Calculate the position of the click relative to the max value of bar
*/
guint scrollbar_scroll_get_line ( const scrollbar *sb, int y );
guint scrollbar_scroll_get_line(const scrollbar *sb, int y);
/**@}*/
#endif // ROFI_SCROLLBAR_H

View File

@ -28,14 +28,14 @@
#ifndef ROFI_TEXTBOX_H
#define ROFI_TEXTBOX_H
#include <xkbcommon/xkbcommon.h>
#include <pango/pango.h>
#include <pango/pango-fontmap.h>
#include <pango/pangocairo.h>
#include <cairo.h>
#include "widgets/widget.h"
#include "widgets/widget-internal.h"
#include "keyb.h"
#include "widgets/widget-internal.h"
#include "widgets/widget.h"
#include <cairo.h>
#include <pango/pango-fontmap.h>
#include <pango/pango.h>
#include <pango/pangocairo.h>
#include <xkbcommon/xkbcommon.h>
/**
* @defgroup Textbox Textbox
@ -44,83 +44,80 @@
* @{
*/
/** Cache to hold font descriptions. This it to avoid having to lookup each time. */
typedef struct TBFontConfig
{
/** Font description */
PangoFontDescription *pfd;
/** Font metrics */
PangoFontMetrics *metrics;
/** height */
double height;
}TBFontConfig;
/** Cache to hold font descriptions. This it to avoid having to lookup each
* time. */
typedef struct TBFontConfig {
/** Font description */
PangoFontDescription *pfd;
/** Font metrics */
PangoFontMetrics *metrics;
/** height */
double height;
} TBFontConfig;
/**
* Internal structure of a textbox widget.
* TODO make this internal to textbox
*/
typedef struct
{
widget widget;
unsigned long flags;
short cursor;
char *text;
const char *placeholder;
int show_placeholder;
PangoLayout *layout;
int tbft;
int markup;
int changed;
typedef struct {
widget widget;
unsigned long flags;
short cursor;
char *text;
const char *placeholder;
int show_placeholder;
PangoLayout *layout;
int tbft;
int markup;
int changed;
int blink;
guint blink_timeout;
int blink;
guint blink_timeout;
double yalign;
double xalign;
double yalign;
double xalign;
TBFontConfig *tbfc;
TBFontConfig *tbfc;
PangoEllipsizeMode emode;
//
const char *theme_name;
PangoEllipsizeMode emode;
//
const char *theme_name;
} textbox;
/**
* Flags for configuring textbox behaviour and looks during creation.
*/
typedef enum
{
TB_AUTOHEIGHT = 1 << 0,
TB_AUTOWIDTH = 1 << 1,
TB_EDITABLE = 1 << 19,
TB_MARKUP = 1 << 20,
TB_WRAP = 1 << 21,
TB_PASSWORD = 1 << 22,
TB_INDICATOR = 1 << 23,
typedef enum {
TB_AUTOHEIGHT = 1 << 0,
TB_AUTOWIDTH = 1 << 1,
TB_EDITABLE = 1 << 19,
TB_MARKUP = 1 << 20,
TB_WRAP = 1 << 21,
TB_PASSWORD = 1 << 22,
TB_INDICATOR = 1 << 23,
} TextboxFlags;
/**
* Flags indicating current state of the textbox.
*/
typedef enum
{
/** Normal */
NORMAL = 0,
/** Text in box is urgent. */
URGENT = 1,
/** Text in box is active. */
ACTIVE = 2,
/** Text in box is selected. */
SELECTED = 4,
/** Text in box has pango markup. */
MARKUP = 8,
typedef enum {
/** Normal */
NORMAL = 0,
/** Text in box is urgent. */
URGENT = 1,
/** Text in box is active. */
ACTIVE = 2,
/** Text in box is selected. */
SELECTED = 4,
/** Text in box has pango markup. */
MARKUP = 8,
/** Text is on an alternate row */
ALT = 16,
/** Render font highlighted (inverted colors.) */
HIGHLIGHT = 32,
/** Mask for alternate and highlighted */
FMOD_MASK = ( ALT | HIGHLIGHT ),
/** Mask of bits indicating state */
STATE_MASK = ~( SELECTED | MARKUP | ALT | HIGHLIGHT )
/** Text is on an alternate row */
ALT = 16,
/** Render font highlighted (inverted colors.) */
HIGHLIGHT = 32,
/** Mask for alternate and highlighted */
FMOD_MASK = (ALT | HIGHLIGHT),
/** Mask of bits indicating state */
STATE_MASK = ~(SELECTED | MARKUP | ALT | HIGHLIGHT)
} TextBoxFontType;
/**
@ -138,15 +135,16 @@ typedef enum
* free with #widget_free
* @returns a new #textbox
*/
textbox* textbox_create ( widget *parent, WidgetType type, const char *name, TextboxFlags flags,
TextBoxFontType tbft, const char *text, double xalign, double yalign );
textbox *textbox_create(widget *parent, WidgetType type, const char *name,
TextboxFlags flags, TextBoxFontType tbft,
const char *text, double xalign, double yalign);
/**
* @param tb Handle to the textbox
* @param tbft The style of font to render.
*
* Set the font render style.
*/
void textbox_font ( textbox *tb, TextBoxFontType tbft );
void textbox_font(textbox *tb, TextBoxFontType tbft);
/**
* @param tb Handle to the textbox
@ -154,7 +152,7 @@ void textbox_font ( textbox *tb, TextBoxFontType tbft );
*
* Set the text to show. Cursor is moved to end (if visible)
*/
void textbox_text ( textbox *tb, const char *text );
void textbox_text(textbox *tb, const char *text);
/**
* @param tb Handle to the textbox
@ -164,16 +162,16 @@ void textbox_text ( textbox *tb, const char *text );
*
* @return TRUE if action was taken.
*/
int textbox_keybinding ( textbox *tb, KeyBindingAction action );
int textbox_keybinding(textbox *tb, KeyBindingAction action);
/**
* @param tb Handle to the textbox
* @param pad The text to insert
* @param pad_len the length of the text
*
* The text should be one insert from a keypress.. the first gunichar is validated to be (or not) control
* return TRUE if inserted
* The text should be one insert from a keypress.. the first gunichar is
* validated to be (or not) control return TRUE if inserted
*/
gboolean textbox_append_text ( textbox *tb, const char *pad, const int pad_len );
gboolean textbox_append_text(textbox *tb, const char *pad, const int pad_len);
/**
* @param tb Handle to the textbox
@ -181,7 +179,7 @@ gboolean textbox_append_text ( textbox *tb, const char *pad, const int pad_len )
*
* Set the cursor position (string index)
*/
void textbox_cursor ( textbox *tb, int pos );
void textbox_cursor(textbox *tb, int pos);
/**
* @param tb Handle to the textbox
@ -191,19 +189,20 @@ void textbox_cursor ( textbox *tb, int pos );
*
* Insert the string str at position pos.
*/
void textbox_insert ( textbox *tb, const int char_pos, const char *str, const int slen );
void textbox_insert(textbox *tb, const int char_pos, const char *str,
const int slen);
/**
* Setup the cached fonts. This is required to do
* before any of the textbox_ functions is called.
* Clean with textbox_cleanup()
*/
void textbox_setup ( void );
void textbox_setup(void);
/**
* Cleanup the allocated colors and fonts by textbox_setup().
*/
void textbox_cleanup ( void );
void textbox_cleanup(void);
/**
* @param tb Handle to the textbox
@ -212,7 +211,7 @@ void textbox_cleanup ( void );
*
* @returns the height of the textbox in pixels.
*/
int textbox_get_height ( const textbox *tb );
int textbox_get_height(const textbox *tb);
/**
* @param tb Handle to the textbox
@ -221,7 +220,7 @@ int textbox_get_height ( const textbox *tb );
*
* @returns the height of the string in pixels.
*/
int textbox_get_font_height ( const textbox *tb );
int textbox_get_font_height(const textbox *tb);
/**
* @param tb Handle to the textbox
@ -230,27 +229,27 @@ int textbox_get_font_height ( const textbox *tb );
*
* @returns the width of the string in pixels.
*/
int textbox_get_font_width ( const textbox *tb );
int textbox_get_font_width(const textbox *tb);
/**
* Estimate the width of a character.
*
* @returns the width of a character in pixels.
*/
double textbox_get_estimated_char_width ( void );
double textbox_get_estimated_char_width(void);
/**
* Estimate the width of a 0.
*
* @returns the width of a 0 in pixels.
*/
double textbox_get_estimated_ch ( void );
double textbox_get_estimated_ch(void);
/**
* Estimate the height of a character.
*
* @returns the height of a character in pixels.
*/
double textbox_get_estimated_char_height ( void );
double textbox_get_estimated_char_height(void);
/**
* @param tb Handle to the textbox
@ -259,7 +258,7 @@ double textbox_get_estimated_char_height ( void );
*
* Remove dlen bytes from position pos.
*/
void textbox_delete ( textbox *tb, int pos, int dlen );
void textbox_delete(textbox *tb, int pos, int dlen);
/**
* @param tb Handle to the textbox
@ -271,32 +270,32 @@ void textbox_delete ( textbox *tb, int pos, int dlen );
* Move and resize the textbox.
* TODO remove for #widget_resize and #widget_move
*/
void textbox_moveresize ( textbox *tb, int x, int y, int w, int h );
void textbox_moveresize(textbox *tb, int x, int y, int w, int h);
/**
* @param tb Handle to the textbox
* @param eh The number of rows to display
*
* Get the (estimated) with of a character, can be used to calculate window width.
* This includes padding.
* Get the (estimated) with of a character, can be used to calculate window
* width. This includes padding.
*
* @returns the estimated width of a character.
*/
int textbox_get_estimated_height ( const textbox *tb, int eh );
int textbox_get_estimated_height(const textbox *tb, int eh);
/**
* @param font The name of the font used.
* @param p The new default PangoContext
*
* Set the default pango context (with font description) for all textboxes.
*/
void textbox_set_pango_context ( const char *font, PangoContext *p );
void textbox_set_pango_context(const char *font, PangoContext *p);
/**
* @param tb Handle to the textbox
* @param list New pango attributes
*
* Sets list as active pango attributes.
*/
void textbox_set_pango_attributes ( textbox *tb, PangoAttrList *list );
void textbox_set_pango_attributes(textbox *tb, PangoAttrList *list);
/**
* @param tb Handle to the textbox
@ -305,14 +304,14 @@ void textbox_set_pango_attributes ( textbox *tb, PangoAttrList *list );
*
* @returns the pango attributes
*/
PangoAttrList *textbox_get_pango_attributes ( textbox *tb );
PangoAttrList *textbox_get_pango_attributes(textbox *tb);
/**
* @param tb Handle to the textbox
*
* @returns the visible text.
*/
const char *textbox_get_visible_text ( const textbox *tb );
const char *textbox_get_visible_text(const textbox *tb);
/**
* @param wid The handle to the textbox.
*
@ -320,14 +319,14 @@ const char *textbox_get_visible_text ( const textbox *tb );
*
* @returns the desired width of the textbox.
*/
int textbox_get_desired_width ( widget *wid );
int textbox_get_desired_width(widget *wid);
/**
* @param tb Handle to the textbox
*
* Move the cursor to the end of the string.
*/
void textbox_cursor_end ( textbox *tb );
void textbox_cursor_end(textbox *tb);
/**
* @param tb Handle to the textbox
@ -335,6 +334,6 @@ void textbox_cursor_end ( textbox *tb );
*
* Set the ellipsizing mode used on the string.
*/
void textbox_set_ellipsize ( textbox *tb, PangoEllipsizeMode mode );
void textbox_set_ellipsize(textbox *tb, PangoEllipsizeMode mode);
/**@}*/
#endif //ROFI_TEXTBOX_H
#endif // ROFI_TEXTBOX_H

View File

@ -32,73 +32,72 @@
/**
* Data structure holding the internal state of the Widget
*/
struct _widget
{
/** The type of the widget */
WidgetType type;
/** X position relative to parent */
short x;
/** Y position relative to parent */
short y;
/** Width of the widget */
short w;
/** Height of the widget */
short h;
/** RofiPadding */
RofiPadding def_margin;
RofiPadding def_padding;
RofiPadding def_border;
RofiPadding def_border_radius;
RofiPadding margin;
RofiPadding padding;
RofiPadding border;
RofiPadding border_radius;
struct _widget {
/** The type of the widget */
WidgetType type;
/** X position relative to parent */
short x;
/** Y position relative to parent */
short y;
/** Width of the widget */
short w;
/** Height of the widget */
short h;
/** RofiPadding */
RofiPadding def_margin;
RofiPadding def_padding;
RofiPadding def_border;
RofiPadding def_border_radius;
RofiPadding margin;
RofiPadding padding;
RofiPadding border;
RofiPadding border_radius;
/** Cursor that is set when the widget is hovered */
RofiCursorType cursor_type;
/** Cursor that is set when the widget is hovered */
RofiCursorType cursor_type;
/** enabled or not */
gboolean enabled;
/** Expand the widget when packed */
gboolean expand;
/** Place widget at end of parent */
gboolean end;
/** Parent widget */
struct _widget *parent;
/** Internal */
gboolean need_redraw;
/** get width of widget implementation function */
int ( *get_width )( struct _widget * );
/** get height of widget implementation function */
int ( *get_height )( struct _widget * );
/** draw widget implementation function */
void ( *draw )( struct _widget *widget, cairo_t *draw );
/** resize widget implementation function */
void ( *resize )( struct _widget *, short, short );
/** update widget implementation function */
void ( *update )( struct _widget * );
/** enabled or not */
gboolean enabled;
/** Expand the widget when packed */
gboolean expand;
/** Place widget at end of parent */
gboolean end;
/** Parent widget */
struct _widget *parent;
/** Internal */
gboolean need_redraw;
/** get width of widget implementation function */
int (*get_width)(struct _widget *);
/** get height of widget implementation function */
int (*get_height)(struct _widget *);
/** draw widget implementation function */
void (*draw)(struct _widget *widget, cairo_t *draw);
/** resize widget implementation function */
void (*resize)(struct _widget *, short, short);
/** update widget implementation function */
void (*update)(struct _widget *);
/** Handle mouse motion, used for dragging */
gboolean ( *motion_notify )( struct _widget *, gint x, gint y );
/** Handle mouse motion, used for dragging */
gboolean (*motion_notify)(struct _widget *, gint x, gint y);
int ( *get_desired_height )( struct _widget * );
int ( *get_desired_width )( struct _widget * );
int (*get_desired_height)(struct _widget *);
int (*get_desired_width)(struct _widget *);
void ( *set_state ) ( struct _widget *, const char * );
void (*set_state)(struct _widget *, const char *);
/** widget find_mouse_target callback */
widget_find_mouse_target_cb find_mouse_target;
/** widget trigger_action callback */
widget_trigger_action_cb trigger_action;
/** user data for find_mouse_target and trigger_action callback */
void *trigger_action_cb_data;
/** widget find_mouse_target callback */
widget_find_mouse_target_cb find_mouse_target;
/** widget trigger_action callback */
widget_trigger_action_cb trigger_action;
/** user data for find_mouse_target and trigger_action callback */
void *trigger_action_cb_data;
/** Free widget callback */
void ( *free )( struct _widget *widget );
/** Free widget callback */
void (*free)(struct _widget *widget);
/** Name of widget (used for theming) */
char *name;
const char *state;
/** Name of widget (used for theming) */
char *name;
const char *state;
};
/**
@ -110,7 +109,8 @@ struct _widget
* Initializes the widget structure.
*
*/
void widget_init ( widget *wid, widget *parent, WidgetType type, const char *name );
void widget_init(widget *wid, widget *parent, WidgetType type,
const char *name);
/**
* @param widget The widget handle.
@ -118,7 +118,7 @@ void widget_init ( widget *wid, widget *parent, WidgetType type, const char *nam
*
* Set the state of the widget.
*/
void widget_set_state ( widget *widget, const char *state );
void widget_set_state(widget *widget, const char *state);
/**
* @param wid The widget handle.
@ -127,7 +127,7 @@ void widget_set_state ( widget *widget, const char *state );
*
* @returns the left padding in pixels.
*/
int widget_padding_get_left ( const widget *wid );
int widget_padding_get_left(const widget *wid);
/**
* @param wid The widget handle.
@ -136,7 +136,7 @@ int widget_padding_get_left ( const widget *wid );
*
* @returns the right padding in pixels.
*/
int widget_padding_get_right ( const widget *wid );
int widget_padding_get_right(const widget *wid);
/**
* @param wid The widget handle.
@ -145,7 +145,7 @@ int widget_padding_get_right ( const widget *wid );
*
* @returns the top padding in pixels.
*/
int widget_padding_get_top ( const widget *wid );
int widget_padding_get_top(const widget *wid);
/**
* @param wid The widget handle.
@ -154,7 +154,7 @@ int widget_padding_get_top ( const widget *wid );
*
* @returns the bottom padding in pixels.
*/
int widget_padding_get_bottom ( const widget *wid );
int widget_padding_get_bottom(const widget *wid);
/**
* @param wid The widget handle.
@ -163,7 +163,7 @@ int widget_padding_get_bottom ( const widget *wid );
*
* @returns the widget width, excluding padding.
*/
int widget_padding_get_remaining_width ( const widget *wid );
int widget_padding_get_remaining_width(const widget *wid);
/**
* @param wid The widget handle.
*
@ -171,7 +171,7 @@ int widget_padding_get_remaining_width ( const widget *wid );
*
* @returns the widget height, excluding padding.
*/
int widget_padding_get_remaining_height ( const widget *wid );
int widget_padding_get_remaining_height(const widget *wid);
/**
* @param wid The widget handle.
*
@ -179,7 +179,7 @@ int widget_padding_get_remaining_height ( const widget *wid );
*
* @returns the top and bottom padding of the widget in pixels.
*/
int widget_padding_get_padding_height ( const widget *wid );
int widget_padding_get_padding_height(const widget *wid);
/**
* @param wid The widget handle.
*
@ -187,5 +187,5 @@ int widget_padding_get_padding_height ( const widget *wid );
*
* @returns the left and right padding of the widget in pixels.
*/
int widget_padding_get_padding_width ( const widget *wid );
int widget_padding_get_padding_width(const widget *wid);
#endif // WIDGET_INTERNAL_H

View File

@ -27,19 +27,19 @@
#ifndef ROFI_WIDGET_H
#define ROFI_WIDGET_H
#include <glib.h>
#include "keyb.h"
#include <cairo.h>
#include <glib.h>
#include <xcb/xcb.h>
#include <xcb/xproto.h>
#include "keyb.h"
/**
* @defgroup widget widget
*
* Generic abstract widget class. Widgets should 'inherit' from this class (first structure in there structure should be
* widget).
* The generic widget implements generic functions like get_width, get_height, draw, resize, update, free and
* clicked.
* It also holds information about how the widget should be packed.
* Generic abstract widget class. Widgets should 'inherit' from this class
* (first structure in there structure should be widget). The generic widget
* implements generic functions like get_width, get_height, draw, resize,
* update, free and clicked. It also holds information about how the widget
* should be packed.
*
* @{
*/
@ -53,37 +53,35 @@ typedef struct _widget widget;
/**
* Type of the widget. It is used to bubble events to the relevant widget.
*/
typedef enum
{
/** Default type */
WIDGET_TYPE_UNKNOWN,
/** The listview widget */
WIDGET_TYPE_LISTVIEW = SCOPE_MOUSE_LISTVIEW,
/** An element in the listview */
WIDGET_TYPE_LISTVIEW_ELEMENT = SCOPE_MOUSE_LISTVIEW_ELEMENT,
/** The input bar edit box */
WIDGET_TYPE_EDITBOX = SCOPE_MOUSE_EDITBOX,
/** The listview scrollbar */
WIDGET_TYPE_SCROLLBAR = SCOPE_MOUSE_SCROLLBAR,
/** A widget allowing user to swithc between modi */
WIDGET_TYPE_MODE_SWITCHER = SCOPE_MOUSE_MODE_SWITCHER,
/** Text-only textbox */
WIDGET_TYPE_TEXTBOX_TEXT,
typedef enum {
/** Default type */
WIDGET_TYPE_UNKNOWN,
/** The listview widget */
WIDGET_TYPE_LISTVIEW = SCOPE_MOUSE_LISTVIEW,
/** An element in the listview */
WIDGET_TYPE_LISTVIEW_ELEMENT = SCOPE_MOUSE_LISTVIEW_ELEMENT,
/** The input bar edit box */
WIDGET_TYPE_EDITBOX = SCOPE_MOUSE_EDITBOX,
/** The listview scrollbar */
WIDGET_TYPE_SCROLLBAR = SCOPE_MOUSE_SCROLLBAR,
/** A widget allowing user to swithc between modi */
WIDGET_TYPE_MODE_SWITCHER = SCOPE_MOUSE_MODE_SWITCHER,
/** Text-only textbox */
WIDGET_TYPE_TEXTBOX_TEXT,
} WidgetType;
/**
* Whether and how the action was handled
*/
typedef enum
{
/** The action was ignore and should bubble */
WIDGET_TRIGGER_ACTION_RESULT_IGNORED,
/** The action was handled directly */
WIDGET_TRIGGER_ACTION_RESULT_HANDLED,
/** The action was handled and should start the grab for motion events */
WIDGET_TRIGGER_ACTION_RESULT_GRAB_MOTION_BEGIN,
/** The action was handled and should stop the grab for motion events */
WIDGET_TRIGGER_ACTION_RESULT_GRAB_MOTION_END,
typedef enum {
/** The action was ignore and should bubble */
WIDGET_TRIGGER_ACTION_RESULT_IGNORED,
/** The action was handled directly */
WIDGET_TRIGGER_ACTION_RESULT_HANDLED,
/** The action was handled and should start the grab for motion events */
WIDGET_TRIGGER_ACTION_RESULT_GRAB_MOTION_BEGIN,
/** The action was handled and should stop the grab for motion events */
WIDGET_TRIGGER_ACTION_RESULT_GRAB_MOTION_END,
} WidgetTriggerActionResult;
/**
@ -92,11 +90,13 @@ typedef enum
* @param x The X coordination of the mouse event relative to @param widget
* @param y The Y coordination of the mouse event relative to @param widget
*
* This callback must only iterate over the children of a Widget, and return NULL if none of them is relevant.
* This callback must only iterate over the children of a Widget, and return
* NULL if none of them is relevant.
*
* @returns A child widget if found, NULL otherwise
*/
typedef widget * ( *widget_find_mouse_target_cb )( widget *widget, WidgetType type, gint x, gint y );
typedef widget *(*widget_find_mouse_target_cb)(widget *widget, WidgetType type,
gint x, gint y);
/**
* @param widget The target widget
@ -105,14 +105,18 @@ typedef widget * ( *widget_find_mouse_target_cb )( widget *widget, WidgetType ty
* @param y The Y coordination of the mouse event relative to @param widget
* @param user_data The data passed to widget_set_trigger_action_handler()
*
* This callback should handle the action if relevant, and returns whether it did or not.
* This callback should handle the action if relevant, and returns whether it
* did or not.
*
* @returns Whether the action was handled or not, see enum values for details
*/
typedef WidgetTriggerActionResult ( *widget_trigger_action_cb )( widget *widget, guint action, gint x, gint y, void *user_data );
typedef WidgetTriggerActionResult (*widget_trigger_action_cb)(widget *widget,
guint action,
gint x, gint y,
void *user_data);
/** Macro to get widget from an implementation (e.g. textbox/scrollbar) */
#define WIDGET( a ) ( (widget *) ( a ) )
#define WIDGET(a) ((widget *)(a))
/**
* @param widget The widget to check
@ -123,7 +127,7 @@ typedef WidgetTriggerActionResult ( *widget_trigger_action_cb )( widget *widget,
*
* @return TRUE if x,y falls within the widget
*/
int widget_intersect ( const widget *widget, int x, int y );
int widget_intersect(const widget *widget, int x, int y);
/**
* @param widget The widget to move
@ -132,7 +136,7 @@ int widget_intersect ( const widget *widget, int x, int y );
*
* Moves the widget.
*/
void widget_move ( widget *widget, short x, short y );
void widget_move(widget *widget, short x, short y);
/**
* @param widget Handle to widget
@ -140,7 +144,7 @@ void widget_move ( widget *widget, short x, short y );
* Get the type of the widget.
* @returns The type of the widget.
*/
WidgetType widget_type ( widget *widget );
WidgetType widget_type(widget *widget);
/**
* @param widget Handle to widget
@ -148,7 +152,7 @@ WidgetType widget_type ( widget *widget );
*
* Set the widget type.
*/
void widget_set_type ( widget *widget, WidgetType type );
void widget_set_type(widget *widget, WidgetType type);
/**
* @param widget Handle to widget
@ -156,7 +160,7 @@ void widget_set_type ( widget *widget, WidgetType type );
* Check if widget is enabled.
* @returns TRUE when widget is enabled.
*/
gboolean widget_enabled ( widget *widget );
gboolean widget_enabled(widget *widget);
/**
* @param widget Handle to widget
@ -164,27 +168,23 @@ gboolean widget_enabled ( widget *widget );
*
* Disable the widget.
*/
void widget_set_enabled ( widget *widget, gboolean enabled );
void widget_set_enabled(widget *widget, gboolean enabled);
/**
* @param widget Handle to widget
*
* Disable the widget.
*/
static inline
void widget_disable ( widget *widget )
{
widget_set_enabled ( widget, FALSE );
static inline void widget_disable(widget *widget) {
widget_set_enabled(widget, FALSE);
}
/**
* @param widget Handle to widget
*
* Enable the widget.
*/
static inline
void widget_enable ( widget *widget )
{
widget_set_enabled ( widget, TRUE );
static inline void widget_enable(widget *widget) {
widget_set_enabled(widget, TRUE);
}
/**
@ -193,14 +193,14 @@ void widget_enable ( widget *widget )
*
* Render the textbox.
*/
void widget_draw ( widget *widget, cairo_t *d );
void widget_draw(widget *widget, cairo_t *d);
/**
* @param wid Handle to the widget
*
* Free the widget and all allocated memory.
*/
void widget_free ( widget *wid );
void widget_free(widget *wid);
/**
* @param widget The widget toresize
@ -209,35 +209,35 @@ void widget_free ( widget *wid );
*
* Resizes the widget.
*/
void widget_resize ( widget *widget, short w, short h );
void widget_resize(widget *widget, short w, short h);
/**
* @param widget The widget handle
*
* @returns the height of the widget.
*/
int widget_get_height ( widget *widget );
int widget_get_height(widget *widget);
/**
* @param widget The widget handle
*
* @returns the width of the widget.
*/
int widget_get_width ( widget *widget );
int widget_get_width(widget *widget);
/**
* @param widget The widget handle
*
* @returns the y position of the widget relative to its parent.
*/
int widget_get_y_pos ( widget *widget );
int widget_get_y_pos(widget *widget);
/**
* @param widget The widget handle
*
* @returns the x position of the widget relative to its parent.
*/
int widget_get_x_pos ( widget *widget );
int widget_get_x_pos(widget *widget);
/**
* @param widget The widget handle
@ -246,7 +246,7 @@ int widget_get_x_pos ( widget *widget );
*
* Will modify param x and param y to make them relative to param widget .
*/
void widget_xy_to_relative ( widget *widget, gint *x, gint *y );
void widget_xy_to_relative(widget *widget, gint *x, gint *y);
/**
* @param widget The widget handle
@ -254,20 +254,20 @@ void widget_xy_to_relative ( widget *widget, gint *x, gint *y );
* Update the widget, and its parent recursively.
* This should be called when size of widget changes.
*/
void widget_update ( widget *widget );
void widget_update(widget *widget);
/**
* @param wid The widget handle
*
* Indicate that the widget needs to be redrawn.
* This is done by setting the redraw flag on the toplevel widget.
*/
void widget_queue_redraw ( widget *wid );
void widget_queue_redraw(widget *wid);
/**
* @param wid The widget handle
*
* Check the flag indicating the widget needs to be redrawn.
*/
gboolean widget_need_redraw ( widget *wid );
gboolean widget_need_redraw(widget *wid);
/**
* @param wid The widget handle
@ -279,7 +279,7 @@ gboolean widget_need_redraw ( widget *wid );
*
* @returns returns the widget that should handle the mouse event.
*/
widget *widget_find_mouse_target ( widget *wid, WidgetType type, gint x, gint y );
widget *widget_find_mouse_target(widget *wid, WidgetType type, gint x, gint y);
/**
* @param wid The widget handle
@ -292,7 +292,8 @@ widget *widget_find_mouse_target ( widget *wid, WidgetType type, gint x, gint y
*
* @returns Whether the action was handled or not
*/
WidgetTriggerActionResult widget_trigger_action ( widget *wid, guint action, gint x, gint y );
WidgetTriggerActionResult widget_trigger_action(widget *wid, guint action,
gint x, gint y);
/**
* @param wid The widget handle
@ -301,7 +302,8 @@ WidgetTriggerActionResult widget_trigger_action ( widget *wid, guint action, gin
*
* Override the widget trigger action handler on widget.
*/
void widget_set_trigger_action_handler ( widget *wid, widget_trigger_action_cb cb, void *cb_data );
void widget_set_trigger_action_handler(widget *wid, widget_trigger_action_cb cb,
void *cb_data);
/**
* @param wid The widget handle
@ -312,7 +314,7 @@ void widget_set_trigger_action_handler ( widget *wid, widget_trigger_action_cb c
*
* @returns TRUE when handled.
*/
gboolean widget_motion_notify ( widget *wid, gint x, gint y );
gboolean widget_motion_notify(widget *wid, gint x, gint y);
/**
* @param wid The widget handle
@ -321,7 +323,7 @@ gboolean widget_motion_notify ( widget *wid, gint x, gint y );
*
* @returns the desired height of the widget in pixels.
*/
int widget_get_desired_height ( widget *wid );
int widget_get_desired_height(widget *wid);
/**
* @param wid The widget handle
@ -330,7 +332,7 @@ int widget_get_desired_height ( widget *wid );
*
* @returns the desired width of the widget in pixels.
*/
int widget_get_desired_width ( widget *wid );
int widget_get_desired_width(widget *wid);
/**
* @param wid The widget handle
*
@ -338,7 +340,7 @@ int widget_get_desired_width ( widget *wid );
*
* @returns the absolute x-position of widget of the widget in pixels.
*/
int widget_get_absolute_xpos ( widget *wid );
int widget_get_absolute_xpos(widget *wid);
/**
* @param wid The widget handle
*
@ -346,6 +348,6 @@ int widget_get_absolute_xpos ( widget *wid );
*
* @returns the absolute y-position of widget of the widget in pixels.
*/
int widget_get_absolute_ypos ( widget *wid );
int widget_get_absolute_ypos(widget *wid);
/**@}*/
#endif // ROFI_WIDGET_H

View File

@ -29,39 +29,38 @@
#define ROFI_XCB_INTERNAL_H
/** Indication we accept that startup notification api is not yet frozen */
#define SN_API_NOT_YET_FROZEN
#include <glib.h>
#include <libsn/sn.h>
#include <libgwater-xcb.h>
#include <xcb/xcb.h>
#include <xcb/xcb_ewmh.h>
#include "libgwater-xcb.h"
#include "nkutils-bindings.h"
#include <nkutils-bindings.h>
/**
* Structure to keep xcb stuff around.
*/
struct _xcb_stuff
{
GMainLoop *main_loop;
GWaterXcbSource *source;
xcb_connection_t *connection;
xcb_ewmh_connection_t ewmh;
xcb_screen_t *screen;
int screen_nbr;
SnDisplay *sndisplay;
SnLauncheeContext *sncontext;
struct _workarea *monitors;
struct
{
/** Flag indicating first event */
uint8_t first_event;
/** Keyboard device id */
int32_t device_id;
} xkb;
xcb_timestamp_t last_timestamp;
NkBindingsSeat *bindings_seat;
gboolean mouse_seen;
xcb_window_t focus_revert;
struct _xcb_stuff {
GMainLoop *main_loop;
GWaterXcbSource *source;
xcb_connection_t *connection;
xcb_ewmh_connection_t ewmh;
xcb_screen_t *screen;
int screen_nbr;
SnDisplay *sndisplay;
SnLauncheeContext *sncontext;
struct _workarea *monitors;
struct {
/** Flag indicating first event */
uint8_t first_event;
/** Keyboard device id */
int32_t device_id;
} xkb;
xcb_timestamp_t last_timestamp;
NkBindingsSeat *bindings_seat;
gboolean mouse_seen;
xcb_window_t focus_revert;
};
#endif

View File

@ -28,8 +28,8 @@
#ifndef ROFI_XCB_H
#define ROFI_XCB_H
#include <xcb/xcb.h>
#include <cairo.h>
#include <xcb/xcb.h>
/**
* xcb data structure type declaration.
@ -46,7 +46,7 @@ extern xcb_stuff *xcb;
*
* @returns the root window.
*/
xcb_window_t xcb_stuff_get_root_window ( void );
xcb_window_t xcb_stuff_get_root_window(void);
/**
* @param w The xcb_window_t to read property from.
@ -57,7 +57,7 @@ xcb_window_t xcb_stuff_get_root_window ( void );
*
* @returns a newly allocated string with the result or NULL
*/
char* window_get_text_prop ( xcb_window_t w, xcb_atom_t atom );
char *window_get_text_prop(xcb_window_t w, xcb_atom_t atom);
/**
* @param w The xcb_window_t to set property on
@ -67,28 +67,22 @@ char* window_get_text_prop ( xcb_window_t w, xcb_atom_t atom );
*
* Set property on window.
*/
void window_set_atom_prop ( xcb_window_t w, xcb_atom_t prop, xcb_atom_t *atoms, int count );
void window_set_atom_prop(xcb_window_t w, xcb_atom_t prop, xcb_atom_t *atoms,
int count);
/** For getting the atoms in an enum */
#define ATOM_ENUM( x ) x
#define ATOM_ENUM(x) x
/** Get the atoms as strings. */
#define ATOM_CHAR( x ) # x
#define ATOM_CHAR(x) #x
/** Atoms we want to pre-load */
#define EWMH_ATOMS( X ) \
X ( _NET_WM_WINDOW_OPACITY ), \
X ( I3_SOCKET_PATH ), \
X ( UTF8_STRING ), \
X ( STRING ), \
X ( CLIPBOARD ), \
X ( WM_WINDOW_ROLE ), \
X ( _XROOTPMAP_ID ), \
X ( _MOTIF_WM_HINTS ), \
X ( WM_TAKE_FOCUS ), \
X ( ESETROOT_PMAP_ID )
#define EWMH_ATOMS(X) \
X(_NET_WM_WINDOW_OPACITY), X(I3_SOCKET_PATH), X(UTF8_STRING), X(STRING), \
X(CLIPBOARD), X(WM_WINDOW_ROLE), X(_XROOTPMAP_ID), X(_MOTIF_WM_HINTS), \
X(WM_TAKE_FOCUS), X(ESETROOT_PMAP_ID)
/** enumeration of the atoms. */
enum { EWMH_ATOMS ( ATOM_ENUM ), NUM_NETATOMS };
enum { EWMH_ATOMS(ATOM_ENUM), NUM_NETATOMS };
/** atoms as string */
extern const char *netatom_names[];
/** atoms */
@ -97,25 +91,24 @@ extern xcb_atom_t netatoms[NUM_NETATOMS];
/**
* Structure describing a workarea/monitor.
*/
typedef struct _workarea
{
/** numeric monitor id. */
int monitor_id;
/** if monitor is set as primary monitor. */
int primary;
/** Horizontal location (in pixels) of the monitor. */
int x;
/** Vertical location (in pixels) of the monitor. */
int y;
/** Width of the monitor. */
int w;
/** Height of the monitor */
int h;
int mw, mh;
/** Output name of the monitor, e.g. eDP1 or VGA-1 */
char *name;
/** Pointer to next monitor */
struct _workarea *next;
typedef struct _workarea {
/** numeric monitor id. */
int monitor_id;
/** if monitor is set as primary monitor. */
int primary;
/** Horizontal location (in pixels) of the monitor. */
int x;
/** Vertical location (in pixels) of the monitor. */
int y;
/** Width of the monitor. */
int w;
/** Height of the monitor */
int h;
int mw, mh;
/** Output name of the monitor, e.g. eDP1 or VGA-1 */
char *name;
/** Pointer to next monitor */
struct _workarea *next;
} workarea;
/**
@ -125,19 +118,19 @@ typedef struct _workarea
*
* @returns TRUE if monitor is found, FALSE if no monitor could be detected.
*/
int monitor_active ( workarea *mon );
int monitor_active(workarea *mon);
/**
* @param w rofis window
*
* Stores old input focus for reverting and set focus to rofi.
*/
void rofi_xcb_set_input_focus ( xcb_window_t w );
void rofi_xcb_set_input_focus(xcb_window_t w);
/**
* IF set, revert the focus back to the original applications.
*/
void rofi_xcb_revert_input_focus ( void );
void rofi_xcb_revert_input_focus(void);
/**
* Depth of visual
@ -157,7 +150,7 @@ extern xcb_colormap_t map;
*
* @returns a cairo surface with the background image of the desktop.
*/
cairo_surface_t * x11_helper_get_bg_surface ( void );
cairo_surface_t *x11_helper_get_bg_surface(void);
/**
* Gets a surface for the root window of the desktop.
*
@ -165,7 +158,7 @@ cairo_surface_t * x11_helper_get_bg_surface ( void );
*
* @returns a cairo surface for the root window of the desktop.
*/
cairo_surface_t *x11_helper_get_screenshot_surface ( void );
cairo_surface_t *x11_helper_get_screenshot_surface(void);
/**
* @param window The X11 window to modify
@ -173,20 +166,19 @@ cairo_surface_t *x11_helper_get_screenshot_surface ( void );
* Set the right hints to disable the window decoration.
* (Set MOTIF_WM_HINTS, decoration field)
*/
void x11_disable_decoration ( xcb_window_t window );
void x11_disable_decoration(xcb_window_t window);
/**
* List of cursor types.
*/
typedef enum
{
/** Default arrow cursor */
CURSOR_DEFAULT = 0,
/** Cursor denoting a clickable area */
CURSOR_POINTER,
/** Cursor denoting an input field / selectable text */
CURSOR_TEXT,
NUM_CURSORS
typedef enum {
/** Default arrow cursor */
CURSOR_DEFAULT = 0,
/** Cursor denoting a clickable area */
CURSOR_POINTER,
/** Cursor denoting an input field / selectable text */
CURSOR_TEXT,
NUM_CURSORS
} X11CursorType;
/**
@ -195,21 +187,20 @@ typedef enum
*
* Change mouse cursor
*/
void x11_set_cursor ( xcb_window_t window, X11CursorType type );
void x11_set_cursor(xcb_window_t window, X11CursorType type);
/**
* List of window managers that need different behaviour to functioning.
*/
typedef enum
{
/** Default EWHM compatible window manager */
WM_EWHM = 0,
/** I3 Window manager */
WM_DO_NOT_CHANGE_CURRENT_DESKTOP = 1,
/** PANGO WORKSPACE NAMES */
WM_PANGO_WORKSPACE_NAMES = 2,
/** Root window offset (for bspwm) */
WM_ROOT_WINDOW_OFFSET = 4,
typedef enum {
/** Default EWHM compatible window manager */
WM_EWHM = 0,
/** I3 Window manager */
WM_DO_NOT_CHANGE_CURRENT_DESKTOP = 1,
/** PANGO WORKSPACE NAMES */
WM_PANGO_WORKSPACE_NAMES = 2,
/** Root window offset (for bspwm) */
WM_ROOT_WINDOW_OFFSET = 4,
} WindowManagerQuirk;
/**
@ -224,9 +215,11 @@ extern WindowManagerQuirk current_window_manager;
*
* Creates a thumbnail of the window.
*
* @returns NULL if window was not found, or unmapped, otherwise returns a cairo_surface.
* @returns NULL if window was not found, or unmapped, otherwise returns a
* cairo_surface.
*/
cairo_surface_t *x11_helper_get_screenshot_surface_window ( xcb_window_t window, int size );
cairo_surface_t *x11_helper_get_screenshot_surface_window(xcb_window_t window,
int size);
/**
* @param surface
@ -235,6 +228,7 @@ cairo_surface_t *x11_helper_get_screenshot_surface_window ( xcb_window_t window,
*
* Blur the content of the surface with radius and deviation.
*/
void cairo_image_surface_blur ( cairo_surface_t* surface, double radius, double deviation );
void cairo_image_surface_blur(cairo_surface_t *surface, double radius,
double deviation);
#endif

View File

@ -27,20 +27,22 @@
#ifndef ROFI_XRMOPTIONS_H
#define ROFI_XRMOPTIONS_H
#include "xcb.h"
#include "theme.h"
#include "xcb.h"
// Big thanks to Sean Pringle for this code.
/**
* @defgroup CONFXResources XResources Configuration
* @ingroup CONFIGURATION
*
* Configuration described in Xresource format. This can be loaded from the X server or file.
* Configuration described in Xresource format. This can be loaded from the X
* server or file.
*
* @defgroup CONFXServer XServer Configuration
* @ingroup CONFXResources
*
* Loads the configuration directly from the X server using the XResources system.
* Loads the configuration directly from the X server using the XResources
* system.
*
* @defgroup CONFCommandline Commandline Configuration
* @ingroup CONFIGURATION
@ -50,7 +52,8 @@
* @defgroup CONFFile File Configuration
* @ingroup CONFXResources
*
* Loads the configuration from a config file that uses the XResource file format.
* Loads the configuration from a config file that uses the XResource file
* format.
*
* @defgroup CONFIGURATION Configuration
*
@ -66,32 +69,31 @@
/**
* Type of the config options.
*/
typedef enum
{
/** Config option is string */
xrm_String = 0,
/** Config option is an unsigned number */
xrm_Number = 1,
/** Config option is a signed number */
xrm_SNumber = 2,
/** Config option is a boolean (true/false) value*/
xrm_Boolean = 3,
/** Config option is a character */
xrm_Char = 4
typedef enum {
/** Config option is string */
xrm_String = 0,
/** Config option is an unsigned number */
xrm_Number = 1,
/** Config option is a signed number */
xrm_SNumber = 2,
/** Config option is a boolean (true/false) value*/
xrm_Boolean = 3,
/** Config option is a character */
xrm_Char = 4
} XrmOptionType;
/**
* Parse commandline options.
* @ingroup CONFCommandline
*/
void config_parse_cmd_options ( void );
void config_parse_cmd_options(void);
/**
* Free any allocated memory.
*
* @ingroup CONFXResources
*/
void config_xresource_free ( void );
void config_xresource_free(void);
/**
* @param type The type of the value
@ -101,12 +103,14 @@ void config_xresource_free ( void );
*
* Add option (at runtime) to the dynamic option parser.
*/
void config_parser_add_option ( XrmOptionType type, const char *key, void **value, const char *comment );
void config_parser_add_option(XrmOptionType type, const char *key, void **value,
const char *comment);
/**
* Print the current configuration to stdout. Uses bold/italic when printing to terminal.
* Print the current configuration to stdout. Uses bold/italic when printing to
* terminal.
*/
void print_options ( void );
void print_options(void);
/**
* @param option The name of the option
@ -117,7 +121,8 @@ void print_options ( void );
*
* Function that does the markup for printing an configuration option to stdout.
*/
void print_help_msg ( const char *option, const char *type, const char*text, const char *def, int isatty );
void print_help_msg(const char *option, const char *type, const char *text,
const char *def, int isatty);
/**
* @param length the length of the returned array
@ -126,7 +131,7 @@ void print_help_msg ( const char *option, const char *type, const char*text, con
*
* @returns an array of string with length elements
*/
char ** config_parser_return_display_help ( unsigned int *length );
char **config_parser_return_display_help(unsigned int *length);
/**
* @brief Set config option.
@ -138,7 +143,7 @@ char ** config_parser_return_display_help ( unsigned int *length );
*
* @returns true when failed to set property.
*/
gboolean config_parse_set_property ( const Property *p, char **error );
gboolean config_parse_set_property(const Property *p, char **error);
/**
* @param out The destination.
@ -146,6 +151,6 @@ gboolean config_parse_set_property ( const Property *p, char **error );
*
* @brief Dump configuration in rasi format.
*/
void config_parse_dump_config_rasi_format ( FILE *out, gboolean changes );
void config_parse_dump_config_rasi_format(FILE *out, gboolean changes);
/** @}*/
#endif