summaryrefslogtreecommitdiff
path: root/src/managers/input
diff options
context:
space:
mode:
authorvaxerski <vaxry@vaxry.net>2022-09-21 14:39:25 +0100
committervaxerski <vaxry@vaxry.net>2022-09-21 14:39:34 +0100
commit79c645f8cd42a389d3a8e6532b1928499d53dcb0 (patch)
treebfe7a2310c9940cc70208a0f4beeda13fd51a173 /src/managers/input
parentd44cc9f112b3162263304c4077d6cb2a97f55715 (diff)
handle touch devices internally as objects
Diffstat (limited to 'src/managers/input')
-rw-r--r--src/managers/input/InputManager.cpp19
-rw-r--r--src/managers/input/InputManager.hpp5
2 files changed, 24 insertions, 0 deletions
diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp
index 2b099ac3..ccb9bda5 100644
--- a/src/managers/input/InputManager.cpp
+++ b/src/managers/input/InputManager.cpp
@@ -987,3 +987,22 @@ void CInputManager::disableAllKeyboards(bool virt) {
k.active = false;
}
}
+
+void CInputManager::newTouchDevice(wlr_input_device* pDevice) {
+ const auto PNEWDEV = &m_lTouchDevices.emplace_back();
+ PNEWDEV->pWlrDevice = pDevice;
+
+ wlr_cursor_attach_input_device(g_pCompositor->m_sWLRCursor, pDevice);
+
+ Debug::log(LOG, "New touch device added at %x", PNEWDEV);
+
+ PNEWDEV->hyprListener_destroy.initCallback(&pDevice->events.destroy, [&](void* owner, void* data) {
+ destroyTouchDevice((STouchDevice*)data);
+ }, PNEWDEV, "TouchDevice");
+}
+
+void CInputManager::destroyTouchDevice(STouchDevice* pDevice) {
+ Debug::log(LOG, "Touch device at %x removed", pDevice);
+
+ m_lTouchDevices.remove(*pDevice);
+}
diff --git a/src/managers/input/InputManager.hpp b/src/managers/input/InputManager.hpp
index 9069e131..f212e610 100644
--- a/src/managers/input/InputManager.hpp
+++ b/src/managers/input/InputManager.hpp
@@ -36,6 +36,8 @@ public:
void newKeyboard(wlr_input_device*);
void newVirtualKeyboard(wlr_input_device*);
void newMouse(wlr_input_device*, bool virt = false);
+ void newTouchDevice(wlr_input_device*);
+ void destroyTouchDevice(STouchDevice*);
void destroyKeyboard(SKeyboard*);
void destroyMouse(wlr_input_device*);
@@ -81,6 +83,9 @@ public:
// idle inhibitors
std::list<SIdleInhibitor> m_lIdleInhibitors;
+ // Touch devices
+ std::list<STouchDevice> m_lTouchDevices;
+
void newTabletTool(wlr_input_device*);
void newTabletPad(wlr_input_device*);
void focusTablet(STablet*, wlr_tablet_tool*, bool motion = false);