From: jiandingzhe msn com To: mario kemper googlemail com Subject: RE: Goo::Canvas deadlock on Gtk2::Gdk::Threads->enter Date: Mon, 10 May 2010 06:17:19 +0000 Is that means while I want to change UI in a working thread, it always needs to be done in a Idle time? > Subject: RE: Goo::Canvas deadlock on Gtk2::Gdk::Threads->enter > From: mario kemper googlemail com > To: jiandingzhe msn com > Date: Sat, 8 May 2010 13:24:56 +0200 > > perldoc Glib::MainLoop > > Using Glib::Idle ensures that your are only making GTK library calls > from the main thread. > > Regards > Mario > > Am Samstag, den 08.05.2010, 03:25 +0000 schrieb Xi Yang: > > That works well, thanks! > > But where are the documents of Glib::Idle? I can't find any perldoc > > about it. > > > > > Subject: Re: Goo::Canvas deadlock on Gtk2::Gdk::Threads->enter > > > From: mario kemper googlemail com > > > To: jiandingzhe msn com > > > CC: gtk-perl-list gnome org > > > Date: Fri, 7 May 2010 14:04:09 +0200 > > > > > > Does this help? > > > > > > sub on_add { > > > Glib::Idle->add(sub{ > > > Gtk2::Gdk::Threads->enter; > > > Goo::Canvas::Rect->new( > > > $root,100,100,50,120 > > > ); > > > Gtk2::Gdk::Threads->leave; > > > return FALSE; > > > }); > > > } > > > > > > > > > Regards > > > Mario > > > > > > Am Freitag, den 07.05.2010, 07:07 +0000 schrieb Xi Yang: > > > > #!/usr/bin/perl > > > > use strict; > > > > > > > > use threads; > > > > use threads::shared; > > > > > > > > use Glib qw/TRUE FALSE/; > > > > use Gtk2 qw/-ini t -threads-init/; > > > > use Goo::Canvas; > > > > < br>> > > > Glib::Object->set_threadsafe(TRUE); > > > > > > > > # create window > > > > my $win = Gtk2::Window->new; > > > > $win->signal_connect( destroy => sub { Gtk2->main_quit; } ); > > > > $win->set_title('children rendering test'); > > > > > > > > my $vbox = Gtk2::VBox->new( FALSE, 6 ); > > > > $win->add($vbox); > > > > > > > > # create Add button > > > > my $hbox = Gtk2::HBox->new(FALSE,6); > > > > $vbox->pack_start($hbox,FALSE,FALSE,0); > > > > > > > > my $but_add_node = Gtk2::Button->new('Add'); > > > > $hbox->pack_start($but_add_node,FALSE,FALSE,0); > > > > $but_add_node->signal_connect('clicked'=>\&on_add); > > > > > > > > # create the c anvas > > > > my $canvas = Goo::Canvas->new(); > > > > my $root = $canvas->get_root_item; > > > > $canvas-& gt;set_size_request( 800, 500 ); > > > > $vbox->pack_start( $canvas, FALSE, FALSE, 0 ); > > > > > > > > # enter mainloop > > > > $win->show_all; > > > > Gtk2->main; > > > > > > > > sub on_add { > > > > Gtk2::Gdk::Threads->enter; > > > > Goo::Canvas::Rect->new( > > > > $root,100,100,50,120 > > > > ); > > > > Gtk2::Gdk::Threads->leave; > > > > } > > > > > > > > > ______________________________________________________________________ > > Your E-mail and More On-the-Go. Get Windows Live Hotmail Free. Sign up > > now. > > __________________ _____________________________ > > gtk-perl-list mailing list > > gtk-perl-list gnome org > > http://mail.gnome.org/mailman/listinfo/gtk-perl-list > > Hotmail: Free, trusted and rich email service. Get it now. Hotmail: Free, trusted and rich email service. Get it now. |