.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "X11::Protocol::Other 3" .TH X11::Protocol::Other 3 2023-07-25 "perl v5.38.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME X11::Protocol::Other \-\- miscellaneous X11::Protocol helpers .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& use X11::Protocol::Other; .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" This is some helper functions for \f(CW\*(C`X11::Protocol\*(C'\fR. .SH EXPORTS .IX Header "EXPORTS" Nothing is exported by default, but the functions can be requested in usual \&\f(CW\*(C`Exporter\*(C'\fR style, .PP .Vb 4 \& use X11::Protocol::Other \*(Aqvisual_is_dynamic\*(Aq; \& if (visual_is_dynamic ($X, $visual_id)) { \& ... \& } .Ve .PP Or just called with full package name .PP .Vb 4 \& use X11::Protocol::Other; \& if (X11::Protocol::Other::visual_is_dynamic ($X, $visual_id)) { \& ... \& } .Ve .PP There's no \f(CW\*(C`:all\*(C'\fR 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. .SH FUNCTIONS .IX Header "FUNCTIONS" .SS "Screen Finding" .IX Subsection "Screen Finding" .ie n .IP """$number = root_to_screen ($X, $root)""" 4 .el .IP "\f(CW$number = root_to_screen ($X, $root)\fR" 4 .IX Item "$number = root_to_screen ($X, $root)" .PD 0 .ie n .IP """$hashref = root_to_screen_info ($X, $root)""" 4 .el .IP "\f(CW$hashref = root_to_screen_info ($X, $root)\fR" 4 .IX Item "$hashref = root_to_screen_info ($X, $root)" .PD Return the screen number or screen info hash for a given root window. \&\f(CW$root\fR can be any XID integer on \f(CW$X\fR. If it's not one of the root windows then the return is \f(CW\*(C`undef\*(C'\fR. .ie n .IP """$number = default_colormap_to_screen ($X, $colormap)""" 4 .el .IP "\f(CW$number = default_colormap_to_screen ($X, $colormap)\fR" 4 .IX Item "$number = default_colormap_to_screen ($X, $colormap)" .PD 0 .ie n .IP """$hashref = default_colormap_to_screen_info ($X, $colormap)""" 4 .el .IP "\f(CW$hashref = default_colormap_to_screen_info ($X, $colormap)\fR" 4 .IX Item "$hashref = default_colormap_to_screen_info ($X, $colormap)" .PD Return the screen number or screen info hash for a given default colormap. \&\f(CW$colormap\fR can be any XID integer on \f(CW$X\fR. If it's not one of the screen default colormaps then the return is \f(CW\*(C`undef\*(C'\fR. .SS Visuals .IX Subsection "Visuals" .ie n .IP """$bool = visual_is_dynamic ($X, $visual_id)""" 4 .el .IP "\f(CW$bool = visual_is_dynamic ($X, $visual_id)\fR" 4 .IX Item "$bool = visual_is_dynamic ($X, $visual_id)" .PD 0 .ie n .IP """$bool = visual_class_is_dynamic ($X, $visual_class)""" 4 .el .IP "\f(CW$bool = visual_class_is_dynamic ($X, $visual_class)\fR" 4 .IX Item "$bool = visual_class_is_dynamic ($X, $visual_class)" .PD Return true if the given visual is dynamic, meaning colormap entries on it can be changed to change the colour of a given pixel value. .Sp \&\f(CW$visual_id\fR is one of the visual ID numbers, ie. one of the keys in \&\f(CW\*(C`$X\->{\*(Aqvisuals\*(Aq}\*(C'\fR. Or \f(CW$visual_class\fR is a VisualClass string like "PseudoColor" or corresponding integer such as 3. .SS "Window Info" .IX Subsection "Window Info" .ie n .IP """($width, $height) = window_size ($X, $window)""" 4 .el .IP "\f(CW($width, $height) = window_size ($X, $window)\fR" 4 .IX Item "($width, $height) = window_size ($X, $window)" .PD 0 .ie n .IP """$visual_id = window_visual ($X, $window)""" 4 .el .IP "\f(CW$visual_id = window_visual ($X, $window)\fR" 4 .IX Item "$visual_id = window_visual ($X, $window)" .PD Return the size or visual ID of a given window. .Sp \&\f(CW$window\fR is an integer XID on \f(CW$X\fR. If it's one of the root windows then the return values are from the screen info hash in \f(CW$X\fR, otherwise the server is queried with \f(CWGetGeometry()\fR (for the size) or \&\f(CWGetWindowAttributes()\fR (for the visual). .Sp These functions are handy when there's a good chance \f(CW$window\fR might be a root window and therefore not need a server round trip. .ie n .IP """@atoms = get_property_atoms($X, $window, $property)""" 4 .el .IP "\f(CW@atoms = get_property_atoms($X, $window, $property)\fR" 4 .IX Item "@atoms = get_property_atoms($X, $window, $property)" Get from \f(CW$window\fR (integer XID) a list-of-atoms property \f(CW$property\fR (atom integer). The return is a list of atom integers, possibly an empty list. If \f(CW$property\fR doesn't exist or is not atoms then return an empty list. .ie n .IP """set_property_atoms($X, $window, $property, @atoms)""" 4 .el .IP "\f(CWset_property_atoms($X, $window, $property, @atoms)\fR" 4 .IX Item "set_property_atoms($X, $window, $property, @atoms)" Set on \f(CW$window\fR (integer XID) a list-of-atoms property \f(CW$property\fR (atom integer) as the given list of \f(CW@atoms\fR (possibly empty). .SS "Colour Parsing" .IX Subsection "Colour Parsing" .ie n .IP """($red16, $green16, $blue16) = hexstr_to_rgb($str)""" 4 .el .IP "\f(CW($red16, $green16, $blue16) = hexstr_to_rgb($str)\fR" 4 .IX Item "($red16, $green16, $blue16) = hexstr_to_rgb($str)" Parse a given RGB colour string like "#FF00FF" into 16\-bit red, green, blue components. The return values are always in the range 0 to 65535. The strings recognised are 1, 2, 3 or 4 digit hex. .Sp .Vb 4 \& #RGB \& #RRGGBB \& #RRRGGGBBB \& #RRRRGGGGBBBB .Ve .Sp If \f(CW$str\fR is unrecognised then the return is an empty list, so for instance .Sp .Vb 2 \& my @rgb = hexstr_to_rgb($str) \& or die "Unrecognised colour: $str"; .Ve .Sp 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". .Sp 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. .SH "SEE ALSO" .IX Header "SEE ALSO" X11::Protocol, X11::Protocol::GrabServer .PP Color::Library (many named colours), Convert::Color, Graphics::Color (Moose based) for more colour parsing .PP X11::AtomConstants, X11::CursorFont .SH "HOME PAGE" .IX Header "HOME PAGE" .SH LICENSE .IX Header "LICENSE" Copyright 2010, 2011, 2012, 2013, 2014, 2017, 2019 Kevin Ryde .PP 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. .PP 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. .PP You should have received a copy of the GNU General Public License along with X11\-Protocol\-Other. If not, see .