aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorvaxerski <[email protected]>2022-12-05 14:28:27 +0000
committervaxerski <[email protected]>2022-12-05 14:28:27 +0000
commitac0e675f3b0bcd9f5c01f43b050d1da6d1215be0 (patch)
treebc5bd1281736cdb6d293ab778379b86dff8d66e2
parentf71f04db9e13950af4a97ae6c8cd31311f8cb6bd (diff)
downloadHyprland-ac0e675f3b0bcd9f5c01f43b050d1da6d1215be0.tar.gz
Hyprland-ac0e675f3b0bcd9f5c01f43b050d1da6d1215be0.zip
better capability handling
-rw-r--r--src/events/Devices.cpp2
-rw-r--r--src/managers/input/InputManager.cpp32
-rw-r--r--src/managers/input/InputManager.hpp2
3 files changed, 16 insertions, 20 deletions
diff --git a/src/events/Devices.cpp b/src/events/Devices.cpp
index eecba44f..6ab23a67 100644
--- a/src/events/Devices.cpp
+++ b/src/events/Devices.cpp
@@ -91,7 +91,7 @@ void Events::listener_newInput(wl_listener* listener, void* data) {
break;
}
- g_pInputManager->updateCapabilities(DEVICE);
+ g_pInputManager->updateCapabilities();
}
void Events::listener_newConstraint(wl_listener* listener, void* data) {
diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp
index 228d64ad..b6fa3996 100644
--- a/src/managers/input/InputManager.cpp
+++ b/src/managers/input/InputManager.cpp
@@ -1014,24 +1014,20 @@ void Events::listener_commitConstraint(void* owner, void* data) {
//g_pInputManager->recheckConstraint((SMouse*)owner);
}
-void CInputManager::updateCapabilities(wlr_input_device* pDev) {
- // TODO: this is dumb
-
- switch (pDev->type) {
- case WLR_INPUT_DEVICE_KEYBOARD:
- m_uiCapabilities |= WL_SEAT_CAPABILITY_KEYBOARD;
- break;
- case WLR_INPUT_DEVICE_POINTER:
- m_uiCapabilities |= WL_SEAT_CAPABILITY_POINTER;
- break;
- case WLR_INPUT_DEVICE_TOUCH:
- m_uiCapabilities |= WL_SEAT_CAPABILITY_TOUCH;
- break;
- default:
- break;
- }
-
- wlr_seat_set_capabilities(g_pCompositor->m_sSeat.seat, m_uiCapabilities);
+void CInputManager::updateCapabilities() {
+ uint32_t caps = 0;
+
+ if (!m_lKeyboards.empty())
+ caps |= WL_SEAT_CAPABILITY_KEYBOARD;
+ if (!m_lMice.empty())
+ caps |= WL_SEAT_CAPABILITY_POINTER;
+ if (!m_lTouchDevices.empty())
+ caps |= WL_SEAT_CAPABILITY_TOUCH;
+ if (!m_lTabletTools.empty())
+ caps |= WL_SEAT_CAPABILITY_POINTER;
+
+ wlr_seat_set_capabilities(g_pCompositor->m_sSeat.seat, caps);
+ m_uiCapabilities = caps;
}
uint32_t CInputManager::accumulateModsFromAllKBs() {
diff --git a/src/managers/input/InputManager.hpp b/src/managers/input/InputManager.hpp
index f606fa77..01f2aec6 100644
--- a/src/managers/input/InputManager.hpp
+++ b/src/managers/input/InputManager.hpp
@@ -60,7 +60,7 @@ public:
void setTouchDeviceConfigs();
void updateDragIcon();
- void updateCapabilities(wlr_input_device*);
+ void updateCapabilities();
void setClickMode(eClickBehaviorMode);
eClickBehaviorMode getClickMode();