GTK main loop

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

GTK main loop

MrGwen
Hi,

   I've tried to hack a bit the Gtk main loop, with the idea to
add a way to stop processes when pressing a key. The problem
with the current loop, when the infinite loop is running, a nested loop
should be launched because no others events are executed.

   I've changed the loop also because polling events with the current one
is sometimes so slow. So the new loop is an infinite loop that is
executed all the 8 milliseconds (5% of CPU time with top). If there is a
process  I create a new process and handle the events, but if it takes
too much time (with another delay) I create another nested event loop.

The nested process is never created, if you have any ideas, may be there
is a priority problem and the processes should be high priority ?
Or simply a bad design or idea :s

GtkLoop := [ | delay |
  delay := Delay forMilliseconds: 8.

  [
    GTK.Gtk eventsPending ifTrue: [  [ | timeout |
      timeout := Delay forMilliseconds: 500.
      timeout gtkValue: [ GTK.Gtk mainIterationDo: false ] onTimeoutDo:
[ GtkLoop forkAt: Processor timingPriority. stderr nextPutAll: 'here';
flush. ] ] fork ].
  delay
   wait; reset ] repeat
].
VisualGST open.
GtkLoop fork.

Gwen

_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk