diff --git a/include/Mw/StringDefs.h b/include/Mw/StringDefs.h index 58fd173..ca540cc 100644 --- a/include/Mw/StringDefs.h +++ b/include/Mw/StringDefs.h @@ -43,6 +43,7 @@ #define MwNisRounded "IisRounded" #define MwNdarkTheme "IdarkTheme" #define MwNuseMonospace "IuseMonospace" +#define MwNdarkThemeAutomatic "IdarkThemeAutomatic" #define MwNtitle "Stitle" #define MwNtext "Stext" diff --git a/milsko.xml b/milsko.xml index d0a75ed..c3d26b3 100644 --- a/milsko.xml +++ b/milsko.xml @@ -96,6 +96,7 @@ + diff --git a/src/core.c b/src/core.c index e3a58fe..e0c018f 100644 --- a/src/core.c +++ b/src/core.c @@ -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);