[Theme] Move some definitions header around for plugin.

This commit is contained in:
Dave Davenport 2022-12-24 11:46:03 +01:00
parent 3d73cf2554
commit 09b9039718
5 changed files with 81 additions and 81 deletions

View file

@ -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
/**@} */

View file

@ -297,6 +297,57 @@ typedef struct Property {
PropertyValue value;
} 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.
*/

View file

@ -32,56 +32,6 @@
#include <glib.h>
#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.
*/
@ -370,34 +320,6 @@ void distance_get_linestyle(RofiDistance d, cairo_t *draw);
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.
*/

View file

@ -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

View file

@ -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);
}
}
}