I built SuperCollider, i think 3.14.0, on my Raspberry 5. I can’t get the MouseX or MouseY commands to work although my Mouse works appropriately otherwise. What’s the deal?
Thanks in Advance
I built SuperCollider, i think 3.14.0, on my Raspberry 5. I can’t get the MouseX or MouseY commands to work although my Mouse works appropriately otherwise. What’s the deal?
Thanks in Advance
MouseX / MouseY don’t work under Wayland display server (they work under X11). I don’t have RPi myself but I’m guessing that the default distribution has moved to Wayland.
We don’t have a solution to this, as it is not possible to simply grab mouse/keyboard input under Wayland.
Rpi can either use x11 or wayland. I opted for wayland because it was newer, not knowing it would break something in SuperCollider. I switched back and MouseX and MouseY work as expected. I also get to have x11 fractal screensavers, which I was missing in Wayland.
Thanks
Maybe we can add a comment to the documentation of MouseX | SuperCollider 3.14.0-dev Help and MouseY
? I think there will be more and more people using Wayland in the future.
I think so. Actually, I suggested that last year.
Good point. Anybody willing to make a PR or an issue about it?
I think the mouseOverAction
method for View
could sometimes be used as an alternative, although it is slow and imprecise when the mouse pointer moves quickly.
Does it work in Wayland?
(
var bounds = Window.screenBounds;
var width = bounds.width / 2;
var height = bounds.height / 2;
var synth = { |freq, pan|
Pan2.ar(SinOsc.ar(freq.lag.poll, pan.lag.poll)) * 0.1
}.play;
w = Window("", Rect(200, 200, width, height).debug);
w.acceptsMouseOver_(true)
.onClose_{synth.free}
.front;
w.asView
.mouseOverAction_ { |view, x, y|
[x, y].postln; // only for test
synth.set(
\freq, y.linexp(0, height -1, 440 * 4, 440),
\pan, x.linlin(1, width - 1, -1, 1)
)
}
)
Generally iiuc it’s possible capture mouse using a window etc. whether using SC GUI or something else. But MouseX works by capturing mouse movement without a window underneath and that’s not possible in Wayland. Having to have a window underneath for this to work is not really a comfortable workaround…