]> cygwin.com Git - cygwin-apps/setup.git/commitdiff
Use SetWindowLongPtrW() when setting WndProc
authorJon Turney <jon.turney@dronecode.org.uk>
Wed, 1 Feb 2023 13:10:25 +0000 (13:10 +0000)
committerJon Turney <jon.turney@dronecode.org.uk>
Thu, 2 Feb 2023 12:56:49 +0000 (12:56 +0000)
Using the SetWindowLongPtrA() variant means that a Unicode to ASCII shim
is inserted around the installed WndProc, which is not what we want.

(Specfically, this flattens the PropSheet caption to an 8-bit encoding
as it passes through the WndProc as a WM_SETTEXT message, which is not
reversible for non-latin scripts)

Future work: Rewrite this using SetWindowSubclass() instead, which
sidesteps all these issues.

proppage.cc
propsheet.cc

index 46357172e45dbbabd4c78a989035326957fa83f8..1be3eeda5f078534de0336ea455fcede2536a31e 100644 (file)
@@ -98,7 +98,7 @@ PropertyPage::FirstDialogProcReflector (HWND hwnd, UINT message,
   This = (PropertyPage *) (((LPPROPSHEETPAGEW) lParam)->lParam);
 
   SetWindowLongPtr (hwnd, DWLP_USER, (LONG_PTR) This);
-  SetWindowLongPtr (hwnd, DWLP_DLGPROC, (LONG_PTR) DialogProcReflector);
+  SetWindowLongPtrW (hwnd, DWLP_DLGPROC, (LONG_PTR) DialogProcReflector);
 
   This->SetHWND (hwnd);
   return This->DialogProc (message, wParam, lParam);
index c36a97567fec4b27c33e206299a79a964ce8de7f..a2dca4581818bd8be1e9a4b5f6d1846facbdb6dd 100644 (file)
@@ -267,10 +267,15 @@ PropSheetProc (HWND hwndDlg, UINT uMsg, LPARAM lParam)
          Hook into the window proc.
          We need to catch some messages for resizing.
         */
-       PropSheetData::Instance().oldWndProc =
-         (WNDPROC)GetWindowLongPtr (hwndDlg, GWLP_WNDPROC);
-       SetWindowLongPtr (hwndDlg, GWLP_WNDPROC,
-         (LONG_PTR)&PropSheetWndProc);
+        PropSheetData::Instance().oldWndProc = (WNDPROC)GetWindowLongPtrW (hwndDlg, GWLP_WNDPROC);
+        SetWindowLongPtrW (hwndDlg, GWLP_WNDPROC, (LONG_PTR)&PropSheetWndProc);
+        /*
+          Store the PropSheet HWND in the Chooser, for use in resizing
+
+          (XXX: this is just silly: The PropSheet HWND is the parent of the
+          PropPage HWND, so chooser has access to that HWND as GetParent()
+          anyhow... )
+         */
        ChooserPage::SetHwndDialog (hwndDlg);
       }
       return TRUE;
This page took 0.035274 seconds and 5 git commands to generate.