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

Tamas Papp tkpapp at gmail.com
Fri May 7 12:16:35 UTC 2010


On Wed, 21 Apr 2010, Kalyanov Dmitry wrote:

> 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)

I am still chasing this bug.  I did the changes you suggested, and it
worked.  Once.  Then I made other changes, and they seemed to fix the
problem - but only once.

So I figured that this must have something to do with compile-time and
runtime: my guess is that something (a memory address, etc) is
determined at compile time, and next time ASDF just loads the file
without recompiling and some assumption proves to be incorrect.

This is confirmed by the following: if I delete the *.fasl files --
even if only in cl-cairo2's src/gtk2/ subdirectory -- everything works
just fine.  To reproduce bug, one only has to do a
restart-inferior-lisp and reload the libraries.

I get these warnings when compiling src/gtk2/gtk2.lisp, I don't know
if they are relevant:

WARNING: GType GdkWindow is not known to GObject
WARNING: GType GdkWindow is not known to GObject
WARNING:
   Declared GType name 'GdkWindow' for class 'GDK-WINDOW' is invalid (g_type_name returned 0)
WARNING: GType GtkFileChooserEmbed is not known to GObject
WARNING: GType GtkFileChooserEmbed is not known to GObject
WARNING:
   Declared GType name 'GtkFileChooserEmbed' for class 'FILE-CHOOSER-EMBED' is invalid (g_type_name returned 0)
WARNING: GType LispArrayListStore is not known to GObject
WARNING: GType LispArrayListStore is not known to GObject
WARNING:
   Declared GType name 'LispArrayListStore' for class 'ARRAY-LIST-STORE' is invalid (g_type_name returned 0)
WARNING: GType LispTreeStore is not known to GObject
WARNING: GType LispTreeStore is not known to GObject
WARNING:
   Declared GType name 'LispTreeStore' for class 'TREE-LISP-STORE' is invalid (g_type_name returned 0)

As before, the source is at
http://github.com/tpapp/cl-cairo2/tree/master/src/gtk2/.

Any help would be appreciated.  Best,

Tamas




More information about the cl-gtk2-devel mailing list