Re: Announcing: Perl bindings for LibSoup

On Fri, Jun 24, 2011 at 11:27, Emmanuele Bassi <ebassi gmail com> wrote:
On 2011-06-24 at 08:24, Emmanuel Rodriguez wrote:

I do have other errors, but that's because I assume that the widget is
already allocated which is not always true. What's the best way to
detect if a widget is displayed and rendered so I can grab a

connect to the ::map signal.

Thanks for the tip.

The bug that I encounter is a bit strange as it turns out that the
widget is already mapped, yet i get the strange error that i pasted
before. The widget in question is a WebKit View which is not a simple

I think that what happens is that while the widget can be mapped some
internal/embedded widgets are not yet fully prepared as they are
waiting for the network layer to return the data (HTML) that's needed
to render them. I believe that in my case an iframe wasn't rendered
yet (a facebook iframe) since i was running my program without a
network connection. So the facebook iframe couldn't be loaded and
probably one of the widgets needed to render that element wasn't in
the right state yet.

Adding a Glib->idle() callback and performing the Cairo screencapture
there seems to fix the problem. I'm hopping that the idle callback
runs after the libsoup callbacks that webkit as registered for
tracking the network responses in order to update it's widgets.

I would like to thank you all for your help. Thanks to your guidance I
was able to prepare a Gtk2::WebKit talk for the French Perl Workshop
this last week. You can find the slides (en franÃais) and sample code
(in english) in this repo

There are random little hacks that show us how to play with webkit in
order to do other things that to render widget in a canvas:
- track resources
- take screenshots (png, pdf, postscript and svg)
- convert S5 presentations into PDF slides

Are you guys aware if there's a way to use Gtk 2 or 3 in a pure
offscreen mode that wouldn't require an X server? I've read that the
clutter folks made some patches to a custom version of webkit that
worked on offscreen mode but I haven't seen them merged.

The closes that I can get to offscreen rendering is to use
Gtk3::OffscreenWindow instead of Gtk2::Window and to start my program
with this wrapper
xvfb-run --server-args="-screen 0 1024x768x24" "$@"

If I don't have DISPLAY set as soon as I call Gtk3::init() my script dies.

Emmanuel Rodriguez

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