[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gtk-app-devel
Subject:    Re: I can't understand the difference output of only a line differ
From:       Binary Chen <binary.chen () gmail ! com>
Date:       2007-12-06 11:40:37
Message-ID: 1196941238.12516.24.camel () binch-laptop
[Download RAW message or body]

On Thu, 2007-12-06 at 11:33 +0000, Emmanuele Bassi wrote:
> there's no need to reply to me: I'm subscribe to the list, so reply
> there.
> 
> On Thu, 2007-12-06 at 18:54 +0800, Binary Chen wrote:
> > On Thu, 2007-12-06 at 10:41 +0000, Emmanuele Bassi wrote:
> > > On Thu, 2007-12-06 at 17:40 +0800, Binary Chen wrote:
> > > 
> > > > 	while (1) {
> > > > 		sleep(1);
> > > > 		gdk_draw_image(drawing->window, gc, img, 0, 0, 0, 0, 200, 200);
> > > > 	}
> > > 
> > > you are blocking with your own loop before entering inside the gtk+ main
> > > loop with the following call:
> > > 
> > > > 	gtk_main();
> > > 
> > But without the sleep() I will also not reach gtk_main(), but the window
> > shows, why? What I am asking is this.
> 
> gdk_draw_image() forces a flush. but that is not the problem: you should
> never use a while() loop inside a GTK+ application, because you are
> effectively blocking the real main loop from spinning. remember: GTK+ is
> not threaded.

Yes, I know GTK+ is not threaded, there is only one thread running, so
this make things more complecated, whats loop am I prohibit running?
Again I'd like to say in both testing the gtk_main() is not running at
all, so whats the difference? Can you point out the exact source of such
headache problem?
> 
> use a timeout or an idle source to repaint your window with the
> GdkImage.
> 
This is just a testing program, not production code, I just want to find
out whats happening.

Thanks.


_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic