introduce MwNdarkThemeAutomatic

This commit is contained in:
Nishi 2026-04-27 05:00:36 +09:00
commit 6927ffd27d
Signed by: nishi
GPG key ID: 27EF69B208EB9343
3 changed files with 7 additions and 1 deletions

View file

@ -43,6 +43,7 @@
#define MwNisRounded "IisRounded"
#define MwNdarkTheme "IdarkTheme"
#define MwNuseMonospace "IuseMonospace"
#define MwNdarkThemeAutomatic "IdarkThemeAutomatic"
#define MwNtitle "Stitle"
#define MwNtext "Stext"

View file

@ -96,6 +96,7 @@
<integer name="darkTheme" common="yes" />
<integer name="useMonospace" common="yes" />
<integer name="fillArea" />
<integer name="darkThemeAutomatic" common="yes" />
<!-- waitMS is a special property, only applies to toplevel widget -->
<integer name="waitMS" common="yes" />

View file

@ -170,10 +170,12 @@ static void llclipboardhandler(MwLL handle, void* data) {
static void lldarkthemehandler(MwLL handle, void* data) {
MwWidget h = (MwWidget)handle->common.user;
int* ptr = data;
int s;
if(IsFirstVisible(h)) {
if(IsFirstVisible(h) && (shgeti(h->integer, MwNdarkTheme) == -1 || ((s = MwGetInteger(h, MwNdarkThemeAutomatic)) != MwDEFAULT && s))) {
MwVaApply(h,
MwNdarkTheme, *ptr,
MwNdarkThemeAutomatic, 1,
NULL);
MwDispatchUserHandler(h, MwNdarkThemeHandler, data);
@ -573,6 +575,8 @@ void MwSetInteger(MwWidget handle, const char* key, int n) {
if(strcmp(key, MwNdarkTheme) == 0) {
MwWidget h = handle;
shdel(h->integer, MwNdarkThemeAutomatic);
while(h->parent != NULL && h->parent->widget_class != NULL) h = h->parent;
MwLLSetDarkTheme(h->lowlevel, n);