renderer: Add cursor:invisible to allow to hide the cursor (#11058)
This commit is contained in:
parent
58b6eceb6d
commit
b7a91e02e9
3 changed files with 14 additions and 2 deletions
|
|
@ -1493,6 +1493,12 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
|
||||||
* cursor:
|
* cursor:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
SConfigOptionDescription{
|
||||||
|
.value = "cursor:invisible",
|
||||||
|
.description = "don't render cursors",
|
||||||
|
.type = CONFIG_OPTION_BOOL,
|
||||||
|
.data = SConfigOptionDescription::SBoolData{false},
|
||||||
|
},
|
||||||
SConfigOptionDescription{
|
SConfigOptionDescription{
|
||||||
.value = "cursor:no_hardware_cursors",
|
.value = "cursor:no_hardware_cursors",
|
||||||
.description = "disables hardware cursors. Auto = disable when multi-gpu on nvidia",
|
.description = "disables hardware cursors. Auto = disable when multi-gpu on nvidia",
|
||||||
|
|
|
||||||
|
|
@ -709,6 +709,7 @@ CConfigManager::CConfigManager() {
|
||||||
|
|
||||||
registerConfigVar("opengl:nvidia_anti_flicker", Hyprlang::INT{1});
|
registerConfigVar("opengl:nvidia_anti_flicker", Hyprlang::INT{1});
|
||||||
|
|
||||||
|
registerConfigVar("cursor:invisible", Hyprlang::INT{0});
|
||||||
registerConfigVar("cursor:no_hardware_cursors", Hyprlang::INT{2});
|
registerConfigVar("cursor:no_hardware_cursors", Hyprlang::INT{2});
|
||||||
registerConfigVar("cursor:no_break_fs_vrr", Hyprlang::INT{2});
|
registerConfigVar("cursor:no_break_fs_vrr", Hyprlang::INT{2});
|
||||||
registerConfigVar("cursor:min_refresh_rate", Hyprlang::INT{24});
|
registerConfigVar("cursor:min_refresh_rate", Hyprlang::INT{24});
|
||||||
|
|
@ -3129,11 +3130,15 @@ const std::vector<SConfigOptionDescription>& CConfigManager::getAllDescriptions(
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CConfigManager::shouldUseSoftwareCursors(PHLMONITOR pMonitor) {
|
bool CConfigManager::shouldUseSoftwareCursors(PHLMONITOR pMonitor) {
|
||||||
static auto PNOHW = CConfigValue<Hyprlang::INT>("cursor:no_hardware_cursors");
|
static auto PNOHW = CConfigValue<Hyprlang::INT>("cursor:no_hardware_cursors");
|
||||||
|
static auto PINVISIBLE = CConfigValue<Hyprlang::INT>("cursor:invisible");
|
||||||
|
|
||||||
if (pMonitor->m_tearingState.activelyTearing)
|
if (pMonitor->m_tearingState.activelyTearing)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
if (*PINVISIBLE != 0)
|
||||||
|
return true;
|
||||||
|
|
||||||
switch (*PNOHW) {
|
switch (*PNOHW) {
|
||||||
case 0: return false;
|
case 0: return false;
|
||||||
case 1: return true;
|
case 1: return true;
|
||||||
|
|
|
||||||
|
|
@ -2030,6 +2030,7 @@ void CHyprRenderer::setCursorFromName(const std::string& name, bool force) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprRenderer::ensureCursorRenderingMode() {
|
void CHyprRenderer::ensureCursorRenderingMode() {
|
||||||
|
static auto PINVISIBLE = CConfigValue<Hyprlang::INT>("cursor:invisible");
|
||||||
static auto PCURSORTIMEOUT = CConfigValue<Hyprlang::FLOAT>("cursor:inactive_timeout");
|
static auto PCURSORTIMEOUT = CConfigValue<Hyprlang::FLOAT>("cursor:inactive_timeout");
|
||||||
static auto PHIDEONTOUCH = CConfigValue<Hyprlang::INT>("cursor:hide_on_touch");
|
static auto PHIDEONTOUCH = CConfigValue<Hyprlang::INT>("cursor:hide_on_touch");
|
||||||
static auto PHIDEONKEY = CConfigValue<Hyprlang::INT>("cursor:hide_on_key_press");
|
static auto PHIDEONKEY = CConfigValue<Hyprlang::INT>("cursor:hide_on_key_press");
|
||||||
|
|
@ -2044,7 +2045,7 @@ void CHyprRenderer::ensureCursorRenderingMode() {
|
||||||
if (*PCURSORTIMEOUT > 0)
|
if (*PCURSORTIMEOUT > 0)
|
||||||
m_cursorHiddenConditions.hiddenOnTimeout = *PCURSORTIMEOUT < g_pInputManager->m_lastCursorMovement.getSeconds();
|
m_cursorHiddenConditions.hiddenOnTimeout = *PCURSORTIMEOUT < g_pInputManager->m_lastCursorMovement.getSeconds();
|
||||||
|
|
||||||
const bool HIDE = m_cursorHiddenConditions.hiddenOnTimeout || m_cursorHiddenConditions.hiddenOnTouch || m_cursorHiddenConditions.hiddenOnKeyboard;
|
const bool HIDE = m_cursorHiddenConditions.hiddenOnTimeout || m_cursorHiddenConditions.hiddenOnTouch || m_cursorHiddenConditions.hiddenOnKeyboard || (*PINVISIBLE != 0);
|
||||||
|
|
||||||
if (HIDE == m_cursorHidden)
|
if (HIDE == m_cursorHidden)
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue