1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-25 13:55:34 -05:00

More doxygen sugar.

This commit is contained in:
Dave Davenport 2016-01-07 16:01:56 +01:00
parent 38be9d94ae
commit 51b5511017
21 changed files with 2053 additions and 924 deletions

View file

@ -50,6 +50,7 @@ rofi_SOURCES=\
source/dialogs/window.c\ source/dialogs/window.c\
source/dialogs/script.c\ source/dialogs/script.c\
include/rofi.h\ include/rofi.h\
include/settings.h\
include/keyb.h\ include/keyb.h\
include/helper.h\ include/helper.h\
include/timings.h\ include/timings.h\
@ -131,6 +132,7 @@ rofi_test_SOURCES=\
source/history.c\ source/history.c\
config/config.c\ config/config.c\
include/rofi.h\ include/rofi.h\
include/settings.h\
include/history.h\ include/history.h\
test/history-test.c test/history-test.c
@ -143,6 +145,7 @@ textbox_test_SOURCES=\
source/helper.c\ source/helper.c\
include/keyb.h\ include/keyb.h\
include/rofi.h\ include/rofi.h\
include/settings.h\
include/textbox.h\ include/textbox.h\
include/x11-helper.h\ include/x11-helper.h\
include/xrmoptions.h\ include/xrmoptions.h\
@ -226,7 +229,7 @@ cppcheck: ${rofi_SOURCES}
.PHONY: ohcount .PHONY: ohcount
ohcount: ${rofi_SOURCES} ohcount: ${rofi_SOURCES}
ohcount -i ${top_srcdir}/source/ ohcount -i ${top_srcdir}/source/ ${top_srcdir}/include/
doxy: doc/rofi.doxy ${rofi_SOURCES} doxy: doc/rofi.doxy ${rofi_SOURCES}
doxygen ${top_builddir}/doc/rofi.doxy doxygen ${top_builddir}/doc/rofi.doxy

View file

@ -26,7 +26,8 @@
*/ */
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "rofi.h" #include <glib.h>
#include "settings.h"
Settings config = { Settings config = {
/** List of enabled modi. */ /** List of enabled modi. */

File diff suppressed because it is too large Load diff

View file

@ -9,19 +9,33 @@
typedef enum _KeyBindingAction typedef enum _KeyBindingAction
{ {
/** Paste from primary clipboard */
PASTE_PRIMARY = 0, PASTE_PRIMARY = 0,
/** Paste from secondary clipboard */
PASTE_SECONDARY, PASTE_SECONDARY,
/** Clear the entry box. */
CLEAR_LINE, CLEAR_LINE,
/** Move to front of text */
MOVE_FRONT, MOVE_FRONT,
/** Move to end of text */
MOVE_END, MOVE_END,
/** Move on word back */
MOVE_WORD_BACK, MOVE_WORD_BACK,
/** Move on word forward */
MOVE_WORD_FORWARD, MOVE_WORD_FORWARD,
/** Move character back */
MOVE_CHAR_BACK, MOVE_CHAR_BACK,
/** Move character forward */
MOVE_CHAR_FORWARD, MOVE_CHAR_FORWARD,
/** Remove previous word */
REMOVE_WORD_BACK, REMOVE_WORD_BACK,
/** Remove next work */
REMOVE_WORD_FORWARD, REMOVE_WORD_FORWARD,
/** Remove next character */
REMOVE_CHAR_FORWARD, REMOVE_CHAR_FORWARD,
/** Remove previous character */
REMOVE_CHAR_BACK, REMOVE_CHAR_BACK,
/** Accept the current selected entry */
ACCEPT_ENTRY, ACCEPT_ENTRY,
ACCEPT_CUSTOM, ACCEPT_CUSTOM,
ACCEPT_ENTRY_CONTINUE, ACCEPT_ENTRY_CONTINUE,

View file

@ -14,6 +14,10 @@
* @defgroup Widgets Widgets * @defgroup Widgets Widgets
*/ */
/**
* @defgroup Main Main
* @{
*/
/** /**
* Pointer to xdg cache directory. * Pointer to xdg cache directory.
*/ */
@ -67,38 +71,6 @@ typedef enum
*/ */
void catch_exit ( __attribute__( ( unused ) ) int sig ); void catch_exit ( __attribute__( ( unused ) ) int sig );
/**
* Enumeration indicating location or gravity of window.
*
* WL_NORTH_WEST WL_NORTH WL_NORTH_EAST
*
* WL_EAST WL_CENTER WL_EAST
*
* WL_SOUTH_WEST WL_SOUTH WL_SOUTH_EAST
*
*/
typedef enum _WindowLocation
{
/** Center */
WL_CENTER = 0,
/** Left top corner. */
WL_NORTH_WEST = 1,
/** Top middle */
WL_NORTH = 2,
/** Top right */
WL_NORTH_EAST = 3,
/** Middle right */
WL_EAST = 4,
/** Bottom right */
WL_EAST_SOUTH = 5,
/** Bottom middle */
WL_SOUTH = 6,
/** Bottom left */
WL_SOUTH_WEST = 7,
/** Middle left */
WL_WEST = 8
} WindowLocation;
/** /**
* @param sw the Mode to show. * @param sw the Mode to show.
* @param lines An array of strings to display. * @param lines An array of strings to display.
@ -117,128 +89,6 @@ typedef enum _WindowLocation
*/ */
MenuReturn menu ( Mode *sw, char **input, char *prompt, unsigned int *selected_line, unsigned int *next_pos, const char *message ) MenuReturn menu ( Mode *sw, char **input, char *prompt, unsigned int *selected_line, unsigned int *next_pos, const char *message )
__attribute__ ( ( nonnull ( 1, 2, 3, 4 ) ) ); __attribute__ ( ( nonnull ( 1, 2, 3, 4 ) ) );
/**
* Settings
*/
typedef struct _Settings
{
/** List of enabled modi */
char *modi;
/** Window settings */
unsigned int window_opacity;
/** Border width */
unsigned int menu_bw;
/** Width (0-100 in %, > 100 in pixels, < 0 in char width.) */
int menu_width;
/** # lines */
unsigned int menu_lines;
/** # Columns */
unsigned int menu_columns;
/** Font string (pango format) */
char * menu_font;
/** New row colors */
unsigned int color_enabled;
char * color_normal;
char * color_active;
char * color_urgent;
char * color_window;
/** Foreground color */
char * menu_fg;
char * menu_fg_urgent;
char * menu_fg_active;
/** Background color */
char * menu_bg;
char * menu_bg_urgent;
char * menu_bg_active;
/** Background color alt */
char * menu_bg_alt;
/** Highlight foreground color */
char * menu_hlfg;
char * menu_hlfg_urgent;
char * menu_hlfg_active;
/** Highlight background color */
char * menu_hlbg;
char * menu_hlbg_urgent;
char * menu_hlbg_active;
/** Border color */
char * menu_bc;
/** Terminal to use */
char * terminal_emulator;
/** SSH client to use */
char * ssh_client;
/** Command to execute when ssh session is selected */
char * ssh_command;
/** Command for executing an application */
char * run_command;
/** Command for executing an application in a terminal */
char * run_shell_command;
/** Command for listing executables */
char * run_list_command;
/** Windows location/gravity */
WindowLocation location;
/** Padding between elements */
unsigned int padding;
/** Y offset */
int y_offset;
/** X offset */
int x_offset;
/** Always should config.menu_lines lines, even if less lines are available */
unsigned int fixed_num_lines;
/** Do not use history */
unsigned int disable_history;
/** Use levenshtein sorting when matching */
unsigned int levenshtein_sort;
/** Search case sensitivity */
unsigned int case_sensitive;
/** Separator to use for dmenu mode */
char separator;
/** Height of an element in number of rows */
int element_height;
/** Sidebar mode, show the modi */
unsigned int sidebar_mode;
/** Lazy filter limit. */
unsigned int lazy_filter_limit;
/** Auto select. */
unsigned int auto_select;
/** Hosts file parsing */
unsigned int parse_hosts;
/** Knonw_hosts file parsing */
unsigned int parse_known_hosts;
/** Combi Modes */
char *combi_modi;
/** Fuzzy match */
unsigned int fuzzy;
unsigned int glob;
unsigned int tokenize;
unsigned int regex;
/** Monitors */
int monitor;
/** Line margin */
unsigned int line_margin;
/** filter */
char *filter;
/** style */
char *separator_style;
/** hide scrollbar */
unsigned int hide_scrollbar;
/** show markup in elements. */
unsigned int markup_rows;
/** fullscreen */
unsigned int fullscreen;
/** bg image */
unsigned int fake_transparency;
/** dpi */
int dpi;
/** Number threads (1 to disable) */
unsigned int threads;
unsigned int scrollbar_width;
} Settings;
/** Global Settings structure. */
extern Settings config;
/** /**
* @param msg The error message to show. * @param msg The error message to show.
@ -283,9 +133,9 @@ typedef int ( *switcher_is_not_ascii )( const Mode *sw, unsigned int index );
*/ */
struct _Mode struct _Mode
{ {
// Name (max 31 char long) /** Name (max 31 char long) */
char name[32]; char name[32];
// Keybindings (keysym and modmask) /** Keybindings (keysym and modmask) */
char * keycfg; char * keycfg;
char * keystr; char * keystr;
KeySym keysym; KeySym keysym;
@ -294,54 +144,44 @@ struct _Mode
/** /**
* A switcher normally consists of the following parts: * A switcher normally consists of the following parts:
*/ */
// Initialize the Mode /** Initialize the Mode */
switcher_init init; switcher_init init;
// Destroy the switcher, e.g. free all its memory. /** Destroy the switcher, e.g. free all its memory. */
switcher_destroy destroy; switcher_destroy destroy;
// Get number of entries to display. (unfiltered). /** Get number of entries to display. (unfiltered). */
switcher_get_num_entries get_num_entries; switcher_get_num_entries get_num_entries;
// Check if the element is ascii. /** Check if the element is ascii. */
switcher_is_not_ascii is_not_ascii; switcher_is_not_ascii is_not_ascii;
// Process the result of the user selection. /** Process the result of the user selection. */
switcher_result result; switcher_result result;
// Token match. /** Token match. */
switcher_token_match token_match; switcher_token_match token_match;
// Get the string to display for the entry. /** Get the string to display for the entry. */
switcher_get_display_value mgrv; switcher_get_display_value mgrv;
// Get the 'completed' entry. /** Get the 'completed' entry. */
switcher_get_completion get_completion; switcher_get_completion get_completion;
// Pointer to private data. /** Pointer to private data. */
void *private_data; void *private_data;
// Free SWitcher /**
// Only to be used when the switcher object itself is dynamic. * Free SWitcher
// And has data in `ed` * Only to be used when the switcher object itself is dynamic.
* And has data in `ed`
*/
switcher_free free; switcher_free free;
// Extra fields for script /** Extra fields for script */
void *ed; void *ed;
}; };
#define color_reset "\033[0m" /** Reset terminal */
#define color_bold "\033[1m" #define color_reset "\033[0m"
#define color_italic "\033[2m" /** Set terminal text bold */
#define color_underline "\033[4m" #define color_bold "\033[1m"
#define color_black "\033[0;30m" /** Set terminal text italic */
#define color_red "\033[0;31m" #define color_italic "\033[2m"
#define color_green "\033[0;32m" /** Set terminal foreground text green */
#define color_yellow "\033[0;33m" #define color_green "\033[0;32m"
#define color_blue "\033[0;34m"
#define color_magenta "\033[0;35m"
#define color_cyan "\033[0;36m"
#define color_white "\033[0;37m"
#define color_white_bold "\033[1;37m"
#define color_black_bold "\033[1;30m"
#define color_red_bold "\033[1;31m"
#define color_green_bold "\033[1;32m"
#define color_yellow_bold "\033[1;33m"
#define color_blue_bold "\033[1;34m"
#define color_magenta_bold "\033[1;35m"
#define color_cyan_bold "\033[1;36m"
int show_error_message ( const char *msg, int markup ); int show_error_message ( const char *msg, int markup );
/*@}*/
#endif #endif

157
include/settings.h Normal file
View file

@ -0,0 +1,157 @@
#ifndef ROFI_SETTINGS_H
#define ROFI_SETTINGS_H
/**
* Enumeration indicating location or gravity of window.
*
* \verbatim WL_NORTH_WEST WL_NORTH WL_NORTH_EAST \endverbatim
* \verbatim WL_EAST WL_CENTER WL_EAST \endverbatim
* \verbatim WL_SOUTH_WEST WL_SOUTH WL_SOUTH_EAST\endverbatim
* \endverbatim
*
* @ingroup CONFIGURATION
*/
typedef enum _WindowLocation
{
/** Center */
WL_CENTER = 0,
/** Left top corner. */
WL_NORTH_WEST = 1,
/** Top middle */
WL_NORTH = 2,
/** Top right */
WL_NORTH_EAST = 3,
/** Middle right */
WL_EAST = 4,
/** Bottom right */
WL_EAST_SOUTH = 5,
/** Bottom middle */
WL_SOUTH = 6,
/** Bottom left */
WL_SOUTH_WEST = 7,
/** Middle left */
WL_WEST = 8
} WindowLocation;
/**
* Settings structure holding all (static) configurable options.
* @ingroup CONFIGURATION
*/
typedef struct _Settings
{
/** List of enabled modi */
char *modi;
/** Window settings */
unsigned int window_opacity;
/** Border width */
unsigned int menu_bw;
/** Width (0-100 in %, > 100 in pixels, < 0 in char width.) */
int menu_width;
/** # lines */
unsigned int menu_lines;
/** # Columns */
unsigned int menu_columns;
/** Font string (pango format) */
char * menu_font;
/** New row colors */
unsigned int color_enabled;
char * color_normal;
char * color_active;
char * color_urgent;
char * color_window;
/** Foreground color */
char * menu_fg;
char * menu_fg_urgent;
char * menu_fg_active;
/** Background color */
char * menu_bg;
char * menu_bg_urgent;
char * menu_bg_active;
/** Background color alt */
char * menu_bg_alt;
/** Highlight foreground color */
char * menu_hlfg;
char * menu_hlfg_urgent;
char * menu_hlfg_active;
/** Highlight background color */
char * menu_hlbg;
char * menu_hlbg_urgent;
char * menu_hlbg_active;
/** Border color */
char * menu_bc;
/** Terminal to use */
char * terminal_emulator;
/** SSH client to use */
char * ssh_client;
/** Command to execute when ssh session is selected */
char * ssh_command;
/** Command for executing an application */
char * run_command;
/** Command for executing an application in a terminal */
char * run_shell_command;
/** Command for listing executables */
char * run_list_command;
/** Windows location/gravity */
WindowLocation location;
/** Padding between elements */
unsigned int padding;
/** Y offset */
int y_offset;
/** X offset */
int x_offset;
/** Always should config.menu_lines lines, even if less lines are available */
unsigned int fixed_num_lines;
/** Do not use history */
unsigned int disable_history;
/** Use levenshtein sorting when matching */
unsigned int levenshtein_sort;
/** Search case sensitivity */
unsigned int case_sensitive;
/** Separator to use for dmenu mode */
char separator;
/** Height of an element in number of rows */
int element_height;
/** Sidebar mode, show the modi */
unsigned int sidebar_mode;
/** Lazy filter limit. */
unsigned int lazy_filter_limit;
/** Auto select. */
unsigned int auto_select;
/** Hosts file parsing */
unsigned int parse_hosts;
/** Knonw_hosts file parsing */
unsigned int parse_known_hosts;
/** Combi Modes */
char *combi_modi;
/** Fuzzy match */
unsigned int fuzzy;
unsigned int glob;
unsigned int tokenize;
unsigned int regex;
/** Monitors */
int monitor;
/** Line margin */
unsigned int line_margin;
/** filter */
char *filter;
/** style */
char *separator_style;
/** hide scrollbar */
unsigned int hide_scrollbar;
/** show markup in elements. */
unsigned int markup_rows;
/** fullscreen */
unsigned int fullscreen;
/** bg image */
unsigned int fake_transparency;
/** dpi */
int dpi;
/** Number threads (1 to disable) */
unsigned int threads;
unsigned int scrollbar_width;
} Settings;
/** Global Settings structure. */
extern Settings config;
#endif // ROFI_SETTINGS_H

View file

@ -28,6 +28,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <rofi.h> #include <rofi.h>
#include "settings.h"
#include <dialogs/dialogs.h> #include <dialogs/dialogs.h>

View file

@ -35,6 +35,7 @@
#include <stdint.h> #include <stdint.h>
#include <errno.h> #include <errno.h>
#include "rofi.h" #include "rofi.h"
#include "settings.h"
#include "dialogs/dmenu.h" #include "dialogs/dmenu.h"
#include "helper.h" #include "helper.h"
#include "xrmoptions.h" #include "xrmoptions.h"

View file

@ -39,6 +39,7 @@
#include <errno.h> #include <errno.h>
#include "rofi.h" #include "rofi.h"
#include "settings.h"
#include "helper.h" #include "helper.h"
#include "dialogs/drun.h" #include "dialogs/drun.h"

View file

@ -44,6 +44,7 @@
#include <errno.h> #include <errno.h>
#include "rofi.h" #include "rofi.h"
#include "settings.h"
#include "helper.h" #include "helper.h"
#include "history.h" #include "history.h"
#include "dialogs/run.h" #include "dialogs/run.h"

View file

@ -44,6 +44,7 @@
#include <helper.h> #include <helper.h>
#include "rofi.h" #include "rofi.h"
#include "settings.h"
#include "history.h" #include "history.h"
#include "dialogs/ssh.h" #include "dialogs/ssh.h"

View file

@ -39,6 +39,7 @@
#include <X11/Xutil.h> #include <X11/Xutil.h>
#include "rofi.h" #include "rofi.h"
#include "settings.h"
#include "helper.h" #include "helper.h"
#include "x11-helper.h" #include "x11-helper.h"
#include "i3-support.h" #include "i3-support.h"

View file

@ -40,6 +40,7 @@
#include <pwd.h> #include <pwd.h>
#include <ctype.h> #include <ctype.h>
#include "helper.h" #include "helper.h"
#include "settings.h"
#include "x11-helper.h" #include "x11-helper.h"
#include "rofi.h" #include "rofi.h"

View file

@ -35,6 +35,7 @@
#include <glib/gstdio.h> #include <glib/gstdio.h>
#include "rofi.h" #include "rofi.h"
#include "history.h" #include "history.h"
#include "settings.h"
#define HISTORY_NAME_LENGTH 256 #define HISTORY_NAME_LENGTH 256
#define HISTORY_MAX_ENTRIES 25 #define HISTORY_MAX_ENTRIES 25

View file

@ -51,6 +51,7 @@
#define SN_API_NOT_YET_FROZEN #define SN_API_NOT_YET_FROZEN
#include <libsn/sn.h> #include <libsn/sn.h>
#include "settings.h"
#include "rofi.h" #include "rofi.h"
#include "helper.h" #include "helper.h"
#include "textbox.h" #include "textbox.h"

View file

@ -32,8 +32,8 @@
#include <X11/Xft/Xft.h> #include <X11/Xft/Xft.h>
#include <glib.h> #include <glib.h>
#include "scrollbar.h" #include "scrollbar.h"
#include "rofi.h"
#include "x11-helper.h" #include "x11-helper.h"
#include "settings.h"
extern Display *display; extern Display *display;

View file

@ -33,8 +33,9 @@
#include <X11/keysym.h> #include <X11/keysym.h>
#include <X11/XKBlib.h> #include <X11/XKBlib.h>
#include <ctype.h> #include <ctype.h>
#include <string.h>
#include <glib.h> #include <glib.h>
#include "rofi.h" #include "settings.h"
#include "textbox.h" #include "textbox.h"
#include "keyb.h" #include "keyb.h"
#include "x11-helper.h" #include "x11-helper.h"

View file

@ -43,6 +43,7 @@
#include <X11/keysym.h> #include <X11/keysym.h>
#include <X11/XKBlib.h> #include <X11/XKBlib.h>
#include <X11/extensions/Xinerama.h> #include <X11/extensions/Xinerama.h>
#include "settings.h"
#include <rofi.h> #include <rofi.h>
#define OVERLAP( a, b, c, \ #define OVERLAP( a, b, c, \

View file

@ -33,6 +33,7 @@
#include <X11/Xresource.h> #include <X11/Xresource.h>
#include "rofi.h" #include "rofi.h"
#include "xrmoptions.h" #include "xrmoptions.h"
#include "settings.h"
#include "helper.h" #include "helper.h"
typedef struct typedef struct

View file

@ -4,6 +4,7 @@
#include <stdio.h> #include <stdio.h>
#include <helper.h> #include <helper.h>
#include <string.h> #include <string.h>
#include "settings.h"
static int test = 0; static int test = 0;

View file

@ -11,6 +11,7 @@
#include <textbox.h> #include <textbox.h>
#include <rofi.h> #include <rofi.h>
#include "settings.h"
static int test = 0; static int test = 0;
unsigned int normal_window_mode = 0; unsigned int normal_window_mode = 0;