aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorVaxry <[email protected]>2024-10-26 02:12:43 +0100
committerVaxry <[email protected]>2024-10-26 02:12:43 +0100
commit3dd8db83f166733d1dd6a753bd6eb07727320768 (patch)
treeefc91d7bf13514a5da3047f8f55608412eb74c6d /src
parentd5689bb53935ff1adbbfc9fdf5b1f542ce39efb2 (diff)
downloadHyprland-3dd8db83f166733d1dd6a753bd6eb07727320768.tar.gz
Hyprland-3dd8db83f166733d1dd6a753bd6eb07727320768.zip
pointer: add default auto for no_hw_cursors
auto defaults to off on nvidia, on for everyone else. Gotta wait until we do fucking drm_dumb and it fucking works
Diffstat (limited to 'src')
-rw-r--r--src/config/ConfigDescriptions.hpp4
-rw-r--r--src/config/ConfigManager.cpp14
-rw-r--r--src/config/ConfigManager.hpp2
-rw-r--r--src/managers/PointerManager.cpp12
4 files changed, 21 insertions, 11 deletions
diff --git a/src/config/ConfigDescriptions.hpp b/src/config/ConfigDescriptions.hpp
index 7910e865..0177f92b 100644
--- a/src/config/ConfigDescriptions.hpp
+++ b/src/config/ConfigDescriptions.hpp
@@ -1244,8 +1244,8 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
SConfigOptionDescription{
.value = "cursor:no_hardware_cursors",
.description = "disables hardware cursors",
- .type = CONFIG_OPTION_BOOL,
- .data = SConfigOptionDescription::SBoolData{false},
+ .type = CONFIG_OPTION_CHOICE,
+ .data = SConfigOptionDescription::SChoiceData{0, "Disabled,Enabled,Auto"},
},
SConfigOptionDescription{
.value = "cursor:no_break_fs_vrr",
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index e2dc4b0f..909dfc63 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -552,7 +552,7 @@ CConfigManager::CConfigManager() {
m_pConfig->addConfigValue("opengl:nvidia_anti_flicker", Hyprlang::INT{1});
m_pConfig->addConfigValue("opengl:force_introspection", Hyprlang::INT{2});
- m_pConfig->addConfigValue("cursor:no_hardware_cursors", Hyprlang::INT{0});
+ m_pConfig->addConfigValue("cursor:no_hardware_cursors", Hyprlang::INT{2});
m_pConfig->addConfigValue("cursor:no_break_fs_vrr", Hyprlang::INT{0});
m_pConfig->addConfigValue("cursor:min_refresh_rate", Hyprlang::INT{24});
m_pConfig->addConfigValue("cursor:hotspot_padding", Hyprlang::INT{0});
@@ -2778,6 +2778,18 @@ const std::vector<SConfigOptionDescription>& CConfigManager::getAllDescriptions(
return CONFIG_OPTIONS;
}
+bool CConfigManager::shouldUseSoftwareCursors() {
+ static auto PNOHW = CConfigValue<Hyprlang::INT>("cursor:no_hardware_cursors");
+
+ switch (*PNOHW) {
+ case 0: return false;
+ case 1: return true;
+ default: return g_pHyprRenderer->isNvidia();
+ }
+
+ return true;
+}
+
std::string SConfigOptionDescription::jsonify() const {
auto parseData = [this]() -> std::string {
return std::visit(
diff --git a/src/config/ConfigManager.hpp b/src/config/ConfigManager.hpp
index cf053daa..88b74b6e 100644
--- a/src/config/ConfigManager.hpp
+++ b/src/config/ConfigManager.hpp
@@ -200,6 +200,8 @@ class CConfigManager {
void ensureMonitorStatus();
void ensureVRR(PHLMONITOR pMonitor = nullptr);
+ bool shouldUseSoftwareCursors();
+
std::string parseKeyword(const std::string&, const std::string&);
void addParseError(const std::string&);
diff --git a/src/managers/PointerManager.cpp b/src/managers/PointerManager.cpp
index 0d6e0206..d2114e79 100644
--- a/src/managers/PointerManager.cpp
+++ b/src/managers/PointerManager.cpp
@@ -247,9 +247,7 @@ void CPointerManager::resetCursorImage(bool apply) {
}
void CPointerManager::updateCursorBackend() {
- static auto PNOHW = CConfigValue<Hyprlang::INT>("cursor:no_hardware_cursors");
-
- const auto CURSORBOX = getCursorBoxGlobal();
+ const auto CURSORBOX = getCursorBoxGlobal();
for (auto const& m : g_pCompositor->m_vMonitors) {
auto state = stateFor(m);
@@ -268,7 +266,7 @@ void CPointerManager::updateCursorBackend() {
continue;
}
- if (state->softwareLocks > 0 || *PNOHW || !attemptHardwareCursor(state)) {
+ if (state->softwareLocks > 0 || g_pConfigManager->shouldUseSoftwareCursors() || !attemptHardwareCursor(state)) {
Debug::log(TRACE, "Output {} rejected hardware cursors, falling back to sw", m->szName);
state->box = getCursorBoxLogicalForMonitor(state->monitor.lock());
state->hardwareFailed = true;
@@ -641,15 +639,13 @@ Vector2D CPointerManager::closestValid(const Vector2D& pos) {
}
void CPointerManager::damageIfSoftware() {
- auto b = getCursorBoxGlobal().expand(4);
-
- static auto PNOHW = CConfigValue<Hyprlang::INT>("cursor:no_hardware_cursors");
+ auto b = getCursorBoxGlobal().expand(4);
for (auto const& mw : monitorStates) {
if (mw->monitor.expired() || !mw->monitor->output)
continue;
- if ((mw->softwareLocks > 0 || mw->hardwareFailed || *PNOHW) && b.overlaps({mw->monitor->vecPosition, mw->monitor->vecSize})) {
+ if ((mw->softwareLocks > 0 || mw->hardwareFailed || g_pConfigManager->shouldUseSoftwareCursors()) && b.overlaps({mw->monitor->vecPosition, mw->monitor->vecSize})) {
g_pHyprRenderer->damageBox(&b, mw->monitor->shouldSkipScheduleFrameOnMouseEvent());
break;
}