mirror of
https://github.com/labwc/labwc.git
synced 2025-11-01 22:58:47 -04:00
Render window close button
This commit is contained in:
parent
40e862f3ac
commit
baca410560
17 changed files with 177 additions and 50 deletions
34
src/theme/xbm/xbm.c
Normal file
34
src/theme/xbm/xbm.c
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Create wlr textures based on xbm data
|
||||
*
|
||||
* Copyright Johan Malm 2020
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "theme/xbm/xbm.h"
|
||||
#include "theme/xbm/parse.h"
|
||||
|
||||
static char filename[] = "/usr/share/themes/Bear2/openbox-3/close.xbm";
|
||||
|
||||
void xbm_load(struct wlr_renderer *renderer)
|
||||
{
|
||||
struct token *tokens;
|
||||
|
||||
char *buffer = xbm_read_file(filename);
|
||||
if (!buffer) {
|
||||
fprintf(stderr, "no buffer\n");
|
||||
return;
|
||||
}
|
||||
tokens = xbm_tokenize(buffer);
|
||||
free(buffer);
|
||||
struct pixmap pixmap = xbm_create_pixmap(tokens);
|
||||
free(tokens);
|
||||
|
||||
theme.xbm_close = wlr_texture_from_pixels(
|
||||
renderer, WL_SHM_FORMAT_ARGB8888, pixmap.width * 4,
|
||||
pixmap.width, pixmap.height, pixmap.data);
|
||||
if (pixmap.data)
|
||||
free(pixmap.data);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue