Artifact [c97a19ee09]

Artifact c97a19ee0993fa36cf98cf53afe204e0496c122d:

Attachment "fix-highdpi-scaling-2.patch" to ticket [90ea2a3a93] added by anonymous on 2024-01-03 18:49:23.
Index: kitcreator
==================================================================
--- kitcreator
+++ kitcreator
@@ -1,6 +1,9 @@
 #! /usr/bin/env bash
+
+KITCREATOR_DIR="$(pwd)"
+export KITCREATOR_DIR
 
 # Clean variables which will interfere with the build
 unset MAKEFLAGS DESTDIR
 
 # Determine appropriate mode

Index: kitsh/build.sh
==================================================================
--- kitsh/build.sh
+++ kitsh/build.sh
@@ -108,10 +108,21 @@
 
 			echo ' *** Removing "kit.rc" since we have Tk with its own resource file'
 
 			rm -f "${BUILDDIR}/kit.rc"
 		fi
+	else
+		# If Tk is present the "wish" manifest is copied when Tk is built (because
+		# that is when the *.rc file is built). In the absense of Tk the "tclsh"
+		# manifest is copied to ensure it is present for the kit.rc file.
+		if [ -f "$KITCREATOR_DIR/tclkit.exe.manifest" ]; then
+			KITCREATOR_MANIFEST="$KITCREATOR_DIR/tclkit.exe.manifest"
+		else
+			KITCREATOR_MANIFEST="$KITCREATOR_DIR/tcl/build/tcl${TCLVERS}/win/tclsh.exe.manifest"
+		fi
+		echo " *** Creating tclkit.exe.manifest from $KITCREATOR_MANIFEST"
+		cat "${KITCREATOR_MANIFEST}" | sed 's@name="Tcl.tclsh"@name="Tcl.tclkit"@' >> ${BUILDDIR}/tclkit.exe.manifest
 	fi
 
 	# Cleanup
 	rm -f kit kit.exe tclsh tclsh.exe
 

Index: kitsh/buildsrc/kitsh-0.0/installvfs.tcl
==================================================================
--- kitsh/buildsrc/kitsh-0.0/installvfs.tcl
+++ kitsh/buildsrc/kitsh-0.0/installvfs.tcl
@@ -34,10 +34,13 @@
 proc copy_file {srcfile destfile} {
 	switch -glob -- $srcfile {
 		"*.tcl" - "*.txt" {
 			set ifd [open $srcfile r]
 			set ofd [open $destfile w]
+
+			# Force tcl files to have lf line endings inside tclkit.
+			fconfigure $ofd -translation lf
 
 			set ret [fcopy $ifd $ofd]
 
 			close $ofd
 			close $ifd

Index: kitsh/buildsrc/kitsh-0.0/kit.rc
==================================================================
--- kitsh/buildsrc/kitsh-0.0/kit.rc
+++ kitsh/buildsrc/kitsh-0.0/kit.rc
@@ -62,5 +62,17 @@
 //
 // Icon
 //
 
 tclsh                      ICON    DISCARDABLE     "tclkit.ico"
+
+//
+// This is needed for Windows 8.1 onwards.
+//
+
+#ifndef RT_MANIFEST
+#define RT_MANIFEST     24
+#endif
+#ifndef CREATEPROCESS_MANIFEST_RESOURCE_ID
+#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1
+#endif
+CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "tclkit.exe.manifest"

Index: tk/build.sh
==================================================================
--- tk/build.sh
+++ tk/build.sh
@@ -266,10 +266,18 @@
 			cp "${KITCREATOR_ICON}" rc/tk.ico
 
 			echo ' *** Importing user-specified resources'
 			cat "${KITCREATOR_RC}" | grep -v '^ *tclsh  *ICON' >> "./rc/tk_base.rc"
 
+			if [ -f "$KITCREATOR_DIR/tclkit.exe.manifest" ]; then
+				KITCREATOR_MANIFEST="$KITCREATOR_DIR/tclkit.exe.manifest"
+			else
+				KITCREATOR_MANIFEST="$BUILDDIR/win/wish.exe.manifest"
+			fi
+			echo " *** Creating tclkit.exe.manifest from $KITCREATOR_MANIFEST"
+			cat "${KITCREATOR_MANIFEST}" | sed 's@name="Tcl.Tk.wish"@name="Tcl.tclkit"@' >> tclkit.exe.manifest
+
 			echo ' *** Creating tkbase.res.o to support Windows build'
 			echo "\"${RC:-windres}\" -o tkbase.res.o  --define STATIC_BUILD --include \"./../generic\" --include \"${TCLCONFIGDIR}/../generic\" --include \"${TCLCONFIGDIR}\" --include \"./rc\" \"./rc/tk_base.rc\""
 			"${RC:-windres}" -o tkbase.res.o  --define STATIC_BUILD --include "./../generic" --include "${TCLCONFIGDIR}/../generic" --include "${TCLCONFIGDIR}" --include "./rc" "./rc/tk_base.rc"
 
 			if [ -f "tkbase.res.o" ]; then