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       "@atoms = get_property_atoms($X, $window, $property)"
73           Get from $window (integer XID) a list-of-atoms property $property
74           (atom integer).  The return is a list of atom integers, possibly an
75           empty list.  If $property doesn't exist or is not atoms then return
76           an empty list.
77
78       "set_property_atoms($X, $window, $property, @atoms)"
79           Set on $window (integer XID) a list-of-atoms property $property
80           (atom integer) as the given list of @atoms (possibly empty).
81
82   Colour Parsing
83       "($red16, $green16, $blue16) = hexstr_to_rgb($str)"
84           Parse a given RGB colour string like "#FF00FF" into 16-bit red,
85           green, blue components.  The return values are always in the range
86           0 to 65535.  The strings recognised are 1, 2, 3 or 4 digit hex.
87
88               #RGB
89               #RRGGBB
90               #RRRGGGBBB
91               #RRRRGGGGBBBB
92
93           If $str is unrecognised then the return is an empty list, so for
94           instance
95
96               my @rgb = hexstr_to_rgb($str)
97                 or die "Unrecognised colour: $str";
98
99           The digits of the 1, 2 and 3 forms are replicated as necessary to
100           give a 16-bit range.  For example 3-digit style "#321FFF000" gives
101           return values 0x3213, 0xFFFF, 0.  Or 1-digit "#F0F" is 0xFFFF, 0,
102           0xFFFF.  Notice "F" expands to 0xFFFF so an "F", "FF" or "FFF" all
103           mean full saturation the same as a 4-digit "FFFF".
104
105           Would it be worth recognising the Xcms style "rgb:RR/GG/BB"?
106           Perhaps that's best left to full Xcms, or general colour conversion
107           modules.  The X11R6 X(7) man page describes the "rgb:" form, but
108           just "#" is much more common.
109

SEE ALSO

111       X11::Protocol, X11::Protocol::GrabServer
112
113       Color::Library (many named colours), Convert::Color, Graphics::Color
114       (Moose based) for more colour parsing
115
116       X11::AtomConstants, X11::CursorFont
117

HOME PAGE

119       <http://user42.tuxfamily.org/x11-protocol-other/index.html>
120

LICENSE

122       Copyright 2010, 2011, 2012, 2013, 2014, 2017, 2019 Kevin Ryde
123
124       X11-Protocol-Other is free software; you can redistribute it and/or
125       modify it under the terms of the GNU General Public License as
126       published by the Free Software Foundation; either version 3, or (at
127       your option) any later version.
128
129       X11-Protocol-Other is distributed in the hope that it will be useful,
130       but WITHOUT ANY WARRANTY; without even the implied warranty of
131       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
132       General Public License for more details.
133
134       You should have received a copy of the GNU General Public License along
135       with X11-Protocol-Other.  If not, see <http://www.gnu.org/licenses/>.
136
137
138
139perl v5.34.0                      2021-07-27           X11::Protocol::Other(3)
Impressum