Re: atom issues



Hi  Zane

with a bit of tweaking (code pasted below), and using "PIXMAP" as kevin suggested,
your example works for me. However having said that, even if my code has "XA_PIXMAP",
it works for me with no gtk errors printed (and xprop shows a new property).

If I use "PIXMAP" I get the following output 
(also notably, the ESETROOT_PMAP_ID one doesn't show up):

----
  realize
  Before:
  replace root
  replace eroot
  After:
  _XROOTMAP_ID(PIXMAP): pixmap id # 0xabcd

-----

use Gtk2 -init;
my $win=new Gtk2::Window -toplevel;

$win->signal_connect('realize', sub {

        print STDERR "realize\n";
        my $window=$win->window;

        my $atom_root=Gtk2::Gdk::Atom->intern("_XROOTMAP_ID", 1);
        my $atom_eroot=Gtk2::Gdk::Atom->intern("ESETROOT_PMAP_ID", 1);

        my $XA_PIXMAP=Gtk2::Gdk::Atom->new('PIXMAP', 0);

        #if the atoms already exist we need to do something...
        if (defined($atom_root) && defined($atom_eroot)) {
                my $any=Gtk2::Gdk::Atom->new("AnyPropertyType", 0);
                my ($type, $format, $data)=$window->property_get($atom_root, $any, 0, 1, 0);
        }
        my $pixmap = 0xabcd;#random number that we can recognise

        $atom_eroot=Gtk2::Gdk::Atom->intern("_XROOTMAP_ID", 0);
        $atom_eroot=Gtk2::Gdk::Atom->intern("ESETROOT_PMAP_ID", 0);
        print STDERR "Before:\n";
        system("sleep 1; xprop -id ".$window->XWINDOW." | grep MAP_ID");
        print STDERR "replace root\n";
        $window->property_change($atom_root, $XA_PIXMAP, 32, 'replace', $pixmap, 1);
        print STDERR "replace eroot\n";
        $window->property_change($atom_eroot, $XA_PIXMAP, 32, 'replace', $pixmap, 1);
        print STDERR "After:\n";
        system("sleep 1; xprop -id ".$window->XWINDOW."| grep MAP_ID");
} );
$win->show_all;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]