From 2323b7f69fac0f152240b932da2d28da3c9eaada Mon Sep 17 00:00:00 2001 From: IoIxD Date: Sun, 26 Apr 2026 23:55:34 -0700 Subject: [PATCH] MwLLDoModern --- WatMakefile | 2 +- include/Mw/LowLevel.h | 10 +++++++++- src/backend/call.c | 2 +- src/backend/classicmacos.c | 5 +++++ src/backend/cocoa.m | 5 +++++ src/backend/gdi.c | 5 +++++ src/backend/wayland.c | 5 +++++ src/backend/x11.c | 5 +++++ src/core.c | 2 +- src/lowlevel.c | 2 ++ tools/watcom-pack.sh | 1 - 11 files changed, 39 insertions(+), 5 deletions(-) diff --git a/WatMakefile b/WatMakefile index 4ce4c3f..50e315b 100644 --- a/WatMakefile +++ b/WatMakefile @@ -1,7 +1,7 @@ CC = wcc386 -bt=nt -q -bd LD = wlink option quiet -CFLAGS = -i=include -i=external/libz/include -d_MILSKO -dUSE_GDI -dUSE_STB_TRUETYPE -dUSE_STB_IMAGE -dSTBI_NO_SIMD +CFLAGS = -i=include -i=external/libz/include -d_MILSKO -dUSE_GDI -dUSE_STB_TRUETYPE -dUSE_STB_IMAGE -dSTBI_NO_SIMD -dUSE_CLASSIC_THEME LDFLAGS = system nt_dll all: src/Mw.dll clean: .SYMBOLIC diff --git a/include/Mw/LowLevel.h b/include/Mw/LowLevel.h index 696fd51..c7fefb4 100644 --- a/include/Mw/LowLevel.h +++ b/include/Mw/LowLevel.h @@ -300,13 +300,21 @@ MWDECL void (*MwLLGetCursorCoord)(MwLL handle, MwPoint* point); MWDECL void (*MwLLGetScreenSize)(MwLL handle, MwRect* rect); /*! - * @brief Set dark theme + * @brief Set any extra parameters for dark theme * @param handle Handle * @param toggle Toggle * @warning Do not run `handle->common.handler->dark_theme` when this function gets called + * @warning This is for stuff like, i.e. setting the accent color on modern Windows. The user themselves sets dark theme with MwNdarkTheme. */ MWDECL void (*MwLLSetDarkTheme)(MwLL handle, int toggle); +/*! + * @brief Whether or not the platform should default to modern theme. + * @param handle Handle + * @return whether to default. + */ +MWDECL MwBool (*MwLLDoModern)(MwLL handle); + /* font renderer */ MWDECL void MwFLSetup(void); diff --git a/src/backend/call.c b/src/backend/call.c index 14338ec..6e6c98f 100644 --- a/src/backend/call.c +++ b/src/backend/call.c @@ -56,6 +56,6 @@ MwLLGetScreenSize = MwLLGetScreenSizeImpl; \ \ MwLLSetDarkTheme = MwLLSetDarkThemeImpl; \ -\ + MwLLDoModern = MwLLDoModernImpl; \ return 0; \ } diff --git a/src/backend/classicmacos.c b/src/backend/classicmacos.c index d7db433..eb0478a 100644 --- a/src/backend/classicmacos.c +++ b/src/backend/classicmacos.c @@ -340,6 +340,11 @@ static void MwLLSetDarkThemeImpl(MwLL handle, int toggle) { (void)toggle; } +static MwBool MwLLDoModernImpl(MwLL handle) { + (void)handle; + return MwFALSE; +} + static int MwLLClassicMacOSCallInitImpl(void) { InitGraf(&qd.thePort); InitFonts(); diff --git a/src/backend/cocoa.m b/src/backend/cocoa.m index 903cf29..d52fbba 100644 --- a/src/backend/cocoa.m +++ b/src/backend/cocoa.m @@ -1156,6 +1156,11 @@ static void MwLLSetDarkThemeImpl(MwLL handle, int toggle) { (void)toggle; } +static MwBool MwLLDoModernImpl(MwLL handle) { + (void)handle; + return MwTRUE; +} + static int MwLLCocoaCallInitImpl(void) { #ifndef __APPLE__ printf("Using GNUStep Backend\n"); diff --git a/src/backend/gdi.c b/src/backend/gdi.c index 3e6284b..f2da670 100644 --- a/src/backend/gdi.c +++ b/src/backend/gdi.c @@ -839,6 +839,11 @@ static void MwLLSetDarkThemeImpl(MwLL handle, int toggle) { DwmSetWindowAttribute(handle->gdi.hWnd, 20, &v, sizeof(v)); } +static MwBool MwLLDoModernImpl(MwLL handle) { + (void)handle; + return MwTRUE; +} + static int MwLLGDICallInitImpl(void) { memset(&wsymtbl, 0, sizeof(wsymtbl)); diff --git a/src/backend/wayland.c b/src/backend/wayland.c index 06b60b5..aad034f 100644 --- a/src/backend/wayland.c +++ b/src/backend/wayland.c @@ -2851,5 +2851,10 @@ static int MwLLWaylandCallInitImpl(void) { return 1; } +static MwBool MwLLDoModernImpl(MwLL handle) { + (void)handle; + return MwTRUE; +} + #include "call.c" CALL(Wayland); diff --git a/src/backend/x11.c b/src/backend/x11.c index 82e7be3..e5282b1 100644 --- a/src/backend/x11.c +++ b/src/backend/x11.c @@ -1449,5 +1449,10 @@ static int MwLLX11CallInitImpl(void) { return 0; } +static MwBool MwLLDoModernImpl(MwLL handle) { + (void)handle; + return MwTRUE; +} + #include "call.c" CALL(X11); diff --git a/src/core.c b/src/core.c index 3b322a4..ac650c1 100644 --- a/src/core.c +++ b/src/core.c @@ -674,7 +674,7 @@ int MwGetInteger(MwWidget handle, const char* key) { #ifdef USE_CLASSIC_THEME if(strcmp(key, MwNmodernLook) == 0) return inherit_integer(handle, key, 0); #else - if(strcmp(key, MwNmodernLook) == 0) return inherit_integer(handle, key, 1); + if(strcmp(key, MwNmodernLook) == 0) return inherit_integer(handle, key, MwLLDoModern(handle->lowlevel)); #endif if(strcmp(key, MwNdarkTheme) == 0) return inherit_integer(handle, key, 0); if(strcmp(key, MwNuseMonospace) == 0) return inherit_integer(handle, key, 0); diff --git a/src/lowlevel.c b/src/lowlevel.c index e2a576e..55822f1 100644 --- a/src/lowlevel.c +++ b/src/lowlevel.c @@ -53,6 +53,8 @@ void (*MwLLGetScreenSize)(MwLL handle, MwRect* rect) = NULL; void (*MwLLSetDarkTheme)(MwLL handle, int toggle) = NULL; +MwBool (*MwLLDoModern)(MwLL handle) = NULL; + void MwLLCreateCommon(MwLL handle) { handle->common.handler = malloc(sizeof(*handle->common.handler)); memset(handle->common.handler, 0, sizeof(*handle->common.handler)); diff --git a/tools/watcom-pack.sh b/tools/watcom-pack.sh index 81626db..57885e0 100755 --- a/tools/watcom-pack.sh +++ b/tools/watcom-pack.sh @@ -20,4 +20,3 @@ cd ../.. rm -f milsko-examples.zip cp resource/logo/logo.png examples/picture.jpg examples/picture.png milsko-examples/ zip -rv milsko-examples.zip milsko-examples -rm -rf milsko-examples