mirror of
https://github.com/hyprwm/Hyprland
synced 2024-12-23 00:09:49 +01:00
added misc:hide_cursor_on_touch
This commit is contained in:
parent
2ec7e241cd
commit
5c83976977
5 changed files with 34 additions and 27 deletions
|
@ -61,6 +61,7 @@ void CConfigManager::setDefaultVars() {
|
|||
configValues["misc:swallow_regex"].strValue = STRVAL_EMPTY;
|
||||
configValues["misc:focus_on_activate"].intValue = 0;
|
||||
configValues["misc:no_direct_scanout"].intValue = 0;
|
||||
configValues["misc:hide_cursor_on_touch"].intValue = 1;
|
||||
|
||||
configValues["debug:int"].intValue = 0;
|
||||
configValues["debug:log_damage"].intValue = 0;
|
||||
|
@ -1342,12 +1343,8 @@ SConfigValue CConfigManager::getConfigValueSafeDevice(const std::string& dev, co
|
|||
if (foundIt == std::string::npos)
|
||||
continue;
|
||||
|
||||
if (cv.first == "input:" + val
|
||||
|| cv.first == "input:touchpad:" + cv.first
|
||||
|| cv.first == "input:touchdevice:" + val
|
||||
|| cv.first == "input:tablet:" + cv.first
|
||||
|| cv.first == "input:tablet:" + val
|
||||
) {
|
||||
if (cv.first == "input:" + val || cv.first == "input:touchpad:" + cv.first || cv.first == "input:touchdevice:" + val || cv.first == "input:tablet:" + cv.first ||
|
||||
cv.first == "input:tablet:" + val) {
|
||||
copy = cv.second;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,8 @@ void CInputManager::onMouseMoved(wlr_pointer_motion_event* e) {
|
|||
mouseMoveUnified(e->time_msec);
|
||||
|
||||
m_tmrLastCursorMovement.reset();
|
||||
|
||||
m_bLastInputTouch = false;
|
||||
}
|
||||
|
||||
void CInputManager::onMouseWarp(wlr_pointer_motion_absolute_event* e) {
|
||||
|
@ -29,6 +31,8 @@ void CInputManager::onMouseWarp(wlr_pointer_motion_absolute_event* e) {
|
|||
mouseMoveUnified(e->time_msec);
|
||||
|
||||
m_tmrLastCursorMovement.reset();
|
||||
|
||||
m_bLastInputTouch = false;
|
||||
}
|
||||
|
||||
void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
|
||||
|
|
|
@ -26,24 +26,22 @@ struct STouchData {
|
|||
};
|
||||
|
||||
// The third row is always 0 0 1 and is not expected by `libinput_device_config_calibration_set_matrix`
|
||||
static const float MATRICES[8][6] = {
|
||||
{// normal
|
||||
1, 0, 0, 0, 1, 0},
|
||||
{// rotation 90°
|
||||
0, -1, 1, 1, 0, 0},
|
||||
{// rotation 180°
|
||||
-1, 0, 1, 0, -1, 1},
|
||||
{// rotation 270°
|
||||
0, 1, 0, -1, 0, 1},
|
||||
{// flipped
|
||||
-1, 0, 1, 0, 1, 0},
|
||||
{// flipped + rotation 90°
|
||||
0, 1, 0, 1, 0, 0},
|
||||
{// flipped + rotation 180°
|
||||
1, 0, 0, 0, -1, 1},
|
||||
{// flipped + rotation 270°
|
||||
0, -1, 1, -1, 0, 1}
|
||||
};
|
||||
static const float MATRICES[8][6] = {{// normal
|
||||
1, 0, 0, 0, 1, 0},
|
||||
{// rotation 90°
|
||||
0, -1, 1, 1, 0, 0},
|
||||
{// rotation 180°
|
||||
-1, 0, 1, 0, -1, 1},
|
||||
{// rotation 270°
|
||||
0, 1, 0, -1, 0, 1},
|
||||
{// flipped
|
||||
-1, 0, 1, 0, 1, 0},
|
||||
{// flipped + rotation 90°
|
||||
0, 1, 0, 1, 0, 0},
|
||||
{// flipped + rotation 180°
|
||||
1, 0, 0, 0, -1, 1},
|
||||
{// flipped + rotation 270°
|
||||
0, -1, 1, -1, 0, 1}};
|
||||
|
||||
class CKeybindManager;
|
||||
|
||||
|
@ -160,6 +158,9 @@ class CInputManager {
|
|||
// for some bugs in follow mouse 0
|
||||
bool m_bLastFocusOnLS = false;
|
||||
|
||||
// for hiding cursor on touch
|
||||
bool m_bLastInputTouch = false;
|
||||
|
||||
private:
|
||||
bool m_bCursorImageOverriden = false;
|
||||
|
||||
|
|
|
@ -15,6 +15,8 @@ void CInputManager::onTouchDown(wlr_touch_down_event* e) {
|
|||
|
||||
refocus();
|
||||
|
||||
m_bLastInputTouch = true;
|
||||
|
||||
m_sTouchData.touchFocusWindow = m_pFoundWindowToFocus;
|
||||
m_sTouchData.touchFocusSurface = m_pFoundSurfaceToFocus;
|
||||
m_sTouchData.touchFocusLS = m_pFoundLSToFocus;
|
||||
|
|
|
@ -1463,11 +1463,14 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
|
|||
|
||||
void CHyprRenderer::ensureCursorRenderingMode() {
|
||||
static auto* const PCURSORTIMEOUT = &g_pConfigManager->getConfigValuePtr("general:cursor_inactive_timeout")->intValue;
|
||||
static auto* const PHIDEONTOUCH = &g_pConfigManager->getConfigValuePtr("misc:hide_cursor_on_touch")->intValue;
|
||||
|
||||
const auto PASSEDCURSORSECONDS = g_pInputManager->m_tmrLastCursorMovement.getSeconds();
|
||||
|
||||
if (*PCURSORTIMEOUT > 0) {
|
||||
if (*PCURSORTIMEOUT < PASSEDCURSORSECONDS && m_bHasARenderedCursor) {
|
||||
if (*PCURSORTIMEOUT > 0 || *PHIDEONTOUCH) {
|
||||
const bool HIDE = (*PCURSORTIMEOUT > 0 && *PCURSORTIMEOUT < PASSEDCURSORSECONDS) || (g_pInputManager->m_bLastInputTouch && *PHIDEONTOUCH);
|
||||
|
||||
if (HIDE && m_bHasARenderedCursor) {
|
||||
m_bHasARenderedCursor = false;
|
||||
|
||||
wlr_cursor_set_surface(g_pCompositor->m_sWLRCursor, nullptr, 0, 0); // hide
|
||||
|
@ -1476,7 +1479,7 @@ void CHyprRenderer::ensureCursorRenderingMode() {
|
|||
|
||||
for (auto& m : g_pCompositor->m_vMonitors)
|
||||
g_pHyprRenderer->damageMonitor(m.get()); // TODO: maybe just damage the cursor area?
|
||||
} else if (*PCURSORTIMEOUT > PASSEDCURSORSECONDS && !m_bHasARenderedCursor) {
|
||||
} else if (!HIDE && !m_bHasARenderedCursor) {
|
||||
m_bHasARenderedCursor = true;
|
||||
|
||||
if (!m_bWindowRequestedCursorHide)
|
||||
|
|
Loading…
Reference in a new issue