[Gtk-sharp-list] Exposes Constantly

Adam Tauno Williams adam at morrison-ind.com
Thu Dec 13 09:22:04 EST 2007


I'm creating a widget in Gtk# which contains a Drawing area.  When an
expose event occurs I create a Cairo context from the Gdk Window of the
drawing area and I draw on it.  It is working well, but the Expose event
seems to fire *CONSTANTLY* so the Widget just sits there soaking up
nearly an entire core.  The window isn't being moved or resized and
nothing is passing over the widget.  Am I missing something?

Possibly the issue is because the drawing area is scrollable? (Even
though it isn't being scrolled).

The expose even of the drawing area is linked to -
protected virtual void OnAreaExposeEvent (object o, Gtk.ExposeEventArgs
args)
    {
      Draw ();
    }

And Draw just creates the Cairo context and draws on it.


public void Draw ()
{
  ....
  Console.WriteLine("Draw: (width={0},height={0})", width, height);   
  cairo = Gdk.CairoHelper.Create (area.GdkWindow);
  ...
  ...
  ((IDisposable) cairo.Target).Dispose();
  (IDisposable) cairo).Dispose ();
}

I see the "Draw: ... " message non-stop.

This is the first time I've used DrawingArea or Cairo as I'm not a
graphics guy at all,  but I really need a weekview calendar widget for
Gtk# and none seem to be available.   So far Cairo seems very nice to
use, and fast;  I've been able to draw hour lines and day columns,
etc...  but the documentation on some of the gritty details is rather
sparse.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 194 bytes
Desc: This is a digitally signed message part
Url : http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20071213/d3a3f8bd/attachment.bin 


More information about the Gtk-sharp-list mailing list