Skip to content

Commit 80b81e7

Browse files
committed
theme.get("win.align") fix
1 parent 55a6010 commit 80b81e7

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

src/themes.c

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2022 Peter Kosyh <p.kosyh at gmail.com>
2+
* Copyright 2009-2025 Peter Kosyh <p.kosyh at gmail.com>
33
*
44
* Permission is hereby granted, free of charge, to any person
55
* obtaining a copy of this software and associated documentation files
@@ -254,6 +254,28 @@ static int out_dpi(const void *v, char **out)
254254
return 0;
255255
}
256256

257+
static int out_win_align(const void *v, char **out)
258+
{
259+
int mode = *(int*)v;
260+
switch (mode) {
261+
case ALIGN_LEFT:
262+
*out = strdup("left");
263+
break;
264+
case ALIGN_RIGHT:
265+
*out = strdup("right");
266+
break;
267+
case ALIGN_CENTER:
268+
*out = strdup("center");
269+
break;
270+
case ALIGN_JUSTIFY:
271+
*out = strdup("justify");
272+
break;
273+
default:
274+
return -1;
275+
}
276+
return 0;
277+
}
278+
257279
static int parse_include(const char *v, void *data)
258280
{
259281
int rc;
@@ -682,6 +704,10 @@ char *theme_getvar(char *name)
682704
if (out_dpi(cmd_parser[i].p, &s))
683705
return NULL;
684706
return s;
707+
} else if (cmd_parser[i].fn == parse_win_align) {
708+
if (out_win_align(cmd_parser[i].p, &s))
709+
return NULL;
710+
return s;
685711
} else
686712
return NULL;
687713
break;

0 commit comments

Comments
 (0)