LCL, Win32: Revert defb345dc8 "fix 32 bit truncation of pointers in SetWindowLong/GetWindowLong. Issue #39502"

Add "LCLIntf." prefix for better readability.
This commit is contained in:
Martin 2022-01-18 22:43:48 +01:00
parent defb345dc8
commit 2ac55d4800
4 changed files with 10 additions and 10 deletions

View File

@ -67,7 +67,7 @@ var
begin
if iMsg = WM_USER + uIDTrayIcon then
begin
vwsTrayIcon := TCustomTrayIcon(PtrUInt(GetWindowLongPtrW(Handle, GWL_USERDATA)));
vwsTrayIcon := TCustomTrayIcon(PtrUInt(LCLIntf.GetWindowLong(Handle, GWL_USERDATA)));
case LParam_ of
WM_RBUTTONUP:
begin
@ -137,13 +137,13 @@ begin
if iMsg = WM_CREATE then
begin
msgTaskbarRestart := RegisterWindowMessage('TaskbarCreated');
SetWindowLongPtrW(Handle, GWL_USERDATA, PtrInt(PCREATESTRUCT(LParam_)^.lpCreateParams));
LCLIntf.SetWindowLong(Handle, GWL_USERDATA, PtrInt(PCREATESTRUCT(LParam_)^.lpCreateParams));
end
else
if (iMsg = msgTaskbarRestart) then
begin
// add taskbar icon
vwsTrayIcon := TCustomTrayIcon(PtrUInt(GetWindowLongPtrW(Handle, GWL_USERDATA)));
vwsTrayIcon := TCustomTrayIcon(PtrUInt(LCLIntf.GetWindowLong(Handle, GWL_USERDATA)));
if Assigned(vwsTrayIcon) then
TWin32WSCustomTrayIcon.AddIcon(vwsTrayIcon);
end;

View File

@ -247,12 +247,12 @@ begin
WindowInfo^.WinControl := AWinControl;
AWinControl.Handle := Window;
if Assigned(SubClassWndProc) then
WindowInfo^.DefWndProc := Windows.WNDPROC(SetWindowLongPtrW(
WindowInfo^.DefWndProc := Windows.WNDPROC(LCLIntf.SetWindowLong(
Window, GWL_WNDPROC, PtrInt(SubClassWndProc)));
// Set control ID to map WinControl. This is required for messages that sent to parent
// to extract control from the passed ID.
// In case of subclassing this ID will be set in WM_NCCREATE message handler
SetWindowLongPtrW(Window, GWL_ID, PtrInt(AWinControl));
LCLIntf.SetWindowLong(Window, GWL_ID, PtrInt(AWinControl));
end;
if AWinControl.Font.IsDefault then
@ -274,7 +274,7 @@ begin
begin
BuddyWindowInfo := AllocWindowInfo(Buddy);
BuddyWindowInfo^.AWinControl := AWinControl;
BuddyWindowInfo^.DefWndProc := Windows.WNDPROC(SetWindowLongPtrW(
BuddyWindowInfo^.DefWndProc := Windows.WNDPROC(LCLIntf.SetWindowLong(
Buddy, GWL_WNDPROC, PtrInt(SubClassWndProc)));
if AWinControl.Font.IsDefault then
lhFont := Win32Widgetset.DefaultFont
@ -576,7 +576,7 @@ var
begin
Handle := AWinControl.Handle;
{$ifdef RedirectDestroyMessages}
SetWindowLongPtrW(Handle, GWL_WNDPROC, PtrInt(@DestroyWindowProc));
LCLIntf.SetWindowLong(Handle, GWL_WNDPROC, PtrInt(@DestroyWindowProc));
{$endif}
// Instead of calling DestroyWindow directly, we need to call WM_MDIDESTROY for MDI children
if Assigned(Application.MainForm) and (Application.MainForm.FormStyle=fsMDIForm) and

View File

@ -187,7 +187,7 @@ class function TWin32WSScrollBox.CreateHandle(const AWinControl: TWinControl;
WindowInfo^.needParentPaint := true;
WindowInfo^.WinControl := AWinControl;
if SubClassWndProc <> nil then
WindowInfo^.DefWndProc := Windows.WNDPROC(SetWindowLongPtrW(
WindowInfo^.DefWndProc := Windows.WNDPROC(LCLIntf.SetWindowLong(
Window, GWL_WNDPROC, PtrInt(SubClassWndProc)));
lhFont := FDefaultFont;
Windows.SendMessage(Window, WM_SETFONT, WPARAM(lhFont), 0);}

View File

@ -392,7 +392,7 @@ begin
WindowInfo^.WinControl.Handle := Window;
WindowInfo^.DefWndProc := NCCreateParams^.DefWndProc;
WindowInfo^.needParentPaint := False;
SetWindowLongPtrW(Window, GWL_ID, PtrInt(NCCreateParams^.WinControl));
LCLIntf.SetWindowLong(Window, GWL_ID, PtrInt(NCCreateParams^.WinControl));
NCCreateParams^.Handled := True;
end;
end;
@ -723,7 +723,7 @@ begin
WindowInfo^.DefWndProc := NCCreateParams^.DefWndProc;
// listbox is not a transparent control -> no need for parentpainting
WindowInfo^.needParentPaint := False;
SetWindowLongPtrW(Window, GWL_ID, PtrInt(NCCreateParams^.WinControl));
LCLIntf.SetWindowLong(Window, GWL_ID, PtrInt(NCCreateParams^.WinControl));
NCCreateParams^.Handled := True;
end;
end;