atom issues



I've been using hset root as the basis of trying to set the
background for X using GTK2, below is the chunk I am currently having
issues with.

  atom_root = XInternAtom (display, "_XROOTMAP_ID", True);
  atom_eroot = XInternAtom (display, "ESETROOT_PMAP_ID", True);

  // doing this to clean up after old background
  if (atom_root != None && atom_eroot != None)
    {
      XGetWindowProperty (display, RootWindow (display, screen),
                          atom_root, 0L, 1L, False, AnyPropertyType,
                          &type, &format, &length, &after, &data_root);
      if (type == XA_PIXMAP)
        {
          XGetWindowProperty (display, RootWindow (display, screen),
                              atom_eroot, 0L, 1L, False, AnyPropertyType,
                              &type, &format, &length, &after, &data_eroot);
          if (data_root && data_eroot && type == XA_PIXMAP &&
              *((Pixmap *) data_root) == *((Pixmap *) data_eroot))
            {
              XKillClient (display, *((Pixmap *) data_root));
            }
        }
    }

  atom_root = XInternAtom (display, "_XROOTPMAP_ID", False);
  atom_eroot = XInternAtom (display, "ESETROOT_PMAP_ID", False);

  if (atom_root == None || atom_eroot == None)
    return 0;

  // setting new background atoms
  XChangeProperty (display, RootWindow (display, screen),
                   atom_root, XA_PIXMAP, 32, PropModeReplace,
                   (unsigned char *) &pixmap, 1);
  XChangeProperty (display, RootWindow (display, screen), atom_eroot,
                   XA_PIXMAP, 32, PropModeReplace, (unsigned char *) &pixmap,
                   1);


My attempt to convert this to Perl for GTK2 has resulted in the
following...

        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('XA_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);
        }

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

        $window->property_change($atom_root, $XA_PIXMAP, 32, 'replace', $pixmap, 1);
        $window->property_change($atom_eroot, $XA_PIXMAP, 32, 'replace', $pixmap, 1);

'Gdk-WARNING **: Couldn't match property type XA_PIXMAP to AnyPropertyType' is
the resulting error I get. Any suggestions?

On another note, this all appears to be a area that is completely uncovered
by any documentation or etc any where when it comes to GTK. Any one have
any suggested readings on doing stuff like this with GTK?

Attachment: signature.asc
Description: PGP signature



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