a need for accessing the internal number for Gtk2::Gdk::Atom



Hi,
I'm writing a simple standalone systray application using gtk2-perl.
In the process I've discovered a few shortcomings in the current 
bindings. One (the most important) of these is that to implement the 
protocol described by the freedesktop systray spec, my application 
needs to send a client-message event containing an actual atom number 
(as opposed to the wrapper object used by the perl bindings), but the 
Gtk2::Gdk::Atom class currently has no way to access the internal 
number. The ICCCM standards require (for example) passing atom numbers
in client-event messages. Therefore I believe adding an accessor for
the internal number is warranted. I don't see any way this can be done
automatically by the bindings, because the contents of the 'data' field 
of the client messages is not strongly typed but is defined more by
conventions (eg ICCCM).

Can anyone tell me if there is some easy way to access this number,
or if they believe I'm incorrect in any way. Otherwise I guess I'll
file a bug report or something.  I've tried using Devel::Peek, 
Data::Structure::Util, Acme::Damn and the like to peek inside the
Gtk2:Gdk::Atom data structure but without coming up with the  correct number.
In the end I have just used X11::Protocol which provides the number in
about 3 lines of code but requires opening another connection to the 
X server.

An example of the code where I need to use the internal number to
send in a client-message is shown below. The relevant part in '#####'.

sub announce_manager_selection()
{
  my ($self,$gdkOwnerWindow,$acquiredAtom,$timestamp)= _;
  
  my $root = Gtk2::Gdk::Display->get_default->get_screen(0)->get_root_window;
  my $e = new Gtk2::Gdk::Event("client-event");
  $e->send_event(1);
  $e->window($root);
  $e->message_type(atom("MANAGER"));
  $e->data_format(32);

  #the GTK perl bindings don't give us a way of getting the
  #number of the atom, so I have to use X11::Protocol;
  #I'd like to do be able to do this:
  
  ######
  my $atomNumber = $atom->number; #this method does not exist
  ######

  $e->data(
           $timestamp,
           $atomNumber, ##### needed here
           $gdkOwnerWindow->XWINDOW,
           0,0
  );

  Gtk2::Gdk::Event->send_clientmessage_toall($e);
}

cheers


-- 



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