add app manifest (win32)

Wed, 08 Oct 2025 15:42:23 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Wed, 08 Oct 2025 15:42:23 +0200
changeset 816
f5690594b240
parent 815
7ddf5fb7ec2a
child 817
d09817e6e6a4

add app manifest (win32)

.hgignore file | annotate | diff | comparison | revisions
application/Makefile file | annotate | diff | comparison | revisions
application/Makefile.unix file | annotate | diff | comparison | revisions
application/Makefile.win32 file | annotate | diff | comparison | revisions
application/app.manifest file | annotate | diff | comparison | revisions
application/app.rc file | annotate | diff | comparison | revisions
application/main.c file | annotate | diff | comparison | revisions
ui/win32/toolkit.c file | annotate | diff | comparison | revisions
ui/win32/window.c file | annotate | diff | comparison | revisions
--- a/.hgignore	Wed Oct 08 12:36:16 2025 +0200
+++ b/.hgignore	Wed Oct 08 15:42:23 2025 +0200
@@ -11,3 +11,4 @@
 relre:.qmake.stash$
 relre:^.idea/.*
 relre:^compile_commands.json$
+relre:^application/app.res$
--- a/application/Makefile	Wed Oct 08 12:36:16 2025 +0200
+++ b/application/Makefile	Wed Oct 08 15:42:23 2025 +0200
@@ -39,8 +39,10 @@
 
 all: $(APP_BIN)
 
-$(APP_BIN): $(OBJ) $(BUILD_ROOT)/build/$(BUILD_LIB_DIR)/$(LIB_PREFIX)uitk$(LIB_EXT)
-	$(LD) -o $(APP_BIN) $(OBJ) $(BUILD_ROOT)/build/$(BUILD_LIB_DIR)/$(LIB_PREFIX)uitk$(LIB_EXT) $(BUILD_ROOT)/build/$(BUILD_LIB_DIR)/$(LIB_PREFIX)ucx$(LIB_EXT) $(LDFLAGS) $(TK_LDFLAGS)
+include $(SYS_MAKEFILE)
+
+$(APP_BIN): $(OBJ) $(RES_FILE) $(BUILD_ROOT)/build/$(BUILD_LIB_DIR)/$(LIB_PREFIX)uitk$(LIB_EXT)
+	$(LD) -o $(APP_BIN) $(OBJ) $(RES_FILE) $(BUILD_ROOT)/build/$(BUILD_LIB_DIR)/$(LIB_PREFIX)uitk$(LIB_EXT) $(BUILD_ROOT)/build/$(BUILD_LIB_DIR)/$(LIB_PREFIX)ucx$(LIB_EXT) $(LDFLAGS) $(TK_LDFLAGS)
 
 ../build/application/%$(OBJ_EXT): %.c
 	$(CC) $(CFLAGS) $(TK_CFLAGS) -o $@ -c $<
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/application/Makefile.win32	Wed Oct 08 15:42:23 2025 +0200
@@ -0,0 +1,5 @@
+RES_FILE = app.res
+
+$(RES_FILE): app.rc app.manifest
+	llvm-rc app.rc
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/application/app.manifest	Wed Oct 08 15:42:23 2025 +0200
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+  <dependency>
+    <dependentAssembly>
+      <assemblyIdentity
+        type="win32"
+        name="Microsoft.Windows.Common-Controls"
+        version="6.0.0.0"
+        processorArchitecture="*"
+        publicKeyToken="6595b64144ccf1df"
+        language="*"
+      />
+    </dependentAssembly>
+  </dependency>
+</assembly>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/application/app.rc	Wed Oct 08 15:42:23 2025 +0200
@@ -0,0 +1,1 @@
+1 24 "app.manifest"
--- a/application/main.c	Wed Oct 08 12:36:16 2025 +0200
+++ b/application/main.c	Wed Oct 08 15:42:23 2025 +0200
@@ -1131,7 +1131,7 @@
     ui_button(obj, .label = "Test 2-2", .hfill = TRUE, .hexpand = TRUE, .margin_top = 20);
     ui_button(obj, .label = "Test 2-3", .margin_top = 30);
     ui_newline(obj);
-    ui_button(obj, .label = "Test 3", .colspan = 3, .fill = TRUE);
+    ui_button(obj, .label = "Test 3XX", .colspan = 3, .fill = TRUE);
 	ui_show(obj);
 }
 
--- a/ui/win32/toolkit.c	Wed Oct 08 12:36:16 2025 +0200
+++ b/ui/win32/toolkit.c	Wed Oct 08 15:42:23 2025 +0200
@@ -41,6 +41,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+#include <commctrl.h>
+
 static const char *application_name;
 
 static ui_callback   startup_func;
@@ -59,6 +61,11 @@
     uic_load_app_properties();
 
     ui_window_init();
+
+    INITCOMMONCONTROLSEX icex = { sizeof(icex), ICC_WIN95_CLASSES };
+    InitCommonControlsEx(&icex);
+
+    SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
 }
 
 const char* ui_appname() {
--- a/ui/win32/window.c	Wed Oct 08 12:36:16 2025 +0200
+++ b/ui/win32/window.c	Wed Oct 08 15:42:23 2025 +0200
@@ -75,7 +75,7 @@
     wc.hInstance = hInstance;
     wc.lpszClassName = mainWindowClass;
     wc.hCursor = LoadCursor(NULL, IDC_ARROW);
-    wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
+    wc.hbrBackground = GetSysColorBrush(COLOR_BTNFACE);
 
     if(!RegisterClassExA(&wc)) {
         MessageBox(NULL, "RegisterClassEx failed", "Error", MB_ICONERROR);
@@ -86,7 +86,7 @@
 static UiObject* create_window(const char *title, void *window_data, bool simple) {
     UiObject *obj = uic_object_new_toplevel();
     obj->window = window_data;
-	
+
 	HWND hwnd = CreateWindowExA(
 			0,
 			"UiMainWindow",

mercurial