diff --git a/framelesshelper_win32.cpp b/framelesshelper_win32.cpp index b4c6e01..6629e26 100644 --- a/framelesshelper_win32.cpp +++ b/framelesshelper_win32.cpp @@ -380,11 +380,11 @@ bool FramelessHelperWin::nativeEventFilter(const QByteArray &eventType, void *me if (Utilities::isDwmCompositionAvailable()) { QSystemLibrary winmmLib(QStringLiteral("winmm")); static const auto ptimeGetDevCaps = - reinterpret_cast(winmmLib.resolve("timeGetDevCaps")); + reinterpret_cast(winmmLib.resolve("timeGetDevCaps")); static const auto ptimeBeginPeriod = - reinterpret_cast(winmmLib.resolve("timeBeginPeriod")); + reinterpret_cast(winmmLib.resolve("timeBeginPeriod")); static const auto ptimeEndPeriod = - reinterpret_cast(winmmLib.resolve("timeEndPeriod")); + reinterpret_cast(winmmLib.resolve("timeEndPeriod")); static const auto pDwmGetCompositionTimingInfo = reinterpret_cast(QSystemLibrary::resolve(QStringLiteral("dwmapi"), "DwmGetCompositionTimingInfo")); if (ptimeGetDevCaps && ptimeBeginPeriod && ptimeEndPeriod && pDwmGetCompositionTimingInfo) { @@ -394,13 +394,13 @@ bool FramelessHelperWin::nativeEventFilter(const QByteArray &eventType, void *me qWarning() << Utilities::getSystemErrorMessage(QStringLiteral("QueryPerformanceFrequency")); break; } - TIMECAPS tc = {}; - if (ptimeGetDevCaps(&tc, sizeof(tc)) != MMSYSERR_NOERROR) { + flh_TIMECAPS tc = {}; + if (ptimeGetDevCaps(&tc, sizeof(tc)) != /*MMSYSERR_NOERROR*/0) { qWarning() << "timeGetDevCaps() failed."; break; } const UINT ms_granularity = tc.wPeriodMin; - if (ptimeBeginPeriod(ms_granularity) != TIMERR_NOERROR) { + if (ptimeBeginPeriod(ms_granularity) != /*TIMERR_NOERROR*/0) { qWarning() << "timeBeginPeriod() failed."; break; } @@ -441,7 +441,7 @@ bool FramelessHelperWin::nativeEventFilter(const QByteArray &eventType, void *me Q_ASSERT(m < period); const qreal m_ms = 1000.0 * static_cast(m) / static_cast(freq.QuadPart); Sleep(static_cast(qRound(m_ms))); - if (ptimeEndPeriod(ms_granularity) != TIMERR_NOERROR) { + if (ptimeEndPeriod(ms_granularity) != /*TIMERR_NOERROR*/0) { qWarning() << "timeEndPeriod() failed."; break; } diff --git a/framelesshelper_windows.h b/framelesshelper_windows.h index 68df4c7..21509ca 100644 --- a/framelesshelper_windows.h +++ b/framelesshelper_windows.h @@ -114,6 +114,16 @@ #define IsMaximized(window) (IsZoomed(window) != FALSE) #endif +struct flh_timecaps_tag +{ + UINT wPeriodMin; // minimum period supported + UINT wPeriodMax; // maximum period supported +}; +using flh_TIMECAPS = flh_timecaps_tag; +using flh_PTIMECAPS = flh_timecaps_tag *; +using flh_NPTIMECAPS = flh_timecaps_tag * NEAR; +using flh_LPTIMECAPS = flh_timecaps_tag * FAR; + [[maybe_unused]] static constexpr UINT kAutoHideTaskbarThickness = 2; // The thickness of an auto-hide taskbar in pixels [[maybe_unused]] static constexpr char kDwmRegistryKey[] = R"(Software\Microsoft\Windows\DWM)";