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

@ -1,8 +1,11 @@
#ifndef 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) */
char *entry;
/** Icon name to display. */
@ -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.

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,8 +40,7 @@
/**
* List of all scopes the mouse can interact on.
*/
typedef enum
{
typedef enum {
SCOPE_GLOBAL,
SCOPE_MOUSE_LISTVIEW,
SCOPE_MOUSE_LISTVIEW_ELEMENT,
@ -55,8 +55,7 @@ typedef enum
/**
* List of all possible actions that can be triggered by a keybinding.
*/
typedef enum
{
typedef enum {
/** Paste from primary clipboard */
PASTE_PRIMARY = 1,
/** Paste from secondary clipboard */
@ -145,8 +144,7 @@ typedef enum
/**
* Actions mouse can take on the ListView.
*/
typedef enum
{
typedef enum {
SCROLL_LEFT = 1,
SCROLL_RIGHT,
SCROLL_DOWN,
@ -156,8 +154,7 @@ typedef enum
/**
* Actions mouse can take on the ListView element.
*/
typedef enum
{
typedef enum {
SELECT_HOVERED_ENTRY = 1,
ACCEPT_HOVERED_ENTRY,
ACCEPT_HOVERED_CUSTOM,
@ -166,8 +163,7 @@ typedef enum
/**
* Default mouse actions.
*/
typedef enum
{
typedef enum {
MOUSE_CLICK_DOWN = 1,
MOUSE_CLICK_UP,
MOUSE_DCLICK_DOWN,

View File

@ -44,14 +44,17 @@ 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
@ -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
@ -148,8 +156,7 @@ typedef char * ( *_mode_get_message )( const Mode *sw );
* It consists of a name, callback and if enabled
* a textbox for the sidebar-mode.
*/
struct rofi_mode
{
struct rofi_mode {
/** Used for external plugins. */
unsigned int abi_version;
/** Name (max 31 char long) */

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,8 +46,7 @@ typedef struct rofi_mode Mode;
/**
* Enum used to sum the possible states of ROFI.
*/
typedef enum
{
typedef enum {
/** Exit. */
MODE_EXIT = 1000,
/** Skip to the next cycle-able dialog. */
@ -63,8 +62,7 @@ typedef enum
/**
* State returned by the rofi window.
*/
typedef enum
{
typedef enum {
/** Entry is selected. */
MENU_OK = 0x00010000,
/** 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 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,13 +138,15 @@ 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.
*/
@ -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
@ -216,7 +222,8 @@ 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);
@ -236,7 +243,8 @@ char * mode_preprocess_input ( Mode *mode, const char *input );
*
* 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);
/**@}*/

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
@ -28,7 +28,8 @@ void rofi_icon_fetcher_destroy ( void );
* @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://.
*
@ -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.

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
@ -55,7 +55,8 @@ extern const char *cache_dir;
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.
*
@ -99,7 +100,8 @@ Mode * rofi_collect_modi_search ( const char *name );
#define color_red "\033[0;31m"
/** 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" \
"please report the following information to rofi's github page:\n" \
" * The generated commandline output when the error occurred.\n" \

View File

@ -35,8 +35,7 @@
*
* @ingroup CONFIGURATION
*/
typedef enum
{
typedef enum {
MM_NORMAL = 0,
MM_REGEX = 1,
MM_GLOB = 2,
@ -47,18 +46,13 @@ typedef enum
/**
* 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
{
typedef struct {
/** List of enabled modi */
char *modi;
/** Font string (pango format) */

View File

@ -27,16 +27,15 @@
#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
{
typedef enum {
/** Minimum width constraint. */
THEME_MEDIA_TYPE_MIN_WIDTH,
/** Maximum width constraint. */
@ -58,8 +57,7 @@ typedef enum
/**
* Theme Media description.
*/
typedef struct ThemeMedia
{
typedef struct ThemeMedia {
ThemeMediaType type;
double value;
} ThemeMedia;
@ -67,8 +65,7 @@ typedef struct ThemeMedia
/**
* ThemeWidget.
*/
typedef struct ThemeWidget
{
typedef struct ThemeWidget {
int set;
char *name;
@ -102,7 +99,8 @@ 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.
@ -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
@ -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
@ -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
@ -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.
@ -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,9 +378,11 @@ 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.
@ -375,7 +394,6 @@ gboolean rofi_theme_is_empty ( void );
*/
void rofi_theme_reset(void);
/**
* @param file File name to prepare.
* @param parent_file Filename of parent file.

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,8 +45,7 @@
*/
// State of the menu.
struct RofiViewState
{
struct RofiViewState {
/** #Mode bound to to this view. */
Mode *sw;
@ -126,8 +126,7 @@ struct RofiViewState
int y;
/** Position and target of the mouse. */
struct
{
struct {
/** X position */
int x;
/** Y position */

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,8 +45,7 @@
* @{
*/
typedef struct RofiViewState RofiViewState;
typedef enum
{
typedef enum {
/** Create a menu for entering text */
MENU_NORMAL = 0,
/** Create a menu for entering passwords */
@ -68,7 +68,9 @@ 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
@ -108,14 +110,16 @@ 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_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.
@ -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
@ -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
@ -293,8 +299,8 @@ 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.
*
* @{
*/

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.
*
* @{
*/

View File

@ -46,8 +46,7 @@ typedef struct _listview listview;
/**
* The scrolling type used in the list view
*/
typedef enum
{
typedef enum {
/** Flip through the pages. */
LISTVIEW_SCROLL_PER_PAGE,
/** keep selected item centered */
@ -58,12 +57,15 @@ typedef enum
* @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.
@ -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
@ -180,7 +184,8 @@ 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);
@ -191,7 +196,9 @@ 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

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,8 +40,7 @@
/**
* Internal structure for the scrollbar.
*/
typedef struct _scrollbar
{
typedef struct _scrollbar {
widget widget;
unsigned int length;
unsigned int pos;

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,9 +44,9 @@
* @{
*/
/** Cache to hold font descriptions. This it to avoid having to lookup each time. */
typedef struct TBFontConfig
{
/** Cache to hold font descriptions. This it to avoid having to lookup each
* time. */
typedef struct TBFontConfig {
/** Font description */
PangoFontDescription *pfd;
/** Font metrics */
@ -58,8 +58,7 @@ typedef struct TBFontConfig
* Internal structure of a textbox widget.
* TODO make this internal to textbox
*/
typedef struct
{
typedef struct {
widget widget;
unsigned long flags;
short cursor;
@ -87,8 +86,7 @@ typedef struct
/**
* Flags for configuring textbox behaviour and looks during creation.
*/
typedef enum
{
typedef enum {
TB_AUTOHEIGHT = 1 << 0,
TB_AUTOWIDTH = 1 << 1,
TB_EDITABLE = 1 << 19,
@ -100,8 +98,7 @@ typedef enum
/**
* Flags indicating current state of the textbox.
*/
typedef enum
{
typedef enum {
/** Normal */
NORMAL = 0,
/** Text in box is urgent. */
@ -138,8 +135,9 @@ 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.
@ -170,8 +168,8 @@ int textbox_keybinding ( textbox *tb, KeyBindingAction action );
* @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);
@ -191,7 +189,8 @@ 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
@ -277,8 +276,8 @@ 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.
*/

View File

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

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,8 +53,7 @@ typedef struct _widget widget;
/**
* Type of the widget. It is used to bubble events to the relevant widget.
*/
typedef enum
{
typedef enum {
/** Default type */
WIDGET_TYPE_UNKNOWN,
/** The listview widget */
@ -74,8 +73,7 @@ typedef enum
/**
* Whether and how the action was handled
*/
typedef enum
{
typedef enum {
/** The action was ignore and should bubble */
WIDGET_TRIGGER_ACTION_RESULT_IGNORED,
/** 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 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,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 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))
@ -171,9 +175,7 @@ void widget_set_enabled ( widget *widget, gboolean enabled );
*
* Disable the widget.
*/
static inline
void widget_disable ( widget *widget )
{
static inline void widget_disable(widget *widget) {
widget_set_enabled(widget, FALSE);
}
/**
@ -181,9 +183,7 @@ void widget_disable ( widget *widget )
*
* Enable the widget.
*/
static inline
void widget_enable ( widget *widget )
{
static inline void widget_enable(widget *widget) {
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
*/
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

View File

@ -29,19 +29,19 @@
#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
{
struct _xcb_stuff {
GMainLoop *main_loop;
GWaterXcbSource *source;
xcb_connection_t *connection;
@ -51,8 +51,7 @@ struct _xcb_stuff
SnDisplay *sndisplay;
SnLauncheeContext *sncontext;
struct _workarea *monitors;
struct
{
struct {
/** Flag indicating first event */
uint8_t first_event;
/** Keyboard device id */

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.
@ -67,7 +67,8 @@ 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
@ -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 */
#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 )
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 };
@ -97,8 +91,7 @@ extern xcb_atom_t netatoms[NUM_NETATOMS];
/**
* Structure describing a workarea/monitor.
*/
typedef struct _workarea
{
typedef struct _workarea {
/** numeric monitor id. */
int monitor_id;
/** if monitor is set as primary monitor. */
@ -178,8 +171,7 @@ void x11_disable_decoration ( xcb_window_t window );
/**
* List of cursor types.
*/
typedef enum
{
typedef enum {
/** Default arrow cursor */
CURSOR_DEFAULT = 0,
/** 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.
*/
typedef enum
{
typedef enum {
/** Default EWHM compatible window manager */
WM_EWHM = 0,
/** I3 Window manager */
@ -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,8 +69,7 @@
/**
* Type of the config options.
*/
typedef enum
{
typedef enum {
/** Config option is string */
xrm_String = 0,
/** Config option is an unsigned number */
@ -101,10 +103,12 @@ 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);
@ -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