I hit this (again) today and had a few minutes to dig a little. I'm no X
expert, just sharing here (since I could not find an existing
libx11-protocol-perl bug) what I learned hoping to move this forward...

I came up with this super hacky change to the example that makes it work:

--- /usr/share/doc/libx11-protocol-perl/examples/render-test.pl 2004-03-23
05:19:25.000000000 +0100
+++ render-test.pl 2025-11-22 07:27:26.657364957 +0100
@@ -1,11 +1,13 @@
 #!/usr/bin/perl

+use X11::Auth;
 use X11::Protocol;
 use strict;

 use IO::Select;

-my $X = new X11::Protocol;
+my ($family, $host_addr, $display_num, $auth_name, $auth_data) =
X11::Auth->new->get_one;
+my $X = new X11::Protocol($ENV{'DISPLAY'}, ['MIT-MAGIC-COOKIE-1',
$auth_data]);

 $X->init_extension("RENDER") or die;

And also this slightly less hacky one:

--- /usr/share/doc/libx11-protocol-perl/examples/render-test.pl 2004-03-23
05:19:25.000000000 +0100
+++ render-test2.pl 2025-11-22 07:37:42.426902814 +0100
@@ -1,11 +1,15 @@
 #!/usr/bin/perl

+use Net::Domain qw(hostname);
+use X11::Auth;
 use X11::Protocol;
 use strict;

 use IO::Select;

-my $X = new X11::Protocol;
+my $hostname = hostname();
+my $auth_data = X11::Auth->new->get_by_host($hostname, 'Local');
+my $X = new X11::Protocol($ENV{'DISPLAY'}, ['MIT-MAGIC-COOKIE-1',
$auth_data]);

 $X->init_extension("RENDER") or die;


FTR the output from xauth list on my system is:
butla/unix:  MIT-MAGIC-COOKIE-1  A-HEX-STRING
#ffff#6275746c61#:  MIT-MAGIC-COOKIE-1  A-HEX-STRING

while the output from:

perl -MX11::Auth -e 'foreach my $a (X11::Auth->new->get_all){foreach my $e
(@$a){print "[".$e."]";}; print "\n"}'|less

is

[Local][butla][][MIT-MAGIC-COOKIE-1][RX3-NON-ASCII-CHARS]
[Wild][butla][][MIT-MAGIC-COOKIE-1][RX3-NON-ASCII-CHARS]

Marcin

Reply via email to