diff options
| author | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-12-21 15:11:39 +0000 |
|---|---|---|
| committer | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-12-21 15:11:39 +0000 |
| commit | 41cdfb7420be3a8473c46f28d74cdada4c0f2258 (patch) | |
| tree | 62ee2cb287a339d23f78d36c37d63cdbaf727e52 /src/managers | |
| parent | fc37ce4a724101def1befa01b353162830f4393f (diff) | |
allow binding tablets to outputs
Diffstat (limited to 'src/managers')
| -rw-r--r-- | src/managers/input/InputManager.cpp | 20 | ||||
| -rw-r--r-- | src/managers/input/InputManager.hpp | 1 | ||||
| -rw-r--r-- | src/managers/input/Tablets.cpp | 3 |
3 files changed, 22 insertions, 2 deletions
diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index db883fea..43fc66cf 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -1147,10 +1147,10 @@ void CInputManager::setTouchDeviceConfigs() { const auto LIBINPUTDEV = (libinput_device*)wlr_libinput_get_device_handle(m.pWlrDevice); const int ROTATION = - std::clamp(HASCONFIG ? g_pConfigManager->getDeviceInt(PTOUCHDEV->name, "touch_transform") : g_pConfigManager->getInt("input:touchdevice:transform"), 0, 7); + std::clamp(HASCONFIG ? g_pConfigManager->getDeviceInt(PTOUCHDEV->name, "transform") : g_pConfigManager->getInt("input:touchdevice:transform"), 0, 7); libinput_device_config_calibration_set_matrix(LIBINPUTDEV, MATRICES[ROTATION]); - const auto OUTPUT = HASCONFIG ? g_pConfigManager->getDeviceString(PTOUCHDEV->name, "touch_output") : g_pConfigManager->getString("input:touchdevice:output"); + const auto OUTPUT = HASCONFIG ? g_pConfigManager->getDeviceString(PTOUCHDEV->name, "output") : g_pConfigManager->getString("input:touchdevice:output"); if (!OUTPUT.empty() && OUTPUT != STRVAL_EMPTY) PTOUCHDEV->boundOutput = OUTPUT; else @@ -1159,6 +1159,22 @@ void CInputManager::setTouchDeviceConfigs() { } } +void CInputManager::setTabletConfigs() { + for (auto& t : m_lTablets) { + const auto HASCONFIG = g_pConfigManager->deviceConfigExists(t.name); + + if (HASCONFIG) { + const auto OUTPUT = g_pConfigManager->getDeviceString(t.name, "output"); + const auto PMONITOR = g_pCompositor->getMonitorFromString(OUTPUT); + + if (PMONITOR) { + wlr_cursor_map_input_to_output(g_pCompositor->m_sWLRCursor, t.wlrDevice, PMONITOR->output); + wlr_cursor_map_input_to_region(g_pCompositor->m_sWLRCursor, t.wlrDevice, nullptr); + } + } + } +} + void CInputManager::destroyTouchDevice(STouchDevice* pDevice) { Debug::log(LOG, "Touch device at %x removed", pDevice); diff --git a/src/managers/input/InputManager.hpp b/src/managers/input/InputManager.hpp index 460b5ac2..91783f38 100644 --- a/src/managers/input/InputManager.hpp +++ b/src/managers/input/InputManager.hpp @@ -60,6 +60,7 @@ class CInputManager { void setKeyboardLayout(); void setPointerConfigs(); void setTouchDeviceConfigs(); + void setTabletConfigs(); void updateDragIcon(); void updateCapabilities(); diff --git a/src/managers/input/Tablets.cpp b/src/managers/input/Tablets.cpp index 00cedb09..10a850c5 100644 --- a/src/managers/input/Tablets.cpp +++ b/src/managers/input/Tablets.cpp @@ -137,6 +137,8 @@ void CInputManager::newTabletTool(wlr_input_device* pDevice) { } }, PNEWTABLET, "Tablet"); + + setTabletConfigs(); } STabletTool* CInputManager::ensureTabletToolPresent(wlr_tablet_tool* pTool) { @@ -176,6 +178,7 @@ void CInputManager::newTabletPad(wlr_input_device* pDevice) { } PNEWPAD->wlrTabletPadV2 = wlr_tablet_pad_create(g_pCompositor->m_sWLRTabletManager, g_pCompositor->m_sSeat.seat, pDevice); + PNEWPAD->pWlrDevice = pDevice; PNEWPAD->hyprListener_Button.initCallback( &wlr_tablet_pad_from_input_device(pDevice)->events.button, |
