[cl-gtk2-devel] UNS: how to send messages to a window?
Olof-Joachim Frahm
Olof.Frahm at web.de
Wed Apr 21 14:17:14 UTC 2010
Tamas Papp <tkpapp at gmail.com> writes:
> I need this for the following: I have a Cairo xlib image surface on
> which I am drawing. Whenever the window needs to be repainted
> (configure/expose events), the contents of the xlib image surface are
> copied onto the window. But I need the window to be manually updated
> whenever I have drawn something new on it (basically, I am drawing
> from the REPL).
When I tried that (drawing from the REPL), I didn't seem like repainting
was necessary, but maybe that has something to do with my remote X
connection ...
> 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/
For what it's worth: trying the code from the repo above, I don't get
any errors; e.g. when I:
> (dotimes (i 50) (sync *context*))
. Also, to schedule the repaint with WITHIN-MAIN-LOOP sounds good to me
since every access then still comes from the GTK main loop ...
Regarding generating expose events/repainting: something like
> (gtk:within-main-loop
> (set-source-color cl-colors:+blue+)
> (move-to 300 200)
> (line-to 200 300)
> (stroke)
> (repaint-drawing-area (slot-value *context* 'cairo-drawing-area)))
as described in [1] should to the trick.
And now just a guess, but does this change anything (returning a boolean
value):
> (defmethod initialize-instance :after ((w cairo-drawing-area) &rest initargs)
> (declare (ignore initargs))
> (gobject:connect-signal w "configure-event"
> (lambda (widget event)
> (declare (ignore event))
> (repaint-drawing-area widget)
> T))
> (gobject:connect-signal w "expose-event"
> (lambda (widget event)
> (declare (ignore event))
> (repaint-drawing-area widget)
> T)))
HTH and maybe with some testing I'll see that error too,
Olof
[1]: http://library.gnome.org/devel/gtk/stable/GtkWidget.html#gtk-widget-queue-draw
--
The world is burning. Run.
More information about the cl-gtk2-devel
mailing list