Skip to content

Commit

Permalink
Remove window titlebar depending on platform.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tum4ik committed Mar 28, 2024
1 parent 300e9a4 commit a906137
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
14 changes: 5 additions & 9 deletions Tum4ik.JustClipboardManager/Helpers/WindowHelper.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System.Reflection.Metadata;
using Tum4ik.JustClipboardManager.Services.Theme;
using Windows.Win32;
using Windows.Win32.Foundation;
Expand All @@ -13,14 +12,11 @@ public static void RemoveDefaultTitleBar(nint windowHandle)
var hwnd = (HWND) windowHandle;
var windowStyleLong = PInvoke.GetWindowLong(hwnd, WINDOW_LONG_PTR_INDEX.GWL_STYLE);
windowStyleLong &= ~(int) WINDOW_STYLE.WS_SYSMENU;
if (nint.Size == 4)
{
_ = PInvoke.SetWindowLong(hwnd, WINDOW_LONG_PTR_INDEX.GWL_STYLE, windowStyleLong);
}
else
{
PInvoke.SetWindowLongPtr(hwnd, WINDOW_LONG_PTR_INDEX.GWL_STYLE, windowStyleLong);
}
#if x64
PInvoke.SetWindowLongPtr(hwnd, WINDOW_LONG_PTR_INDEX.GWL_STYLE, windowStyleLong);
#elif x86
PInvoke.SetWindowLong(hwnd, WINDOW_LONG_PTR_INDEX.GWL_STYLE, windowStyleLong);
#endif
}


Expand Down
16 changes: 16 additions & 0 deletions Tum4ik.JustClipboardManager/Tum4ik.JustClipboardManager.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,22 @@
<NeutralLanguage>en-US</NeutralLanguage>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'">
<DefineConstants>$(DefineConstants);x86</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<DefineConstants>$(DefineConstants);x64</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x86'">
<DefineConstants>$(DefineConstants);x86</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<DefineConstants>$(DefineConstants);x64</DefineConstants>
</PropertyGroup>

<ItemGroup>
<None Remove="appsettings.json" />
<None Remove="Controls\AppBarNavigationButton.xaml" />
Expand Down

0 comments on commit a906137

Please sign in to comment.