1X11::Protocol::Other(3)User Contributed Perl DocumentatioXn11::Protocol::Other(3)
2
3
4

NAME

6       X11::Protocol::Other -- miscellaneous X11::Protocol helpers
7

SYNOPSIS

9        use X11::Protocol::Other;
10

DESCRIPTION

12       This is some helper functions for "X11::Protocol".
13

EXPORTS

15       Nothing is exported by default, but the functions can be requested in
16       usual "Exporter" style,
17
18           use X11::Protocol::Other 'visual_is_dynamic';
19           if (visual_is_dynamic ($X, $visual_id)) {
20             ...
21           }
22
23       Or just called with full package name
24
25           use X11::Protocol::Other;
26           if (X11::Protocol::Other::visual_is_dynamic ($X, $visual_id)) {
27             ...
28           }
29
30       There's no ":all" tag since this module is meant as a grab-bag of
31       functions and to import as-yet unknown things would be asking for name
32       clashes.
33

FUNCTIONS

35   Screen Finding
36       "$number = root_to_screen ($X, $root)"
37       "$hashref = root_to_screen_info ($X, $root)"
38           Return the screen number or screen info hash for a given root
39           window.  $root can be any XID integer on $X.  If it's not one of
40           the root windows then the return is "undef".
41
42       "$number = default_colormap_to_screen ($X, $colormap)"
43       "$hashref = default_colormap_to_screen_info ($X, $colormap)"
44           Return the screen number or screen info hash for a given default
45           colormap.  $colormap can be any XID integer on $X.  If it's not one
46           of the screen default colormaps then the return is "undef".
47
48   Visuals
49       "$bool = visual_is_dynamic ($X, $visual_id)"
50       "$bool = visual_class_is_dynamic ($X, $visual_class)"
51           Return true if the given visual is dynamic, meaning colormap
52           entries on it can be changed to change the colour of a given pixel
53           value.
54
55           $visual_id is one of the visual ID numbers, ie. one of the keys in
56           "$X->{'visuals'}".  Or $visual_class is a VisualClass string like
57           "PseudoColor" or corresponding integer such as 3.
58
59   Window Info
60       "($width, $height) = window_size ($X, $window)"
61       "$visual_id = window_visual ($X, $window)"
62           Return the size or visual ID of a given window.
63
64           $window is an integer XID on $X.  If it's one of the root windows
65           then the return values are from the screen info hash in $X,
66           otherwise the server is queried with "GetGeometry()" (for the size)
67           or "GetWindowAttributes()" (for the visual).
68
69           These functions are handy when there's a good chance $window might
70           be a root window and therefore not need a server round trip.
71
72   Colour Parsing
73       "($red16, $green16, $blue16) = hexstr_to_rgb($str)"
74           Parse a given RGB colour string like "#FF00FF" into 16-bit red,
75           green, blue components.  The return values are always in the range
76           0 to 65535.  The strings recognised are 1, 2, 3 or 4 digit hex.
77
78               #RGB
79               #RRGGBB
80               #RRRGGGBBB
81               #RRRRGGGGBBBB
82
83           If $str is unrecognised then the return is an empty list, so for
84           instance
85
86               my @rgb = hexstr_to_rgb($str)
87                 or die "Unrecognised colour: $str";
88
89           The digits of the 1, 2 and 3 forms are replicated as necessary to
90           give a 16-bit range.  For example 3-digit style "#321FFF000" gives
91           return values 0x3213, 0xFFFF, 0.  Or 1-digit "#F0F" is 0xFFFF, 0,
92           0xFFFF.  Notice "F" expands to 0xFFFF so an "F", "FF" or "FFF" all
93           mean full saturation the same as a 4-digit "FFFF".
94
95           Would it be worth recognising the Xcms style "rgb:RR/GG/BB"?
96           Perhaps that's best left to full Xcms, or general colour conversion
97           modules.  The X11R6 X(7) man page describes the "rgb:" form, but
98           just "#" is much more common.
99

SEE ALSO

101       X11::Protocol, X11::Protocol::GrabServer
102
103       Color::Library (many named colours), Convert::Color, Graphics::Color
104       (Moose based) for more colour parsing
105
106       X11::AtomConstants, X11::CursorFont
107

HOME PAGE

109       <http://user42.tuxfamily.org/x11-protocol-other/index.html>
110

LICENSE

112       Copyright 2010, 2011, 2012, 2013, 2014 Kevin Ryde
113
114       X11-Protocol-Other is free software; you can redistribute it and/or
115       modify it under the terms of the GNU General Public License as
116       published by the Free Software Foundation; either version 3, or (at
117       your option) any later version.
118
119       X11-Protocol-Other is distributed in the hope that it will be useful,
120       but WITHOUT ANY WARRANTY; without even the implied warranty of
121       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
122       General Public License for more details.
123
124       You should have received a copy of the GNU General Public License along
125       with X11-Protocol-Other.  If not, see <http://www.gnu.org/licenses/>.
126
127
128
129perl v5.28.0                      2014-01-18           X11::Protocol::Other(3)
Impressum