X11::Protocol::Ext::TOG_CUP3pm
Colormap utilization policy extension
Usage
use X11::Protocol;my $X = X11::Protocol->new;$X->init_extension('TOG-CUP')or print "TOG-CUP extension not available";
Overview
The TOG-CUP extension helps applications with private colormaps use the same pixel for the same color in different colormaps.
Using common pixel values, were possible, means that when a private colormap is in use ("$x->InstallColormap()", usually done by the window manager) some of the colours in other windows will still appear correctly.
Note that this extension makes a subtle change to the core "$X->AllocColor()" and "$X->AllocNamedColor()" requests. Normally they allocate the first available pixel, but with TOG-CUP if there's a matching colour in the default colormap and that same pixel in the target colormap is free then that pixel is allocated, thus making that colour the same in the two colormaps.
Requests
The following are made available with an init_extension() per "EXTENSIONS" in X11::Protocol.
my $bool = $X->init_extension('TOG-CUP');
- "($server_major, $server_minor) = $X->CupQueryVersion ($client_major, $client_minor)"
-
Negotiate a protocol version with the server.
$client_majorand$client_minoris what the client would like, the returned$server_majorand$server_minoris what the server will do, which might be different.The current code supports up to 1.0. The intention would be to automatically negotiate in
init_extension()if necessary, which it's currently not.
- "@colors = $X->CupGetReservedColormapEntries ($screen)"
-
Return a list of reserved colormap entries in the default colormap of screen number
$screen(an integer 0 upwards). Each returned element is an arrayref[ $pixel, $red16, $blue16, $green16, $alloc_flags ]$red16,$blue16and$green16are RGB colour components in the range 0 to 65535.$alloc_flagsis currently unused.Reserved colours are pre-allocated and unchanging. The core protocol specifies
"$X->{'black_pixel'}"and"$X->{'white_pixel'}"and they're included in the result, plus any further colours which might be reserved.For example under the MS-DOS graphical overlay manager there's a certain set of "desktop" colours which a server on that system might treat as reserved.
- "@colors = $X->CupStoreColors ($colormap, [$pixel,$red16,$green16,$blue16],...)"
-
Allocate read-only colours in
$colormapat particular pixels.Each argument is an arrayref of desired pixel and RGB colour. (A
$do_maskparameter can be present at the end too but is unused and can be omitted.)[ $pixel, $red16, $blue16, $green16 ]The desired colour is allocated shareable read-only (like
"$X->AllocColor()") at the given$pixelif possible, or another if necessary. The return is a similar list of arrayref elements, one for each argument[ $pixel, $red16, $blue16, $green16, $alloc_flags ]The returned
$pixelmight differ from what was requested. If the requested$pixelis already allocated, and it has a different colour, then another pixel value is chosen.The returned RGB components are the actual colour shade allocated. This might differ if the visual has limited colour resolution (which is likely).
The returned
$alloc_flagshas bit 0x08 set if the pixel was successfully allocated, or clear if not. Other bits in$alloc_flagsare currently unused.For example
my @ret = $X->CupStoreColors($colormap,[ 2, 65535,0,0], # red[ 3, 0,65535,0], # green[ 4, 16383,16383,16383]); # greyforeach my $elem (@ret) {my ($pixel, $red,$green,$blue, $alloc_ok) = @$elem;my $ok = ($alloc_ok & 8 ? "allocated" : "oops, not allocated");print "at $pixel actual $red,$green,$blue $ok\n";}
Home page
<http://user42.tuxfamily.org/x11-protocol-other/index.html>
Releases
7 releases since Debian 8 (Jessie); the text changed 4 times.