summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfuyu147 <fuyu.147@hotmail.com>2025-12-19 11:14:22 -0500
committerGitHub <noreply@github.com>2025-12-19 16:14:22 +0000
commit315806f59816aacdbf7c66aaeaa0e49d3a33a66d (patch)
tree3969eaf1ac96bd2cd3948065f470c19f8cceacb5 /src
parent6175ecd4c4ba817c4620f66a75e1e11da7c7a8ca (diff)
tablet: added option to hide cursor (#12525)
Diffstat (limited to 'src')
-rw-r--r--src/config/ConfigDescriptions.hpp6
-rw-r--r--src/config/ConfigManager.cpp1
-rw-r--r--src/managers/input/InputManager.cpp6
-rw-r--r--src/managers/input/InputManager.hpp3
-rw-r--r--src/managers/input/Tablets.cpp2
-rw-r--r--src/render/Renderer.cpp10
-rw-r--r--src/render/Renderer.hpp1
7 files changed, 25 insertions, 4 deletions
diff --git a/src/config/ConfigDescriptions.hpp b/src/config/ConfigDescriptions.hpp
index 38bb0a20..187d0d05 100644
--- a/src/config/ConfigDescriptions.hpp
+++ b/src/config/ConfigDescriptions.hpp
@@ -1683,6 +1683,12 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
.data = SConfigOptionDescription::SBoolData{true},
},
SConfigOptionDescription{
+ .value = "cursor:hide_on_tablet",
+ .description = "Hides the cursor when the last input was a tablet input until a mouse input is done.",
+ .type = CONFIG_OPTION_BOOL,
+ .data = SConfigOptionDescription::SBoolData{true},
+ },
+ SConfigOptionDescription{
.value = "cursor:use_cpu_buffer",
.description = "Makes HW cursors use a CPU buffer. Required on Nvidia to have HW cursors. Experimental",
.type = CONFIG_OPTION_BOOL,
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index 1af5fb15..bb2cc845 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -739,6 +739,7 @@ CConfigManager::CConfigManager() {
registerConfigVar("cursor:sync_gsettings_theme", Hyprlang::INT{1});
registerConfigVar("cursor:hide_on_key_press", Hyprlang::INT{0});
registerConfigVar("cursor:hide_on_touch", Hyprlang::INT{1});
+ registerConfigVar("cursor:hide_on_tablet", Hyprlang::INT{0});
registerConfigVar("cursor:use_cpu_buffer", Hyprlang::INT{2});
registerConfigVar("cursor:warp_back_after_non_mouse_input", Hyprlang::INT{0});
diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp
index 764c394e..746b6acf 100644
--- a/src/managers/input/InputManager.cpp
+++ b/src/managers/input/InputManager.cpp
@@ -146,7 +146,8 @@ void CInputManager::onMouseMoved(IPointer::SMotionEvent e) {
m_lastCursorMovement.reset();
- m_lastInputTouch = false;
+ m_lastInputTouch = false;
+ m_lastInputTablet = false;
if (e.mouse)
m_lastMousePos = getMouseCoordsInternal();
@@ -159,7 +160,8 @@ void CInputManager::onMouseWarp(IPointer::SMotionAbsoluteEvent e) {
m_lastCursorMovement.reset();
- m_lastInputTouch = false;
+ m_lastInputTouch = false;
+ m_lastInputTablet = false;
}
void CInputManager::simulateMouseMovement() {
diff --git a/src/managers/input/InputManager.hpp b/src/managers/input/InputManager.hpp
index c3d6ac2f..239f6140 100644
--- a/src/managers/input/InputManager.hpp
+++ b/src/managers/input/InputManager.hpp
@@ -208,6 +208,9 @@ class CInputManager {
// for hiding cursor on touch
bool m_lastInputTouch = false;
+ // for hiding cursor on tablet
+ bool m_lastInputTablet = false;
+
// for tracking mouse refocus
PHLWINDOWREF m_lastMouseFocus;
diff --git a/src/managers/input/Tablets.cpp b/src/managers/input/Tablets.cpp
index 5bb0bb50..52be6eee 100644
--- a/src/managers/input/Tablets.cpp
+++ b/src/managers/input/Tablets.cpp
@@ -216,9 +216,11 @@ void CInputManager::onTabletProximity(CTablet::SProximityEvent e) {
PTOOL->m_active = e.in;
if (!e.in) {
+ m_lastInputTablet = false;
if (PTOOL->getSurface())
unfocusTool(PTOOL);
} else {
+ m_lastInputTablet = true;
simulateMouseMovement();
refocusTablet(PTAB, PTOOL);
}
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp
index 40b6cc89..1ee65a0f 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -121,12 +121,14 @@ CHyprRenderer::CHyprRenderer() {
});
static auto P2 = g_pHookSystem->hookDynamic("mouseMove", [&](void* self, SCallbackInfo& info, std::any param) {
- if (!m_cursorHiddenConditions.hiddenOnKeyboard && m_cursorHiddenConditions.hiddenOnTouch == g_pInputManager->m_lastInputTouch && !m_cursorHiddenConditions.hiddenOnTimeout)
+ if (!m_cursorHiddenConditions.hiddenOnKeyboard && m_cursorHiddenConditions.hiddenOnTouch == g_pInputManager->m_lastInputTouch &&
+ m_cursorHiddenConditions.hiddenOnTablet == g_pInputManager->m_lastInputTablet && !m_cursorHiddenConditions.hiddenOnTimeout)
return;
m_cursorHiddenConditions.hiddenOnKeyboard = false;
m_cursorHiddenConditions.hiddenOnTimeout = false;
m_cursorHiddenConditions.hiddenOnTouch = g_pInputManager->m_lastInputTouch;
+ m_cursorHiddenConditions.hiddenOnTablet = g_pInputManager->m_lastInputTablet;
ensureCursorRenderingMode();
});
@@ -2111,19 +2113,23 @@ void CHyprRenderer::ensureCursorRenderingMode() {
static auto PINVISIBLE = CConfigValue<Hyprlang::INT>("cursor:invisible");
static auto PCURSORTIMEOUT = CConfigValue<Hyprlang::FLOAT>("cursor:inactive_timeout");
static auto PHIDEONTOUCH = CConfigValue<Hyprlang::INT>("cursor:hide_on_touch");
+ static auto PHIDEONTABLET = CConfigValue<Hyprlang::INT>("cursor:hide_on_tablet");
static auto PHIDEONKEY = CConfigValue<Hyprlang::INT>("cursor:hide_on_key_press");
if (*PCURSORTIMEOUT <= 0)
m_cursorHiddenConditions.hiddenOnTimeout = false;
if (*PHIDEONTOUCH == 0)
m_cursorHiddenConditions.hiddenOnTouch = false;
+ if (*PHIDEONTABLET == 0)
+ m_cursorHiddenConditions.hiddenOnTablet = false;
if (*PHIDEONKEY == 0)
m_cursorHiddenConditions.hiddenOnKeyboard = false;
if (*PCURSORTIMEOUT > 0)
m_cursorHiddenConditions.hiddenOnTimeout = *PCURSORTIMEOUT < g_pInputManager->m_lastCursorMovement.getSeconds();
- m_cursorHiddenByCondition = m_cursorHiddenConditions.hiddenOnTimeout || m_cursorHiddenConditions.hiddenOnTouch || m_cursorHiddenConditions.hiddenOnKeyboard;
+ m_cursorHiddenByCondition =
+ m_cursorHiddenConditions.hiddenOnTimeout || m_cursorHiddenConditions.hiddenOnTouch || m_cursorHiddenConditions.hiddenOnTablet || m_cursorHiddenConditions.hiddenOnKeyboard;
const bool HIDE = m_cursorHiddenByCondition || (*PINVISIBLE != 0);
diff --git a/src/render/Renderer.hpp b/src/render/Renderer.hpp
index 6e0c69fa..f2377b3b 100644
--- a/src/render/Renderer.hpp
+++ b/src/render/Renderer.hpp
@@ -154,6 +154,7 @@ class CHyprRenderer {
struct {
bool hiddenOnTouch = false;
+ bool hiddenOnTablet = false;
bool hiddenOnTimeout = false;
bool hiddenOnKeyboard = false;
} m_cursorHiddenConditions;