Re: [gtk-list] how to instantly drawing



Hi, 

the behaviour you report makes sense. Since you're calling 
sleep(), your process really is sleeping, thus also not drawing 
the line you just drew ... you probably want to use a timeout 
callback for this, as this will return control to gtk ... your function 
could look like this

int	status = 0;
int mydraw ()
{
	if (status == 0)
		drawline (red, ...)
	if (status == 1)
		drawline (green, ...)
	status ++;
	return 0;
}

If you call this function through a timeout callback, it should work ...

Greetings
--> R

On Tue, 21 Dec 1999, Jiang XU wrote:
> I try to paint on the GtkWidget->window .
> For example, I have a GtkWindow called "mainwindow", I try to draw on
> its GdkWindow that is mainwindow->window.
> I try to draw a red line, then after 1 second I will draw a green line
> at the same place.
> 
> so the code will be look like:
> 
> drawline(red, mainwindow->window,...);
> sleep(1);
> drawline(green, mainwindow->window,..);
> 
> But what happened is: each time it only shows up the green line, never
> see the red line, even didnot see the screen reflesh.
> 
> I know I can put the code in the configure event call back function of
> the mainwindow.  But I donot want to reflesh the whole screen, so I
> didn't send out the configure_event signal .
> 
> I wonder whether there is a way to instantly draw on the GdkWIndow
> (which is GtkWidget->window), and show on the screen immediately!!
> 
> I  appreciate any Help! If someone knows, Please teach me ASAP,
> 
> Thanks very much
> 
> Jiang
> 
> -- 
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]