Re: Replacing Test::WWW::Selenium::Catalyst with Gtk3::WebKit



On 28.11.2011 09:22, Stefan Seifert wrote:
So my new approach is to generate a key event at Gtk3 level and send it to the
Webkit widget. After all this would be even more realisitc. But again this is
quite difficult. There is a Gtk3::Gdk::Event class available, but no
Gtk3::Gdk::Event::Key or Gtk3::Gdk::EventKey or anything like that. From
reading the .gir file the latter should exist, but it just doesn't. If it's
missing in the bindings, how could I add it? And even if I could create it, I
still don't know how to actually set the keycode field in the struct. There's
pretty much no documentation and lot's of guess work on how Perl maps to
Gtk3...

Gtk3::Gdk::Event is one of the remaining construction sites for Glib::Object::Introspection/Gtk3 (the only other one is probably Gtk3::TreeIter in custom Gtk3::TreeModel implementations).

You can create new events with Gtk3::Gdk::Event->new($type):

  http://developer.gnome.org/gdk3/stable/gdk3-Events.html#gdk-event-new
  http://developer.gnome.org/gdk3/stable/gdk3-Events.html#GdkEventType

You can also read struct fields by accessing the correct union member:

  $event->key->{keyval}

But there's no support for setting struct fields yet. (You can of course assign something to $event->key->{keyval}, but that won't change the underlying event object at the moment.)



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