mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-26 06:45:59 +01:00
add disabling pointer devices
This commit is contained in:
parent
d5a0610ea2
commit
28c81fc71e
3 changed files with 16 additions and 0 deletions
|
@ -193,6 +193,7 @@ void CConfigManager::setDeviceDefaultVars(const std::string& dev) {
|
||||||
cfgValues["scroll_method"].strValue = STRVAL_EMPTY;
|
cfgValues["scroll_method"].strValue = STRVAL_EMPTY;
|
||||||
cfgValues["touch_transform"].intValue = 0;
|
cfgValues["touch_transform"].intValue = 0;
|
||||||
cfgValues["touch_output"].strValue = STRVAL_EMPTY;
|
cfgValues["touch_output"].strValue = STRVAL_EMPTY;
|
||||||
|
cfgValues["enabled"].intValue = 1; // only for mice / touchpads
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConfigManager::setDefaultAnimationVars() {
|
void CConfigManager::setDefaultAnimationVars() {
|
||||||
|
|
|
@ -131,6 +131,8 @@ struct SMouse {
|
||||||
|
|
||||||
bool virt = false;
|
bool virt = false;
|
||||||
|
|
||||||
|
bool connected = false; // means connected to the cursor
|
||||||
|
|
||||||
DYNLISTENER(commitConstraint);
|
DYNLISTENER(commitConstraint);
|
||||||
DYNLISTENER(destroyMouse);
|
DYNLISTENER(destroyMouse);
|
||||||
|
|
||||||
|
|
|
@ -683,6 +683,8 @@ void CInputManager::newMouse(wlr_input_device* mouse, bool virt) {
|
||||||
|
|
||||||
wlr_cursor_attach_input_device(g_pCompositor->m_sWLRCursor, mouse);
|
wlr_cursor_attach_input_device(g_pCompositor->m_sWLRCursor, mouse);
|
||||||
|
|
||||||
|
PMOUSE->connected = true;
|
||||||
|
|
||||||
g_pCompositor->m_sSeat.mouse = PMOUSE;
|
g_pCompositor->m_sSeat.mouse = PMOUSE;
|
||||||
|
|
||||||
m_tmrLastCursorMovement.reset();
|
m_tmrLastCursorMovement.reset();
|
||||||
|
@ -699,6 +701,17 @@ void CInputManager::setPointerConfigs() {
|
||||||
|
|
||||||
const auto HASCONFIG = g_pConfigManager->deviceConfigExists(devname);
|
const auto HASCONFIG = g_pConfigManager->deviceConfigExists(devname);
|
||||||
|
|
||||||
|
if (HASCONFIG) {
|
||||||
|
const auto ENABLED = g_pConfigManager->getDeviceInt(devname, "enabled");
|
||||||
|
if (ENABLED && !m.connected) {
|
||||||
|
wlr_cursor_attach_input_device(g_pCompositor->m_sWLRCursor, m.mouse);
|
||||||
|
m.connected = true;
|
||||||
|
} else if (!ENABLED && m.connected) {
|
||||||
|
wlr_cursor_detach_input_device(g_pCompositor->m_sWLRCursor, m.mouse);
|
||||||
|
m.connected = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (wlr_input_device_is_libinput(m.mouse)) {
|
if (wlr_input_device_is_libinput(m.mouse)) {
|
||||||
const auto LIBINPUTDEV = (libinput_device*)wlr_libinput_get_device_handle(m.mouse);
|
const auto LIBINPUTDEV = (libinput_device*)wlr_libinput_get_device_handle(m.mouse);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue