add disabling pointer devices

This commit is contained in:
Vaxry 2022-10-27 12:58:10 +01:00
parent d5a0610ea2
commit 28c81fc71e
3 changed files with 16 additions and 0 deletions

View file

@ -193,6 +193,7 @@ void CConfigManager::setDeviceDefaultVars(const std::string& dev) {
cfgValues["scroll_method"].strValue = STRVAL_EMPTY;
cfgValues["touch_transform"].intValue = 0;
cfgValues["touch_output"].strValue = STRVAL_EMPTY;
cfgValues["enabled"].intValue = 1; // only for mice / touchpads
}
void CConfigManager::setDefaultAnimationVars() {

View file

@ -131,6 +131,8 @@ struct SMouse {
bool virt = false;
bool connected = false; // means connected to the cursor
DYNLISTENER(commitConstraint);
DYNLISTENER(destroyMouse);

View file

@ -683,6 +683,8 @@ void CInputManager::newMouse(wlr_input_device* mouse, bool virt) {
wlr_cursor_attach_input_device(g_pCompositor->m_sWLRCursor, mouse);
PMOUSE->connected = true;
g_pCompositor->m_sSeat.mouse = PMOUSE;
m_tmrLastCursorMovement.reset();
@ -699,6 +701,17 @@ void CInputManager::setPointerConfigs() {
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)) {
const auto LIBINPUTDEV = (libinput_device*)wlr_libinput_get_device_handle(m.mouse);