diff src/shape_rect.c @ 73:9ab15ebc9061

Observer for mouse events
author Thinker K.F. Li <thinker@branda.to>
date Mon, 18 Aug 2008 01:59:26 +0800
parents e292beec12d4
children b90abd31a281
line wrap: on
line diff
--- a/src/shape_rect.c	Wed Aug 13 09:25:57 2008 +0800
+++ b/src/shape_rect.c	Mon Aug 18 01:59:26 2008 +0800
@@ -12,6 +12,10 @@
     co_aix poses[12][2];
 } sh_rect_t;
 
+static void sh_rect_free(shape_t *shape) {
+    free(shape);
+}
+
 shape_t *sh_rect_new(co_aix x, co_aix y, co_aix w, co_aix h,
 		    co_aix rx, co_aix ry) {
     sh_rect_t *rect;
@@ -29,14 +33,11 @@
     rect->h = h;
     rect->rx = rx;
     rect->ry = ry;
+    rect->shape.free = sh_rect_free;
 
     return (shape_t *)rect;
 }
 
-void sh_rect_free(shape_t *shape) {
-    free(shape);
-}
-
 void sh_rect_set(shape_t *shape, co_aix x, co_aix y,
 		 co_aix w, co_aix h, co_aix rx, co_aix ry) {
     sh_rect_t *rect = (sh_rect_t *)shape;