X11::P...NERAMA(3pm)
π X11::Protocol::Ext::XINERAMA β multi-monitor display information π
okay bestie, this one's X11::Protocol::Ext::XINERAMA (the file header calls it X11::P...NERAMA(3pm) because man page headers are drama queens about column width, whatever π
). It's a Perl module, and it's literally all about knowing what your monitors are doing. Let's go π¦
β¨ SYNOPSIS β¨
use X11::Protocol;
my $X = X11::Protocol->new;
$X->init_extension('XINERAMA')
or print "XINERAMA extension not available";
that's it, that's the whole vibe check π
πΈ DESCRIPTION πΈ
So Xinerama is the thing that takes two or more physical monitors and smushes them together into one single large screen. iconic behavior honestly. The XINERAMA extension is what lets clients ask questions about how that setup is actually arranged π₯
ngl there's a lil lore here: 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? Servers have only ever made one screen this way π. And the 1.1 Xinerama requests don't even have that parameter. so there's that.
if you want a whole sample program that dumps out the Xinerama state information, go peek at examples/xinerama-info.pl π
β REQUESTS β
These requests become available once you do an init_extension() β per EXTENSIONS in X11::Protocol, iykyk.
my $bool = $X->init_extension('XINERAMA');
π Xinerama 1.0
($server_major, $server_minor) = $X->PanoramiXQueryVersion ($client_major, $client_minor)β negotiate a protocol version with the server.$client_majorand$client_minorare what you would like; the returned$server_majorand$server_minorare what the server will actually do. And heads up bestie, that might be less than what you requested β but never more. The current code in this module supports up to 1.1, and the intention would be to automatically negotiate insideinit_extension()if/when that becomes necessary.$flag = $X->PanoramiXGetState ($window)β returns non-zero if Xinerama is active on the screen of$window(an XID). simple as that β¨$count = $X->PanoramiXGetScreenCount ($window)β returns the number of physical monitors on the screen of$window(an XID). count your blessings, count your monitors π($width, $height) = $X->PanoramiXGetScreenSize ($window, $monitor)β returns the size in pixels of physical monitor number$monitor(an integer,0for the first monitor) on the screen of$window(an XID).
π¦ Xinerama 1.1
$bool = $X->XineramaIsActive ()β returns non-zero if Xinerama is active on the$Xserver. periodt.@rectangles = $X->XineramaQueryScreens ()β returns the rectangular areas made up by the physical monitors. The return is a list of arrayrefs:
[ $x,$y, $width,$height ]
$x,$y is the top-left corner of the monitor in the combined screen. main character coordinates fr fr π
π BUGS π
Xsun
Rumour has it (and bestie, this is pure gossip territory) that the Xsun server with Xinerama 1.0 had a different request number 4 than the XineramaIsActive of Xinerama 1.1 above. π
<http://blogs.sun.com/alanc/entry/xinerama_protocol_clashes_on_solaris>
There's no attempt to do anything about this here, as yet. But here's the thing β if PanoramiXQueryVersion() reports 1.0, then you shouldn't be using XineramaIsActive() anyway, so there's no clash. If you do use it and it's the Xsun server, then expect either a Length error reply, or the server adapting itself to the request length and behaving as XineramaIsActive. gamble at your own risk π
PanoramiXGetScreenSize() Buffer Overrun
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. literally do not do that.
X.org some time post 1.5.x, "Prevent buffer overrun in
ProcPanoramiXGetScreenSize",
<http://cgit.freedesktop.org/xorg/xserver/commit/?id=2b266eda6e23d16116f8a8e258192df353970279>
π OTHER NOTES π
Wanna 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 Xnest or 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, if you wanna run up without bothering to look at anything at all, Xvfb in memory or a disk file. no screen, no problem π§
π SEE ALSO π
- X11::Protocol
- Initial technical details:
http://www.kernel.org/doc/als1999/Conference/IMcCartney/xinerama.html
π HOME PAGE π
<http://user42.tuxfamily.org/x11-protocol-other/index.html>
π LICENSE π
Copyright 2011, 2012, 2013, 2014, 2017 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/>.
and that's the whole page bestie π this little baddie came from perl v5.28.1, dated 2019-08-26, filed under X11::P...NERAMA(3pm). go forth and query your screens π¦β¨
π¦ where this page comes from
- debian bookworm: libx11-protocol-other-perl 31-1 Β· GPL-3.0-or-later
- debian trixie: libx11-protocol-other-perl 31-1 Β· GPL-3.0-or-later
- ubuntu jammy: libx11-protocol-other-perl 31-1 Β· GPL-3.0-or-later
- ubuntu noble: libx11-protocol-other-perl 31-1 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms