summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2021-05-05 21:53:29 +0200
committerDave Davenport <qball@gmpclient.org>2021-05-05 21:53:29 +0200
commitf69f8fcb7bbaf62736801c782e8a9c449c9daed0 (patch)
tree82cbddbc7b2e4a5c0b686e7cc8e097f6ea77ceb1
parent37044dc27e19c97510fdc7eb48f33d834439aba3 (diff)
Cleanup code documentation.
-rw-r--r--include/dialogs/filebrowser.h13
-rw-r--r--include/rofi-icon-fetcher.h7
-rw-r--r--include/theme.h6
-rw-r--r--include/xcb.h17
-rw-r--r--source/dialogs/filebrowser.c1
-rw-r--r--source/rofi-icon-fetcher.c8
-rw-r--r--source/rofi.c1
-rw-r--r--source/view.c10
-rw-r--r--source/widgets/textbox.c4
-rw-r--r--source/widgets/widget.c1
10 files changed, 65 insertions, 3 deletions
diff --git a/include/dialogs/filebrowser.h b/include/dialogs/filebrowser.h
index ea440a71..8816bdb3 100644
--- a/include/dialogs/filebrowser.h
+++ b/include/dialogs/filebrowser.h
@@ -38,7 +38,20 @@
/** #Mode object representing the run dialog. */
extern Mode file_browser_mode;
+/**
+ * Create a new filebrowser.
+ * @returns a new filebrowser structure.
+ */
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 );
/**@}*/
#endif // ROFI_DIALOG_FILE_BROWSER_H
diff --git a/include/rofi-icon-fetcher.h b/include/rofi-icon-fetcher.h
index 19a46241..fed9c588 100644
--- a/include/rofi-icon-fetcher.h
+++ b/include/rofi-icon-fetcher.h
@@ -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 );
+/**
+ * @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 );
/** @} */
#endif // ROFI_ICON_FETCHER_H
diff --git a/include/theme.h b/include/theme.h
index f50f892e..151446bc 100644
--- a/include/theme.h
+++ b/include/theme.h
@@ -386,6 +386,12 @@ void rofi_theme_parse_merge_widgets ( ThemeWidget *parent, ThemeWidget *child );
* Returns the media type described by 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 );
/**
diff --git a/include/xcb.h b/include/xcb.h
index 77962e51..b342e94e 100644
--- a/include/xcb.h
+++ b/include/xcb.h
@@ -127,7 +127,16 @@ typedef struct _workarea
*/
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);
+
+/**
+ * IF set, revert the focus back to the original applications.
+ */
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.
*/
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);
#endif
diff --git a/source/dialogs/filebrowser.c b/source/dialogs/filebrowser.c
index 568eef69..d53068ed 100644
--- a/source/dialogs/filebrowser.c
+++ b/source/dialogs/filebrowser.c
@@ -58,6 +58,7 @@ enum FBFileType
RFILE,
NUM_FILE_TYPES,
};
+/** Icons to use for the file type */
const char *icon_name[NUM_FILE_TYPES] =
{
"go-up",
diff --git a/source/rofi-icon-fetcher.c b/source/rofi-icon-fetcher.c
index cfe9d747..99fe3180 100644
--- a/source/rofi-icon-fetcher.c
+++ b/source/rofi-icon-fetcher.c
@@ -163,14 +163,22 @@ void rofi_icon_fetcher_destroy ( void )
* Copyright (C) 2011-2018 Red Hat, Inc.
*/
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+/** Location of red byte */
#define RED_BYTE 2
+/** Location of green byte */
#define GREEN_BYTE 1
+/** Location of blue byte */
#define BLUE_BYTE 0
+/** Location of alpha byte */
#define ALPHA_BYTE 3
#else
+/** Location of red byte */
#define RED_BYTE 1
+/** Location of green byte */
#define GREEN_BYTE 2
+/** Location of blue byte */
#define BLUE_BYTE 3
+/** Location of alpha byte */
#define ALPHA_BYTE 0
#endif
diff --git a/source/rofi.c b/source/rofi.c
index 8c5cca77..c9dad4d3 100644
--- a/source/rofi.c
+++ b/source/rofi.c
@@ -119,6 +119,7 @@ static int dmenu_mode = FALSE;
/** Rofi's return code */
int return_code = EXIT_SUCCESS;
+/** Flag indicating we are using old config format. */
static gboolean old_config_format = FALSE;
void process_result ( RofiViewState *state );
diff --git a/source/view.c b/source/view.c
index 5d94f89d..1b2edd76 100644
--- a/source/view.c
+++ b/source/view.c
@@ -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.
*/
gboolean do_bench = TRUE;
-struct
+
+/**
+ * Internal structure that hold benchmarking information.
+ */
+static struct
{
+ /** timer used for timestamping. */
GTimer *time;
+ /** number of draws done. */
uint64_t draws;
+ /** previous timestamp */
double last_ts;
+ /** minimum draw time. */
double min;
} BenchMark = {
.time = NULL,
diff --git a/source/widgets/textbox.c b/source/widgets/textbox.c
index a5112755..cd58ad00 100644
--- a/source/widgets/textbox.c
+++ b/source/widgets/textbox.c
@@ -55,8 +55,8 @@ static PangoContext *p_context = NULL;
/** The pango font metrics */
static PangoFontMetrics *p_metrics = NULL;
-/* Default tbfc */
-TBFontConfig *tbfc_default = NULL;
+/** Default tbfc */
+static TBFontConfig *tbfc_default = NULL;
/** HashMap of previously parsed font descriptions. */
static GHashTable *tbfc_cache = NULL;
diff --git a/source/widgets/widget.c b/source/widgets/widget.c
index 1a309b00..99bb8736 100644
--- a/source/widgets/widget.c
+++ b/source/widgets/widget.c
@@ -33,6 +33,7 @@
/** Default padding. */
#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 }
/* Corner radius - tl, tr, br, bl */