summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Davenport <qball@blame.services>2022-12-24 11:46:03 +0100
committerDave Davenport <qball@blame.services>2022-12-24 11:46:03 +0100
commit09b90397189d2342f70f94c34a94824a8ed0c34d (patch)
tree7588a93f05c3d4d2e37c22c4a224c423cbd794ab
parent3d73cf25541a5ea3dceb864a15f8ad4f654615da (diff)
[Theme] Move some definitions header around for plugin.
-rw-r--r--include/helper.h27
-rw-r--r--include/rofi-types.h51
-rw-r--r--include/theme.h78
-rw-r--r--source/mode.c1
-rw-r--r--source/widgets/textbox.c5
5 files changed, 81 insertions, 81 deletions
diff --git a/include/helper.h b/include/helper.h
index 83a06970..bcae4810 100644
--- a/include/helper.h
+++ b/include/helper.h
@@ -399,6 +399,33 @@ char *helper_string_replace_if_exists(char *string, ...);
*/
char *helper_get_theme_path(const char *file, const char *ext);
+/**
+ * @param name The name of the element to find.
+ * @param state The state of the element.
+ * @param exact If the match should be exact, or parent can be included.
+ *
+ * Find the configuration element. If not exact, the closest specified element
+ * is returned.
+ *
+ * @returns the ThemeWidget if found, otherwise NULL.
+ */
+ConfigEntry *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.
+ *
+ * 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(ConfigEntry *widget, PropertyType type,
+ const char *property, gboolean exact);
G_END_DECLS
/**@} */
diff --git a/include/rofi-types.h b/include/rofi-types.h
index 807a2556..4fc878d4 100644
--- a/include/rofi-types.h
+++ b/include/rofi-types.h
@@ -298,6 +298,57 @@ typedef struct Property {
} Property;
/**
+ * Describe the media constraint type.
+ */
+typedef enum {
+ /** Minimum width constraint. */
+ THEME_MEDIA_TYPE_MIN_WIDTH,
+ /** Maximum width constraint. */
+ THEME_MEDIA_TYPE_MAX_WIDTH,
+ /** Minimum height constraint. */
+ THEME_MEDIA_TYPE_MIN_HEIGHT,
+ /** Maximum height constraint. */
+ THEME_MEDIA_TYPE_MAX_HEIGHT,
+ /** Monitor id constraint. */
+ THEME_MEDIA_TYPE_MON_ID,
+ /** Minimum aspect ratio constraint. */
+ THEME_MEDIA_TYPE_MIN_ASPECT_RATIO,
+ /** Maximum aspect ratio constraint. */
+ THEME_MEDIA_TYPE_MAX_ASPECT_RATIO,
+ /** Boolean option for use with env. */
+ THEME_MEDIA_TYPE_BOOLEAN,
+ /** Invalid entry. */
+ THEME_MEDIA_TYPE_INVALID,
+} ThemeMediaType;
+
+/**
+ * Theme Media description.
+ */
+typedef struct ThemeMedia {
+ ThemeMediaType type;
+ double value;
+ gboolean boolv;
+} ThemeMedia;
+
+/**
+ * ThemeWidget.
+ */
+typedef struct ThemeWidget {
+ int set;
+ char *name;
+
+ unsigned int num_widgets;
+ struct ThemeWidget **widgets;
+
+ ThemeMedia *media;
+
+ GHashTable *properties;
+
+ struct ThemeWidget *parent;
+} ThemeWidget;
+
+typedef ThemeWidget ConfigEntry;
+/**
* Structure to hold a range.
*/
typedef struct rofi_range_pair {
diff --git a/include/theme.h b/include/theme.h
index 2dd31d5c..aaba03c8 100644
--- a/include/theme.h
+++ b/include/theme.h
@@ -33,56 +33,6 @@
#include <widgets/widget.h>
/**
- * Describe the media constraint type.
- */
-typedef enum {
- /** Minimum width constraint. */
- THEME_MEDIA_TYPE_MIN_WIDTH,
- /** Maximum width constraint. */
- THEME_MEDIA_TYPE_MAX_WIDTH,
- /** Minimum height constraint. */
- THEME_MEDIA_TYPE_MIN_HEIGHT,
- /** Maximum height constraint. */
- THEME_MEDIA_TYPE_MAX_HEIGHT,
- /** Monitor id constraint. */
- THEME_MEDIA_TYPE_MON_ID,
- /** Minimum aspect ratio constraint. */
- THEME_MEDIA_TYPE_MIN_ASPECT_RATIO,
- /** Maximum aspect ratio constraint. */
- THEME_MEDIA_TYPE_MAX_ASPECT_RATIO,
- /** Boolean option for use with env. */
- THEME_MEDIA_TYPE_BOOLEAN,
- /** Invalid entry. */
- THEME_MEDIA_TYPE_INVALID,
-} ThemeMediaType;
-
-/**
- * Theme Media description.
- */
-typedef struct ThemeMedia {
- ThemeMediaType type;
- double value;
- gboolean boolv;
-} ThemeMedia;
-
-/**
- * ThemeWidget.
- */
-typedef struct ThemeWidget {
- int set;
- char *name;
-
- unsigned int num_widgets;
- struct ThemeWidget **widgets;
-
- ThemeMedia *media;
-
- GHashTable *properties;
-
- struct ThemeWidget *parent;
-} ThemeWidget;
-
-/**
* Global pointer to the current active theme.
*/
extern ThemeWidget *rofi_theme;
@@ -371,34 +321,6 @@ ThemeWidget *rofi_theme_find_widget(const char *name, const char *state,
gboolean exact);
/**
- * @param name The name of the element to find.
- * @param state The state of the element.
- * @param exact If the match should be exact, or parent can be included.
- *
- * Find the configuration element. If not exact, the closest specified element
- * is returned.
- *
- * @returns the ThemeWidget if found, otherwise NULL.
- */
-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.
- *
- * 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);
-
-/**
* Reset the current theme.
*/
void rofi_theme_reset(void);
diff --git a/source/mode.c b/source/mode.c
index 02c4aaee..990bea56 100644
--- a/source/mode.c
+++ b/source/mode.c
@@ -34,6 +34,7 @@
#include "rofi-icon-fetcher.h"
// This one should only be in mode implementations.
+#include "helper.h"
#include "mode-private.h"
/**
* @ingroup MODE
diff --git a/source/widgets/textbox.c b/source/widgets/textbox.c
index 5e45a0d5..51273adf 100644
--- a/source/widgets/textbox.c
+++ b/source/widgets/textbox.c
@@ -561,8 +561,8 @@ static void textbox_draw(widget *wid, cairo_t *draw) {
tb->cursor_x_pos = x + cursor_x;
}
if (tb->blink) {
- // save the state so we can restore the text color afterwards
- cairo_save(draw);
+ // use text color as fallback for themes that don't specify the cursor
+ // color
rofi_theme_get_color(WIDGET(tb), "cursor-color", draw);
cairo_rectangle(draw, x + cursor_x, y + cursor_y, cursor_pixel_width,
cursor_height);
@@ -576,7 +576,6 @@ static void textbox_draw(widget *wid, cairo_t *draw) {
} else {
cairo_fill(draw);
}
- cairo_restore(draw);
}
}
}