Skip to content

Commit df96630

Browse files
authored
SDL: avoid silly ABS_MT_TRACKING_ID for mouse button presses (#1600)
Re. <#1599 (comment)>.
1 parent ca16fb8 commit df96630

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ffi/SDL2_0.lua

+2-1
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,9 @@ local function getFingerSlot(event)
235235
end
236236

237237
local function genTouchDownEvent(event, slot, x, y)
238+
local is_finger = event.type == SDL.SDL_FINGERDOWN
238239
genEmuEvent(C.EV_ABS, C.ABS_MT_SLOT, slot)
239-
genEmuEvent(C.EV_ABS, C.ABS_MT_TRACKING_ID, tonumber(event.tfinger.fingerId))
240+
genEmuEvent(C.EV_ABS, C.ABS_MT_TRACKING_ID, is_finger and tonumber(event.tfinger.fingerId) or slot)
240241
genEmuEvent(C.EV_ABS, C.ABS_MT_POSITION_X, x)
241242
genEmuEvent(C.EV_ABS, C.ABS_MT_POSITION_Y, y)
242243
genEmuEvent(C.EV_SYN, C.SYN_REPORT, 0)

0 commit comments

Comments
 (0)