1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2025-07-31 21:59:25 -04:00

Cleanup code documentation.

This commit is contained in:
Dave Davenport 2021-05-05 21:53:29 +02:00
parent 37044dc27e
commit f69f8fcb7b
10 changed files with 65 additions and 3 deletions

View file

@ -38,7 +38,20 @@
/** #Mode object representing the run dialog. */ /** #Mode object representing the run dialog. */
extern Mode file_browser_mode; extern Mode file_browser_mode;
/**
* Create a new filebrowser.
* @returns a new filebrowser structure.
*/
Mode *create_new_file_browser ( void ); Mode *create_new_file_browser ( void );
/**
* @param sw Mode object.
* @param mretv return value passed in.
* @param input The user input string.
* @param selected_list The user selected line.
* @param path The full path as output.
*
* @returns the state the user selected.
*/
ModeMode file_browser_mode_completer ( Mode *sw, int mretv, char **input, unsigned int selected_line, char **path ); ModeMode file_browser_mode_completer ( Mode *sw, int mretv, char **input, unsigned int selected_line, char **path );
/**@}*/ /**@}*/
#endif // ROFI_DIALOG_FILE_BROWSER_H #endif // ROFI_DIALOG_FILE_BROWSER_H

View file

@ -45,6 +45,13 @@ uint32_t rofi_icon_fetcher_query ( const char *name, const int size );
*/ */
cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid ); cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid );
/**
* @param path the image path to check.
*
* Checks if a file is a supported image. (by looking at extension).
*
* @returns true if image, false otherwise.
*/
gboolean rofi_icon_fetcher_file_is_image ( const char * const path ); gboolean rofi_icon_fetcher_file_is_image ( const char * const path );
/** @} */ /** @} */
#endif // ROFI_ICON_FETCHER_H #endif // ROFI_ICON_FETCHER_H

View file

@ -386,6 +386,12 @@ void rofi_theme_parse_merge_widgets ( ThemeWidget *parent, ThemeWidget *child );
* Returns the media type described by type. * Returns the media type described by type.
*/ */
ThemeMediaType rofi_theme_parse_media_type ( const char *type ); ThemeMediaType rofi_theme_parse_media_type ( const char *type );
/**
* @param distance The distance object to copy.
*
* @returns a copy of the distance.
*/
RofiDistance rofi_theme_property_copy_distance ( RofiDistance const distance ); RofiDistance rofi_theme_property_copy_distance ( RofiDistance const distance );
/** /**

View file

@ -127,7 +127,16 @@ typedef struct _workarea
*/ */
int monitor_active ( workarea *mon ); int monitor_active ( workarea *mon );
/**
* @param w rofis window
*
* Stores old input focus for reverting and set focus to rofi.
*/
void rofi_xcb_set_input_focus(xcb_window_t w); void rofi_xcb_set_input_focus(xcb_window_t w);
/**
* IF set, revert the focus back to the original applications.
*/
void rofi_xcb_revert_input_focus(void); void rofi_xcb_revert_input_focus(void);
/** /**
@ -194,5 +203,13 @@ extern WindowManagerQuirk current_window_manager;
* @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 radius
* @param 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

@ -58,6 +58,7 @@ enum FBFileType
RFILE, RFILE,
NUM_FILE_TYPES, NUM_FILE_TYPES,
}; };
/** Icons to use for the file type */
const char *icon_name[NUM_FILE_TYPES] = const char *icon_name[NUM_FILE_TYPES] =
{ {
"go-up", "go-up",

View file

@ -163,14 +163,22 @@ void rofi_icon_fetcher_destroy ( void )
* Copyright (C) 2011-2018 Red Hat, Inc. * Copyright (C) 2011-2018 Red Hat, Inc.
*/ */
#if G_BYTE_ORDER == G_LITTLE_ENDIAN #if G_BYTE_ORDER == G_LITTLE_ENDIAN
/** Location of red byte */
#define RED_BYTE 2 #define RED_BYTE 2
/** Location of green byte */
#define GREEN_BYTE 1 #define GREEN_BYTE 1
/** Location of blue byte */
#define BLUE_BYTE 0 #define BLUE_BYTE 0
/** Location of alpha byte */
#define ALPHA_BYTE 3 #define ALPHA_BYTE 3
#else #else
/** Location of red byte */
#define RED_BYTE 1 #define RED_BYTE 1
/** Location of green byte */
#define GREEN_BYTE 2 #define GREEN_BYTE 2
/** Location of blue byte */
#define BLUE_BYTE 3 #define BLUE_BYTE 3
/** Location of alpha byte */
#define ALPHA_BYTE 0 #define ALPHA_BYTE 0
#endif #endif

View file

@ -119,6 +119,7 @@ static int dmenu_mode = FALSE;
/** Rofi's return code */ /** Rofi's return code */
int return_code = EXIT_SUCCESS; int return_code = EXIT_SUCCESS;
/** Flag indicating we are using old config format. */
static gboolean old_config_format = FALSE; static gboolean old_config_format = FALSE;
void process_result ( RofiViewState *state ); void process_result ( RofiViewState *state );

View file

@ -227,11 +227,19 @@ void rofi_capture_screenshot ( void )
* Code used for benchmarking drawing the gui, this will keep updating the UI as fast as possible. * Code used for benchmarking drawing the gui, this will keep updating the UI as fast as possible.
*/ */
gboolean do_bench = TRUE; gboolean do_bench = TRUE;
struct
/**
* Internal structure that hold benchmarking information.
*/
static struct
{ {
/** timer used for timestamping. */
GTimer *time; GTimer *time;
/** number of draws done. */
uint64_t draws; uint64_t draws;
/** previous timestamp */
double last_ts; double last_ts;
/** minimum draw time. */
double min; double min;
} BenchMark = { } BenchMark = {
.time = NULL, .time = NULL,

View file

@ -55,8 +55,8 @@ static PangoContext *p_context = NULL;
/** The pango font metrics */ /** The pango font metrics */
static PangoFontMetrics *p_metrics = NULL; static PangoFontMetrics *p_metrics = NULL;
/* Default tbfc */ /** Default tbfc */
TBFontConfig *tbfc_default = NULL; static TBFontConfig *tbfc_default = NULL;
/** HashMap of previously parsed font descriptions. */ /** HashMap of previously parsed font descriptions. */
static GHashTable *tbfc_cache = NULL; static GHashTable *tbfc_cache = NULL;

View file

@ -33,6 +33,7 @@
/** Default padding. */ /** Default padding. */
#define WIDGET_DEFAULT_PADDING 0 #define WIDGET_DEFAULT_PADDING 0
/** macro for initializing the padding struction. */
#define WIDGET_PADDING_INIT { { WIDGET_DEFAULT_PADDING, ROFI_PU_PX, ROFI_DISTANCE_MODIFIER_NONE, NULL, NULL }, ROFI_HL_SOLID } #define WIDGET_PADDING_INIT { { WIDGET_DEFAULT_PADDING, ROFI_PU_PX, ROFI_DISTANCE_MODIFIER_NONE, NULL, NULL }, ROFI_HL_SOLID }
/* Corner radius - tl, tr, br, bl */ /* Corner radius - tl, tr, br, bl */