X11::P...NERAMA(3pm)

πŸ“¦
version 31 Β· 7 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble

πŸ’– 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_major and $client_minor are what you would like; the returned $server_major and $server_minor are 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 inside init_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, 0 for 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 $X server. 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 🌟


πŸŽ€ 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