Skip to content

Commit ace88c0

Browse files
committed
config: set no_hw_cursors to auto by default and disable on tearing
when tearing, updates to the overlay plane may be ignored by the kernel. To avoid the cursor being a slideshow, disable hw cursors
1 parent 1309b59 commit ace88c0

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

src/config/ConfigDescriptions.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1356,7 +1356,7 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
13561356
},
13571357
SConfigOptionDescription{
13581358
.value = "cursor:no_hardware_cursors",
1359-
.description = "disables hardware cursors",
1359+
.description = "disables hardware cursors. Auto = disable when tearing",
13601360
.type = CONFIG_OPTION_CHOICE,
13611361
.data = SConfigOptionDescription::SChoiceData{0, "Disabled,Enabled,Auto"},
13621362
},

src/config/ConfigManager.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ CConfigManager::CConfigManager() {
621621

622622
m_pConfig->addConfigValue("opengl:nvidia_anti_flicker", Hyprlang::INT{1});
623623

624-
m_pConfig->addConfigValue("cursor:no_hardware_cursors", Hyprlang::INT{0});
624+
m_pConfig->addConfigValue("cursor:no_hardware_cursors", Hyprlang::INT{2});
625625
m_pConfig->addConfigValue("cursor:no_break_fs_vrr", Hyprlang::INT{2});
626626
m_pConfig->addConfigValue("cursor:min_refresh_rate", Hyprlang::INT{24});
627627
m_pConfig->addConfigValue("cursor:hotspot_padding", Hyprlang::INT{0});
@@ -2798,12 +2798,13 @@ const std::vector<SConfigOptionDescription>& CConfigManager::getAllDescriptions(
27982798
return CONFIG_OPTIONS;
27992799
}
28002800

2801-
bool CConfigManager::shouldUseSoftwareCursors() {
2801+
bool CConfigManager::shouldUseSoftwareCursors(PHLMONITOR pMonitor) {
28022802
static auto PNOHW = CConfigValue<Hyprlang::INT>("cursor:no_hardware_cursors");
28032803

28042804
switch (*PNOHW) {
28052805
case 0: return false;
28062806
case 1: return true;
2807+
case 2: return !pMonitor->tearingState.activelyTearing;
28072808
default: break;
28082809
}
28092810

src/config/ConfigManager.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ class CConfigManager {
189189
void ensureMonitorStatus();
190190
void ensureVRR(PHLMONITOR pMonitor = nullptr);
191191

192-
bool shouldUseSoftwareCursors();
192+
bool shouldUseSoftwareCursors(PHLMONITOR pMonitor);
193193
void updateWatcher();
194194

195195
std::string parseKeyword(const std::string&, const std::string&);

src/managers/PointerManager.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ void CPointerManager::updateCursorBackend() {
274274
continue;
275275
}
276276

277-
if (state->softwareLocks > 0 || g_pConfigManager->shouldUseSoftwareCursors() || !attemptHardwareCursor(state)) {
277+
if (state->softwareLocks > 0 || g_pConfigManager->shouldUseSoftwareCursors(m) || !attemptHardwareCursor(state)) {
278278
Debug::log(TRACE, "Output {} rejected hardware cursors, falling back to sw", m->szName);
279279
state->box = getCursorBoxLogicalForMonitor(state->monitor.lock());
280280
state->hardwareFailed = true;
@@ -737,7 +737,8 @@ void CPointerManager::damageIfSoftware() {
737737
if (mw->monitor.expired() || !mw->monitor->output)
738738
continue;
739739

740-
if ((mw->softwareLocks > 0 || mw->hardwareFailed || g_pConfigManager->shouldUseSoftwareCursors()) && b.overlaps({mw->monitor->vecPosition, mw->monitor->vecSize})) {
740+
if ((mw->softwareLocks > 0 || mw->hardwareFailed || g_pConfigManager->shouldUseSoftwareCursors(mw->monitor.lock())) &&
741+
b.overlaps({mw->monitor->vecPosition, mw->monitor->vecSize})) {
741742
g_pHyprRenderer->damageBox(b, mw->monitor->shouldSkipScheduleFrameOnMouseEvent());
742743
break;
743744
}

0 commit comments

Comments
 (0)