X11::Protocol::Ext::XINERAMA - multi-monitor display information
use X11::Protocol; my $X = X11::Protocol->new; $X->init_extension('XINERAMA') or print "XINERAMA extension not available";
Xinerama puts together two or more physical monitors to make a single large screen. The XINERAMA extension allows clients to enquire about the setup.
The 1.0 "PanoramiX" requests take a
$window parameter apparently to allow for more than one X screen made up of multiple physical monitors, but in practice the servers have only made one screen this way and the 1.1 "Xinerama" requests don't have that.
See examples/xinerama-info.pl in the sources for a sample program dumping the Xinerama state information.
The following requests are made available with an
init_extension() per "EXTENSIONS" in X11::Protocol.
my $bool = $X->init_extension('XINERAMA');
($server_major, $server_minor) = $X->PanoramiXQueryVersion ($client_major, $client_minor)
Negotiate a protocol version with the server.
$client_minor is what the client would like, the returned
$server_minor is what the server will do, which might be less than requested (but not more).
The current code in this module supports up to 1.1. The intention would be to automatically negotiate within
init_extension() if/when necessary,
$flag = $X->PanoramiXGetState ($window)
Return non-zero if Xinerama is active on the screen of
$window (an XID).
$count = $X->PanoramiXGetScreenCount ($window)
Return the number of physical monitors on the screen of
$window (an XID).
($width, $height) = $X->PanoramiXGetScreenSize ($window, $monitor)
Return the size in pixels of physical monitor number
$monitor (integer, 0 for the first monitor) on the screen of
$window (an XID).
$bool = $X->XineramaIsActive ()
Return non-zero if Xinerama is active on the
@rectangles = $X->XineramaQueryScreens ()
Return the rectangular areas made up by the physical monitors. The return is a list of arrayrefs,
[ $x,$y, $width,$height ]
$y is the top-left corner of the monitor in the combined screen.
Rumour has it the
Xsun server with Xinerama 1.0 had a different request number 4 than the
XineramaIsActive of Xinerama 1.1 above.
There's no attempt to do anything about this here, as yet. If
PanoramiXQueryVersion() reports 1.0 then you shouldn't use
XineramaIsActive() anyway, so no clash. If you do and it's the
Xsun server then expect either a Length error reply, or the server to adapt itself to the request length and behave as
Early server code such as X11R6.4 might not range check the monitor number in
PanoramiXGetScreenSize(). Did big values read out fragments of arbitrary memory, or cause a segfault? Don't do that.
X.org some time post 1.5.x, "Prevent buffer overrun in ProcPanoramiXGetScreenSize", http://cgit.freedesktop.org/xorg/xserver/commit/?id=2b266eda6e23d16116f8a8e258192df353970279
To simulate some Xinerama for testing the
Xdmx server can multiplex together two or more other servers to present one big screen. Those sub-servers can even be
Xephyr windows on an existing X display. For example running up
Xdmx as display ":102",
Xephyr :5 -screen 200x100 & Xephyr :6 -screen 190x110 & sleep 1 Xdmx -display :5 -display :6 +xinerama -input :5 -input :6 :102
Xephyr implements some extensions natively, whereas
Xnest relies on the target server capabilities. Or to run up without bothering to look at anything
Xvfb in memory or a disk file.
Initial technical details
Copyright 2011, 2012, 2013 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/>.