xoop: a tool to make the X cursor loop around the screen - Programming On Unix

Users browsing this thread: 1 Guest(s)
mcol
Members
For the lols I recently have been working on this little project I call xoop (found here).

Basically all it does is allow for the cursor in X to appear at the other end of the X screen when it hits one side. Here I mean screen like X means screen, i.e. the total areal sum of all monitors. A current limitation with multi-monitors is that it only really works if the X screen is rectangular, but as long as it is (same sized monitors side-by-side, or just 1 monitor) then it works great.

At least, it works great on my system - so I am very interested to hear "it doesn't work" if someone has issues.

At first it feels a bit weird but after a while it has become second nature, which I've found very interesting.

Let me know what you guys think!
z3bra
Grey Hair Nixers
Pretty fun !

Why did you bother setting up a window, and even support EWMH on it ? Was it needed ?

I have two monitors of different size, so it doesn't work "as expected". You should consider testing the cursor position against the monitor size/position rather than your window's edge. That would be more adaptive to the various multi-monitor setups you can find in the wild.
vain
Long time nixers
Another idea:

Set up pointer barriers (as in https://uninformativ.de/git/xpointerbarrier/) and warp the mouse when it hits a barrier. See also Peter Hutterer’s blog post on barriers, which explains the events.
mcol
Members
Quote:Why did you bother setting up a window, and even support EWMH on it ? Was it needed ?

I used a window so I could use enter-notify events. What else could I have done (beside the barriers)?

TIL about pointer barriers - very cool! And makes way more sense for this purpose. I'll look into using these instead.

Quote:You should consider testing the cursor position against the monitor size/position rather than your window's edge. That would be more adaptive to the various multi-monitor setups you can find in the wild.

Do you mean in the calculation of where to teleport the pointer to? Yeah there are a few things I use for this calculation, and I'm not restricted by one window (i.e. I could easily put on per output; much easier than trying to calculate the geometry of one window around all monitors! This would obviously require calculating based on monitor positions). My concern with the irregular multimonitor setups is that it isn't always obvious whether the pointer should teleport, or where to. In a T-shaped 2 monitor setup, what happens when the mouse hits the bottom edge of the top monitor where there isn't another monitor to go to? The top? What if it was an H-shaped 3 monitor setup. Going left-to-right inside one of the H legs you might expect it to appear in the other leg - inconsistent with the T. Although there might be some way to nicely account for all configurations, things begin to get complicated.