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

@ -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);