Skip to content

SDL3: track mouse pointers and finger pointers separately#2295

Merged
Frenzie merged 1 commit into
koreader:masterfrom
Frenzie:finger-pointers
Mar 11, 2026
Merged

SDL3: track mouse pointers and finger pointers separately#2295
Frenzie merged 1 commit into
koreader:masterfrom
Frenzie:finger-pointers

Conversation

@Frenzie

@Frenzie Frenzie commented Mar 9, 2026

Copy link
Copy Markdown
Member

It looks like SDL3 SDL_GetTouchFinges can't be used as an equivalent for SDL2 SDL_GetNumTouchFingers. Track slots manually to match up with KOReader's internal state.

Prevents a crash in SDL3:

./luajit: ./ffi/SDL3.lua:243: attempt to index a nil value
stack traceback:
        ./ffi/SDL3.lua:243: in function 'getFingerSlot'
        ./ffi/SDL3.lua:399: in function 'waitForEvent'
        frontend/device/input.lua:1402: in function 'waitEvent'
        frontend/ui/uimanager.lua:1526: in function 'handleInput'
        frontend/ui/uimanager.lua:1581: in function 'run'
        reader.lua:295: in main chunk
        [C]: at 0x5618cad4b838

[Edit: forgot to say, but reproduction requires moving at least one finger around for several seconds, like when panning, hence why I didn't notice it before.]


This change is Reviewable

It looks like SDL3 SDL_GetTouchFinges can't be used as an equivalent for SDL2 SDL_GetNumTouchFingers. Track slots manually to match up with KOReader's internal state.

Prevents a crash in SDL3:

```
./luajit: ./ffi/SDL3.lua:243: attempt to index a nil value
stack traceback:
        ./ffi/SDL3.lua:243: in function 'getFingerSlot'
        ./ffi/SDL3.lua:399: in function 'waitForEvent'
        frontend/device/input.lua:1402: in function 'waitEvent'
        frontend/ui/uimanager.lua:1526: in function 'handleInput'
        frontend/ui/uimanager.lua:1581: in function 'run'
        reader.lua:295: in main chunk
        [C]: at 0x5618cad4b838
```
@Frenzie Frenzie merged commit 7f5d819 into koreader:master Mar 11, 2026
2 checks passed
@Frenzie Frenzie deleted the finger-pointers branch March 11, 2026 20:35
jqs7 pushed a commit to jqs7/koreader-base that referenced this pull request Mar 13, 2026
)

It looks like SDL3 SDL_GetTouchFinges can't be used as an equivalent for SDL2 SDL_GetNumTouchFingers. Track slots manually to match up with KOReader's internal state.

Prevents a crash in SDL3:

```
./luajit: ./ffi/SDL3.lua:243: attempt to index a nil value
stack traceback:
        ./ffi/SDL3.lua:243: in function 'getFingerSlot'
        ./ffi/SDL3.lua:399: in function 'waitForEvent'
        frontend/device/input.lua:1402: in function 'waitEvent'
        frontend/ui/uimanager.lua:1526: in function 'handleInput'
        frontend/ui/uimanager.lua:1581: in function 'run'
        reader.lua:295: in main chunk
        [C]: at 0x5618cad4b838
```
benoit-pierre added a commit to benoit-pierre/koreader that referenced this pull request Mar 15, 2026
- SDL3: track mouse pointers and finger pointers separately (koreader/koreader-base#2295)
- xss-dummy: drop the library (koreader/koreader-base#2296)
- ci/macos: fix nodejs deprecation warnings (koreader/koreader-base#2297)
- rework how some targets are handled (koreader/koreader-base#2298)
Frenzie pushed a commit to koreader/koreader that referenced this pull request Mar 15, 2026
- SDL3: track mouse pointers and finger pointers separately (koreader/koreader-base#2295)
- xss-dummy: drop the library (koreader/koreader-base#2296)
- ci/macos: fix nodejs deprecation warnings (koreader/koreader-base#2297)
- rework how some targets are handled (koreader/koreader-base#2298)
benoit-pierre pushed a commit to benoit-pierre/koreader that referenced this pull request Mar 16, 2026
…oreader-base#2295)

It looks like SDL3 SDL_GetTouchFinges can't be used as an equivalent for SDL2 SDL_GetNumTouchFingers. Track slots manually to match up with KOReader's internal state.

Prevents a crash in SDL3:

```
./luajit: ./ffi/SDL3.lua:243: attempt to index a nil value
stack traceback:
        ./ffi/SDL3.lua:243: in function 'getFingerSlot'
        ./ffi/SDL3.lua:399: in function 'waitForEvent'
        frontend/device/input.lua:1402: in function 'waitEvent'
        frontend/ui/uimanager.lua:1526: in function 'handleInput'
        frontend/ui/uimanager.lua:1581: in function 'run'
        reader.lua:295: in main chunk
        [C]: at 0x5618cad4b838
```
jqs7 pushed a commit to jqs7/koreader that referenced this pull request Mar 19, 2026
- SDL3: track mouse pointers and finger pointers separately (koreader/koreader-base#2295)
- xss-dummy: drop the library (koreader/koreader-base#2296)
- ci/macos: fix nodejs deprecation warnings (koreader/koreader-base#2297)
- rework how some targets are handled (koreader/koreader-base#2298)
0xstillb pushed a commit to 0xstillb/koreader-thai that referenced this pull request May 9, 2026
- SDL3: track mouse pointers and finger pointers separately (koreader/koreader-base#2295)
- xss-dummy: drop the library (koreader/koreader-base#2296)
- ci/macos: fix nodejs deprecation warnings (koreader/koreader-base#2297)
- rework how some targets are handled (koreader/koreader-base#2298)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant