Absolute mouse position

JiDe Zhang zccrs at live.com
Tue Sep 20 05:50:55 UTC 2022

This sounds like Synergy I've used, which monitor to the mouse position to know if the mouse has moved to edges of the screen, to control the mouse apply to another device's screen.
From: wayland-devel <wayland-devel-bounces at lists.freedesktop.org> on behalf of Jonas Ådahl <jadahl at gmail.com>
Sent: Monday, September 19, 2022 19:59
To: Jesse Van Gavere <jesse.vangavere at scioteq.com>
Cc: wayland-devel at lists.freedesktop.org <wayland-devel at lists.freedesktop.org>
Subject: Re: Absolute mouse position

On Mon, Sep 19, 2022 at 11:43:47AM +0000, Jesse Van Gavere wrote:
> -----Original Message-----
> From: Simon Ser <contact at emersion.fr>
> Sent: Monday, 19 September 2022 13:31
> To: Jesse Van Gavere <jesse.vangavere at scioteq.com>
> Cc: wayland-devel at lists.freedesktop.org
> Subject: Re: Absolute mouse position
> On Monday, September 19th, 2022 at 13:19, Jesse Van Gavere <jesse.vangavere at scioteq.com> wrote:
> > Is it possible to somehow get the absolute mouse position relative to
> > a screen from Wayland as was possible in X11? It is something an
> > application of ours relies on to work properly and we’ve been trying
> > to see if we can make this work in both X11 and Wayland.
> No, this isn't possible, by design.
> Can you explain your use-case? Then maybe we can suggest a way to make it work on Wayland.
> Simon
> Hello Simon,
> Thank you for responding, and certainly.
> We have in essence a KVM device that can control some local connected servers/computers, it has a sort of composition of the connected computers so you can control each server simultaneously and we achieve this by tracking the mouse position to know when to go to another server (basically a mouse event that goes over a servers border within the composition to another server), we have an absolute/relative mouse mode on this, in the absolute mouse mode knowing the position at the server side is not important because our KVM always sends Absolute/TS events so it's always aware and in control of its position, however in the relative mode we do not, there might be mouse acceleration, mouse warping (a primary use case for why we would use a relative mode on our KVM) and all kinds of things going on at the server side we have no control over.
> To compensate for this we made a small tool that currently interrogates the X server for its mouse position, it communicates this back to our KVM and that way our KVM can keep an up to date internal position of the mouse.
> But we keep running into issues because everything is moving to Wayland and our application is only able to receive mouse positions if the mouse is on an application using the X server and this creates undesirable behavior, so we're looking to fix this by having a way to receive the mouse no matter if the mouse is on an application using X or Wayland.
> Do you have an idea on how this would be possible? We are allowed to install/use almost anything to get this working so any ideas, no matter how exotic, is welcome.

What it sounds like is something rather similar to Input Leap
(https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Finput-leap%2Finput-leap&data=05%7C01%7C%7C806b8f1a1168461df16e08da9a36785c%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637991855996366459%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=sS5BrgVSZA8NJqAZaMPG%2FjpcLz8zV2Izk1uEsb%2BBTz0%3D&reserved=0) which roughly aims to provide
a way to use the same mouse/keyboard device on multiple computers, also
by finding out when a pointer touches the edge of a screen that
logically bridges to some other machine.

There are a couple approaches to get this kind of functionality to a
Wayland session:

One is the "input capture" XDG Desktop portal
(https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fflatpak%2Fxdg-desktop-portal%2Fpull%2F714&data=05%7C01%7C%7C806b8f1a1168461df16e08da9a36785c%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637991855996366459%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=1bKFoMnZhpZlr0nSyNt9VEfilU3pVUQwCQM6UIYY5ZA%3D&reserved=0) that aims to
provide a sandbox friendly way to let applications capture input without
allowing arbitrary applications to eaves drop on input events all the
time. It uses libei (https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.freedesktop.org%2Flibinput%2Flibei&data=05%7C01%7C%7C806b8f1a1168461df16e08da9a36785c%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637991855996366459%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=xtouSl4WIVxtoocPgqu6WSTECWCoK%2FIyd2Vb%2FZ5rXZM%3D&reserved=0) as a
method of input event transfer. As for the receiving side, the aim is to
tie the knot together with using libei for transmitting events in the
other direction via the remote desktop XDG desktop portal

The other approach focuses is as far as I know for the receiving end of
the problem, and uses various wlroots Wayland protocols for injecting
input events (https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fr-c-f%2Fwaynergy&data=05%7C01%7C%7C806b8f1a1168461df16e08da9a36785c%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637991855996366459%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=rOPmXrayB869fMvwP5aZhgmkADFBR0vjve%2FuqsssYU8%3D&reserved=0). I'm sure others are
more aware of the details, and whether it aims to solve the input
capture side of this as well.


> Thanks.
> Regards,
> Jesse
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20220920/cf614b08/attachment-0001.htm>

More information about the wayland-devel mailing list