Skip to content

Commit

Permalink
chore: remove windows 11 check
Browse files Browse the repository at this point in the history
  • Loading branch information
Nerixyz committed May 11, 2024
1 parent 44f879c commit aa955d4
Showing 1 changed file with 2 additions and 23 deletions.
25 changes: 2 additions & 23 deletions src/widgets/BaseWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
# pragma comment(lib, "Dwmapi.lib")

# include <QHBoxLayout>
# include <QOperatingSystemVersion>
#endif

#include "widgets/helper/TitlebarButton.hpp"
Expand All @@ -41,19 +40,6 @@ namespace {
// From kHiddenTaskbarSize in Firefox
constexpr UINT HIDDEN_TASKBAR_SIZE = 2;

bool isWindows11OrGreater()
{
static const bool result = [] {
// This calls RtlGetVersion under the hood so we don't have to.
// The micro version corresponds to dwBuildNumber.
auto version = QOperatingSystemVersion::current();
return (version.majorVersion() > 10) ||
(version.microVersion() >= 22000);
}();

return result;
}

/// Finds the taskbar HWND on a specific monitor (or any)
HWND findTaskbarWindow(LPRECT rcMon = nullptr)
{
Expand Down Expand Up @@ -118,8 +104,7 @@ RECT windowBordersFor(HWND hwnd, bool isMaximized)
{
RECT margins{0, 0, 0, 0};

auto addBorders = isMaximized || isWindows11OrGreater();
if (addBorders)
if (isMaximized)
{
auto dpi = GetDpiForWindow(hwnd);
auto systemMetric = [&](auto index) {
Expand All @@ -136,15 +121,9 @@ RECT windowBordersFor(HWND hwnd, bool isMaximized)

margins.left += borderWidth;
margins.right -= borderWidth;
if (isMaximized)
{
margins.top += borderHeight;
}
margins.top += borderHeight;
margins.bottom -= borderHeight;
}

if (isMaximized)
{
auto *hMonitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST);
MONITORINFO mi;
mi.cbSize = sizeof(mi);
Expand Down

0 comments on commit aa955d4

Please sign in to comment.