1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-18 13:54:36 -05:00

Cleanup, update header files using clang-tidy.

This commit is contained in:
Dave Davenport 2021-08-19 13:34:01 +02:00
parent c5246a6bc7
commit 8d0dd01997
28 changed files with 1101 additions and 1048 deletions

View file

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

View file

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

View file

@ -1,8 +1,11 @@
#ifndef ROFI_DIALOGS_DMENU_SCRIPT_SHARED_H #ifndef ROFI_DIALOGS_DMENU_SCRIPT_SHARED_H
#define ROFI_DIALOGS_DMENU_SCRIPT_SHARED_H #define ROFI_DIALOGS_DMENU_SCRIPT_SHARED_H
typedef struct #include <glib.h>
{ #include <mode.h>
#include <stdint.h>
typedef struct {
/** Entry content. (visible part) */ /** Entry content. (visible part) */
char *entry; char *entry;
/** Icon name to display. */ /** Icon name to display. */
@ -26,5 +29,7 @@ typedef struct
* *
* Updates entry with the parsed values from buffer. * 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 #endif // ROFI_DIALOGS_DMENU_SCRIPT_SHARED_H

View file

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

View file

@ -33,8 +33,8 @@
* @ingroup MODES * @ingroup MODES
* *
* SSH Mode, returns a list of known SSH hosts the user can log into. * 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 does this by parsing the SSH config file and optional the known host and
* It also keeps history of the last chosen hosts. * host list It also keeps history of the last chosen hosts.
* *
* This mode uses the following options from the #config object: * This mode uses the following options from the #config object:
* * #Settings::ssh_command * * #Settings::ssh_command

View file

@ -27,8 +27,8 @@
#ifndef ROFI_HELPER_THEME_H #ifndef ROFI_HELPER_THEME_H
#define ROFI_HELPER_THEME_H #define ROFI_HELPER_THEME_H
#include <pango/pango.h>
#include "theme.h" #include "theme.h"
#include <pango/pango.h>
/** /**
* @defgroup HELPERS Helpers * @defgroup HELPERS Helpers
* @{ * @{
@ -39,11 +39,15 @@
* @param input The input string to find the matches on * @param input The input string to find the matches on
* @param retv The Attribute list to update with matches * @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. * @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. * @param pfd Pango font description to validate.

View file

@ -48,7 +48,8 @@
* Sets the entry in the history, if it exists its use-count is incremented. * 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. * @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. * 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. * @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) * Gets the entries in the list (in order of usage)
* @returns a list of entries length long. (and NULL terminated). * @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 #endif // ROFI_HISTORY_H

View file

@ -28,7 +28,8 @@
#ifndef ROFI_KEYB_H #ifndef ROFI_KEYB_H
#define ROFI_KEYB_H #define ROFI_KEYB_H
#include "nkutils-bindings.h" #include <glib.h>
#include <nkutils-bindings.h>
/** /**
* @defgroup KEYB KeyboardBindings * @defgroup KEYB KeyboardBindings
@ -39,8 +40,7 @@
/** /**
* List of all scopes the mouse can interact on. * List of all scopes the mouse can interact on.
*/ */
typedef enum typedef enum {
{
SCOPE_GLOBAL, SCOPE_GLOBAL,
SCOPE_MOUSE_LISTVIEW, SCOPE_MOUSE_LISTVIEW,
SCOPE_MOUSE_LISTVIEW_ELEMENT, SCOPE_MOUSE_LISTVIEW_ELEMENT,
@ -55,8 +55,7 @@ typedef enum
/** /**
* List of all possible actions that can be triggered by a keybinding. * List of all possible actions that can be triggered by a keybinding.
*/ */
typedef enum typedef enum {
{
/** Paste from primary clipboard */ /** Paste from primary clipboard */
PASTE_PRIMARY = 1, PASTE_PRIMARY = 1,
/** Paste from secondary clipboard */ /** Paste from secondary clipboard */
@ -145,8 +144,7 @@ typedef enum
/** /**
* Actions mouse can take on the ListView. * Actions mouse can take on the ListView.
*/ */
typedef enum typedef enum {
{
SCROLL_LEFT = 1, SCROLL_LEFT = 1,
SCROLL_RIGHT, SCROLL_RIGHT,
SCROLL_DOWN, SCROLL_DOWN,
@ -156,8 +154,7 @@ typedef enum
/** /**
* Actions mouse can take on the ListView element. * Actions mouse can take on the ListView element.
*/ */
typedef enum typedef enum {
{
SELECT_HOVERED_ENTRY = 1, SELECT_HOVERED_ENTRY = 1,
ACCEPT_HOVERED_ENTRY, ACCEPT_HOVERED_ENTRY,
ACCEPT_HOVERED_CUSTOM, ACCEPT_HOVERED_CUSTOM,
@ -166,8 +163,7 @@ typedef enum
/** /**
* Default mouse actions. * Default mouse actions.
*/ */
typedef enum typedef enum {
{
MOUSE_CLICK_DOWN = 1, MOUSE_CLICK_DOWN = 1,
MOUSE_CLICK_UP, MOUSE_CLICK_UP,
MOUSE_DCLICK_DOWN, MOUSE_DCLICK_DOWN,

View file

@ -44,14 +44,17 @@ typedef void ( *_mode_free )( Mode *data );
* @param sw The #Mode pointer * @param sw The #Mode pointer
* @param selected_line The selected line * @param selected_line The selected line
* @param state The state to display [out] * @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 * @param get_entry if it should only return the state
* *
* Get the value for displaying. * Get the value for displaying.
* *
* @return the string and state 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 * @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 * @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 * @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 * @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. * @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. * @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 * @param sw The #Mode pointer
@ -122,7 +129,8 @@ typedef void ( *__mode_destroy )( Mode *sw );
* *
* @returns the next action to take * @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 * @param sw The #Mode pointer
@ -148,8 +156,7 @@ typedef char * ( *_mode_get_message )( const Mode *sw );
* It consists of a name, callback and if enabled * It consists of a name, callback and if enabled
* a textbox for the sidebar-mode. * a textbox for the sidebar-mode.
*/ */
struct rofi_mode struct rofi_mode {
{
/** Used for external plugins. */ /** Used for external plugins. */
unsigned int abi_version; unsigned int abi_version;
/** Name (max 31 char long) */ /** Name (max 31 char long) */

View file

@ -27,8 +27,8 @@
#ifndef ROFI_MODE_H #ifndef ROFI_MODE_H
#define ROFI_MODE_H #define ROFI_MODE_H
#include <cairo.h>
#include "rofi-types.h" #include "rofi-types.h"
#include <cairo.h>
G_BEGIN_DECLS G_BEGIN_DECLS
/** /**
* @defgroup MODE Mode * @defgroup MODE Mode
@ -46,8 +46,7 @@ typedef struct rofi_mode Mode;
/** /**
* Enum used to sum the possible states of ROFI. * Enum used to sum the possible states of ROFI.
*/ */
typedef enum typedef enum {
{
/** Exit. */ /** Exit. */
MODE_EXIT = 1000, MODE_EXIT = 1000,
/** Skip to the next cycle-able dialog. */ /** Skip to the next cycle-able dialog. */
@ -63,8 +62,7 @@ typedef enum
/** /**
* State returned by the rofi window. * State returned by the rofi window.
*/ */
typedef enum typedef enum {
{
/** Entry is selected. */ /** Entry is selected. */
MENU_OK = 0x00010000, MENU_OK = 0x00010000,
/** User canceled the operation. (e.g. pressed escape) */ /** User canceled the operation. (e.g. pressed escape) */
@ -118,14 +116,18 @@ unsigned int mode_get_num_entries ( const Mode *mode );
* @param mode The mode to query * @param mode The mode to query
* @param selected_line The entry to query * @param selected_line The entry to query
* @param state The state of the entry [out] * @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. * @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 * @param mode The mode to query
@ -136,13 +138,15 @@ char * mode_get_display_value ( const Mode *mode, unsigned int selected_line, in
* *
* @returns allocated new cairo_surface_t if applicable * @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 mode The mode to query
* @param selected_line The entry 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. * @returns allocated string.
*/ */
@ -158,7 +162,8 @@ char * mode_get_completion ( const Mode *mode, unsigned int selected_line );
* *
* @returns the next #ModeMode. * @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 * @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 * @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 * @param mode The mode to query
@ -216,7 +222,8 @@ const char *mode_get_display_name ( const Mode *mode );
/** /**
* @param mode The mode to query * @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);
@ -236,7 +243,8 @@ char * mode_preprocess_input ( Mode *mode, const char *input );
* *
* Query the mode for a user display. * 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);
/**@}*/ /**@}*/

View file

@ -1,9 +1,9 @@
#ifndef ROFI_ICON_FETCHER_H #ifndef ROFI_ICON_FETCHER_H
#define ROFI_ICON_FETCHER_H #define ROFI_ICON_FETCHER_H
#include <cairo.h>
#include <glib.h> #include <glib.h>
#include <stdint.h> #include <stdint.h>
#include <cairo.h>
/** /**
* @defgroup ICONFETCHER IconFetcher * @defgroup ICONFETCHER IconFetcher
@ -28,7 +28,8 @@ void rofi_icon_fetcher_destroy ( void );
* @param size The size of the icon to fetch. * @param size The size of the icon to fetch.
* *
* Query the icon-theme for icon with name and size. * 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://. * name can also be a full path, if prefixed with file://.
* *
@ -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. * @param hsize The height of the icon to fetch.
* *
* Query the icon-theme for icon with name and size. * 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
* For icons it will take the min of wsize and hsize. * 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://. * name can also be a full path, if prefixed with file://.
* *
* @returns the uid identifying the request. * @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. * @param uid The unique id representing the matching request.

View file

@ -27,15 +27,15 @@
#ifndef ROFI_MAIN_H #ifndef ROFI_MAIN_H
#define 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 "keyb.h"
#include "mode.h" #include "mode.h"
#include "rofi-types.h"
#include "view.h" #include "view.h"
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <xcb/xcb.h>
#include <xkbcommon/xkbcommon.h>
/** /**
* @defgroup Main Main * @defgroup Main Main
@ -55,7 +55,8 @@ extern const char *cache_dir;
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. * Get an enabled mode handle.
* *
@ -99,7 +100,8 @@ Mode * rofi_collect_modi_search ( const char *name );
#define color_red "\033[0;31m" #define color_red "\033[0;31m"
/** Appends instructions on how to report an error. */ /** Appends instructions on how to report an error. */
#define ERROR_MSG( a ) a "\n" \ #define ERROR_MSG(a) \
a "\n" \
"If you suspect this is caused by a bug in rofi,\n" \ "If you suspect this is caused by a bug in rofi,\n" \
"please report the following information to rofi's github page:\n" \ "please report the following information to rofi's github page:\n" \
" * The generated commandline output when the error occurred.\n" \ " * The generated commandline output when the error occurred.\n" \

View file

@ -35,8 +35,7 @@
* *
* @ingroup CONFIGURATION * @ingroup CONFIGURATION
*/ */
typedef enum typedef enum {
{
MM_NORMAL = 0, MM_NORMAL = 0,
MM_REGEX = 1, MM_REGEX = 1,
MM_GLOB = 2, MM_GLOB = 2,
@ -47,18 +46,13 @@ typedef enum
/** /**
* Possible sorting methods for listview. * Possible sorting methods for listview.
*/ */
typedef enum typedef enum { SORT_NORMAL = 0, SORT_FZF = 1 } SortingMethod;
{
SORT_NORMAL = 0,
SORT_FZF = 1
} SortingMethod;
/** /**
* Settings structure holding all (static) configurable options. * Settings structure holding all (static) configurable options.
* @ingroup CONFIGURATION * @ingroup CONFIGURATION
*/ */
typedef struct typedef struct {
{
/** List of enabled modi */ /** List of enabled modi */
char *modi; char *modi;
/** Font string (pango format) */ /** Font string (pango format) */

View file

@ -27,16 +27,15 @@
#ifndef THEME_H #ifndef THEME_H
#define THEME_H #define THEME_H
#include <glib.h>
#include <cairo.h>
#include <widgets/widget.h>
#include "rofi-types.h" #include "rofi-types.h"
#include <cairo.h>
#include <glib.h>
#include <widgets/widget.h>
/** /**
* Describe the media constraint type. * Describe the media constraint type.
*/ */
typedef enum typedef enum {
{
/** Minimum width constraint. */ /** Minimum width constraint. */
THEME_MEDIA_TYPE_MIN_WIDTH, THEME_MEDIA_TYPE_MIN_WIDTH,
/** Maximum width constraint. */ /** Maximum width constraint. */
@ -58,8 +57,7 @@ typedef enum
/** /**
* Theme Media description. * Theme Media description.
*/ */
typedef struct ThemeMedia typedef struct ThemeMedia {
{
ThemeMediaType type; ThemeMediaType type;
double value; double value;
} ThemeMedia; } ThemeMedia;
@ -67,8 +65,7 @@ typedef struct ThemeMedia
/** /**
* ThemeWidget. * ThemeWidget.
*/ */
typedef struct ThemeWidget typedef struct ThemeWidget {
{
int set; int set;
char *name; char *name;
@ -102,7 +99,8 @@ extern ThemeWidget *rofi_configuration;
* *
* @returns handle to the new entry. * @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. * @param widget The widget handle.
@ -180,7 +178,8 @@ void rofi_theme_widget_add_properties ( ThemeWidget *widget, GHashTable *table )
* *
* @returns The distance value of this property for this widget. * @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 * @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. * @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 * @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. * @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 * @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. * @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 widget The widget to query
* @param property The property 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. * @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 * @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. * @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 * @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. * 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 * @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. * @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 * @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. * @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 * @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. * @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. * @param d The distance handle.
@ -335,24 +346,30 @@ void distance_get_linestyle ( RofiDistance d, cairo_t *draw );
* @param state The state of the element. * @param state The state of the element.
* @param exact If the match should be exact, or parent can be included. * @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. * @returns the ThemeWidget if found, otherwise NULL.
*/ */
ThemeWidget *rofi_theme_find_widget ( const char *name, const char *state, gboolean exact ); ThemeWidget *rofi_theme_find_widget(const char *name, const char *state,
ThemeWidget *rofi_config_find_widget ( const char *name, const char *state, gboolean exact ); 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 widget The widget to find the property on.
* @param type The %PropertyType to find. * @param type The %PropertyType to find.
* @param property The property 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. * @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 * @param widget The widget to query
@ -361,9 +378,11 @@ Property *rofi_theme_find_property ( ThemeWidget *widget, PropertyType type, con
* *
* Obtain list of elements (strings) of the widget. * 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. * Checks if a theme is set, or is empty.
* @returns TRUE when empty. * @returns TRUE when empty.
@ -375,7 +394,6 @@ gboolean rofi_theme_is_empty ( void );
*/ */
void rofi_theme_reset(void); void rofi_theme_reset(void);
/** /**
* @param file File name to prepare. * @param file File name to prepare.
* @param parent_file Filename of parent file. * @param parent_file Filename of parent file.

View file

@ -27,15 +27,16 @@
#ifndef ROFI_VIEW_INTERNAL_H #ifndef ROFI_VIEW_INTERNAL_H
#define ROFI_VIEW_INTERNAL_H #define ROFI_VIEW_INTERNAL_H
#include "widgets/container.h" #include "keyb.h"
#include "widgets/widget.h" #include "mode.h"
#include "widgets/textbox.h" #include "theme.h"
#include "widgets/box.h" #include "widgets/box.h"
#include "widgets/container.h"
#include "widgets/icon.h" #include "widgets/icon.h"
#include "widgets/listview.h" #include "widgets/listview.h"
#include "keyb.h" #include "widgets/textbox.h"
#include "widgets/widget.h"
#include "xcb.h" #include "xcb.h"
#include "theme.h"
/** /**
* @ingroup ViewHandle * @ingroup ViewHandle
@ -44,8 +45,7 @@
*/ */
// State of the menu. // State of the menu.
struct RofiViewState struct RofiViewState {
{
/** #Mode bound to to this view. */ /** #Mode bound to to this view. */
Mode *sw; Mode *sw;
@ -126,8 +126,7 @@ struct RofiViewState
int y; int y;
/** Position and target of the mouse. */ /** Position and target of the mouse. */
struct struct {
{
/** X position */ /** X position */
int x; int x;
/** Y position */ /** Y position */

View file

@ -27,8 +27,9 @@
#ifndef ROFI_VIEW_H #ifndef ROFI_VIEW_H
#define ROFI_VIEW_H #define ROFI_VIEW_H
#include "mode.h"
#include "mode.h"
#include <xcb/xcb.h>
/** /**
* @defgroup View View * @defgroup View View
* *
@ -44,8 +45,7 @@
* @{ * @{
*/ */
typedef struct RofiViewState RofiViewState; typedef struct RofiViewState RofiViewState;
typedef enum typedef enum {
{
/** Create a menu for entering text */ /** Create a menu for entering text */
MENU_NORMAL = 0, MENU_NORMAL = 0,
/** Create a menu for entering passwords */ /** Create a menu for entering passwords */
@ -68,7 +68,9 @@ typedef enum
* *
* @returns The command issued (see MenuReturn) * @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 * @param state The Menu Handle
@ -108,14 +110,16 @@ void rofi_view_handle_text ( RofiViewState *state, char *text );
* *
* Update the state if needed. * 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 * @param state the Menu handle
* *
* Update the state if needed. * Update the state if needed.
*/ */
void rofi_view_maybe_update(RofiViewState *state); 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_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_temp_click_to_exit(RofiViewState *state, xcb_window_t target);
/** /**
* Update the state if needed. * Update the state if needed.
@ -140,7 +144,8 @@ const char * rofi_view_get_user_input ( const RofiViewState *state );
* *
* Select a line. * 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 * @param state The Menu Handle
@ -165,7 +170,8 @@ void rofi_view_restart ( RofiViewState *state );
* *
* @returns TRUE if action was handled. * @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 * @param state The handle to the view
@ -293,8 +299,8 @@ xcb_window_t rofi_view_get_window ( void );
* @defgroup ViewThreadPool ViewThreadPool * @defgroup ViewThreadPool ViewThreadPool
* @ingroup View * @ingroup View
* *
* The view can (optionally) keep a set of worker threads around to parallize work. * The view can (optionally) keep a set of worker threads around to parallize
* This includes filtering and sorting. * work. This includes filtering and sorting.
* *
* @{ * @{
*/ */

View file

@ -28,17 +28,17 @@
#ifndef ROFI_HBOX_H #ifndef ROFI_HBOX_H
#define ROFI_HBOX_H #define ROFI_HBOX_H
#include "widget.h"
#include "rofi-types.h" #include "rofi-types.h"
#include "widget.h"
/** /**
* @defgroup box box * @defgroup box box
* @ingroup widget * @ingroup widget
* *
* Widget used to pack multiple widgets either horizontally or vertically. * Widget used to pack multiple widgets either horizontally or vertically.
* It supports packing widgets horizontally or vertically. Child widgets are always * It supports packing widgets horizontally or vertically. Child widgets are
* expanded to the maximum size in the opposite direction of the packing direction. * always expanded to the maximum size in the opposite direction of the packing
* e.g. vertically packed widgets use the full box width. * direction. e.g. vertically packed widgets use the full box width.
* *
* @{ * @{
*/ */

View file

@ -46,8 +46,7 @@ typedef struct _listview listview;
/** /**
* The scrolling type used in the list view * The scrolling type used in the list view
*/ */
typedef enum typedef enum {
{
/** Flip through the pages. */ /** Flip through the pages. */
LISTVIEW_SCROLL_PER_PAGE, LISTVIEW_SCROLL_PER_PAGE,
/** keep selected item centered */ /** keep selected item centered */
@ -58,12 +57,15 @@ typedef enum
* @param tb The textbox to set * @param tb The textbox to set
* @param entry The position of the textbox * @param entry The position of the textbox
* @param udata User data * @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. * @param full If true Set both text and style.
* *
* Update callback, this is called to set the value of each (visible) element. * 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. * Callback when a element is activated.
@ -80,7 +82,9 @@ typedef void ( *listview_mouse_activated_cb )( listview *, gboolean, void * );
* *
* @returns a new listview * @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 * @param lv The listview handle
@ -180,7 +184,8 @@ void listview_set_cycle ( listview *lv, gboolean cycle );
* @param lv Handler to the listview object * @param lv Handler to the listview object
* @param type ScrollType * @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);
@ -191,7 +196,9 @@ void listview_set_scroll_type ( listview *lv, ScrollType type );
* *
* Set the mouse activated callback. * 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 lv Handler to the listview object
* @param enable boolean to enable/disable multi-select * @param enable boolean to enable/disable multi-select

View file

@ -27,9 +27,9 @@
#ifndef ROFI_SCROLLBAR_H #ifndef ROFI_SCROLLBAR_H
#define ROFI_SCROLLBAR_H #define ROFI_SCROLLBAR_H
#include <cairo.h>
#include "widgets/widget.h"
#include "widgets/widget-internal.h" #include "widgets/widget-internal.h"
#include "widgets/widget.h"
#include <cairo.h>
/** /**
* @defgroup Scrollbar Scrollbar * @defgroup Scrollbar Scrollbar
@ -40,8 +40,7 @@
/** /**
* Internal structure for the scrollbar. * Internal structure for the scrollbar.
*/ */
typedef struct _scrollbar typedef struct _scrollbar {
{
widget widget; widget widget;
unsigned int length; unsigned int length;
unsigned int pos; unsigned int pos;

View file

@ -28,14 +28,14 @@
#ifndef ROFI_TEXTBOX_H #ifndef ROFI_TEXTBOX_H
#define 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 "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 * @defgroup Textbox Textbox
@ -44,9 +44,9 @@
* @{ * @{
*/ */
/** Cache to hold font descriptions. This it to avoid having to lookup each time. */ /** Cache to hold font descriptions. This it to avoid having to lookup each
typedef struct TBFontConfig * time. */
{ typedef struct TBFontConfig {
/** Font description */ /** Font description */
PangoFontDescription *pfd; PangoFontDescription *pfd;
/** Font metrics */ /** Font metrics */
@ -58,8 +58,7 @@ typedef struct TBFontConfig
* Internal structure of a textbox widget. * Internal structure of a textbox widget.
* TODO make this internal to textbox * TODO make this internal to textbox
*/ */
typedef struct typedef struct {
{
widget widget; widget widget;
unsigned long flags; unsigned long flags;
short cursor; short cursor;
@ -87,8 +86,7 @@ typedef struct
/** /**
* Flags for configuring textbox behaviour and looks during creation. * Flags for configuring textbox behaviour and looks during creation.
*/ */
typedef enum typedef enum {
{
TB_AUTOHEIGHT = 1 << 0, TB_AUTOHEIGHT = 1 << 0,
TB_AUTOWIDTH = 1 << 1, TB_AUTOWIDTH = 1 << 1,
TB_EDITABLE = 1 << 19, TB_EDITABLE = 1 << 19,
@ -100,8 +98,7 @@ typedef enum
/** /**
* Flags indicating current state of the textbox. * Flags indicating current state of the textbox.
*/ */
typedef enum typedef enum {
{
/** Normal */ /** Normal */
NORMAL = 0, NORMAL = 0,
/** Text in box is urgent. */ /** Text in box is urgent. */
@ -138,8 +135,9 @@ typedef enum
* free with #widget_free * free with #widget_free
* @returns a new #textbox * @returns a new #textbox
*/ */
textbox* textbox_create ( widget *parent, WidgetType type, const char *name, TextboxFlags flags, textbox *textbox_create(widget *parent, WidgetType type, const char *name,
TextBoxFontType tbft, const char *text, double xalign, double yalign ); TextboxFlags flags, TextBoxFontType tbft,
const char *text, double xalign, double yalign);
/** /**
* @param tb Handle to the textbox * @param tb Handle to the textbox
* @param tbft The style of font to render. * @param tbft The style of font to render.
@ -170,8 +168,8 @@ int textbox_keybinding ( textbox *tb, KeyBindingAction action );
* @param pad The text to insert * @param pad The text to insert
* @param pad_len the length of the text * @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 * The text should be one insert from a keypress.. the first gunichar is
* return TRUE if inserted * 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);
@ -191,7 +189,8 @@ void textbox_cursor ( textbox *tb, int pos );
* *
* Insert the string str at position 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 * Setup the cached fonts. This is required to do
@ -277,8 +276,8 @@ void textbox_moveresize ( textbox *tb, int x, int y, int w, int h );
* @param tb Handle to the textbox * @param tb Handle to the textbox
* @param eh The number of rows to display * @param eh The number of rows to display
* *
* Get the (estimated) with of a character, can be used to calculate window width. * Get the (estimated) with of a character, can be used to calculate window
* This includes padding. * width. This includes padding.
* *
* @returns the estimated width of a character. * @returns the estimated width of a character.
*/ */

View file

@ -32,8 +32,7 @@
/** /**
* Data structure holding the internal state of the Widget * Data structure holding the internal state of the Widget
*/ */
struct _widget struct _widget {
{
/** The type of the widget */ /** The type of the widget */
WidgetType type; WidgetType type;
/** X position relative to parent */ /** X position relative to parent */
@ -110,7 +109,8 @@ struct _widget
* Initializes the widget structure. * 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. * @param widget The widget handle.

View file

@ -27,19 +27,19 @@
#ifndef ROFI_WIDGET_H #ifndef ROFI_WIDGET_H
#define ROFI_WIDGET_H #define ROFI_WIDGET_H
#include <glib.h> #include "keyb.h"
#include <cairo.h> #include <cairo.h>
#include <glib.h>
#include <xcb/xcb.h> #include <xcb/xcb.h>
#include <xcb/xproto.h> #include <xcb/xproto.h>
#include "keyb.h"
/** /**
* @defgroup widget widget * @defgroup widget widget
* *
* Generic abstract widget class. Widgets should 'inherit' from this class (first structure in there structure should be * Generic abstract widget class. Widgets should 'inherit' from this class
* widget). * (first structure in there structure should be widget). The generic widget
* The generic widget implements generic functions like get_width, get_height, draw, resize, update, free and * implements generic functions like get_width, get_height, draw, resize,
* clicked. * update, free and clicked. It also holds information about how the widget
* It also holds information about how the widget should be packed. * should be packed.
* *
* @{ * @{
*/ */
@ -53,8 +53,7 @@ typedef struct _widget widget;
/** /**
* Type of the widget. It is used to bubble events to the relevant widget. * Type of the widget. It is used to bubble events to the relevant widget.
*/ */
typedef enum typedef enum {
{
/** Default type */ /** Default type */
WIDGET_TYPE_UNKNOWN, WIDGET_TYPE_UNKNOWN,
/** The listview widget */ /** The listview widget */
@ -74,8 +73,7 @@ typedef enum
/** /**
* Whether and how the action was handled * Whether and how the action was handled
*/ */
typedef enum typedef enum {
{
/** The action was ignore and should bubble */ /** The action was ignore and should bubble */
WIDGET_TRIGGER_ACTION_RESULT_IGNORED, WIDGET_TRIGGER_ACTION_RESULT_IGNORED,
/** The action was handled directly */ /** The action was handled directly */
@ -92,11 +90,13 @@ typedef enum
* @param x The X coordination of the mouse event relative to @param widget * @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 * @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 * @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 * @param widget The target widget
@ -105,11 +105,15 @@ 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 y The Y coordination of the mouse event relative to @param widget
* @param user_data The data passed to widget_set_trigger_action_handler() * @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 * @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) */ /** Macro to get widget from an implementation (e.g. textbox/scrollbar) */
#define WIDGET(a) ((widget *)(a)) #define WIDGET(a) ((widget *)(a))
@ -171,9 +175,7 @@ void widget_set_enabled ( widget *widget, gboolean enabled );
* *
* Disable the widget. * Disable the widget.
*/ */
static inline static inline void widget_disable(widget *widget) {
void widget_disable ( widget *widget )
{
widget_set_enabled(widget, FALSE); widget_set_enabled(widget, FALSE);
} }
/** /**
@ -181,9 +183,7 @@ void widget_disable ( widget *widget )
* *
* Enable the widget. * Enable the widget.
*/ */
static inline static inline void widget_enable(widget *widget) {
void widget_enable ( widget *widget )
{
widget_set_enabled(widget, TRUE); widget_set_enabled(widget, TRUE);
} }
@ -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 * @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 * @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. * 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 * @param wid The widget handle

View file

@ -29,19 +29,19 @@
#define ROFI_XCB_INTERNAL_H #define ROFI_XCB_INTERNAL_H
/** Indication we accept that startup notification api is not yet frozen */ /** Indication we accept that startup notification api is not yet frozen */
#define SN_API_NOT_YET_FROZEN #define SN_API_NOT_YET_FROZEN
#include <glib.h>
#include <libsn/sn.h> #include <libsn/sn.h>
#include <libgwater-xcb.h>
#include <xcb/xcb.h> #include <xcb/xcb.h>
#include <xcb/xcb_ewmh.h> #include <xcb/xcb_ewmh.h>
#include "libgwater-xcb.h"
#include "nkutils-bindings.h" #include <nkutils-bindings.h>
/** /**
* Structure to keep xcb stuff around. * Structure to keep xcb stuff around.
*/ */
struct _xcb_stuff struct _xcb_stuff {
{
GMainLoop *main_loop; GMainLoop *main_loop;
GWaterXcbSource *source; GWaterXcbSource *source;
xcb_connection_t *connection; xcb_connection_t *connection;
@ -51,8 +51,7 @@ struct _xcb_stuff
SnDisplay *sndisplay; SnDisplay *sndisplay;
SnLauncheeContext *sncontext; SnLauncheeContext *sncontext;
struct _workarea *monitors; struct _workarea *monitors;
struct struct {
{
/** Flag indicating first event */ /** Flag indicating first event */
uint8_t first_event; uint8_t first_event;
/** Keyboard device id */ /** Keyboard device id */

View file

@ -28,8 +28,8 @@
#ifndef ROFI_XCB_H #ifndef ROFI_XCB_H
#define ROFI_XCB_H #define ROFI_XCB_H
#include <xcb/xcb.h>
#include <cairo.h> #include <cairo.h>
#include <xcb/xcb.h>
/** /**
* xcb data structure type declaration. * xcb data structure type declaration.
@ -67,7 +67,8 @@ char* window_get_text_prop ( xcb_window_t w, xcb_atom_t atom );
* *
* Set property on window. * 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 */ /** For getting the atoms in an enum */
#define ATOM_ENUM(x) x #define ATOM_ENUM(x) x
@ -76,16 +77,9 @@ void window_set_atom_prop ( xcb_window_t w, xcb_atom_t prop, xcb_atom_t *atoms,
/** Atoms we want to pre-load */ /** Atoms we want to pre-load */
#define EWMH_ATOMS(X) \ #define EWMH_ATOMS(X) \
X ( _NET_WM_WINDOW_OPACITY ), \ X(_NET_WM_WINDOW_OPACITY), X(I3_SOCKET_PATH), X(UTF8_STRING), X(STRING), \
X ( I3_SOCKET_PATH ), \ X(CLIPBOARD), X(WM_WINDOW_ROLE), X(_XROOTPMAP_ID), X(_MOTIF_WM_HINTS), \
X ( UTF8_STRING ), \ X(WM_TAKE_FOCUS), X(ESETROOT_PMAP_ID)
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. */ /** enumeration of the atoms. */
enum { EWMH_ATOMS(ATOM_ENUM), NUM_NETATOMS }; enum { EWMH_ATOMS(ATOM_ENUM), NUM_NETATOMS };
@ -97,8 +91,7 @@ extern xcb_atom_t netatoms[NUM_NETATOMS];
/** /**
* Structure describing a workarea/monitor. * Structure describing a workarea/monitor.
*/ */
typedef struct _workarea typedef struct _workarea {
{
/** numeric monitor id. */ /** numeric monitor id. */
int monitor_id; int monitor_id;
/** if monitor is set as primary monitor. */ /** if monitor is set as primary monitor. */
@ -178,8 +171,7 @@ void x11_disable_decoration ( xcb_window_t window );
/** /**
* List of cursor types. * List of cursor types.
*/ */
typedef enum typedef enum {
{
/** Default arrow cursor */ /** Default arrow cursor */
CURSOR_DEFAULT = 0, CURSOR_DEFAULT = 0,
/** Cursor denoting a clickable area */ /** Cursor denoting a clickable area */
@ -200,8 +192,7 @@ void x11_set_cursor ( xcb_window_t window, X11CursorType type );
/** /**
* List of window managers that need different behaviour to functioning. * List of window managers that need different behaviour to functioning.
*/ */
typedef enum typedef enum {
{
/** Default EWHM compatible window manager */ /** Default EWHM compatible window manager */
WM_EWHM = 0, WM_EWHM = 0,
/** I3 Window manager */ /** I3 Window manager */
@ -224,9 +215,11 @@ extern WindowManagerQuirk current_window_manager;
* *
* Creates a thumbnail of the window. * 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 * @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. * 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 #endif

View file

@ -27,20 +27,22 @@
#ifndef ROFI_XRMOPTIONS_H #ifndef ROFI_XRMOPTIONS_H
#define ROFI_XRMOPTIONS_H #define ROFI_XRMOPTIONS_H
#include "xcb.h"
#include "theme.h" #include "theme.h"
#include "xcb.h"
// Big thanks to Sean Pringle for this code. // Big thanks to Sean Pringle for this code.
/** /**
* @defgroup CONFXResources XResources Configuration * @defgroup CONFXResources XResources Configuration
* @ingroup 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 * @defgroup CONFXServer XServer Configuration
* @ingroup CONFXResources * @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 * @defgroup CONFCommandline Commandline Configuration
* @ingroup CONFIGURATION * @ingroup CONFIGURATION
@ -50,7 +52,8 @@
* @defgroup CONFFile File Configuration * @defgroup CONFFile File Configuration
* @ingroup CONFXResources * @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 * @defgroup CONFIGURATION Configuration
* *
@ -66,8 +69,7 @@
/** /**
* Type of the config options. * Type of the config options.
*/ */
typedef enum typedef enum {
{
/** Config option is string */ /** Config option is string */
xrm_String = 0, xrm_String = 0,
/** Config option is an unsigned number */ /** Config option is an unsigned number */
@ -101,10 +103,12 @@ void config_xresource_free ( void );
* *
* Add option (at runtime) to the dynamic option parser. * 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);
@ -117,7 +121,8 @@ void print_options ( void );
* *
* Function that does the markup for printing an configuration option to stdout. * 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 * @param length the length of the returned array