On Mon, Sep 19, 2022 at 11:43:47AM +0000, Jesse Van Gavere wrote:
> 
> 
> -----Original Message-----
> From: Simon Ser <cont...@emersion.fr> 
> Sent: Monday, 19 September 2022 13:31
> To: Jesse Van Gavere <jesse.vangav...@scioteq.com>
> Cc: wayland-devel@lists.freedesktop.org
> Subject: Re: Absolute mouse position
> 
> On Monday, September 19th, 2022 at 13:19, Jesse Van Gavere 
> <jesse.vangav...@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://github.com/input-leap/input-leap) 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://github.com/flatpak/xdg-desktop-portal/pull/714) 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://gitlab.freedesktop.org/libinput/libei) 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
(https://github.com/flatpak/xdg-desktop-portal/pull/762).

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://github.com/r-c-f/waynergy). I'm sure others are
more aware of the details, and whether it aims to solve the input
capture side of this as well.


Jonas

> 
> Thanks.
> 
> Regards,
> Jesse

Reply via email to