Render window close button

This commit is contained in:
Johan Malm 2020-06-29 19:27:59 +01:00
parent 40e862f3ac
commit baca410560
17 changed files with 177 additions and 50 deletions

25
include/theme/xbm/parse.h Normal file
View file

@ -0,0 +1,25 @@
/*
* Parse xbm token to create pixmap
*
* Copyright Johan Malm 2020
*/
#ifndef PARSE_H
#define PARSE_H
#include <stdint.h>
#include "theme/xbm/tokenize.h"
struct pixmap {
uint32_t *data;
int width;
int height;
};
/**
* xbm_create_pixmap - parse xbm tokens and create pixmap
* @tokens: token vector
*/
struct pixmap xbm_create_pixmap(struct token *tokens);
#endif /* PARSE_H */

View file

@ -0,0 +1,39 @@
/*
* XBM file tokenizer
*
* Copyright Johan Malm 2020
*/
#ifndef TOKENIZE_H
#define 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];
size_t pos;
enum token_type type;
};
/**
* tokenize - tokenize xbm file
* @buffer: buffer containing xbm file
* return token vector
*/
struct token *xbm_tokenize(char *buffer);
/**
* xbm_read_file - read file into buffer (as it's easier to tokenize that way)
* @filename: file to be read
* return allocated memory
*/
char *xbm_read_file(const char *filename);
#endif /* TOKENIZE_H */

14
include/theme/xbm/xbm.h Normal file
View file

@ -0,0 +1,14 @@
#ifndef XBM_H
#define XBM_H
#include <wlr/render/wlr_renderer.h>
#include "theme.h"
#include "theme/xbm/parse.h"
/**
* xbm_load - load theme xbm files into global theme struct
*/
void xbm_load(struct wlr_renderer *renderer);
#endif /* XBM_H */