mirror of
https://github.com/labwc/labwc.git
synced 2026-02-09 10:07:31 -05:00
button: refactor xbm code
- Rename src/xbm/ to src/button/ - Combine xbm.c parse.c tokenize.c into button-xbm.c No functional change
This commit is contained in:
parent
3111c57d6f
commit
03bc2ada47
12 changed files with 315 additions and 391 deletions
11
include/button/button-xbm.h
Normal file
11
include/button/button-xbm.h
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
#ifndef LABWC_BUTTON_XBM_H
|
||||
#define LABWC_BUTTON_XBM_H
|
||||
|
||||
struct lab_data_buffer;
|
||||
|
||||
/* button_xbm_load - Convert xbm file to buffer with cairo surface */
|
||||
void button_xbm_load(const char *filename, struct lab_data_buffer **buffer,
|
||||
char *fallback_button, float *rgba);
|
||||
|
||||
#endif /* LABWC_BUTTON_XBM_H */
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Parse xbm token to create pixmap
|
||||
*
|
||||
* Copyright Johan Malm 2020
|
||||
*/
|
||||
|
||||
#ifndef LABWC_PARSE_H
|
||||
#define LABWC_PARSE_H
|
||||
|
||||
#include "xbm/tokenize.h"
|
||||
#include <stdint.h>
|
||||
|
||||
struct pixmap {
|
||||
uint32_t *data;
|
||||
int width;
|
||||
int height;
|
||||
};
|
||||
|
||||
/**
|
||||
* parse_set_color - set color to be used when parsing icons
|
||||
* @rgba: four floats representing red, green, blue, alpha
|
||||
*/
|
||||
void parse_set_color(float *rgba);
|
||||
|
||||
/**
|
||||
* parse_xbm_tokens - parse xbm tokens and create pixmap
|
||||
* @tokens: token vector
|
||||
*/
|
||||
struct pixmap parse_xbm_tokens(struct token *tokens);
|
||||
|
||||
/**
|
||||
* parse_xbm_builtin - parse builtin xbm button and create pixmap
|
||||
* @button: button byte array (xbm format)
|
||||
*/
|
||||
struct pixmap parse_xbm_builtin(const char *button, int size);
|
||||
|
||||
#endif /* LABWC_PARSE_H */
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* XBM file tokenizer
|
||||
*
|
||||
* Copyright Johan Malm 2020
|
||||
*/
|
||||
|
||||
#ifndef LABWC_TOKENIZE_H
|
||||
#define LABWC_TOKENIZE_H
|
||||
|
||||
enum token_type {
|
||||
TOKEN_NONE = 0,
|
||||
TOKEN_IDENT,
|
||||
TOKEN_INT,
|
||||
TOKEN_SPECIAL,
|
||||
TOKEN_OTHER,
|
||||
};
|
||||
|
||||
#define MAX_TOKEN_SIZE (256)
|
||||
struct token {
|
||||
char name[MAX_TOKEN_SIZE];
|
||||
int value;
|
||||
size_t pos;
|
||||
enum token_type type;
|
||||
};
|
||||
|
||||
/**
|
||||
* tokenize - tokenize xbm file
|
||||
* @buffer: buffer containing xbm file
|
||||
* return token vector
|
||||
*/
|
||||
struct token *tokenize_xbm(char *buffer);
|
||||
|
||||
#endif /* LABWC_TOKENIZE_H */
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
#ifndef LABWC_XBM_H
|
||||
#define LABWC_XBM_H
|
||||
|
||||
#include <wlr/render/wlr_renderer.h>
|
||||
|
||||
#include "xbm/parse.h"
|
||||
|
||||
/**
|
||||
* xbm_load - load theme xbm files into global theme struct
|
||||
*/
|
||||
void xbm_load_button(const char *filename, struct lab_data_buffer **buffer,
|
||||
char *fallback_button, float *rgba);
|
||||
|
||||
#endif /* LABWC_XBM_H */
|
||||
Loading…
Add table
Add a link
Reference in a new issue