Discussion:
[Xcb] Deeper pixmaps for xcb-shape masks
Javier Pollak
2018-09-14 17:47:44 UTC
Permalink
Hi, I'm working on a patch for bspwm to add rounded corners to windows and
their borders.
Everything works just as expected but because the mask applied to the
Bounding and Clipping shape is required to be 1 bit deep.
This makes my rounded corners look very jagged since there's no value in
between 0 (transparent) and 1 (opaque).

[Here's a scrot](Loading Image...)

Is there any way to remedy this?
What I tried so far is to apply an additional mask to the window background
itself since it allows for a mask of the same depth as the window.
The problem with that solution is that it does not apply to the border...
Uli Schlachter
2018-09-16 16:20:12 UTC
Permalink
Hi,
Post by Javier Pollak
Hi, I'm working on a patch for bspwm to add rounded corners to windows and
their borders.
[...]
Post by Javier Pollak
Is there any way to remedy this?
What I tried so far is to apply an additional mask to the window background
itself since it allows for a mask of the same depth as the window.
The problem with that solution is that it does not apply to the border...
If the problem is X11 window borders, then the only solution is not to
use them, but to draw your own borders instead.

In general, you can use alpha values through the RENDER extension for
anti-aliased edges, but only if a compositing manager is running since
the X11 server does not do any compositing for you.

Cheers,
Uli
--
99 little bugs in the code
99 little bugs in the code
Take one down, patch it around
117 little bugs in the code
-- @irqed
Javier Pollak
2018-09-17 16:25:12 UTC
Permalink
I see..

So if I wanted to have proper rounded bounding and antialiased corners, I
would have to apply the bounding through shape-ext. and then reclip it in
the compositor?

Proper bounding: having the mouse hi er over rounded corners and behave as
expected
Post by Javier Pollak
Hi,
Post by Javier Pollak
Hi, I'm working on a patch for bspwm to add rounded corners to windows
and
Post by Javier Pollak
their borders.
[...]
Post by Javier Pollak
Is there any way to remedy this?
What I tried so far is to apply an additional mask to the window
background
Post by Javier Pollak
itself since it allows for a mask of the same depth as the window.
The problem with that solution is that it does not apply to the border...
If the problem is X11 window borders, then the only solution is not to
use them, but to draw your own borders instead.
In general, you can use alpha values through the RENDER extension for
anti-aliased edges, but only if a compositing manager is running since
the X11 server does not do any compositing for you.
Cheers,
Uli
--
99 little bugs in the code
99 little bugs in the code
Take one down, patch it around
117 little bugs in the code
Javier Pollak
2018-09-19 00:26:21 UTC
Permalink
(For those on the mailing list: see

https://github.com/Javyre/bspwm/commit/94ba788802ea1d5d0e4419f7b9a357574b1e1451#r30542158
for the reply to which I am reponding )


Thank you for the detailed response.

You have indeed understood the question perfectly and I'm a bit
disappointed at such a complicated solution being needed to accomplish this
but I guess it all makes sense. I'd like for @baskerville to at least
consider merging this future PR so for now I'll keep the patch as minimally
intrusive as possible.

Maybe if he agrees to such a change as to make bspwm reparenting I'll look
deeper into this and put the work into it. But for now, again thank you
very much for your help.

(P.S.: I pushed some new changes to my fork if you'd like to look over it.
All of the issues with the commit you commented on should be resolved.)
Hi again,
I won't be able to send an answer by mail in the next few days, so I'll
answer here. Sorry for this weird way of "mailing".
Re: https://lists.freedesktop.org/archives/xcb/2018-September/011147.html
If I understand this question correctly, then you are worried about
mouse-clicks being handled as expected, i.e. when one clicks outside of the
"rounded corner" but inside of the rectangular window bounds, the mouse
click should go to the window below. For this, (if I remember correctly),
version 1.1 of the SHAPE extension adds a new kind of shape: In addition to
bounding and clip shape, there is also the input shape.
- Turn bspwm into a reparenting WM (I am assuming it is not yet one)
- The frame window for reparenting has two childs: The actual window
with the client content and another window with the border *that is
above the content window*
- Draw an antialiased version of rounded corners to some pixmap with
the RENDER extension
- Any pixel with non-zero alpha is the shape of the window that things
are reparented to
- Draw an antialiased version of just the border to some pixmap with
the RENDER extension
- Any pixel with non-zero alpha in this pixmap is used for the
bounding shape of the border window
- Additionally, you actually draw this shape to the border window *while
honoring alpha* (i.e. this is done through the SHAPE extension)
Thus, you end up with the parent window having a shape that includes
anything where the window should be visible. The border window only touches
pixels where the border is visible thanks to its shape. The anti-aliasing
of the shape happens through the actual window content.
Additionally, you could set the input shape of the window that things are
reparented to. For example, anything with alpha less than 50% could be made
click-through.
I am not quite sure if the above answers your question. However, I am sure
that this is way too complicated for anyone to actually want to do this.
And of course, if no compositor is running, this fails, since then you
cannot actually do any semi-transparency.
Perhaps it is best not to do antialiased rounded corners. :-)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<https://github.com/Javyre/bspwm/commit/94ba788802ea1d5d0e4419f7b9a357574b1e1451#commitcomment-30542158>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AP9cg57sLQ9sEEudVEcUaMxlsttACRGiks5ucKNbgaJpZM4Wq7IU>
.
I see..
So if I wanted to have proper rounded bounding and antialiased corners, I
would have to apply the bounding through shape-ext. and then reclip it in
the compositor?
Proper bounding: having the mouse hi er over rounded corners and behave as
expected
Post by Javier Pollak
Hi,
Post by Javier Pollak
Hi, I'm working on a patch for bspwm to add rounded corners to windows
and
Post by Javier Pollak
their borders.
[...]
Post by Javier Pollak
Is there any way to remedy this?
What I tried so far is to apply an additional mask to the window
background
Post by Javier Pollak
itself since it allows for a mask of the same depth as the window.
The problem with that solution is that it does not apply to the
border...
If the problem is X11 window borders, then the only solution is not to
use them, but to draw your own borders instead.
In general, you can use alpha values through the RENDER extension for
anti-aliased edges, but only if a compositing manager is running since
the X11 server does not do any compositing for you.
Cheers,
Uli
--
99 little bugs in the code
99 little bugs in the code
Take one down, patch it around
117 little bugs in the code
Javier Pollak
2018-09-19 00:22:45 UTC
Permalink
(For those on the mailing list: see

https://github.com/Javyre/bspwm/commit/94ba788802ea1d5d0e4419f7b9a357574b1e1451#r30542158
for the reply to which I am reponding )


Thank you for the detailed response.

You have indeed understood the question perfectly and I'm a bit
disappointed at such a complicated solution being needed to accomplish this
but I guess it all makes sense. I'd like for @baskerville to at least
consider merging this future PR so for now I'll keep the patch as minimally
intrusive as possible.

Maybe if he agrees to such a change as to make bspwm reparenting I'll look
deeper into this and put the work into it. But for now, again thank you
very much for your help.

(P.S.: I pushed some new changes to my fork if you'd like to look over it.
All of the issues with the commit you commented on should be resolved.)
Hi again,
I won't be able to send an answer by mail in the next few days, so I'll
answer here. Sorry for this weird way of "mailing".
Re: https://lists.freedesktop.org/archives/xcb/2018-September/011147.html
If I understand this question correctly, then you are worried about
mouse-clicks being handled as expected, i.e. when one clicks outside of the
"rounded corner" but inside of the rectangular window bounds, the mouse
click should go to the window below. For this, (if I remember correctly),
version 1.1 of the SHAPE extension adds a new kind of shape: In addition to
bounding and clip shape, there is also the input shape.
- Turn bspwm into a reparenting WM (I am assuming it is not yet one)
- The frame window for reparenting has two childs: The actual window
with the client content and another window with the border *that is
above the content window*
- Draw an antialiased version of rounded corners to some pixmap with
the RENDER extension
- Any pixel with non-zero alpha is the shape of the window that things
are reparented to
- Draw an antialiased version of just the border to some pixmap with
the RENDER extension
- Any pixel with non-zero alpha in this pixmap is used for the
bounding shape of the border window
- Additionally, you actually draw this shape to the border window *while
honoring alpha* (i.e. this is done through the SHAPE extension)
Thus, you end up with the parent window having a shape that includes
anything where the window should be visible. The border window only touches
pixels where the border is visible thanks to its shape. The anti-aliasing
of the shape happens through the actual window content.
Additionally, you could set the input shape of the window that things are
reparented to. For example, anything with alpha less than 50% could be made
click-through.
I am not quite sure if the above answers your question. However, I am sure
that this is way too complicated for anyone to actually want to do this.
And of course, if no compositor is running, this fails, since then you
cannot actually do any semi-transparency.
Perhaps it is best not to do antialiased rounded corners. :-)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<https://github.com/Javyre/bspwm/commit/94ba788802ea1d5d0e4419f7b9a357574b1e1451#commitcomment-30542158>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AP9cg57sLQ9sEEudVEcUaMxlsttACRGiks5ucKNbgaJpZM4Wq7IU>
.
Loading...