Re: Displaying a popup before the main window
- From: Kevin Ryde <user42 zip com au>
- To: Nicolas Courtel <courtel cena fr>
- Cc: gtk-perl-list gnome org
- Subject: Re: Displaying a popup before the main window
- Date: Wed, 15 Sep 2010 08:15:35 +1000
Nicolas Courtel <courtel cena fr> writes:
the popup shows up empty, and
I can't figure out what I've done wrong.
It's only drawn when a map/expose/etc comes back from the server, by
which time you're off doing other things.
A window with a background pixmap can show without any action from the
app program. Eg. per below, except that recent gtk has broken
set_cursor() on new windows like this, so you don't get the busy cursor.
It ought to send an XSetCursor, but for some reason waits to interact
with the server :-(.
Making the image is a bit tedious. Is there a library to do a whole
temporary popup already? You'd probably want a sub-window to avoid a
window resize tiling with the image. Or turn that off in the wm hints,
or use 'popup' window type, or all three :).
use Gtk2 -init;
my $pixbuf = Gtk2::Gdk::Pixbuf->new_from_file
my $width = $pixbuf->get_width;
my $height = $pixbuf->get_height;
my $popup = Gtk2::Window->new ('toplevel');
$popup->set_default_size ($width, $height);
my $win = $popup->window;
my $gc = $popup->style->bg_gc('normal');
my $pixmap = Gtk2::Gdk::Pixmap->new ($win, $width, $height, -1);
$pixmap->draw_rectangle ($gc, 1, 0,0, $width,$height); # clear
$pixmap->draw_pixbuf ($gc, $pixbuf, 0,0, 0,0, $width,$height, 'none', 0,0);
my $window = Gtk2::Window->new;
$window->set_title ("My window");
my $label = Gtk2::Label->new ("Hello, world!");
] [Thread Prev