[10616] in The GTK GIMP ToolKit mailing list archive

home help back first fref pref prev next nref lref last post

[gtk-list] Re: gtk events question

daemon@ATHENA.MIT.EDU (Marc van Kempen)
Wed Dec 2 18:45:37 1998

To: Owen Taylor <otaylor@redhat.com>
Cc: gtk-list@redhat.com
In-reply-to: otaylor's message of 01 Dec 1998 16:08:35 -0500.
	     <ybelnkrin8s.fsf@fresnel.labs.redhat.com> 
Reply-to: marc@bowtie.nl
Date: Thu, 03 Dec 1998 00:43:28 +0100
From: Marc van Kempen <marc@bowtie.nl>
Resent-From: gtk-list@redhat.com

In message <ybelnkrin8s.fsf@fresnel.labs.redhat.com>, Owen Taylor writes:
>
>Marc van Kempen <marc@bowtie.nl> writes:
>
>> Hi,
>> 
>> I'm trying to execute an external program and have a 
>> popup which signals the user to wait for the program to
>> end. In my callback which executes the program I have 
>> something like:
>> 
>> jb_msg_create("wait blabla");		/* this creates the popup window */
>> 
>> /* now try to wait until the window has been created and displayed */
>
>Waiting for a window to show like this is never a good idea,
>since GTK+ usually will go idle before the X server shows
>the window and responds. Instead use:
>
>void       gtk_widget_show_now            (GtkWidget           *widget);
>
>instead of gtk_widget_show() to show your window.

[snip]
>> 
>> But this is blocking in gtk_main_iteration() and will only continue
>> after I move the mouse.
>> 
>> So what is the recommended way of handling such a scenario?
>
>gtk_events_pending() should be considered to return a boolean.
>
>Try:
>
> while (gtk_events_pending())
>   gtk_main_iteration()
>
Hi Owen,

Thanks for you suggestions.

I tried this, but it still didn't work.  After using gdk_flush() before 
the gtk_main_iteration() loop it started to work reliably.

What seems to be the problem is the fact that I have used glade for a large
part of the user interface and the method that I use to save the window
pointers of the windows that get created is to save them in the realize 
event callback for the window. That way I don't have to mess with the code
that gets created by glade, but can keep my own code and the generated
code separated.

When I copied the code into my own sourcefiles and took that callback out it 
started to work too, without the gdk_flush().

It looks a bit like black art to me, but I'll investigate further tomorrow.

Bye,
Marc.

-- 
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null


home help back first fref pref prev next nref lref last post