Re: [gtk-list] Making the event loop run normally
- From: Lyndon Drake <lyndon stat auckland ac nz>
- To: GTK+ list <gtk-list redhat com>
- Subject: Re: [gtk-list] Making the event loop run normally
- Date: Thu, 26 Nov 1998 15:18:10 +1300
I've been looking through the source of gtk_main etc. to try
to work this out for myself. As far as I can tell, I should
either just call
gtk_main();
or have a small block of code:
gtk_main_loop_level++;
old_done = iteration_done;
while(!gtk_main_iteration())
;
iteration_done = old_done;
gtk_main_loop_level--;
The only difference is that the second way of running the
event loop doesn't call the init and quit functions.
Can anyone make some informed comments on the purpose of the
init and quit function lists, and whether they need to be
called from this "inner" event loop?
Thanks,
Lyndon
On Wed, Nov 25, 1998 at 02:46:06PM +1300, Lyndon Drake wrote:
> Hi,
>
> Yet another question for the Gtk gurus out there.
>
> In R, the front end calls an eval() function, passing it an
> expression to evaluate. This expression may call R_ReadConsole,
> which (in the text mode version) just read()s from the tty.
>
> In the gtk interface, I want to read from a subclass of a text
> widget. The problem I have is how to ensure that events get
> processed while this happens.
>
> One way to do it would be to:
> while(gtk_events_pending())
> gtk_main_iteration();
> or whatever it is.
>
> The problem with that is that it will spin round in the loop,
> using up 100% processor time, for as long as it takes the user
> to type in a line.
>
> What needs to happen is:
> - R eval calls R_ReadConsole
> - R_ReadConsole enables input in my GtkConsole widget and
> connects to a signal which indicates when a line of input is
> ready.
> - R_ReadConsole should somehow get the gtk event loop running,
> so that the application's interface (especially the console
> widget) keeps going. Eventually there will be other windows
> that could (for example) accept mouse input, so I want all
> events for the application (not just the current window) to
> be processed.
>
> Can anyone suggest a function to call from my R_ReadConsole
> function that will just drop into the gtk event loop?
>
> Thanks,
> Lyndon
>
> --
> 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]