Just about everything in Gtk2 is event-driven, so if you add an event-watcher to the $image, as it's being loaded, it emits an "expose event" when displayed.
sub load_image {
...
....
....
$vp->add( $image );
# add event watcher
$image->signal_connect(
event => sub {
my ( $item, $event ) = @_;
warn "event " . $event->type . "\n";
return 0; #return 1 prevents window from closing
# return 0 lets the signal thru
}
);
.....
.....
}
Now, it would seem that you could just wait until the expose event occurs before proceeding. What the best way to do that
is probably a resettable flag $is_image_exposed, and go into a non-blocking delay until it is 1.
I havn't tested that, and there may be other ways. Read "perldoc Gtk2::Widget" and look for things like "$widget->has_screen" ( and others).
The docs for Gtk2 are pretty meager, and require alot of experimentation to get the right code.
But if you ask me, just set the delay slower. :-)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.