<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:SimSun;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:DengXian;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:DengXian;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:SimSun;
panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
text-align:justify;
text-justify:inter-ideograph;
font-size:10.5pt;
font-family:DengXian;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
.MsoChpDefault
{mso-style-type:export-only;}
/* Page Definitions */
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
{page:WordSection1;}
--></style></head><body lang=ZH-CN link=blue vlink="#954F72" style='word-wrap:break-word'><div class=WordSection1><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Ok, I'll go discuss it with our designers and colleagues, thank you again for your answers!</span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:12.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal>从<span lang=EN-US> Windows </span>版<span lang=EN-US><a href="https://go.microsoft.com/fwlink/?LinkId=550986"><span lang=EN-US><span lang=EN-US>邮件</span></span></a></span>发送</p><p class=MsoNormal><span lang=EN-US style='font-size:12.0pt;font-family:SimSun'><o:p> </o:p></span></p><div style='mso-element:para-border-div;border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal style='border:none;padding:0cm'><b>发件人<span lang=EN-US>: </span></b><span lang=EN-US><a href="mailto:peter.hutterer@who-t.net">Peter Hutterer</a><br></span><b>发送时间<span lang=EN-US>: </span></b><span lang=EN-US>2023</span>年<span lang=EN-US>11</span>月<span lang=EN-US>24</span>日<span lang=EN-US> 17:15<br></span><b>收件人<span lang=EN-US>: </span></b><span lang=EN-US><a href="mailto:weinan97@163.com">weinan wang</a><br></span><b>抄送<span lang=EN-US>: </span></b><span lang=EN-US><a href="mailto:wayland-devel@lists.freedesktop.org">wayland-devel@lists.freedesktop.org</a><br></span><b>主题<span lang=EN-US>: </span></b><span lang=EN-US>Re: Re: </span>回复<span lang=EN-US>: Re: get input device inwayland</span></p></div><p class=MsoNormal><span lang=EN-US style='font-size:12.0pt;font-family:SimSun'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>On Fri, Nov 24, 2023 at 11:00:34AM +0800, weinan wang wrote:</span></p><p class=MsoNormal><span lang=EN-US>> Thank you, I think I understand why the wayland-protocol is designed</span></p><p class=MsoNormal><span lang=EN-US>> the way it is.</span></p><p class=MsoNormal><span lang=EN-US>> Finally, I would like to ask if there is a input mapping protocol upstream is</span></p><p class=MsoNormal><span lang=EN-US>> considering to add like "xinput map-to-output".</span></p><p class=MsoNormal><span lang=EN-US>> Tablet, touch screen, and other absolute device mapping functions</span></p><p class=MsoNormal><span lang=EN-US>> are currently implemented separately in different compositors,</span></p><p class=MsoNormal><span lang=EN-US>> such as kwin has added related functions in dbus</span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>there is no protocol planned or at least I'm not aware of it, it will be</span></p><p class=MsoNormal><span lang=EN-US>a compositor-specific configuration only.</span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>It all requires a bit of a mindshift - think of Wayland like HTTP. You</span></p><p class=MsoNormal><span lang=EN-US>don't configure your browser via HTTP requests from the websites, that</span></p><p class=MsoNormal><span lang=EN-US>is done through other channels, for a whole bunch of reasons.</span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Cheers,</span></p><p class=MsoNormal><span lang=EN-US> Peter</span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>> At 2023-11-24 09:11:34, "Peter Hutterer" <peter.hutterer@who-t.net> wrote:</span></p><p class=MsoNormal><span lang=EN-US>> >On Wed, Nov 22, 2023 at 06:52:47PM +0800, WeiWei wrote:</span></p><p class=MsoNormal><span lang=EN-US>> >> Thank you very much, I will discuss this idea with the designer.</span></p><p class=MsoNormal><span lang=EN-US>> >> </span></p><p class=MsoNormal><span lang=EN-US>> >> I'd like to ask, why the underlying device is not exposed in</span></p><p class=MsoNormal><span lang=EN-US>> >> current wayland-protocols, what are the benefits of doing this.</span></p><p class=MsoNormal><span lang=EN-US>> ></span></p><p class=MsoNormal><span lang=EN-US>> >The overwhelmingly vast majority of applications don't need to know</span></p><p class=MsoNormal><span lang=EN-US>> >about the specifics of the device, so exposing it is both not necessary</span></p><p class=MsoNormal><span lang=EN-US>> >and may also lead to interference if the applications try to do things</span></p><p class=MsoNormal><span lang=EN-US>> >based on assumptions that a compositor may not meet.</span></p><p class=MsoNormal><span lang=EN-US>> ></span></p><p class=MsoNormal><span lang=EN-US>> >X did expose the devices and in addition to making it a nightmare to</span></p><p class=MsoNormal><span lang=EN-US>> >maintain it is also effectively unused. Plus there's a whole can of</span></p><p class=MsoNormal><span lang=EN-US>> >niche bugs that can get exposed that way - e.g. if you're listening for</span></p><p class=MsoNormal><span lang=EN-US>> >button events on a specific device you can get out of sync with what the</span></p><p class=MsoNormal><span lang=EN-US>> >compositor treats as logical button state.</span></p><p class=MsoNormal><span lang=EN-US>> ></span></p><p class=MsoNormal><span lang=EN-US>> >> With keyboard and pointer, we don't usually care about </span></p><p class=MsoNormal><span lang=EN-US>> >> physical device, but for touch devices, each touch device</span></p><p class=MsoNormal><span lang=EN-US>> >> will work independently and need input mapping and calibration,</span></p><p class=MsoNormal><span lang=EN-US>> >> is it possible to consider adding some device information</span></p><p class=MsoNormal><span lang=EN-US>> >> in wl_touch in the future.</span></p><p class=MsoNormal><span lang=EN-US>> ></span></p><p class=MsoNormal><span lang=EN-US>> >The general consensus is that touch mapping and calibration should be</span></p><p class=MsoNormal><span lang=EN-US>> >part of the compositor and/or a side-channel to the compositor if the</span></p><p class=MsoNormal><span lang=EN-US>> >calibration needs to be done in an external application.</span></p><p class=MsoNormal><span lang=EN-US>> ></span></p><p class=MsoNormal><span lang=EN-US>> >Cheers,</span></p><p class=MsoNormal><span lang=EN-US>> > Peter</span></p><p class=MsoNormal><span lang=EN-US>> ></span></p><p class=MsoNormal><span lang=EN-US>> >> </span></p><p class=MsoNormal><span lang=EN-US>> >> </span></p><p class=MsoNormal><span lang=EN-US>> >> </span>从<span lang=EN-US> Windows </span>版邮件发送</p><p class=MsoNormal><span lang=EN-US>> >> </span></p><p class=MsoNormal><span lang=EN-US>> >> </span>发件人<span lang=EN-US>: Peter Hutterer</span></p><p class=MsoNormal><span lang=EN-US>> >> </span>发送时间<span lang=EN-US>: 2023</span>年<span lang=EN-US>11</span>月<span lang=EN-US>22</span>日<span lang=EN-US> 14:45</span></p><p class=MsoNormal><span lang=EN-US>> >> </span>收件人<span lang=EN-US>: weinan wang</span></p><p class=MsoNormal><span lang=EN-US>> >> </span>抄送<span lang=EN-US>: wayland-devel@lists.freedesktop.org</span></p><p class=MsoNormal><span lang=EN-US>> >> </span>主题<span lang=EN-US>: Re: Re: get input device in wayland</span></p><p class=MsoNormal><span lang=EN-US>> >> </span></p><p class=MsoNormal><span lang=EN-US>> >> On Wed, Nov 22, 2023 at 09:22:56AM +0800, weinan wang wrote:</span></p><p class=MsoNormal><span lang=EN-US>> >> > Thanks for reply,</span></p><p class=MsoNormal><span lang=EN-US>> >> > We want to achieve an application for touch input map,</span></p><p class=MsoNormal><span lang=EN-US>> >> > it will map touch input to a output device when we have multi-screen.</span></p><p class=MsoNormal><span lang=EN-US>> >> > </span></p><p class=MsoNormal><span lang=EN-US>> >> > The input map need provide a input device and a output device,</span></p><p class=MsoNormal><span lang=EN-US>> >> > in our design, we will traversal all screen to ask user "is this screen you</span></p><p class=MsoNormal><span lang=EN-US>> >> > want to map", and user choice a touch device by tap on a touch device,</span></p><p class=MsoNormal><span lang=EN-US>> >> > just like "touch config" feature in Windows11.</span></p><p class=MsoNormal><span lang=EN-US>> >> > </span></p><p class=MsoNormal><span lang=EN-US>> >> > All in all, we want to achieve an application for touch input map, if have a batter</span></p><p class=MsoNormal><span lang=EN-US>> >> > design, i will discuss it with the designer.</span></p><p class=MsoNormal><span lang=EN-US>> >> </span></p><p class=MsoNormal><span lang=EN-US>> >> There is no absolutely surefire way to do this as a pure Wayland</span></p><p class=MsoNormal><span lang=EN-US>> >> application but one possible UI flow would be:</span></p><p class=MsoNormal><span lang=EN-US>> >> </span></p><p class=MsoNormal><span lang=EN-US>> >> - getting the list of touchscreens from udev [1]</span></p><p class=MsoNormal><span lang=EN-US>> >> - printing something like "Mapping screen 'Foo Vendor Touchscreen'" </span></p><p class=MsoNormal><span lang=EN-US>> >> - display on output A with icons "this one", "nah, next one please"</span></p><p class=MsoNormal><span lang=EN-US>> >> - rotate through outputs until "this one" is clicked</span></p><p class=MsoNormal><span lang=EN-US>> >> </span></p><p class=MsoNormal><span lang=EN-US>> >> You don't need to care whether the confirmation even comes from the</span></p><p class=MsoNormal><span lang=EN-US>> >> touchscreen.</span></p><p class=MsoNormal><span lang=EN-US>> >> </span></p><p class=MsoNormal><span lang=EN-US>> >> Alternatively you can display on all screens simultaneously and assume</span></p><p class=MsoNormal><span lang=EN-US>> >> the button + screen that receives the "Yes" click are the one that want</span></p><p class=MsoNormal><span lang=EN-US>> >> the touchscreen.</span></p><p class=MsoNormal><span lang=EN-US>> >> </span></p><p class=MsoNormal><span lang=EN-US>> >> Cheers,</span></p><p class=MsoNormal><span lang=EN-US>> >> Peter</span></p><p class=MsoNormal><span lang=EN-US>> >> </span></p><p class=MsoNormal><span lang=EN-US>> >> [1] slightly unreliable since there's no guarantee they're all handled</span></p><p class=MsoNormal><span lang=EN-US>> >> but most likely good enough</span></p><p class=MsoNormal><span lang=EN-US>> >> </span></p><p class=MsoNormal><span lang=EN-US>> >> > At 2023-11-22 06:31:07, "Peter Hutterer" <peter.hutterer@who-t.net> wrote:</span></p><p class=MsoNormal><span lang=EN-US>> >> > >On Tue, Nov 21, 2023 at 04:20:10PM +0800, weinan wang wrote:</span></p><p class=MsoNormal><span lang=EN-US>> >> > >> Hey Guys,</span></p><p class=MsoNormal><span lang=EN-US>> >> > >> We have an application that needs to get the touch device</span></p><p class=MsoNormal><span lang=EN-US>> >> > >> corresponding to the touch event, and on X11, we can get the device ID</span></p><p class=MsoNormal><span lang=EN-US>> >> > >> that sends this event according to the XI_Touch events, and then find</span></p><p class=MsoNormal><span lang=EN-US>> >> > >> the device we want according to this ID. But on Wayland, it seems</span></p><p class=MsoNormal><span lang=EN-US>> >> > >> that neither wl_seat nor wl_touch can get device-related information,</span></p><p class=MsoNormal><span lang=EN-US>> >> > >> this application is a user permission, so we can't use libinput to get</span></p><p class=MsoNormal><span lang=EN-US>> >> > >> more low-level events.</span></p><p class=MsoNormal><span lang=EN-US>> >> > >> Please ask if there is any other way to get the device that sends the</span></p><p class=MsoNormal><span lang=EN-US>> >> > >> event?</span></p><p class=MsoNormal><span lang=EN-US>> >> > ></span></p><p class=MsoNormal><span lang=EN-US>> >> > >This is not possible in wayland, physical devices are abstracted into</span></p><p class=MsoNormal><span lang=EN-US>> >> > >wl_pointer/wl_keyboard/wl_touch and the underlying device is not exposed</span></p><p class=MsoNormal><span lang=EN-US>> >> > >anywhere through wayland or even current wayland-protocols.</span></p><p class=MsoNormal><span lang=EN-US>> >> > ></span></p><p class=MsoNormal><span lang=EN-US>> >> > >The sole exception is the wl_tablet protocol which is per physical</span></p><p class=MsoNormal><span lang=EN-US>> >> > >device but that's due to how tablets are being used.</span></p><p class=MsoNormal><span lang=EN-US>> >> > ></span></p><p class=MsoNormal><span lang=EN-US>> >> > >You don't usually have access to the libinput context inside the</span></p><p class=MsoNormal><span lang=EN-US>> >> > >compositor either (because Wayland itself doesn't require libinput, it's</span></p><p class=MsoNormal><span lang=EN-US>> >> > >an implementation detail).</span></p><p class=MsoNormal><span lang=EN-US>> >> > ></span></p><p class=MsoNormal><span lang=EN-US>> >> > >The question here is: what are you trying to achieve? maybe there's a</span></p><p class=MsoNormal><span lang=EN-US>> >> > >different way to do it than having access to the specific physical</span></p><p class=MsoNormal><span lang=EN-US>> >> > >device.</span></p><p class=MsoNormal><span lang=EN-US>> >> > ></span></p><p class=MsoNormal><span lang=EN-US>> >> > >Cheers,</span></p><p class=MsoNormal><span lang=EN-US>> >> > > Peter</span></p><p class=MsoNormal><span lang=EN-US>> >> </span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p></div></body></html>