Absolute mouse position

2022-09-19 Thread Jesse Van Gavere
Hello,

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.

Regards,
Jesse


Re: Absolute mouse position

2022-09-19 Thread Simon Ser
On Monday, September 19th, 2022 at 13:19, Jesse Van Gavere 
 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


RE: Absolute mouse position

2022-09-19 Thread Jesse Van Gavere


-Original Message-
From: Simon Ser  
Sent: Monday, 19 September 2022 13:31
To: Jesse Van Gavere 
Cc: wayland-devel@lists.freedesktop.org
Subject: Re: Absolute mouse position

On Monday, September 19th, 2022 at 13:19, Jesse Van Gavere 
 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.

Thanks.

Regards,
Jesse


Re: Absolute mouse position

2022-09-19 Thread Jonas Ådahl
On Mon, Sep 19, 2022 at 11:43:47AM +, Jesse Van Gavere wrote:
> 
> 
> -Original Message-
> From: Simon Ser  
> Sent: Monday, 19 September 2022 13:31
> To: Jesse Van Gavere 
> Cc: wayland-devel@lists.freedesktop.org
> Subject: Re: Absolute mouse position
> 
> On Monday, September 19th, 2022 at 13:19, Jesse Van Gavere 
>  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


Re: Wrong (non modified) key under Wayland when multiple events combined in single SYN_REPORT

2022-09-19 Thread Hans de Goede
Hi,

On 9/13/22 12:28, Carlos Garnacho wrote:
> Hi!,
> 
> On Tue, Sep 13, 2022 at 11:36 AM Hans de Goede  wrote:
>>
>> Hi,
>>
>> On 9/12/22 23:20, Peter wrote:
>>> Hi all,
>>>
>>>
>>> Op maandag 12 september 2022 om 15:14:09 +0200 schreef Juerd Waalboer 
>>> :
 Hans de Goede skribis 2022-09-12  7:16 (+0200):
> During a big hacker event in the Netherlands this summer (MCH) the 
> logistics
> team used custom barcodes to keep track of inventory. These custom 
> barcodes
> contain a # symbol.

 In other barcodes, @ symbols. Quite possibly anything with shifted 
 characters; I vaguely recall a mixed case (ascii) string where the 
 uppercasing was on the wrong letter.
>>>
>>> Yes, that definitely also happened.
>>>

> Juerd, we did not discuss how you were running Wayland (which compositor),
> I guess you were using GNOME3 when you hit this ?

 I'm not sure, as I only encountered the bug as an end user and suggested 
 changing to X to work around it (which worked). I've added Peter Hazenberg 
 to the CC list; he installed and maintained the computers, and is familiar 
 with the bug. Peter, can you confirm that we were using GNOME 3 in both 
 Wayland and X?
>>>
>>> Yes, we used gnome 3. It was mostly a boring default Fedora 36 Workstation 
>>> installation.
>>>
>>> Good to hear Hans already reproduced the issue at the mentioned 
>>> hackerspace, I assume with the exact same hardware
>>
>> Yes I reproduced it on my own laptop inside a terminal under GNOME3. I 
>> suspect that it reproduces on any (VTE based?) terminal running under GNOME3 
>> Wayland when using the right barcode-scanner model and scanning specific 
>> barcodes.
> 
> Thanks Hans/Juerd/Peter. I can reproduce this issue on GNOME Shell
> with the evemu logs provided. From my multiple tries, the libinput
> debug output seems pretty much consistent and in line with the evemu
> output (i.e. press shift, release 't', press '3', release shift), so
> there does not seem to be any issue there. At the wayland level, the
> wl_keyboard.modifier events received by the client are somewhat amiss
> though.
> 
> Amusingly, running on plain Mutter (e.g. `mutter --wayland
> --display-server` on a TTY) does also seem to fix the issue. The most
> immediate difference I can think of is the involvement of input
> methods.
> 
> Since this does not seem to be a generic Wayland issue, feel free to
> file a bug at https://gitlab.gnome.org/GNOME/gnome-shell/-/issues and
> move discussion there, this might still end up in Mutter, or in IBus,
> unclear yet.

Thanks, issue filed:

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5890

Regards,

Hans



Re: Absolute mouse position

2022-09-19 Thread JiDe Zhang
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  on behalf of 
Jonas Ådahl 
Sent: Monday, September 19, 2022 19:59
To: Jesse Van Gavere 
Cc: wayland-devel@lists.freedesktop.org 
Subject: Re: Absolute mouse position

On Mon, Sep 19, 2022 at 11:43:47AM +, Jesse Van Gavere wrote:
>
>
> -Original Message-
> From: Simon Ser 
> Sent: Monday, 19 September 2022 13:31
> To: Jesse Van Gavere 
> Cc: wayland-devel@lists.freedesktop.org
> Subject: Re: Absolute mouse position
>
> On Monday, September 19th, 2022 at 13:19, Jesse Van Gavere 
>  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%7C84df9e7fe9f640afb435%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%7C84df9e7fe9f640afb435%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%7C84df9e7fe9f640afb435%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
(https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fflatpak%2Fxdg-desktop-portal%2Fpul