I'm working on a program, WebDVD[1], that renders pages in Mozilla
(using GtkMozEmbed) and then takes screenshots of them. Thanks to a
lot of earlier help from Boris Zbarsky, I have been able to make a
fairly good job of this. However, I now find that the logic I've used
to wait for a page to finish loading and rendering does not seem to
wait for background images to load.
In my window class, I have two member variables to track loading
progress:
int pending_req_count_; // initialised to 0
bool pending_window_update_; // initialised to false
When I start loading a page, I set pending_window_update_ to true. I
use the following code in the signal handler for the net_state_change
signal:
if (flags & GTK_MOZ_EMBED_FLAG_IS_REQUEST)
{
if (flags & GTK_MOZ_EMBED_FLAG_START)
++pending_req_count_;
if (flags & GTK_MOZ_EMBED_FLAG_STOP)
{
assert(pending_req_count_ != 0);
--pending_req_count_;
}
}
if (flags & GTK_MOZ_EMBED_FLAG_STOP
&& flags & GTK_MOZ_EMBED_FLAG_IS_WINDOW)
{
// Check whether the load was successful, ignoring this
// pseudo-error.
if (status != NS_IMAGELIB_ERROR_LOAD_ABORTED)
check(status);
pending_window_update_ = false;
}
if (pending_req_count_ == 0 && !pending_window_update_)
{
// Here I start working on the page.
}
How can I change this code to wait for background images too?
The full source code can be downloaded from the following URL, if you
wish to look into this further.
[1] http://womble.decadentplace.org.uk/software/#webdvd
--
Ben Hutchings
Every program is either trivial or else contains at least one bug
_______________________________________________
mozilla-embedding mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-embedding