Sine Striker
2023-12-13 27604c5152cd9b768c31cbb1947e0138cea2c484
src/core/qwindowkit_windows.h
@@ -4,14 +4,7 @@
#include <QtCore/qt_windows.h>
#include <QtCore/qglobal.h>
// MOC can't handle C++ attributes before 5.15.
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
#  define Q_NODISCARD    [[nodiscard]]
#  define Q_MAYBE_UNUSED [[maybe_unused]]
#else
#  define Q_NODISCARD
#  define Q_MAYBE_UNUSED
#endif
#include <QWKCore/qwkglobal.h>
#ifndef GET_X_LPARAM
#  define GET_X_LPARAM(lp) (static_cast<int>(static_cast<short>(LOWORD(lp))))
@@ -19,6 +12,22 @@
#ifndef GET_Y_LPARAM
#  define GET_Y_LPARAM(lp) (static_cast<int>(static_cast<short>(HIWORD(lp))))
#endif
#ifndef IsMinimized
#  define IsMinimized(hwnd) (::IsIconic(hwnd) != FALSE)
#endif
#ifndef IsMaximized
#  define IsMaximized(hwnd) (::IsZoomed(hwnd) != FALSE)
#endif
#ifndef RECT_WIDTH
#  define RECT_WIDTH(rect) ((rect).right - (rect).left)
#endif
#ifndef RECT_HEIGHT
#  define RECT_HEIGHT(rect) ((rect).bottom - (rect).top)
#endif
// Maybe undocumented Windows messages
@@ -30,4 +39,41 @@
#  define WM_UNREGISTER_WINDOW_SERVICES (0x0272)
#endif
#ifndef WM_NCUAHDRAWCAPTION
#  define WM_NCUAHDRAWCAPTION (0x00AE)
#endif
#ifndef WM_NCUAHDRAWFRAME
#  define WM_NCUAHDRAWFRAME (0x00AF)
#endif
namespace QWK {
    QWK_CORE_EXPORT RTL_OSVERSIONINFOW GetRealOSVersion();
    inline bool IsWindows10OrGreater_Real() {
        RTL_OSVERSIONINFOW rovi = GetRealOSVersion();
        return (rovi.dwMajorVersion > 10) ||
               (rovi.dwMajorVersion == 10 && rovi.dwMinorVersion >= 0);
    }
    inline bool IsWindows11OrGreater_Real() {
        RTL_OSVERSIONINFOW rovi = GetRealOSVersion();
        return (rovi.dwMajorVersion > 10) ||
               (rovi.dwMajorVersion == 10 && rovi.dwMinorVersion >= 0 &&
                rovi.dwBuildNumber >= 22000);
    }
    inline bool IsWindows8Point1OrGreater_Real() {
        RTL_OSVERSIONINFOW rovi = GetRealOSVersion();
        return (rovi.dwMajorVersion > 6) || (rovi.dwMajorVersion == 6 && rovi.dwMinorVersion >= 3);
    }
    inline bool IsWindows8OrGreater_Real() {
        RTL_OSVERSIONINFOW rovi = GetRealOSVersion();
        return (rovi.dwMajorVersion > 6) || (rovi.dwMajorVersion == 6 && rovi.dwMinorVersion >= 2);
    }
}
#endif // QWINDOWKIT_WINDOWS_H