Hi Paolo,

Here is a small improvment on the Gtk main loop as you've said on IRC ;)

Gwen
diff --git a/packages/gtk/GtkImpl.st b/packages/gtk/GtkImpl.st
index 55be9ec..62a5881 100644
--- a/packages/gtk/GtkImpl.st
+++ b/packages/gtk/GtkImpl.st
@@ -517,8 +517,9 @@ Gtk class extend [
 
 	[
             [sem wait.
-            [context acquireWait; dispatch]
-                ensure: [context releaseSignal].
+            "[context acquireWait; dispatch]
+                ensure: [context releaseSignal]."
+	    context handle.
             loop isRunning] whileTrue]
                  ensure: [loop unref]
     ]
diff --git a/packages/gtk/MoreFuncs.st b/packages/gtk/MoreFuncs.st
index 6ef5e78..36726f8 100644
--- a/packages/gtk/MoreFuncs.st
+++ b/packages/gtk/MoreFuncs.st
@@ -1,4 +1,11 @@
 GMainContext extend [
+
+    handle [
+        <category: 'C call-outs'>
+        <asyncCCall: 'gstGtkMainContextHandle' args: #(#self )>
+
+    ]
+
     dispatch [
 	<category: 'C call-outs'>
 	<asyncCCall: 'g_main_context_dispatch' args: #(#self )>
diff --git a/packages/gtk/gst-gtk.c b/packages/gtk/gst-gtk.c
index cc5456c..aac1e2d 100644
--- a/packages/gtk/gst-gtk.c
+++ b/packages/gtk/gst-gtk.c
@@ -745,6 +745,14 @@ main_context_release_signal (GMainContext *context)
   g_mutex_unlock (mutex);
 }
 
+static void
+main_context_handle (GMainContext *context)
+{
+  main_context_acquire_wait (context);
+  g_main_context_dispatch (context);
+  main_context_release_signal (context);
+}
+
 static gpointer
 main_loop_thread (gpointer semaphore)
 {
@@ -1143,6 +1151,7 @@ gst_initModule (proxy)
   _gst_vm_proxy->defineCFunc ("gstGtkMain", create_main_loop_thread);
   _gst_vm_proxy->defineCFunc ("gstGtkMainContextAcquireWait", main_context_acquire_wait);
   _gst_vm_proxy->defineCFunc ("gstGtkMainContextReleaseSignal", main_context_release_signal);
+  _gst_vm_proxy->defineCFunc ("gstGtkMainContextHandle", main_context_handle);
   _gst_vm_proxy->defineCFunc ("gstGtkGetProperty", object_get_property);
   _gst_vm_proxy->defineCFunc ("gstGtkSetProperty", object_set_property);
   _gst_vm_proxy->defineCFunc ("gstGtkGetChildProperty", container_get_child_property);
_______________________________________________
help-smalltalk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-smalltalk

Reply via email to