Re: C/C++ API to set screen for a window on Wayland

Viet Dang <[email protected]> Thu, 8 Aug 2024 22:17:46 +0100
Newsgroups gmane.comp.kde.devel.kwin
Message-ID <CAO-rTSELoamceaOSG6sFX1tGuOpDhFfNYezEdNRjvG_Mt2OBtQ@mail.gmail.com>
--0000000000009a8c67061f328ffe
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Ah I got it, it didn't work because I used QWidget::setScreen(), but the
layer shell screen configuration is ScreenFromQWindow. When I changed to
using QWindow::setScreen() then it worked.

Thanks again, Aleix.

Viet


On Thu, Aug 8, 2024 at 1:20=E2=80=AFAM Viet Dang <[email protected]> wrote:

> Hi Aleix,
>
> Maybe my post wasn't clear, this is for multi-screen/multi-monitor setup,
> so for example I need to set the dock to screen 1 or screen 2 etc.
>
> I've already used layer-shell to set the dock's anchor, strut, and
> layer, but it doesn't seem to support setting screen/monitor?
>
> Thanks,
> Viet
>
>
> On Thu, Aug 8, 2024 at 12:56=E2=80=AFAM Aleix Pol <[email protected]> wrot=
e:
>
>> It depends on how you're placing your surface.
>>
>> Given you're asking about a dock in the KWin list, you should be using
>> layer-shell. It does allow setting the output when placing it:
>>
>> https://wayland.app/protocols/wlr-layer-shell-unstable-v1#zwlr_layer_she=
ll_v1:request:get_layer_surface
>>
>> As C++ API you can use layer-shell-qt:
>> https://invent.kde.org/plasma/layer-shell-qt/
>>
>> Best of luck,
>> Aleix
>>
>> On Thu, Aug 8, 2024 at 12:54=E2=80=AFAM Viet Dang <[email protected]> wro=
te:
>> >
>> > Hi,
>> >
>> > On Wayland, is there any way for third-party docks to set the screen
>> where the dock resides?
>> >
>> > I've looked through the Wayland protocol list but did not find anythin=
g
>> relevant.
>> >
>> > Thanks a lot,
>> > Viet
>> >
>>
>

--0000000000009a8c67061f328ffe
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Ah I got it, it didn&#39;t work because I used=C2=A0QWidge=
t::setScreen(), but the layer shell screen configuration is=C2=A0ScreenFrom=
QWindow. When I changed to using QWindow::setScreen() then it worked.<div><=
br></div><div>Thanks again, Aleix.</div><div><br></div><div>Viet</div><div>=
<br></div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gm=
ail_attr">On Thu, Aug 8, 2024 at 1:20=E2=80=AFAM Viet Dang &lt;<a href=3D"m=
ailto:[email protected]">[email protected]</a>&gt; wrote:<br></div><blockquot=
e class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px s=
olid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr">Hi Aleix,<div><br>=
</div><div>Maybe my post wasn&#39;t clear, this is for multi-screen/multi-m=
onitor setup, so for example I need to set the dock to screen 1 or screen 2=
 etc.</div><div><br></div><div>I&#39;ve already used layer-shell to set the=
 dock&#39;s anchor, strut, and layer,=C2=A0but it doesn&#39;t seem to suppo=
rt setting screen/monitor?</div><div><br></div><div>Thanks,</div><div>Viet<=
/div><div><br></div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" c=
lass=3D"gmail_attr">On Thu, Aug 8, 2024 at 12:56=E2=80=AFAM Aleix Pol &lt;<=
a href=3D"mailto:[email protected]" target=3D"_blank">[email protected]</a>&g=
t; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0p=
x 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">It dep=
ends on how you&#39;re placing your surface.<br>
<br>
Given you&#39;re asking about a dock in the KWin list, you should be using<=
br>
layer-shell. It does allow setting the output when placing it:<br>
<a href=3D"https://wayland.app/protocols/wlr-layer-shell-unstable-v1#zwlr_l=
ayer_shell_v1:request:get_layer_surface" rel=3D"noreferrer" target=3D"_blan=
k">https://wayland.app/protocols/wlr-layer-shell-unstable-v1#zwlr_layer_she=
ll_v1:request:get_layer_surface</a><br>
<br>
As C++ API you can use layer-shell-qt:<br>
<a href=3D"https://invent.kde.org/plasma/layer-shell-qt/" rel=3D"noreferrer=
" target=3D"_blank">https://invent.kde.org/plasma/layer-shell-qt/</a><br>
<br>
Best of luck,<br>
Aleix<br>
<br>
On Thu, Aug 8, 2024 at 12:54=E2=80=AFAM Viet Dang &lt;<a href=3D"mailto:dan=
[email protected]" target=3D"_blank">[email protected]</a>&gt; wrote:<br>
&gt;<br>
&gt; Hi,<br>
&gt;<br>
&gt; On Wayland, is there any way for third-party docks to set the screen w=
here the dock resides?<br>
&gt;<br>
&gt; I&#39;ve looked through the Wayland protocol list but did not find any=
thing relevant.<br>
&gt;<br>
&gt; Thanks a lot,<br>
&gt; Viet<br>
&gt;<br>
</blockquote></div>
</blockquote></div>

--0000000000009a8c67061f328ffe--