MouseX broken! Values not as expected

What do I do when my MousesX seems to be broken? I have set it to be btwn 1 and 10, but at the right most of my screen the value goes only up to UGen(MouseX): 6.14056 for warp = 0 and to UGen(MouseX): 3.7254 for warp = 1.

(
{
	MouseX.kr(1, 10, 1).poll
}.play
)

Are you using Wayland on Linux?

~$ echo $XDG_SESSION_TYPE 
x11

No I’m using the XServer

Tried it on Ubuntu 22, X11.

Almost got correct results! When cursor is on the left side: UGen(MouseX): 1, but when cursor is on the right side: UGen(MouseX): 9.98801.

My cursor can’t get past the right side of the screen, it is at most pointing to ‘pixelWidth - 1’. So should the MouseX mapping. This might be considered as a bug.

This made me wonder: how would a dual monitor setup work with MouseX? Could it be the problem here?

If I remember correctly…

It works by placing each screen side by side on a large canvas, mousex’s coordinates refer to this canvas, not the screen, which is but a part of the canvas.

On macOS it works by using the main screen (the one SC is at?) for the requested range, and it “extends” that range to the other screens, e.g. MouseX.kr(0, 1) would return 0-1 for the main screen, and -1 to 0 for the screen to the left.

I also don’t get the final top value when the cursor is at the rightmost position, it does seem that we get one pixel less for the max value.

Wayland will be a challenge because of its security protocols; MouseX just works when it is in the application’s area. It would be much better to maintain consistency since so many examples use this feature.

[Just a hint for a new topic]

1 Like