<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Hi,</p>
<p>
<blockquote type="cite">since documentation on X11 is hard to find</blockquote>
Yes, and IMHO the best approach is to find software doing what you
want to do and see how they do it – when it comes to windows,
window managers might be a good choice (such as awesome or i3,
shameless plug for Uli and me here).</p>
<p>Another thing to watch out for with (true) transparency is that
you need to define both a back pixel and a border pixel in the
window attributes. I'm not sure whether this changed in recent
releases of Xorg, but it used to be the case. See [1], beautifully
demonstrating that even Uli went through these problems before,
albeit many years ago. :-)</p>
<p>
<blockquote type="cite"><span>For true transparency, I can't seem
to set the depth properly using xcb_create_window(...), since
I have no idea what unit the depth parameter is even supposed
to be! Giving it 32 does not work, the only value that seems
to work for me is XCB_COPY_FROM_PARENT. </span></blockquote>
As I mentioned above, just look at the code of existing software.
For the case of i3 (only one of many!), you will find what you're
looking for in x_con_init() in src/x.c.</p>
<p>
<blockquote type="cite"><span>Essentially, I have no idea if my
window already has a depth of 32-bit or not.</span></blockquote>
You can check the depth of a window using "xwininfo -frame", for
example.</p>
<p>
<blockquote type="cite">However, once the root pixmap changes, I
would have to copy the pixmap then redo the drawing process.</blockquote>
Well, that's the nature of fake transparency. It doesn't do well
with changing backgrounds, in particular quickly changing
backgrounds. It will always look sloppy; it's fake transparency,
after all. If you want it to be correct, use true transparency
(requiring compositing). There's only so much you can do.</p>
<p>
<blockquote type="cite">I'm curious as to if there is a better way
that I haven't though of.</blockquote>
One improvement you could make is to render your window's content
to a separate pixmap (or, in this case, cairo surface) and do the
same for the root window. When the background changes, you don't
need to rerender your own content, but only overlay the updated
background and your content's surface.</p>
<p>There's certainly a lot one can do, but I wouldn't bother with
that quite yet. Drawing a few rectangles and some text isn't so
expensive that any machine from this decade should have serious
problem with it, assuming you've done everything else correctly.
X11 protocol can be frickle, especially if you don't understand
it, so I'd focus on getting an understanding of how it works and
how your client should behave first; also to ensure it actually
adheres to the specifications.<br>
</p>
<p>[1] <a class="moz-txt-link-freetext" href="https://stackoverflow.com/questions/3645632">https://stackoverflow.com/questions/3645632</a></p>
<p><br>
</p>
<p>Regards</p>
<p>Ingo<br>
</p>
<br>
<div class="moz-cite-prefix">On 10/17/2017 03:04 AM, Sheheryar
Parvaz wrote:<br>
</div>
<blockquote type="cite"
cite="mid:DM5PR13MB15961453194926377E252107F14C0@DM5PR13MB1596.namprd13.prod.outlook.com">
<meta http-equiv="Context-Type" content="text/html;
charset=iso-8859-1">
<div id="divtagdefaultwrapper" dir="ltr">
<div>
<p>First of all, <span title="Get Quick Suggestions from
Bing" class="x__mcp_F2"
id="x_SmartSuggestionsKeyword758296">
thank you</span> very much for your response, it is very
helpful since documentation on X11 is hard to find. In my
case, I want to be able to use pseudo-transparency and true
transparency depending on what is available, so help on both
methods is appreciated.</p>
<p><br>
</p>
<p><span>> You want a window with depth 32. If you have
that (and correctly tell<br>
> cairo about it), you can just cairo to draw a
transparent background<br>
> [1].</span></p>
<p><span><br>
</span></p>
<p><span>For true transparency, I can't seem to set the depth
properly using xcb_create_window(...), since I have no
idea what unit the depth parameter is even supposed to be!
Giving it 32 does not work, the only value that seems to
work for me is XCB_COPY_FROM_PARENT. Essentially, I have
no idea if my window already has a depth of 32-bit or not.</span><br>
</p>
<p>I'm assuming it isn't since cairo seems to be drawing a
black background. By the way, the only mask I have set is
CW_EVENT_MASK. This could be the reason why, but I have no
idea.</p>
<p><br>
</p>
<p>I am also having trouble thinking about how to do
pseudo-transparency. For now, I am copying the root pixmap
to the window, then telling cairo to draw over it, using the
default cairo operator. However, once the root pixmap
changes, I would have to copy the pixmap then redo the
drawing process. This is not the most efficient way, and I'm
curious as to if there is a better way that I haven't though
of.</p>
<p><br>
</p>
Thank you again, and hopefully this is the right place to
discuss this.<br>
</div>
<div>
<div class="PlainText">
<hr tabindex="-1">
</div>
<span></span></div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Xcb mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Xcb@lists.freedesktop.org">Xcb@lists.freedesktop.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freedesktop.org/mailman/listinfo/xcb">https://lists.freedesktop.org/mailman/listinfo/xcb</a></pre>
</blockquote>
<br>
</body>
</html>