Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Files.App.CsWin32/Files.App.CsWin32.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
<DefineConstants Condition="'$(Configuration)' == 'Debug'">TRACE;DEBUG;NETFX_CORE</DefineConstants>
<DefineConstants Condition="'$(Configuration)' != 'Debug'">TRACE;RELEASE;NETFX_CORE</DefineConstants>
<DefineConstants>$(DefineConstants);$(Platform)</DefineConstants>
<Optimize Condition="'$(Configuration)' != 'Debug'">true</Optimize>
</PropertyGroup>

Expand Down
1 change: 1 addition & 0 deletions src/Files.App.CsWin32/NativeMethods.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ SendMessage
IsWindowVisible
COPYDATASTRUCT
SetWindowLongPtr
SetWindowLong
GetDpiForWindow
CallWindowProc
MINMAXINFO
Expand Down
12 changes: 12 additions & 0 deletions src/Files.App.CsWin32/Windows.Win32.Extras.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,16 @@ namespace UI.WindowsAndMessaging
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate LRESULT WNDPROC(HWND hWnd, uint msg, WPARAM wParam, LPARAM lParam);
}

public static partial class PInvoke
{
public static nint SetWindowLongPlat(HWND hWnd, UI.WindowsAndMessaging.WINDOW_LONG_PTR_INDEX nIndex, nint dwNewLong)
{
#if x86
return SetWindowLong(hWnd, nIndex, (int)dwNewLong);
#else
return SetWindowLongPtr(hWnd, nIndex, dwNewLong);
#endif
}
}
}
2 changes: 1 addition & 1 deletion src/Files.App/Data/Items/WindowEx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public unsafe WindowEx(int minWidth = 400, int minHeight = 300)

_newWndProc = new(NewWindowProc);
var pNewWndProc = Marshal.GetFunctionPointerForDelegate(_newWndProc);
var pOldWndProc = PInvoke.SetWindowLongPtr(new(WindowHandle), WINDOW_LONG_PTR_INDEX.GWL_WNDPROC, pNewWndProc);
var pOldWndProc = PInvoke.SetWindowLongPlat(new(WindowHandle), WINDOW_LONG_PTR_INDEX.GWL_WNDPROC, pNewWndProc);
_oldWndProc = Marshal.GetDelegateForFunctionPointer<WNDPROC>(pOldWndProc);

Closed += WindowEx_Closed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,11 @@ public unsafe void PointerEntered(bool onPreview)
(uint)Marshal.SizeOf(dwAttrib));

if (isOfficePreview)
PInvoke.SetWindowLongPtr(new((nint)hwnd), WINDOW_LONG_PTR_INDEX.GWL_EXSTYLE, 0);
PInvoke.SetWindowLongPlat(new((nint)hwnd), WINDOW_LONG_PTR_INDEX.GWL_EXSTYLE, 0);
}
else
{
PInvoke.SetWindowLongPtr(new((nint)hwnd), WINDOW_LONG_PTR_INDEX.GWL_EXSTYLE, (nint)(WINDOW_EX_STYLE.WS_EX_LAYERED | WINDOW_EX_STYLE.WS_EX_COMPOSITED));
PInvoke.SetWindowLongPlat(new((nint)hwnd), WINDOW_LONG_PTR_INDEX.GWL_EXSTYLE, (nint)(WINDOW_EX_STYLE.WS_EX_LAYERED | WINDOW_EX_STYLE.WS_EX_COMPOSITED));

var dwAttrib = Convert.ToUInt32(true);

Expand Down