Skip to content

Commit

Permalink
theme.get("win.align") fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hugeping committed Mar 1, 2025
1 parent 55a6010 commit 80b81e7
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion src/themes.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2022 Peter Kosyh <p.kosyh at gmail.com>
* Copyright 2009-2025 Peter Kosyh <p.kosyh at gmail.com>
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation files
Expand Down Expand Up @@ -254,6 +254,28 @@ static int out_dpi(const void *v, char **out)
return 0;
}

static int out_win_align(const void *v, char **out)
{
int mode = *(int*)v;
switch (mode) {
case ALIGN_LEFT:
*out = strdup("left");
break;
case ALIGN_RIGHT:
*out = strdup("right");
break;
case ALIGN_CENTER:
*out = strdup("center");
break;
case ALIGN_JUSTIFY:
*out = strdup("justify");
break;
default:
return -1;
}
return 0;
}

static int parse_include(const char *v, void *data)
{
int rc;
Expand Down Expand Up @@ -682,6 +704,10 @@ char *theme_getvar(char *name)
if (out_dpi(cmd_parser[i].p, &s))
return NULL;
return s;
} else if (cmd_parser[i].fn == parse_win_align) {
if (out_win_align(cmd_parser[i].p, &s))
return NULL;
return s;
} else
return NULL;
break;
Expand Down

0 comments on commit 80b81e7

Please sign in to comment.