mirror of
https://github.com/labwc/labwc.git
synced 2025-11-02 09:01:47 -05:00
Prepare to move from wlr_texture to lab_data_buffer
This commit is contained in:
parent
7ea733761b
commit
044388a5cd
13 changed files with 148 additions and 122 deletions
|
|
@ -36,9 +36,15 @@ struct lab_data_buffer {
|
|||
void *data;
|
||||
uint32_t format;
|
||||
size_t stride;
|
||||
bool free_on_destroy;
|
||||
};
|
||||
|
||||
struct lab_data_buffer *buffer_create(uint32_t width, uint32_t height,
|
||||
float scale);
|
||||
/* Create a buffer which creates a new cairo CAIRO_FORMAT_ARGB32 surface */
|
||||
struct lab_data_buffer *buffer_create_cairo(uint32_t width, uint32_t height,
|
||||
float scale, bool free_on_destroy);
|
||||
|
||||
/* Create a buffer which wraps a given DRM_FORMAT_ARGB8888 pointer */
|
||||
struct lab_data_buffer *buffer_create_wrap(void *pixel_data, uint32_t width,
|
||||
uint32_t height, uint32_t stride, bool free_on_destroy);
|
||||
|
||||
#endif /* __LABWC_BUFFER_H */
|
||||
|
|
|
|||
|
|
@ -2,9 +2,7 @@
|
|||
#ifndef __LABWC_FONT_H
|
||||
#define __LABWC_FONT_H
|
||||
|
||||
struct server;
|
||||
struct wlr_texture;
|
||||
struct wlr_box;
|
||||
struct lab_data_buffer;
|
||||
|
||||
struct font {
|
||||
char *name;
|
||||
|
|
@ -18,16 +16,23 @@ struct font {
|
|||
int font_height(struct font *font);
|
||||
|
||||
/**
|
||||
* texture_create - Create ARGB8888 texture using pango
|
||||
* @server: context (for wlr_renderer)
|
||||
* @texture: texture pointer; existing pointer will be freed
|
||||
* font_buffer_create - Create ARGB8888 lab_data_buffer using pango
|
||||
* @buffer: buffer pointer
|
||||
* @max_width: max allowable width; will be ellipsized if longer
|
||||
* @text: text to be generated as texture
|
||||
* @font: font description
|
||||
* @color: foreground color in rgba format
|
||||
*/
|
||||
void font_texture_create(struct server *server, struct wlr_texture **texture,
|
||||
int max_width, const char *text, struct font *font, float *color);
|
||||
void font_buffer_create(struct lab_data_buffer **buffer, int max_width,
|
||||
const char *text, struct font *font, float *color);
|
||||
|
||||
/**
|
||||
* font_buffer_update - Wrapper around font_buffer_create
|
||||
* Only difference is that if given buffer pointer is != NULL
|
||||
* wlr_buffer_drop() will be called on the buffer.
|
||||
*/
|
||||
void font_buffer_update(struct lab_data_buffer **buffer, int max_width,
|
||||
const char *text, struct font *font, float *color);
|
||||
|
||||
/**
|
||||
* font_finish - free some font related resources
|
||||
|
|
|
|||
|
|
@ -54,20 +54,20 @@ struct theme {
|
|||
float osd_label_text_color[4];
|
||||
|
||||
/* textures */
|
||||
struct wlr_texture *xbm_close_active_unpressed;
|
||||
struct wlr_texture *xbm_maximize_active_unpressed;
|
||||
struct wlr_texture *xbm_iconify_active_unpressed;
|
||||
struct wlr_texture *xbm_menu_active_unpressed;
|
||||
struct lab_data_buffer *xbm_close_active_unpressed;
|
||||
struct lab_data_buffer *xbm_maximize_active_unpressed;
|
||||
struct lab_data_buffer *xbm_iconify_active_unpressed;
|
||||
struct lab_data_buffer *xbm_menu_active_unpressed;
|
||||
|
||||
struct wlr_texture *xbm_close_inactive_unpressed;
|
||||
struct wlr_texture *xbm_maximize_inactive_unpressed;
|
||||
struct wlr_texture *xbm_iconify_inactive_unpressed;
|
||||
struct wlr_texture *xbm_menu_inactive_unpressed;
|
||||
struct lab_data_buffer *xbm_close_inactive_unpressed;
|
||||
struct lab_data_buffer *xbm_maximize_inactive_unpressed;
|
||||
struct lab_data_buffer *xbm_iconify_inactive_unpressed;
|
||||
struct lab_data_buffer *xbm_menu_inactive_unpressed;
|
||||
|
||||
struct wlr_texture *corner_top_left_active_normal;
|
||||
struct wlr_texture *corner_top_right_active_normal;
|
||||
struct wlr_texture *corner_top_left_inactive_normal;
|
||||
struct wlr_texture *corner_top_right_inactive_normal;
|
||||
struct lab_data_buffer *corner_top_left_active_normal;
|
||||
struct lab_data_buffer *corner_top_right_active_normal;
|
||||
struct lab_data_buffer *corner_top_left_inactive_normal;
|
||||
struct lab_data_buffer *corner_top_right_inactive_normal;
|
||||
|
||||
/* not set in rc.xml/themerc, but derived from font & padding_height */
|
||||
int title_height;
|
||||
|
|
@ -76,12 +76,10 @@ struct theme {
|
|||
/**
|
||||
* theme_init - read openbox theme and generate button textures
|
||||
* @theme: theme data
|
||||
* @renderer: wlr_renderer for creating button textures
|
||||
* @theme_name: theme-name in <theme-dir>/<theme-name>/openbox-3/themerc
|
||||
* Note <theme-dir> is obtained in theme-dir.c
|
||||
*/
|
||||
void theme_init(struct theme *theme, struct wlr_renderer *renderer,
|
||||
const char *theme_name);
|
||||
void theme_init(struct theme *theme, const char *theme_name);
|
||||
|
||||
/**
|
||||
* theme_finish - free button textures
|
||||
|
|
|
|||
|
|
@ -9,6 +9,6 @@
|
|||
/**
|
||||
* xbm_load - load theme xbm files into global theme struct
|
||||
*/
|
||||
void xbm_load(struct theme *theme, struct wlr_renderer *renderer);
|
||||
void xbm_load(struct theme *theme);
|
||||
|
||||
#endif /* __LABWC_XBM_H */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue