diff options
| author | Pietro Gagliardi <[email protected]> | 2014-03-16 21:40:33 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-03-16 21:40:33 -0400 |
| commit | ae554f10c3b652a3dfe765fd63107237e9aafa28 (patch) | |
| tree | bbe08c7df5c6b88d4087051ed85a5ce2c165f0e4 /area_unix.go | |
| parent | ab4d286c78b4e240a82b2b191f0d9c8d43c7b44c (diff) | |
Changed Area to use a delegate handler object that implements the new AreaHandler interface for handling events. Also updated the GTK+ backend with this change, and made a few more tweaks to the documentation in area.go.
Diffstat (limited to 'area_unix.go')
| -rw-r--r-- | area_unix.go | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/area_unix.go b/area_unix.go index c55f425..a119e51 100644 --- a/area_unix.go +++ b/area_unix.go @@ -45,13 +45,7 @@ func our_area_draw_callback(widget *C.GtkWidget, cr *C.cairo_t, data C.gpointer) // thanks to desrt in irc.gimp.net/#gtk+ C.cairo_clip_extents(cr, &x, &y, &w, &h) cliprect := image.Rect(int(x), int(y), int(w), int(h)) - imgret := make(chan *image.NRGBA) - defer close(imgret) - s.paint <- PaintRequest{ - Rect: cliprect, - Out: imgret, - } - i := <-imgret + i := s.handler.Paint(cliprect) // pixel order is [R G B A] (see Example 1 on https://developer.gnome.org/gdk-pixbuf/2.26/gdk-pixbuf-The-GdkPixbuf-Structure.html) so we don't have to convert anything // gdk-pixbuf is not alpha-premultiplied (thanks to desrt in irc.gimp.net/#gtk+) pixbuf := C.gdk_pixbuf_new_from_data( @@ -111,13 +105,7 @@ func finishMouseEvent(data C.gpointer, me MouseEvent, mb uint, x C.gdouble, y C. me.Held = append(me.Held, 5) } me.Pos = image.Pt(int(x), int(y)) - // see cSysData.signal() in sysdata.go - go func() { - select { - case s.mouse <- me: - default: - } - }() + s.handler.Mouse(me) } //export our_area_button_press_event_callback |
