Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You already accepted a partial answer, but I hope you will still read this.</p> <p>It is true that the desktop background by convention is the root window. However, there are two important mechanics going on on a typical modern desktop:</p> <ul> <li>root pixmap setting (wallpaper), which is <em>not</em> drawn on the background of the root window</li> <li>enrichment of the desktop background (for example clickable icons) by obstructing the root window with another base level window</li> </ul> <p>If you only want to <em>draw</em> on the background, only the latter matters to you. If you however also want to read the background, for example for real transparency, also the first point plays a role.</p> <p><strong>Drawing to the background:</strong></p> <p>The authors of the program xsnow and xpenguins were the first to deal with this problem. They wrote a clever function that can derive KDE and Gnome desktop windows if they are present. As other window managers that obstruct the root window tend to obey these de-facto standards, it works very reliably. With their code, you instantly know which window to draw to.</p> <p><strong>Reading the root background (pixmap):</strong></p> <p>This is harder. The naive query for window pixels will fail because all foreground windows are also part of the root window; so this makes it easy to do a screenshot, but not to get the real background.</p> <p>There is a convention however, on a global name of the root pixmap (as used by any decent background pixmap setter). The pixmap can be found by querying for that name. It gets nasty however, if either the background setter sucks and does not obey to that rule, or the background is not a pixmap, but only a pattern or whatever.</p> <p>The second option, of which I only found recently, is to use the XDBE (double buffer) extension to get the root window's background. This is very clean, only takes like two or three lines of codes and works in any case. <em>But</em> Xorg sees XDBE as deprecated (or, more precisely, soon-to-be deprecated). So I don't know if using it only for that purpose is still a good idea. But I can give you <em>code on request</em>!</p> <p><strong>Finally the implementation:</strong></p> <p>Yes, there is an implementation available for both things. Check out <a href="http://fopref.meinungsverstaerker.de/xmms-rootvis/" rel="nofollow noreferrer">http://fopref.meinungsverstaerker.de/xmms-rootvis/</a> In that archive, which is GPL, <code>getroot.c</code> is taken from xpenguins, without dependencies to other xpenguins code. Also, starting in line 144 of <code>rootvis.c</code> you will find the code to grab the background pixmap.</p> <p>Have fun!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload