[Gd-chatter] r11385 - in branches/opendylan-melange: gtk gtk-duim
andreas at gwydiondylan.org
andreas at gwydiondylan.org
Wed May 30 00:41:53 CEST 2007
Author: andreas
Date: Wed May 30 00:41:51 2007
New Revision: 11385
Modified:
branches/opendylan-melange/gtk-duim/gtk-events.dylan
branches/opendylan-melange/gtk-duim/gtk-mirror.dylan
branches/opendylan-melange/gtk-duim/gtk-port.dylan
branches/opendylan-melange/gtk-duim/gtk-top.dylan
branches/opendylan-melange/gtk/gtk.dylan
branches/opendylan-melange/gtk/module.dylan
Log:
job: fd
Separate thread for event handling. Multi-threaded
GTK is apparently not supported on Win32, according to
documentation...
Modified: branches/opendylan-melange/gtk-duim/gtk-events.dylan
==============================================================================
--- branches/opendylan-melange/gtk-duim/gtk-events.dylan (original)
+++ branches/opendylan-melange/gtk-duim/gtk-events.dylan Wed May 30 00:41:51 2007
@@ -28,7 +28,9 @@
=> (timed-out? :: <boolean>)
//--- We should do something with the timeout
ignore(timeout);
- gtk-main-iteration();
+ with-gdk-lock
+ gtk-main-iteration();
+ end;
#f;
end method process-next-event;
Modified: branches/opendylan-melange/gtk-duim/gtk-mirror.dylan
==============================================================================
--- branches/opendylan-melange/gtk-duim/gtk-mirror.dylan (original)
+++ branches/opendylan-melange/gtk-duim/gtk-mirror.dylan Wed May 30 00:41:51 2007
@@ -189,7 +189,9 @@
(_port :: <gtk-port>, sheet :: <sheet>, mirror :: <widget-mirror>) => ()
let widget = mirror-widget(mirror);
duim-debug-message("Showing %=", sheet);
- gtk-widget-show(widget)
+ with-gdk-lock
+ gtk-widget-show(widget)
+ end
end method map-mirror;
define sealed method unmap-mirror
Modified: branches/opendylan-melange/gtk-duim/gtk-port.dylan
==============================================================================
--- branches/opendylan-melange/gtk-duim/gtk-port.dylan (original)
+++ branches/opendylan-melange/gtk-duim/gtk-port.dylan Wed May 30 00:41:51 2007
@@ -25,8 +25,8 @@
define sealed method initialize
(_port :: <gtk-port>, #key server-path) => ()
- next-method();
initialize-gtk();
+ next-method();
/*---*** What to do here?
let type = head(server-path);
let display = get-property(tail(server-path), #"display",
@@ -52,7 +52,7 @@
define sideways method class-for-make-port
(type == #"gtk", #rest initargs, #key)
=> (class :: <class>, initargs :: false-or(<sequence>))
- values(<gtk-port>, concatenate(initargs, #(event-processor-type:, #"n")))
+ values(<gtk-port>, concatenate(initargs, #(event-processor-type:, #"n+1")))
end method class-for-make-port;
define sealed method port-type
Modified: branches/opendylan-melange/gtk-duim/gtk-top.dylan
==============================================================================
--- branches/opendylan-melange/gtk-duim/gtk-top.dylan (original)
+++ branches/opendylan-melange/gtk-duim/gtk-top.dylan Wed May 30 00:41:51 2007
@@ -388,7 +388,9 @@
mirror :: <top-level-mirror>)
=> ()
let widget = mirror-widget(mirror);
- gtk-widget-show(widget)
+ with-gdk-lock
+ gtk-widget-show(widget)
+ end
end method map-mirror;
define sealed method unmap-mirror
Modified: branches/opendylan-melange/gtk/gtk.dylan
==============================================================================
--- branches/opendylan-melange/gtk/gtk.dylan (original)
+++ branches/opendylan-melange/gtk/gtk.dylan Wed May 30 00:41:51 2007
@@ -167,23 +167,35 @@
if(run-after?) 1 else 0 end)
end function g-signal-connect;
+define macro with-gdk-lock
+ { with-gdk-lock ?:body end }
+ =>
+ { block()
+ gdk-threads-enter();
+ ?body
+ cleanup
+ gdk-threads-leave();
+ end }
+end;
+
define function initialize-gtk
() => ()
g-thread-init(null-pointer(<GThreadFunctions>));
gdk-threads-init();
- gdk-threads-enter();
- let name = application-name();
- with-c-string (string = name)
- let string* = make(<C-string*>, element-count: 1);
- string*[0] := string;
- let string** = make(<char***>);
- string**[0] := string*;
- let int* = make(<C-int*>);
- int*[0] := 1;
- %gtk-init(int*, string**);
- destroy(string*);
- destroy(string**);
- destroy(int*)
+ with-gdk-lock
+ let name = application-name();
+ with-c-string (string = name)
+ let string* = make(<C-string*>, element-count: 1);
+ string*[0] := string;
+ let string** = make(<char***>);
+ string**[0] := string*;
+ let int* = make(<C-int*>);
+ int*[0] := 1;
+ %gtk-init(int*, string**);
+ destroy(string*);
+ destroy(string**);
+ destroy(int*)
+ end;
end;
automatic-finalization-enabled?() := #t;
end function initialize-gtk;
Modified: branches/opendylan-melange/gtk/module.dylan
==============================================================================
--- branches/opendylan-melange/gtk/module.dylan (original)
+++ branches/opendylan-melange/gtk/module.dylan Wed May 30 00:41:51 2007
@@ -14,5 +14,6 @@
gtk-widget-get-window,
gtk-widget-get-state,
property-getter-definer,
- property-setter-definer;
+ property-setter-definer,
+ \with-gdk-lock;
end;
More information about the chatter
mailing list