diff options
| author | UjinT34 <41110182+UjinT34@users.noreply.github.com> | 2024-06-14 14:45:32 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-14 13:45:32 +0200 |
| commit | a9d53a2252f7ec084e2487d18777e2df01c8c351 (patch) | |
| tree | d9c57d21becd4fe0c5e4e9619612289b479e4b2a /src/helpers/Monitor.cpp | |
| parent | b2590b58c51094424a9651d8df37dfab838b5bbb (diff) | |
vrr: add option to fix mouse breaking vrr (#6483)
* option to fix mouse breaking vrr
* skip damage on mouse move
* remove this-> & cleanup
* add cursor:min_refresh_rate to avoid cursor freezing
* run clang-format
---------
Co-authored-by: UjinT34 <ujin@uvpn.ru>
Diffstat (limited to 'src/helpers/Monitor.cpp')
| -rw-r--r-- | src/helpers/Monitor.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp index 027b47bd..58687e09 100644 --- a/src/helpers/Monitor.cpp +++ b/src/helpers/Monitor.cpp @@ -362,6 +362,24 @@ void CMonitor::addDamage(const CBox* box) { g_pCompositor->scheduleFrameForMonitor(this); } +bool CMonitor::shouldSkipScheduleFrameOnMouseEvent() { + static auto PNOBREAK = CConfigValue<Hyprlang::INT>("cursor:no_break_fs_vrr"); + static auto PMINRR = CConfigValue<Hyprlang::INT>("cursor:min_refresh_rate"); + + // skip scheduling extra frames for fullsreen apps with vrr + bool shouldSkip = *PNOBREAK && output->adaptive_sync_status == WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED && activeWorkspace && activeWorkspace->m_bHasFullscreenWindow && + activeWorkspace->m_efFullscreenMode == FULLSCREEN_FULL; + + // keep requested minimum refresh rate + if (shouldSkip && *PMINRR && lastPresentationTimer.getMillis() > 1000 / *PMINRR) { + // damage whole screen because some previous cursor box damages were skipped + wlr_damage_ring_add_whole(&damage); + return false; + } + + return shouldSkip; +} + bool CMonitor::isMirror() { return pMirrorOf != nullptr; } |
