mirror of
https://github.com/hyprwm/Hyprland
synced 2024-12-23 04:49:48 +01:00
parent
11d1c50420
commit
dd0714c22a
4 changed files with 18 additions and 4 deletions
|
@ -250,6 +250,7 @@ void CConfigManager::setDefaultVars() {
|
|||
configValues["input:tablet:output"].strValue = STRVAL_EMPTY;
|
||||
configValues["input:tablet:region_position"].vecValue = Vector2D();
|
||||
configValues["input:tablet:region_size"].vecValue = Vector2D();
|
||||
configValues["input:tablet:relative_input"].intValue = 0;
|
||||
|
||||
configValues["binds:pass_mouse_when_bound"].intValue = 0;
|
||||
configValues["binds:scroll_event_delay"].intValue = 300;
|
||||
|
@ -310,6 +311,7 @@ void CConfigManager::setDeviceDefaultVars(const std::string& dev) {
|
|||
cfgValues["enabled"].intValue = 1; // only for mice / touchpads
|
||||
cfgValues["region_position"].vecValue = Vector2D(); // only for tablets
|
||||
cfgValues["region_size"].vecValue = Vector2D(); // only for tablets
|
||||
cfgValues["relative_input"].intValue = 0; // only for tablets
|
||||
}
|
||||
|
||||
void CConfigManager::setDefaultAnimationVars() {
|
||||
|
|
|
@ -252,6 +252,8 @@ struct STablet {
|
|||
wlr_tablet_v2_tablet* wlrTabletV2 = nullptr;
|
||||
wlr_input_device* wlrDevice = nullptr;
|
||||
|
||||
bool relativeInput = false;
|
||||
|
||||
std::string name = "";
|
||||
|
||||
//
|
||||
|
|
|
@ -1494,7 +1494,10 @@ void CInputManager::setTabletConfigs() {
|
|||
if (wlr_input_device_is_libinput(t.wlrDevice)) {
|
||||
const auto LIBINPUTDEV = (libinput_device*)wlr_libinput_get_device_handle(t.wlrDevice);
|
||||
|
||||
const int ROTATION = std::clamp(g_pConfigManager->getDeviceInt(t.name, "transform", "input:tablet:transform"), 0, 7);
|
||||
const auto RELINPUT = g_pConfigManager->getDeviceInt(t.name, "relative_input", "input:tablet:relative_input");
|
||||
t.relativeInput = RELINPUT;
|
||||
|
||||
const int ROTATION = std::clamp(g_pConfigManager->getDeviceInt(t.name, "transform", "input:tablet:transform"), 0, 7);
|
||||
Debug::log(LOG, "Setting calibration matrix for device {}", t.name);
|
||||
libinput_device_config_calibration_set_matrix(LIBINPUTDEV, MATRICES[ROTATION]);
|
||||
|
||||
|
|
|
@ -43,9 +43,16 @@ void CInputManager::newTabletTool(wlr_input_device* pDevice) {
|
|||
g_pInputManager->m_tmrLastCursorMovement.reset();
|
||||
break;
|
||||
default:
|
||||
double x = (EVENT->updated_axes & WLR_TABLET_TOOL_AXIS_X) ? EVENT->x : NAN;
|
||||
double y = (EVENT->updated_axes & WLR_TABLET_TOOL_AXIS_Y) ? EVENT->y : NAN;
|
||||
wlr_cursor_warp_absolute(g_pCompositor->m_sWLRCursor, PTAB->wlrDevice, x, y);
|
||||
double x = (EVENT->updated_axes & WLR_TABLET_TOOL_AXIS_X) ? EVENT->x : NAN;
|
||||
double dx = (EVENT->updated_axes & WLR_TABLET_TOOL_AXIS_X) ? EVENT->dx : NAN;
|
||||
double y = (EVENT->updated_axes & WLR_TABLET_TOOL_AXIS_Y) ? EVENT->y : NAN;
|
||||
double dy = (EVENT->updated_axes & WLR_TABLET_TOOL_AXIS_Y) ? EVENT->dy : NAN;
|
||||
|
||||
if (PTAB->relativeInput)
|
||||
wlr_cursor_move(g_pCompositor->m_sWLRCursor, PTAB->wlrDevice, dx, dy);
|
||||
else
|
||||
wlr_cursor_warp_absolute(g_pCompositor->m_sWLRCursor, PTAB->wlrDevice, x, y);
|
||||
|
||||
g_pInputManager->refocus();
|
||||
g_pInputManager->m_tmrLastCursorMovement.reset();
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue