If there's only one contact, we won't get an ABS_MT_SLOT, so we need to
make sure we fall back to the main finger slot once we've caught a tool
switch.
Also, move the dedicated pen slot further away, so it has zero chance of
being detected as a potential buddy contact to a finger contact.
Fix#11514
MTSlots=nil,-- table, object may be replaced at runtime
MTSlots=nil,-- table, object may be replaced at runtime
active_slots=nil,-- ditto
active_slots=nil,-- ditto
@ -219,6 +220,10 @@ function Input:init()
},
},
}
}
-- Always send pen data to a slot far enough away from our main finger slot that it can never be matched with a finger buddy in GestureDetector (i.e., +/- 1),
-- with an extra bit of leeway, since we don't even actually support three finger gestures ;).
self.pen_slot=self.main_finger_slot+4
self.gesture_detector=GestureDetector:new{
self.gesture_detector=GestureDetector:new{
screen=self.device.screen,
screen=self.device.screen,
input=self,
input=self,
@ -563,24 +568,30 @@ function Input:handleKeyBoardEv(ev)
end
end
elseifself.wacom_protocolthen
elseifself.wacom_protocolthen
ifev.code==C.BTN_TOOL_PENthen
ifev.code==C.BTN_TOOL_PENthen
-- Always send pen data to slot 2
-- Switch to the dedicated pen slot, and make sure it's active, as this can come in a dedicated input frame
self:setupSlotData(2)
self:setupSlotData(self.pen_slot)
ifev.value==1then
ifev.value==1then
self:setCurrentMtSlot("tool",TOOL_TYPE_PEN)
self:setCurrentMtSlot("tool",TOOL_TYPE_PEN)
else
else
self:setCurrentMtSlot("tool",TOOL_TYPE_FINGER)
self:setCurrentMtSlot("tool",TOOL_TYPE_FINGER)
-- Switch back to our main finger slot
self.cur_slot=self.main_finger_slot
end
end
return
return
elseifev.code==C.BTN_TOUCHthen
elseifev.code==C.BTN_TOUCHthen
-- BTN_TOUCH is bracketed by BTN_TOOL_PEN, so we can limit this to pens, to avoid stomping on panel slots.
-- BTN_TOUCH is bracketed by BTN_TOOL_PEN, so we can limit this to pens, to avoid stomping on panel slots.