From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Vitaly Takmazov Newsgroups: gmane.emacs.devel Subject: Patch for Windows 8.1+ HiDPI support Date: Wed, 13 May 2015 10:45:53 +0300 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11342c2cfadb960515f1cc8c X-Trace: ger.gmane.org 1431524482 6672 80.91.229.3 (13 May 2015 13:41:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 13 May 2015 13:41:22 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed May 13 15:41:22 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YsWuX-0007zj-Uy for ged-emacs-devel@m.gmane.org; Wed, 13 May 2015 15:41:22 +0200 Original-Received: from localhost ([::1]:49009 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YsWuX-0007gv-0K for ged-emacs-devel@m.gmane.org; Wed, 13 May 2015 09:41:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50414) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YsRMb-00067s-Hs for emacs-devel@gnu.org; Wed, 13 May 2015 03:45:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YsRMa-00031p-1P for emacs-devel@gnu.org; Wed, 13 May 2015 03:45:57 -0400 Original-Received: from mail-la0-x22f.google.com ([2a00:1450:4010:c03::22f]:34794) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YsRMZ-00031N-KG for emacs-devel@gnu.org; Wed, 13 May 2015 03:45:55 -0400 Original-Received: by laat2 with SMTP id t2so23226909laa.1 for ; Wed, 13 May 2015 00:45:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=km71DTXQT1qMmhdDLmsixv4UBX6ImrUthjOoVwfFeqk=; b=n59fI+gbJB5fHMVct/ih2q/rMTAn143b37usKS9tSJLqtYXH6fEaJ7PzCG1yULmHpg A58rF/PN2yxCJhFIHys0h84bWUXd7BZViWYIPk8BUptIZd/JFgaPtHfhkgJT2eoAeDFZ tHtCnGHdvZoOdkNshmzmnofXLUljJm9vcJrShrqdAKRy8qUVZ5vI1AH20aw/2QsJlvVy pXzgYxDzQ15DdOvvC3Hgg/iqfnr8014AfgUENsfpt4FaVw4N6d2gQ+KY9M/5ECTjSzwZ Uw4qHq7BxZESAyAOydvk3ICpPYA3Pv2MqPajSuQfra0xbDyoFXAU8FsOBS/uIK7NvfC7 NYpw== X-Received: by 10.152.243.9 with SMTP id wu9mr14738086lac.63.1431503153845; Wed, 13 May 2015 00:45:53 -0700 (PDT) Original-Received: by 10.112.54.134 with HTTP; Wed, 13 May 2015 00:45:53 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c03::22f X-Mailman-Approved-At: Wed, 13 May 2015 09:41:07 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:186478 Archived-At: --001a11342c2cfadb960515f1cc8c Content-Type: text/plain; charset=UTF-8 Hello, Emacs works perfectly on HiDPI monitor, I have patched ony two minor things: 1) declare dpi-awareness in manifest files, so Windows will not enable "compatibility mode" and fonts now look crisp by default 2) remove unneeded OFN_ENABLEHOOK flag passed to GetOpenFileName, which allow OS to show modern "open file" dialog. Legacy dialog not support HiDPI mode and show too small icons. Let me know if I miss something and/or select wrong place to report it --- diff --git a/nt/emacs-x64.manifest b/nt/emacs-x64.manifestindex 5434e29..3cf56dd 100644--- a/nt/emacs-x64.manifest+++ b/nt/emacs-x64.manifest@@ -1,5 +1,5 @@ -+ + + + true+ + diff --git a/nt/emacs-x86.manifest b/nt/emacs-x86.manifestindex 7f09c56..d7053be 100644--- a/nt/emacs-x86.manifest+++ b/nt/emacs-x86.manifest@@ -1,5 +1,5 @@ -+ + + + true+ + diff --git a/src/w32fns.c b/src/w32fns.cindex ed11031..c04b9b0 100644--- a/src/w32fns.c+++ b/src/w32fns.c@@ -6680,7 +6680,7 @@ value of DIR as in previous invocations; this is standard Windows behavior. */) #endif file_details_w->nFilterIndex = NILP (only_dir_p) ? 1 : 2; file_details_w->Flags = (OFN_HIDEREADONLY | OFN_NOCHANGEDIR- | OFN_EXPLORER | OFN_ENABLEHOOK);+ | OFN_EXPLORER); if (!NILP (mustmatch)) { /* Require that the path to the parent directory exists. */@@ -6707,7 +6707,7 @@ value of DIR as in previous invocations; this is standard Windows behavior. */) file_details_a->lpstrTitle = prompt_a; file_details_a->nFilterIndex = NILP (only_dir_p) ? 1 : 2; file_details_a->Flags = (OFN_HIDEREADONLY | OFN_NOCHANGEDIR- | OFN_EXPLORER | OFN_ENABLEHOOK);+ | OFN_EXPLORER); if (!NILP (mustmatch)) { /* Require that the path to the parent directory exists. */ --001a11342c2cfadb960515f1cc8c Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hello,
Emacs works perfectly on HiDPI monitor, I have patched o= ny two minor things:
1) declare dpi-awareness in manifest files, so Windows= will not enable "compatibility mode" and fonts now look crisp by= default
2) remove unneeded OFN_ENABLEHOOK flag passed to GetOpenFileName, = which allow OS to show modern "open file" dialog. Legacy dialog n= ot support HiDPI mode and show too small icons.
Let me know if I miss somet= hing and/or select wrong place to report it

---
diff --git a/nt/emacs-x64.manifest b/nt/emacs-x64.mani=
fest
index 5434e29..3cf56dd 100644
--- a/nt/emacs-x64.manifest
+++ b/nt/emacs-x64.manifest
@@ -1,5 +1,5 @@
 <?xml version=3D"1.0" encoding=3D"UTF-8" standalone=3D"yes"?>
-<assembly xmlns=3D"urn:schem=
as-microsoft-com:asm.v1" manifestVersion=3D"1.0">
+<assembly xmlns=3D"urn:schemas-=
microsoft-com:asm.v1" manifestVersion=3D"1.0" xmlns:asmv3=3D=
"urn:schemas-microsoft-com:asm.v3">
   <dependency>
     <dependentAssembly>
       <assemblyIdentity type=3D"win32" name=3D"Microsoft.Windows.Common-Controls"
@@ -30,4 +30,9 @@
          <supportedOS Id=3D"{4<=
/span>a2f28e3-53b9-4441-ba9c-d69d4a4<=
/span>a6e38}"/>
       </application>=20
     </compatibility>
+  <asmv3:application>
+    <asmv3:windowsSettings xmlns=3D&=
quot;http=
://schemas.microsoft.com/SMI/2005/WindowsSettings">
+      <dpiAware>true</dpiAware=
>
+    </asmv3:windowsSettings>
+  </asmv3:application>
 </assembly>
diff --git a/nt/emacs-x86.manifest b/nt/=
emacs-x86.manifest
index 7f09c56..d7053be 100644
--- a/nt/emacs-x86.manifest
+++ b/nt/emacs-x86.manifest
@@ -1,5 +1,5 @@
 <?xml version=3D"1.0" encoding=3D"UTF-8" standalone=3D"yes"?>
-<assembly xmlns=3D"urn:schem=
as-microsoft-com:asm.v1" manifestVersion=3D"1.0">
+<assembly xmlns=3D"urn:schemas-=
microsoft-com:asm.v1" manifestVersion=3D"1.0" xmlns:asmv3=3D=
"urn:schemas-microsoft-com:asm.v3">
   <dependency>
     <dependentAssembly>
       <assemblyIdentity type=3D"win32" name=3D"Microsoft.Windows.Common-Controls"
@@ -30,4 +30,9 @@
         <supportedOS Id=3D"{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
       </application>=20
     </compatibility>
+  <asmv3:application>
+    <asmv3:windowsSettings xmlns=3D&=
quot;http=
://schemas.microsoft.com/SMI/2005/WindowsSettings">
+      <dpiAware>true</dpiAware=
>
+    </asmv3:windowsSettings>
+  </asmv3:application>
 </assembly>
diff --git a/src/w32fns.c b/src/w32fns.c=

index ed11031..c04b9b0 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -6680,7 +6680,7 @@ value of DIR as=
 in previous invocations; this is standard Windows behavior.  */)
 #endif
     file_details_w->nFilterIndex =3D NILP (only_dir_p) ? 1 : 2=
;
     file_details_w->Flags =3D (OFN_HIDEREADONLY | OFN_NOCHANGEDIR
-                 | OFN_EXPLORER | OF=
N_ENABLEHOOK);
+                 | OFN_EXPLORER);
     if (!NILP (mustmatch))
       {
         /* Require that the path to the parent directory exists.  */
@@ -6707,7 +6707,7 @@ value of DIR as=
 in previous invocations; this is standard Windows behavior.  */)
     file_details_a->lpstrTitle =3D prompt_a;
     file_details_a->nFilterIndex =3D NILP (only_dir_p) ? 1 : 2=
;
     file_details_a->Flags =3D (OFN_HIDEREADONLY | OFN_NOCHANGEDIR
-                 | OFN_EXPLORER | OF=
N_ENABLEHOOK);
+                 | OFN_EXPLORER);
     if (!NILP (mustmatch))
       {
         /* Require that the path to the parent directory exists.  */
=
--001a11342c2cfadb960515f1cc8c--