X11::Protocol::Other(3pm) | User Contributed Perl Documentation | X11::Protocol::Other(3pm) |
X11::Protocol::Other -- miscellaneous X11::Protocol helpers
use X11::Protocol::Other;
This is some helper functions for "X11::Protocol".
Nothing is exported by default, but the functions can be requested in usual "Exporter" style,
use X11::Protocol::Other 'visual_is_dynamic'; if (visual_is_dynamic ($X, $visual_id)) { ... }
Or just called with full package name
use X11::Protocol::Other; if (X11::Protocol::Other::visual_is_dynamic ($X, $visual_id)) { ... }
There's no ":all" tag since this module is meant as a grab-bag of functions and to import as-yet unknown things would be asking for name clashes.
$visual_id is one of the visual ID numbers, ie. one of the keys in "$X->{'visuals'}". Or $visual_class is a VisualClass string like "PseudoColor" or corresponding integer such as 3.
$window is an integer XID on $X. If it's one of the root windows then the return values are from the screen info hash in $X, otherwise the server is queried with "GetGeometry()" (for the size) or "GetWindowAttributes()" (for the visual).
These functions are handy when there's a good chance $window might be a root window and therefore not need a server round trip.
#RGB #RRGGBB #RRRGGGBBB #RRRRGGGGBBBB
If $str is unrecognised then the return is an empty list, so for instance
my @rgb = hexstr_to_rgb($str) or die "Unrecognised colour: $str";
The digits of the 1, 2 and 3 forms are replicated as necessary to give a 16-bit range. For example 3-digit style "#321FFF000" gives return values 0x3213, 0xFFFF, 0. Or 1-digit "#F0F" is 0xFFFF, 0, 0xFFFF. Notice "F" expands to 0xFFFF so an "F", "FF" or "FFF" all mean full saturation the same as a 4-digit "FFFF".
Would it be worth recognising the Xcms style "rgb:RR/GG/BB"? Perhaps that's best left to full Xcms, or general colour conversion modules. The X11R6 X(7) man page describes the "rgb:" form, but just "#" is much more common.
X11::Protocol, X11::Protocol::GrabServer
Color::Library (many named colours), Convert::Color, Graphics::Color (Moose based) for more colour parsing
X11::AtomConstants, X11::CursorFont
<http://user42.tuxfamily.org/x11-protocol-other/index.html>
Copyright 2010, 2011, 2012, 2013, 2014 Kevin Ryde
X11-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/>.
2017-11-01 | perl v5.26.1 |