|
NAMEX11::Protocol::XSetRoot -- set root window backgroundSYNOPSISuse X11::Protocol::XSetRoot; X11::Protocol::XSetRoot->set_background (color => 'green'); # or given $X, but which then can't be used any more X11::Protocol::XSetRoot->set_background (X => $X, pixmap => $pixmap_xid, pixmap_allocated_colors => 1); DESCRIPTIONThis module sets the X root window background in the style of the "xsetroot" program.The simplest use is a named colour interpreted by the server's usual "AllocNamedColor()" or a 1 to 4 digit hex string like "#RRGGBB" or "#RRRRGGGGBBBB". X11::Protocol::XSetRoot->set_background (color => 'green'); X11::Protocol::XSetRoot->set_background (color => '#FF0000'); # red A pattern can be set with a pixmap. A pixmap the size of the screen can give a full background picture. # draw $pixmap with say $X->black_pixel and $X->white_pixel, # then set it with X11::Protocol::XSetRoot->set_background (X => $X, pixmap => $pixmap); "set_background()" takes ownership of the given $pixmap and frees it with "FreePixmap()" once put into the window background. Setting the root to a pixmap drawn by a program is the main use for this module. If you just want a solid colour then that can be done easily enough with the actual "xsetroot" program. Retained ResourcesAllocated pixel colours (in "PseudoColor" etc) and any "use_esetroot" preserve pixels and the pixmap with "SetCloseDownMode ('RetainPermanent')" and leave root window properties "_XSETROOT_ID" or "ESETROOT_PMAP_ID" ready to released by a "KillClient()" in a future background change.In these cases the $X connection cannot be used any more since a further background change and consequent "KillClient()" could occur at any time, perhaps immediately. If a "pixmap" is given then if it contains any allocated pixels ("AllocColor()" etc) then this should be indicated with the "pixmap_allocated_colors" option. (Allocated pixels are noticed automatically for "pixel" and "color" options.) # AllocColor colours, draw $pixmap with them, then # X11::Protocol::XSetRoot->set_background (X => $X, pixmap => $pixmap, pixmap_allocated_colors => 1); # don't use $X any more The easiest thing is to close an $X connection immediately after a "set_background()". Perhaps there could be a return value to say whether a retain was done and thus the connection cannot be used again. Or perhaps in the future if "X11::Protocol" had an explicit "$X->close()" then that could be done here so a closed connection would indicate it cannot be used further. If the root visual is static ("TrueColor" etc) then there's no colour allocation as such ("AllocColor()" is just a lookup). In this case "set_background()" knows there's no need for "RetainPermanent" for colours, only for pixmaps. If the "color" or "pixel" options are the screen "black_pixel" or "white_pixel" then those pixels exist permanently in the root colormap and "set_background()" knows there's no need to "RetainPermanent" for them. If the server has the TOG-CUP extension (see X11::Protocol::Ext::TOG_CUP) then any permanent pixels there are recognised too. Virtual Root"XSetRoot" looks for "__SWM_VROOT" using X11::Protocol::WM "root_to_virtual_root()" and acts on that when applicable. Such a virtual root is used by "amiwm", "swm" and "tvtwm" window managers and the "xscreensaver" program.The enlightenment window manager, however, uses a background window covering the root window. This stops most root window programs from working, including XSetRoot here. EsetrootThe "Esetroot" program and various compatible programs such as "fvwm-root" use a separate set of properties from what "xsetroot" uses. The "Esetroot" method records the root pixmap ready for use by programs such as "Eterm", eg. to implement pseudo-transparency (its "Eterm --trans", which the method was designed for).The "set_background()" option "use_esetroot" uses the "Esetroot" style rather than the default "xsetroot" style. It can be used with the "pixel" or "color" options too and in that case "set_background()" makes a 1x1 pixmap to give a solid colour. "set_background()" always deletes and kills (as appropriate) both the "xsetroot" and "Esetroot" properties since both are superseded by a new background. For reference, to use "Eterm --trans" (as of its version 0.9.6 March 2011) an "Esetroot" background should be present when "Eterm" starts and it should not be removed later (and not set to "None"). "Eterm" won't notice an initial "Esetroot" while it's running. This means do an "Esetroot" before running "Eterm" and then do all future background changes in "Esetroot" style. The advantage of the "Esetroot" method is that the root pixmap is available for client programs to use in creative ways. If the client draws some of the root pixmap as its own background then it can appear semi-transparent. This doesn't require the SHAPE extension and allows visual effects like shading or dithering too. For comparison, the "xsetroot" style means the root pixmap is not available to client programs. In principle that allows the server to apply it to the hardware and never refer to it again. In practice that might not occur, for example if multiple console "virtual terminals" mean the server must give up the hardware when switched away. FUNCTIONS
ROOT WINDOW PROPERTIES
ENVIRONMENT
FILES/etc/X11/rgb.txt on the server, being the usual colour names database for the "color" option above.SEE ALSOX11::Protocol, X11::Protocol::Ext::TOG_CUPxsetroot(1), Esetroot(1), Eterm(1), fvwm-root(1) <http://www.eterm.org/docs/view.php?doc=ref#trans> <http://www.eterm.org/doc/Eterm_reference.html#trans> <file:///usr/share/doc/eterm/Eterm_reference.html#trans> See examples/view-root.pl for a simple program to display the root window contents. HOME PAGE<http://user42.tuxfamily.org/x11-protocol-other/index.html>LICENSECopyright 2010, 2011, 2012, 2013, 2014, 2017 Kevin RydeX11-Protocol-Other is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. X11-Protocol-Other is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with X11-Protocol-Other. If not, see <http://www.gnu.org/licenses/>.
Visit the GSP FreeBSD Man Page Interface. |