aboutsummaryrefslogtreecommitdiff
path: root/swt.c
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2023-04-20 21:55:47 +0200
committerNathan Reiner <nathan@nathanreiner.xyz>2023-04-20 21:55:47 +0200
commita46daccc110b6a43bf1dba928d7f1f1e72a14d81 (patch)
treeef66aacc32657452b8b435a2f5e732b49b08f41f /swt.c
parenta4a86549a939dee9da41f28efe7435ba4884f1a6 (diff)
fix missing font crash and use color index as rgb if not found
Diffstat (limited to 'swt.c')
-rw-r--r--swt.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/swt.c b/swt.c
index 446267a..b16447d 100644
--- a/swt.c
+++ b/swt.c
@@ -72,7 +72,7 @@ static int execshortcut();
static char *kmap();
static void buffer_release(void *data, struct wl_buffer *buffer);
static void draw_frame();
-static uint32_t get_color(int i);
+static uint32_t get_color(uint32_t i);
static void draw_glyph(Glyph g, int x, int y);
static void commit_surface();
static void surface_configure(void *data, struct xdg_surface *surface, uint32_t serial);
@@ -216,10 +216,11 @@ paste()
uint32_t
-get_color(int i)
+get_color(uint32_t i)
{
- if (!BETWEEN(i, 0, sizeof(colors) / sizeof(uint32_t)))
- return colors[defaultbg];
+ if (!BETWEEN(i, 0, sizeof(colors) / sizeof(uint32_t))) {
+ return i;
+ }
return colors[i];
}