[cl-gtk2-devel] how to send messages to a window?

Kalyanov Dmitry kalyanov.dmitry at gmail.com
Wed Apr 21 18:04:57 UTC 2010


On Wednesday 21 April 2010 12:50:47, Tamas Papp wrote:
> Hi,
> 
> How can I send an "expose" message to a window from _outside_ the main
> loop?

Basically, you can't. You should call queue-widget-draw function inside main 
loop by means of within-main-loop-and-wait (this macro will wait until your 
code actually completes in the main loop and returns its return value) or 
within-main-loop (this macro will not wait until your code finishes or even 
starts executing and returns immediately). Call to this function marks the 
widget area as invalidated and at the next occasion (at the next iteration of 
gtk+ event loop) Gtk+ will repaint the widget.

> But when I call sync, sometimes I get "unmapped memory area" errors
> for GObject callbacks.  The whole code is available here:
> http://github.com/tpapp/cl-cairo2/tree/master/src/gtk2/

Could you provide more information, a stack trace? Where does this message 
comes from - is it a Lisp exception or cairo error message or gtk error 
message? Does it occur randomly or deterministically?

The code looks fine except for several issues:
1) in create-gtk2-xlib-context you can use within-main-loop-and-wait instead 
of within-main-loop
2) (incf (sync-counter-object)) is not atomic - you should use a real lock 
(bordeaux-threads provides portable locking API)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <https://mailman.common-lisp.net/pipermail/cl-gtk2-devel/attachments/20100421/dbbdee09/attachment.sig>


More information about the cl-gtk2-devel mailing list