Create window from arbitrary pixmap as background

Lucas de Sena lucas at seninha.org
Sat Jul 20 19:16:55 UTC 2024


On 2024-07-20, Carsten Haitzler wrote:
> create the pixmap to match the depth of the window, not the other way around.
> libxpm is a pretty inefficient thing. xpm's are too. there are plenty of other
> solutions that are far better... :)

That's what I often do.  This is an exceptional case in which the pixmap
is created before the window.  This is a library function which creates,
handles, and destroy an icon window while in its event loop.  The caller
program is limited to set the window's background-pixmap attribute.

I think I'm gonna write it with the API limitation that the given pixmap
must have the same depth of the root window.  Otherwise the library will
simply fall back to a default (compile-time defined) pixmap.

I am writing a drag-and-drop library, btw.


On 2024-07-20, Carsten Haitzler wrote:
> but yes - you need to create a window with a visual that is supported (and
> obviously with a depth that is supported).

As I thought.  I could use XMatchVisualInfo(3) and XCreateColormap(3) to
get the matching visual and colormap.  But that would add more points of
failure (I may get an empty list of matching visuals, and I have no idea
of which visual class to try).


> On Sat, 20 Jul 2024 14:58:58 -0300 Lucas de Sena <lucas at seninha.org> said:
> > I checked how a few iconifying window managers deal with clients
> > providing icon pixmap and mask on XWMHints(3).  But as far as I could
> > understand, fvwm and twm ignores pixmaps with non-default depths; and
> > windowmaker creates an XImage from the pixmap and then creates a
> > default-depth pixmap back from it.  Is the latter approach the most
> > correct (or only) one?
> 
> well this is a different thing - that pxiamp is provided by some other client
> so you have fairly little choice. it's a bit primitive TBH especially as you
> now don't have alpha - this is why the freeddesktop extended hints provide an
> icon RGBA data property ... much nicer :)

Yes!  I have written a pager dockapp before[1] which draws miniatures of
the virtual desktops and their top-level windows.  I just gave up ICCCM.
Too much boilerplate code!  I just look at ewmh's _NET_WM_ICON property,
and create an XImage from it... way saner.

[1]: https://github.com/phillbush/paginator

-- 
Lucas de Sena


More information about the xorg mailing list