allow binding tablets to outputs

This commit is contained in:
vaxerski
2022-12-21 15:11:39 +00:00
parent fc37ce4a72
commit 41cdfb7420
6 changed files with 33 additions and 4 deletions

View File

@@ -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);