Brutkey

blinry
@blinry@chaos.social

I always had a good time writing games in the LΓ–VE engine! <3 So I forked LΓ–VE, and found an easy way to return the mouse device ID when users receive a "mousemoved" callback in Lua!

But… the ID was always 0 – for both devices! :(

LΓ–VE is built on top of the graphics library SDL, which I knew had introduced some multi-seat features on Wayland recently. So maybe SDL was the culprit?

blinry
@blinry@chaos.social

So I tried it in pure #SDL3! I thought I'd never have to code something in C again, but here we are.

And indeed: The device IDs are always 0 there, as well – making it impossible to differentiate my two mice.

I haven't figured out why yet; might need some deep-dive into the SDL code to find out? Or maybe I'm not passing the events in properly from "above" (my hacked niri compositor). But given that the other approaches worked, it's maybe something in the SDL pipeline…


blinry
@blinry@chaos.social

I figured it out! Mouse IDs for events are only available in "relative mode" for some reason; which you can enable using SDL_SetWindowRelativeMouseMode(true).

Using love.mouse.setRelativeMode(true), it also kinda works in LΓ–VE! \o/ Still have to "constrain" the other mouse in the window.

But this should be good enough to have some fun with this tomorrow! :3