[Commit] twin ChangeLog, 1.27, 1.28 Makefile.am, 1.13, 1.14 twin.h, 1.19, 1.20 twin_box.c, 1.3, 1.4 twin_button.c, 1.4, 1.5 twin_calc.c, 1.1, 1.2 twin_clock.c, 1.3, 1.4 twin_convolve.c, 1.7, 1.8 twin_demo.c, 1.2, 1.3 twin_demoline.c, NONE, 1.1 twin_demoline.h, NONE, 1.1 twin_demospline.c, NONE, 1.1 twin_demospline.h, NONE, 1.1 twin_draw.c, 1.8, 1.9 twin_font.c, 1.14, 1.15 twin_glyphs.c, 1.6, 1.7 twin_label.c, 1.3, 1.4 twin_path.c, 1.12, 1.13 twin_toplevel.c, 1.2, 1.3 twin_widget.c, 1.5, 1.6 twin_window.c, 1.5, 1.6 twin_x11.c, 1.8, 1.9 twinint.h, 1.17, 1.18 xtwin.c, 1.24, 1.25

Keith Packard commit at keithp.com
Fri Oct 29 10:33:08 PDT 2004


Committed by: keithp

Update of /local/src/CVS/twin
In directory home.keithp.com:/tmp/cvs-serv9445

Modified Files:
	ChangeLog Makefile.am twin.h twin_box.c twin_button.c 
	twin_calc.c twin_clock.c twin_convolve.c twin_demo.c 
	twin_draw.c twin_font.c twin_glyphs.c twin_label.c twin_path.c 
	twin_toplevel.c twin_widget.c twin_window.c twin_x11.c 
	twinint.h xtwin.c 
Added Files:
	twin_demoline.c twin_demoline.h twin_demospline.c 
	twin_demospline.h 
Log Message:
2004-10-29  Keith Packard  <keithp at keithp.com>

	* Makefile.am:
	add demoline + demospline
	
	* twin.h:
	* twin_box.c: (_twin_box_dispatch):
	* twin_clock.c: (twin_clock_hand), (_twin_clock_face):
	* twin_convolve.c: (_twin_subpath_convolve):
	* twin_demo.c: (twin_line_start), (twin_circletext_start),
	* twin_draw.c: (twin_composite):
	* twin_font.c: (_twin_text_compute_pen):
	* twin_label.c: (_twin_label_paint), (_twin_label_init):
	* twin_path.c: (twin_path_circle), (twin_path_ellipse),
	(twin_path_arc), (twin_path_rectangle),
	(twin_path_rounded_rectangle), (twin_path_lozenge),
	(twin_path_tab), (twin_path_set_cap_style),
	(twin_path_current_cap_style), (twin_path_create),
	(twin_composite_stroke):
	(twin_quickbrown_start), (twin_ascii_start), (twin_demo_start):
	* twin_widget.c: (_twin_path_shape), (_twin_widget_paint_shape),
	(_twin_widget_paint), (_twin_widget_init),
	(_twin_path_bevel_shape):
	* twinint.h:
	Add cap styles, widget shapes, text alignment and arcs
	Change circle/ellipse API.
	
	* twin_button.c: (_twin_button_dispatch):
	Capture button events.
	
	* twin_calc.c: (twin_calc_start):
	Use Lozenge shape for output
	
	* twin_demoline.c: (_twin_demoline_paint),
	(_twin_demoline_update_pos), (_twin_demoline_hit),
	(_twin_demoline_dispatch), (_twin_demoline_init),
	(twin_demoline_create), (twin_demoline_start):
	* twin_demoline.h:
	Drag lines with the mouse
	
	* twin_demospline.c: (_twin_demospline_paint),
	(_twin_demospline_update_pos), (_twin_demospline_hit),
	(_twin_demospline_dispatch), (_twin_demospline_init),
	(twin_demospline_create), (twin_demospline_start):
	* twin_demospline.h:
	drag splines with the mouse
	
	* twin_glyphs.c:
	move '1' right a bit
	
	* twin_toplevel.c: (_twin_toplevel_event):
	Convert dispatch result to boool
	
	* twin_window.c: (twin_window_create), (twin_window_dispatch):
	was mis-computing delegate and crashing when window->event was NULL
	
	* twin_x11.c: (twin_x11_read_events):
	Map X button info to twin mask
	
	* xtwin.c: (main):
	draw different stuff.


Index: ChangeLog
===================================================================
RCS file: /local/src/CVS/twin/ChangeLog,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- ChangeLog	27 Oct 2004 20:34:55 -0000	1.27
+++ ChangeLog	29 Oct 2004 17:33:03 -0000	1.28
@@ -1,3 +1,65 @@
+2004-10-29  Keith Packard  <keithp at keithp.com>
+
+	* Makefile.am:
+	add demoline + demospline
+	
+	* twin.h:
+	* twin_box.c: (_twin_box_dispatch):
+	* twin_clock.c: (twin_clock_hand), (_twin_clock_face):
+	* twin_convolve.c: (_twin_subpath_convolve):
+	* twin_demo.c: (twin_line_start), (twin_circletext_start),
+	* twin_draw.c: (twin_composite):
+	* twin_font.c: (_twin_text_compute_pen):
+	* twin_label.c: (_twin_label_paint), (_twin_label_init):
+	* twin_path.c: (twin_path_circle), (twin_path_ellipse),
+	(twin_path_arc), (twin_path_rectangle),
+	(twin_path_rounded_rectangle), (twin_path_lozenge),
+	(twin_path_tab), (twin_path_set_cap_style),
+	(twin_path_current_cap_style), (twin_path_create),
+	(twin_composite_stroke):
+	(twin_quickbrown_start), (twin_ascii_start), (twin_demo_start):
+	* twin_widget.c: (_twin_path_shape), (_twin_widget_paint_shape),
+	(_twin_widget_paint), (_twin_widget_init),
+	(_twin_path_bevel_shape):
+	* twinint.h:
+	Add cap styles, widget shapes, text alignment and arcs
+	Change circle/ellipse API.
+	
+	* twin_button.c: (_twin_button_dispatch):
+	Capture button events.
+	
+	* twin_calc.c: (twin_calc_start):
+	Use Lozenge shape for output
+	
+	* twin_demoline.c: (_twin_demoline_paint),
+	(_twin_demoline_update_pos), (_twin_demoline_hit),
+	(_twin_demoline_dispatch), (_twin_demoline_init),
+	(twin_demoline_create), (twin_demoline_start):
+	* twin_demoline.h:
+	Drag lines with the mouse
+	
+	* twin_demospline.c: (_twin_demospline_paint),
+	(_twin_demospline_update_pos), (_twin_demospline_hit),
+	(_twin_demospline_dispatch), (_twin_demospline_init),
+	(twin_demospline_create), (twin_demospline_start):
+	* twin_demospline.h:
+	drag splines with the mouse
+	
+	* twin_glyphs.c:
+	move '1' right a bit
+	
+	* twin_toplevel.c: (_twin_toplevel_event):
+	Convert dispatch result to boool
+	
+	* twin_window.c: (twin_window_create), (twin_window_dispatch):
+	was mis-computing delegate and crashing when window->event was NULL
+	
+	* twin_x11.c: (twin_x11_read_events):
+	Map X button info to twin mask
+	
+	* xtwin.c: (main):
+	draw different stuff.
+
 2004-10-27  Keith Packard  <keithp at keithp.com>
 
 	* twin_box.c: (_twin_box_dispatch):

Index: Makefile.am
===================================================================
RCS file: /local/src/CVS/twin/Makefile.am,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- Makefile.am	27 Oct 2004 20:09:36 -0000	1.13
+++ Makefile.am	29 Oct 2004 17:33:03 -0000	1.14
@@ -56,6 +56,10 @@
 	twin_demo.h \
 	twin_hello.c \
 	twin_hello.h \
+	twin_demoline.c \
+	twin_demoline.h \
+	twin_demospline.c \
+	twin_demospline.h \
 	xtwin.c
 
 xtwin_LDADD = @X_LIBS@ -lm

Index: twin.h
===================================================================
RCS file: /local/src/CVS/twin/twin.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- twin.h	27 Oct 2004 20:09:36 -0000	1.19
+++ twin.h	29 Oct 2004 17:33:03 -0000	1.20
@@ -62,6 +62,9 @@
 #define TWIN_ANGLE_22_5	    (TWIN_ANGLE_360 >> 4)
 #define TWIN_ANGLE_11_25    (TWIN_ANGLE_360 >> 5)
 
+#define TWIN_ANGLE_270	    (TWIN_ANGLE_180 + TWIN_ANGLE_90)
+#define TWIN_ANGLE_0	    (0)
+
 #define twin_degrees_to_angle(d)    ((twin_angle_t) ((((int32_t) (d)) * TWIN_ANGLE_360 / 360)))
 
 /*
@@ -227,10 +230,17 @@
 
 typedef struct _twin_path twin_path_t;
 
+typedef enum _twin_cap {
+    TwinCapRound,
+    TwinCapButt,
+    TwinCapProjecting,
+} twin_cap_t;
+
 typedef struct _twin_state {
     twin_matrix_t   matrix;
     twin_fixed_t    font_size;
     twin_style_t    font_style;
+    twin_cap_t	    cap_style;
 } twin_state_t;
 
 /*
@@ -391,18 +401,28 @@
     twin_stretch_t	    stretch_height;
 } twin_widget_layout_t;
 
+typedef enum _twin_shape {
+    TwinShapeRectangle,
+    TwinShapeRoundedRectangle,
+    TwinShapeLozenge,
+    TwinShapeTab,
+    TwinShapeEllipse,
+} twin_shape_t;
+
 struct _twin_widget {
     twin_window_t	    *window;
     twin_widget_t	    *next;
     twin_box_t		    *parent;
+    twin_dispatch_proc_t    dispatch;
+    twin_rect_t		    extents;	/* current geometry */
     twin_widget_t	    *copy_geom;
     twin_bool_t		    paint;
     twin_bool_t		    layout;
     twin_bool_t		    want_focus;
     twin_argb32_t	    background;
-    twin_rect_t		    extents;	/* current geometry */
     twin_widget_layout_t    preferred;
-    twin_dispatch_proc_t    dispatch;
+    twin_shape_t	    shape;
+    twin_fixed_t	    radius;
 };
 
 struct _twin_box {
@@ -417,6 +437,10 @@
     twin_box_t		box;
 } twin_toplevel_t;
 
+typedef enum _twin_align {
+    TwinAlignLeft, TwinAlignCenter, TwinAlignRight
+} twin_align_t;
+
 typedef struct _twin_label {
     twin_widget_t	widget;
     char		*label;
@@ -424,6 +448,7 @@
     twin_fixed_t	font_size;
     twin_style_t	font_style;
     twin_point_t	offset;
+    twin_align_t	align;
 } twin_label_t;
 
 typedef enum _twin_button_signal {
@@ -670,13 +695,60 @@
 twin_path_rdraw (twin_path_t *path, twin_fixed_t x, twin_fixed_t y);
 
 void
-twin_path_circle(twin_path_t *path, twin_fixed_t radius);
+twin_path_circle(twin_path_t	*path, 
+		 twin_fixed_t	x,
+		 twin_fixed_t	y,
+		 twin_fixed_t	radius);
 
 void
-twin_path_ellipse (twin_path_t *path, 
+twin_path_ellipse (twin_path_t	*path,
+		   twin_fixed_t	x,
+		   twin_fixed_t	y,
 		   twin_fixed_t x_radius, 
 		   twin_fixed_t	y_radius);
 void
+twin_path_arc (twin_path_t  *path,
+	       twin_fixed_t x,
+	       twin_fixed_t y,
+	       twin_fixed_t x_radius,
+	       twin_fixed_t y_radius,
+	       twin_angle_t start,
+	       twin_angle_t extent);
+
+void
+twin_path_rectangle (twin_path_t    *path,
+		     twin_fixed_t   x,
+		     twin_fixed_t   y,
+		     twin_fixed_t   w,
+		     twin_fixed_t   h);
+
+void
+twin_path_rounded_rectangle (twin_path_t	*path,
+			     twin_fixed_t	x,
+			     twin_fixed_t	y,
+			     twin_fixed_t	w,
+			     twin_fixed_t	h,
+			     twin_fixed_t	x_radius,
+			     twin_fixed_t	y_radius);
+
+void
+twin_path_lozenge (twin_path_t	*path,
+		   twin_fixed_t	x,
+		   twin_fixed_t	y,
+		   twin_fixed_t	w,
+		   twin_fixed_t	h);
+
+void
+twin_path_tab (twin_path_t	*path,
+	       twin_fixed_t	x,
+	       twin_fixed_t	y,
+	       twin_fixed_t	w,
+	       twin_fixed_t	h,
+	       twin_fixed_t	x_radius,
+	       twin_fixed_t	y_radius);
+
+
+void
 twin_path_close (twin_path_t *path);
 
 void
@@ -724,6 +796,12 @@
 void
 twin_path_set_font_style (twin_path_t *path, twin_style_t font_style);
 
+void
+twin_path_set_cap_style (twin_path_t *path, twin_cap_t cap_style);
+
+twin_cap_t
+twin_path_current_cap_style (twin_path_t *path);
+
 twin_state_t
 twin_path_save (twin_path_t *path);
 

Index: twin_box.c
===================================================================
RCS file: /local/src/CVS/twin/twin_box.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- twin_box.c	27 Oct 2004 20:34:55 -0000	1.3
+++ twin_box.c	29 Oct 2004 17:33:03 -0000	1.4
@@ -236,6 +236,11 @@
 		twin_pixmap_t	*pixmap = box->widget.window->pixmap;
 		twin_rect_t	clip = twin_pixmap_current_clip (pixmap);
 
+		if (child->shape != TwinShapeRectangle)
+		    twin_fill (child->window->pixmap,
+			       widget->background, TWIN_SOURCE,
+			       child->extents.left, child->extents.top,
+			       child->extents.right, child->extents.bottom);
 		twin_pixmap_set_clip (pixmap, child->extents);
 		child->paint = TWIN_FALSE;
 		(*child->dispatch) (child, event);

Index: twin_button.c
===================================================================
RCS file: /local/src/CVS/twin/twin_button.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- twin_button.c	27 Oct 2004 20:09:36 -0000	1.4
+++ twin_button.c	29 Oct 2004 17:33:03 -0000	1.5
@@ -64,6 +64,7 @@
 	_twin_button_set_label_offset (button);
 	if (button->signal)
 	    (*button->signal) (button, TwinButtonSignalDown, button->closure);
+	return TwinDispatchDone;
 	break;
     case TwinEventMotion:
 	if (button->pressed)
@@ -77,6 +78,7 @@
 		_twin_button_set_label_offset (button);
 	    }
 	}
+	return TwinDispatchDone;
 	break;
     case TwinEventButtonUp:
 	button->pressed = TWIN_FALSE;
@@ -87,6 +89,7 @@
 	    if (button->signal)
 		(*button->signal) (button, TwinButtonSignalUp, button->closure);
 	}
+	return TwinDispatchDone;
 	break;
     default:
 	break;

Index: twin_calc.c
===================================================================
RCS file: /local/src/CVS/twin/twin_calc.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- twin_calc.c	27 Oct 2004 20:09:36 -0000	1.1
+++ twin_calc.c	29 Oct 2004 17:33:03 -0000	1.2
@@ -81,10 +81,10 @@
     "+", "-", "*", "/", "=", "CLR"
 };
 
-#define TWIN_CALC_VALUE_SIZE	twin_int_to_fixed(24)
-#define TWIN_CALC_VALUE_STYLE	TWIN_TEXT_BOLD
+#define TWIN_CALC_VALUE_SIZE	twin_int_to_fixed(29)
+#define TWIN_CALC_VALUE_STYLE	TWIN_TEXT_ROMAN
 #define TWIN_CALC_VALUE_FG	0xff000000
-#define TWIN_CALC_VALUE_BG	0xc0c0c0c0
+#define TWIN_CALC_VALUE_BG	0x80808080
 #define TWIN_CALC_BUTTON_SIZE	twin_int_to_fixed(15)
 #define TWIN_CALC_BUTTON_STYLE	TWIN_TEXT_BOLD
 #define TWIN_CALC_BUTTON_FG	0xff000000
@@ -210,6 +210,8 @@
 				       TWIN_CALC_VALUE_SIZE,
 				       TWIN_CALC_VALUE_STYLE);
     twin_widget_set (&calc->display->widget, TWIN_CALC_VALUE_BG);
+    calc->display->align = TwinAlignRight;
+    calc->display->widget.shape = TwinShapeLozenge;
     calc->keys = twin_box_create (&calc->toplevel->box, TwinBoxHorz);
     for (i = 0; i < TWIN_CALC_COLS; i++)
     {
@@ -226,6 +228,7 @@
 			     TWIN_CALC_BUTTON_BG);
 	    calc->buttons[b]->signal = _twin_calc_button_signal;
 	    calc->buttons[b]->closure = calc;
+/*	    calc->buttons[b]->label.widget.shape = TwinShapeLozenge; */
 	    if (i || j)
 		calc->buttons[b]->label.widget.copy_geom = &calc->buttons[calc_layout[0][0]]->label.widget;
 	}

Index: twin_clock.c
===================================================================
RCS file: /local/src/CVS/twin/twin_clock.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- twin_clock.c	27 Oct 2004 20:34:55 -0000	1.3
+++ twin_clock.c	29 Oct 2004 17:33:03 -0000	1.4
@@ -89,7 +89,7 @@
     m.m[2][1] = 0;
     twin_path_set_matrix (pen, m);
     twin_path_set_matrix (path, m);
-    twin_path_circle (pen, fill_width);
+    twin_path_circle (pen, 0, 0, fill_width);
     twin_path_convolve (path, stroke, pen);
 
     twin_paint_path (_twin_clock_pixmap(clock), fill_pixel, path);
@@ -115,8 +115,7 @@
 
     twin_clock_set_transform (clock, path);
 
-    twin_path_move (path, 0, 0);
-    twin_path_circle (path, TWIN_FIXED_ONE);
+    twin_path_circle (path, 0, 0, TWIN_FIXED_ONE);
     
     twin_paint_path (_twin_clock_pixmap(clock), TWIN_CLOCK_BACKGROUND, path);
 

Index: twin_convolve.c
===================================================================
RCS file: /local/src/CVS/twin/twin_convolve.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- twin_convolve.c	27 Sep 2004 21:28:31 -0000	1.7
+++ twin_convolve.c	29 Oct 2004 17:33:03 -0000	1.8
@@ -75,10 +75,10 @@
     return 0;
 }
 
+#define F(x)	twin_sfixed_to_double(x)
 #if 0
 #include <stdio.h>
 #include <math.h>
-#define F(x)	twin_sfixed_to_double(x)
 #define DBGOUT(x...)	printf(x)
 
 static double
@@ -95,6 +95,8 @@
 #define DBGOUT(x...)
 #endif
 
+#define A(a)  ((a) < 0 ? -(a) : (a))
+
 /*
  * Convolve one subpath with a convex pen.  The result is
  * a closed path.
@@ -104,21 +106,22 @@
 			twin_path_t	*stroke,
 			twin_path_t	*pen)
 {
-    twin_spoint_t    *sp   = stroke->points;
-    twin_spoint_t    *pp   = pen->points;
+    twin_spoint_t   *sp   = stroke->points;
+    twin_spoint_t   *pp   = pen->points;
     int		    ns    = stroke->npoints;
     int		    np    = pen->npoints;
-    twin_spoint_t    *sp0  = &sp[0];
-    twin_spoint_t    *sp1  = &sp[1];
+    twin_spoint_t   *sp0  = &sp[0];
+    twin_spoint_t   *sp1  = &sp[1];
     int		    start = _twin_path_leftpoint (pen, sp0, sp1);
-    twin_spoint_t    *spn1 = &sp[ns-1];
-    twin_spoint_t    *spn2 = &sp[ns-2];
+    twin_spoint_t   *spn1 = &sp[ns-1];
+    twin_spoint_t   *spn2 = &sp[ns-2];
     int		    ret   = _twin_path_leftpoint (pen, spn1, spn2);
     int		    p;
     int		    s;
     int		    starget;
     int		    ptarget;
     int		    inc;
+    int		    first;
 
     DBGOUT ("convolve stroke:\n");
     for (s = 0; s < ns; s++)
@@ -135,6 +138,7 @@
 	    p, F(pp[p].x), F(pp[p].y),
 	    F(sp[s].x + pp[p].x), F(sp[s].y + pp[p].y));
     _twin_path_smove (path, sp[s].x + pp[p].x, sp[s].y + pp[p].y);
+    first = path->npoints - 1;
     
     /* step along the path first */
     inc = 1;
@@ -186,15 +190,67 @@
 	 */
 	
 	/* draw a cap */
-	while (p != ptarget)
-	{
-	    if (++p == np) p = 0;
-	    DBGOUT("cap:    ");
-	    DBGOUT ("s%02d (%9.4f, %9.4f), p%02d (%9.4f, %9.4f): %9.4f, %9.4f\n",
-		    s, F(sp[s].x), F(sp[s].y),
-		    p, F(pp[p].x), F(pp[p].y),
-		    F(sp[s].x + pp[p].x), F(sp[s].y + pp[p].y));
-	    _twin_path_sdraw (path, sp[s].x + pp[p].x, sp[s].y + pp[p].y);
+	switch (path->state.cap_style) {
+	    int		pm;
+	case TwinCapProjecting:
+	    /*
+	     * This draws a rough projecting cap using the
+	     * pen.
+	     *
+	     * First, project the line forward one pen radius
+	     * by finding the pen location halfway between the
+	     * two normals.
+	     *
+	     * Then, just add that to the normals themselves to
+	     * find the corners of the projecting cap.  
+	     * 
+	     * The result may have significant error, so overwrite
+	     * the existing corners with the new coordinates to
+	     * avoid a kink.
+	     */
+	    if (p <= ptarget)
+		pm = (ptarget + p) >> 1;
+	    else
+	    {
+		pm = (ptarget + np + p) >> 1;
+		if (pm >= np) pm -= np;
+	    }
+	    
+	    /* replace last point with corner of cap */
+	    path->npoints--;
+	    _twin_path_sdraw (path,
+			      sp[s].x + pp[pm].x + pp[p].x,
+			      sp[s].y + pp[pm].y + pp[p].y);
+	    p = ptarget;
+	    if (inc == 1)
+	    {
+		/* start next line at cap corner */
+		_twin_path_sdraw (path,
+				  sp[s].x + pp[pm].x + pp[p].x,
+				  sp[s].y + pp[pm].y + pp[p].y);
+	    }
+	    else
+	    {
+		/* overwrite initial point */
+		path->points[first].x = sp[s].x + pp[pm].x + pp[p].x;
+		path->points[first].y = sp[s].y + pp[pm].y + pp[p].y;
+	    }
+	    break;
+	case TwinCapButt:
+	    p = ptarget-1;
+	    /* fall through … */
+	case TwinCapRound:
+	    while (p != ptarget)
+	    {
+		if (++p == np) p = 0;
+		DBGOUT("cap:    ");
+		DBGOUT ("s%02d (%9.4f, %9.4f), p%02d (%9.4f, %9.4f): %9.4f, %9.4f\n",
+			s, F(sp[s].x), F(sp[s].y),
+			p, F(pp[p].x), F(pp[p].y),
+			F(sp[s].x + pp[p].x), F(sp[s].y + pp[p].y));
+		_twin_path_sdraw (path, sp[s].x + pp[p].x, sp[s].y + pp[p].y);
+	    }
+	    break;
 	}
 	
 	if (inc == -1)
@@ -205,6 +261,7 @@
 	ptarget = start;
 	starget = 0;
     }
+    twin_path_close (path);
 }
 
 void

Index: twin_demo.c
===================================================================
RCS file: /local/src/CVS/twin/twin_demo.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- twin_demo.c	26 Oct 2004 06:15:42 -0000	1.2
+++ twin_demo.c	29 Oct 2004 17:33:03 -0000	1.3
@@ -78,45 +78,24 @@
     twin_window_t   *window = twin_window_create (screen, TWIN_ARGB32,
 						  TwinWindowApplication,
 						  x, y, w, h);
-    int		    wid = window->client.right - window->client.left;
-    int		    hei = window->client.bottom - window->client.top;
     twin_pixmap_t   *pixmap = window->pixmap;
-    twin_path_t	    *path = twin_path_create ();
-    twin_path_t	    *pen = twin_path_create ();
     twin_path_t	    *stroke = twin_path_create ();
-    twin_pixmap_t   *alpha = twin_pixmap_create (TWIN_A8, w, h);
-    twin_operand_t  source, mask;
+    twin_fixed_t    fy;
     
+    twin_path_translate (stroke, D(200), D(200));
     twin_fill (pixmap, 0xffffffff, TWIN_SOURCE, 
-	       0, 0, wid, hei);
+	       0, 0, w, h);
 
     twin_window_set_name (window, "line");
     
-    twin_path_circle (pen, D (1));
-    
-    stroke = twin_path_create ();
-    pen = twin_path_create ();
-    twin_path_translate (stroke, D(100), D(100));
-    
-/*    twin_path_rotate (stroke, twin_degrees_to_angle (270)); */
-    twin_path_rotate (stroke, twin_degrees_to_angle (270));
-    twin_path_move (stroke, D(0), D(0));
-    twin_path_draw (stroke, D(100), D(0));
-    twin_path_set_matrix (pen, twin_path_current_matrix (stroke));
-    twin_path_circle (pen, D(20));
-    twin_path_convolve (path, stroke, pen);
-
-    twin_fill_path (alpha, path, 0, 0);
-    twin_path_destroy (path);
-    twin_path_destroy (pen);
+    for (fy = 0; fy < 150; fy += 40)
+    {
+	twin_path_move (stroke, D(-150), -D(fy));
+	twin_path_draw (stroke, D(150), D(fy));
+    }
+    twin_path_set_cap_style (stroke, TwinCapProjecting);
+    twin_paint_stroke (pixmap, 0xff000000, stroke, D(10));
     twin_path_destroy (stroke);
-    source.source_kind = TWIN_SOLID;
-    source.u.argb = 0xff000000;
-    mask.source_kind = TWIN_PIXMAP;
-    mask.u.pixmap = alpha;
-    twin_composite (pixmap, 0, 0,
-		    &source, 0, 0, &mask, 0, 0, TWIN_OVER, wid, hei);
-    twin_pixmap_destroy (alpha);
     twin_window_show (window);
 }
 
@@ -140,7 +119,7 @@
     twin_window_set_name (window, "circletext");
     
     twin_path_set_font_style (path, TWIN_TEXT_UNHINTED);
-    twin_path_circle (pen, D (1));
+    twin_path_circle (pen, 0, 0, D (1));
     
     twin_path_translate (path, D(200), D(200));
     twin_path_set_font_size (path, D(15));
@@ -186,7 +165,7 @@
     twin_fill (pixmap, 0xffffffff, TWIN_SOURCE, 
 	       0, 0, wid, hei);
     
-    twin_path_circle (pen, D (1));
+    twin_path_circle (pen, 0, 0, D (1));
     
     fx = D(3);
     fy = D(8);
@@ -233,7 +212,7 @@
     twin_window_set_name (window, "ASCII");
     
     twin_fill (pixmap, 0xffffffff, TWIN_SOURCE, 0, 0, wid, hei);
-    twin_path_circle (pen, D (1));
+    twin_path_circle (pen, 0, 0, D (1));
     
     fx = D(3);
     fy = D(8);
@@ -328,11 +307,15 @@
 void
 twin_demo_start (twin_screen_t *screen, const char *name, int x, int y, int w, int h)
 {
+#if 0
     twin_circletext_start (screen, x, y, w, h);
+#endif
     twin_line_start (screen, x += 20, y += 20, w, h);
+#if 0
     twin_quickbrown_start (screen, x += 20, y += 20, w, h);
     twin_ascii_start (screen, x += 20, y += 20, w, h);
     twin_jelly_start (screen, x += 20, y += 20, w, h);
+#endif
 #if 0
 
 #if 0

--- NEW FILE: twin_demoline.c ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: twin_demoline.h ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: twin_demospline.c ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: twin_demospline.h ---
(This appears to be a binary file; contents omitted.)

Index: twin_draw.c
===================================================================
RCS file: /local/src/CVS/twin/twin_draw.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- twin_draw.c	27 Oct 2004 06:07:35 -0000	1.8
+++ twin_draw.c	29 Oct 2004 17:33:03 -0000	1.9
@@ -274,23 +274,23 @@
 		twin_coord_t	height)
 {
     twin_coord_t    iy;
-    twin_coord_t    left, right, top, bottom;
+    twin_coord_t    left, top, right, bottom;
     twin_coord_t    sdx, sdy;
     twin_source_u   s;
 
     dst_x += dst->clip.left;
     dst_y += dst->clip.top;
     left = dst_x;
-    right = dst_x + width;
     top = dst_y;
+    right = dst_x + width;
     bottom = dst_y + height;
     /* clip */
     if (left < dst->clip.left)
 	left = dst->clip.left;
-    if (right > dst->clip.right)
-	right = dst->clip.right;
     if (top < dst->clip.top)
 	top = dst->clip.top;
+    if (right > dst->clip.right)
+	right = dst->clip.right;
     if (bottom > dst->clip.bottom)
 	bottom = dst->clip.bottom;
 

Index: twin_font.c
===================================================================
RCS file: /local/src/CVS/twin/twin_font.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- twin_font.c	27 Oct 2004 02:46:40 -0000	1.14
+++ twin_font.c	29 Oct 2004 17:33:03 -0000	1.15
@@ -196,7 +196,7 @@
     twin_path_t	*pen = twin_path_create ();
 
     twin_path_set_matrix (pen, info->pen_matrix);
-    twin_path_circle (pen, TWIN_FIXED_ONE);
+    twin_path_circle (pen, 0, 0, TWIN_FIXED_ONE);
     return pen;
 }
 

Index: twin_glyphs.c
===================================================================
RCS file: /local/src/CVS/twin/twin_glyphs.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- twin_glyphs.c	26 Oct 2004 06:15:42 -0000	1.6
+++ twin_glyphs.c	29 Oct 2004 17:33:03 -0000	1.7
@@ -209,11 +209,11 @@
     'e',
 /* 0x31 '1'  offset 666 */
     0, 28, 42, 0, 2, 3,
-    0, 14, 28 /* snap_x */
+    0, 17, 28 /* snap_x */
     -21, -15, 0, /* snap_y */
-    'm', 4, -34,
-    'c', 8, -35, 12, -38, 14, -42,
-    'l', 14, 0,
+    'm', 7, -34,
+    'c', 11, -35, 15, -38, 17, -42,
+    'l', 17, 0,
     'e',
 /* 0x32 '2'  offset 691 */
     0, 28, 42, 0, 4, 4,

Index: twin_label.c
===================================================================
RCS file: /local/src/CVS/twin/twin_label.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- twin_label.c	27 Oct 2004 20:09:36 -0000	1.3
+++ twin_label.c	29 Oct 2004 17:33:03 -0000	1.4
@@ -54,13 +54,25 @@
     {
 	twin_fixed_t	wf = twin_int_to_fixed (w);
 	twin_fixed_t	hf = twin_int_to_fixed (h);
+	twin_fixed_t	x, y;
 
 	twin_path_set_font_size (path, label->font_size);
 	twin_path_set_font_style (path, label->font_style);
 	twin_text_metrics_utf8 (path, label->label, &m);
-	twin_path_move (path, (wf - m.width) / 2 + label->offset.x,
-			(hf - (m.ascent + m.descent)) / 2 + m.ascent + label->offset.y);
-
+	y = (hf - (m.ascent + m.descent)) / 2 + m.ascent + label->offset.y;
+	switch (label->align) {
+	case TwinAlignLeft:
+	    x = label->font_size / 2;
+	    break;
+	case TwinAlignCenter:
+	    x = (wf - m.width) / 2;
+	    break;
+	case TwinAlignRight:
+	    x = wf - label->font_size / 2 - m.width;
+	    break;
+	}
+	x += label->offset.x;
+	twin_path_move (path, x, y);
 	twin_path_utf8 (path, label->label);
 	twin_paint_path (label->widget.window->pixmap, label->foreground, path);
 	twin_path_destroy (path);
@@ -126,6 +138,7 @@
     label->label = NULL;
     label->offset.x = 0;
     label->offset.y = 0;
+    label->align = TwinAlignCenter;
     twin_label_set (label, value, foreground, font_size, font_style);
 }
 

Index: twin_path.c
===================================================================
RCS file: /local/src/CVS/twin/twin_path.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- twin_path.c	25 Oct 2004 19:09:36 -0000	1.12
+++ twin_path.c	29 Oct 2004 17:33:03 -0000	1.13
@@ -192,6 +192,27 @@
     }
 }
 
+void
+twin_path_circle (twin_path_t	*path, 
+		  twin_fixed_t	x,
+		  twin_fixed_t	y,
+		  twin_fixed_t radius)
+{
+    twin_path_ellipse (path, x, y, radius, radius);
+}
+
+void
+twin_path_ellipse (twin_path_t *path, 
+		   twin_fixed_t x, 
+		   twin_fixed_t	y,
+		   twin_fixed_t x_radius, 
+		   twin_fixed_t	y_radius)
+{
+    twin_path_move (path, x + x_radius, y);
+    twin_path_arc (path, x, y, x_radius, y_radius, 0, TWIN_ANGLE_360);
+    twin_path_close (path);
+}
+
 #define twin_fixed_abs(f)   ((f) < 0 ? -(f) : (f))
 
 static twin_fixed_t
@@ -202,90 +223,146 @@
 }
 
 void
-twin_path_circle (twin_path_t *path, twin_fixed_t radius)
+twin_path_arc (twin_path_t  *path,
+	       twin_fixed_t x,
+	       twin_fixed_t y,
+	       twin_fixed_t x_radius,
+	       twin_fixed_t y_radius,
+	       twin_angle_t start,
+	       twin_angle_t extent)
 {
-    int		    sides;
-    int		    n;
-    twin_spoint_t   center;
-    int		    i;
-    twin_matrix_t   save;
+    twin_matrix_t   save = twin_path_current_matrix (path);
     twin_fixed_t    max_radius;
+    int32_t    	    sides;
+    int32_t    	    n;
+    twin_angle_t    a;
+    twin_angle_t    first, last, step, inc;
+    twin_angle_t    epsilon;
 
-    save = twin_path_current_matrix (path);
-
-    twin_path_scale (path, radius, radius);
-
-    center = _twin_path_current_spoint (path);
+    twin_path_translate (path, x, y);
+    twin_path_scale (path, x_radius, y_radius);
 
-    _twin_path_sfinish (path);
-    
     max_radius = _twin_matrix_max_radius (&path->state.matrix);
-    
     sides = max_radius / twin_sfixed_to_fixed (TWIN_SFIXED_TOLERANCE);
-    
     if (sides > 1024) sides = 1024;
 
     n = 2;
     while ((1 << n) < sides)
 	n++;
 
-    for (i = 0; i <= (1 << n); i++)
-    {
-	twin_angle_t	a = (i * TWIN_ANGLE_360) >> n;
-	twin_fixed_t	x = twin_cos (a);
-	twin_fixed_t	y = twin_sin (a);
+    sides = (1 << n);
 
-	_twin_path_sdraw (path, 
-			  center.x + _twin_matrix_dx (&path->state.matrix, x, y),
-			  center.y + _twin_matrix_dy (&path->state.matrix, x, y));
+    step = TWIN_ANGLE_360 >> n;
+    inc = step;
+    epsilon = 1;
+    if (extent < 0)
+    {
+	inc = -inc;
+	epsilon = -1;
     }
     
-    _twin_path_sfinish (path);
+    first = (start + inc - epsilon) & ~(step - 1);
+    last = (start + extent - inc + epsilon) & ~(step - 1);
+
+    if (first != start)
+	twin_path_draw (path, twin_cos(start), twin_sin(start));
+    
+    for (a = first; a != last; a += inc)
+	twin_path_draw (path, twin_cos (a), twin_sin (a));
+    
+    if (last != start + extent)
+	twin_path_draw (path, twin_cos (start+extent), twin_sin(start+extent));
+
     twin_path_set_matrix (path, save);
 }
 
 void
-twin_path_ellipse (twin_path_t *path, 
-		   twin_fixed_t x_radius, 
-		   twin_fixed_t	y_radius)
+twin_path_rectangle (twin_path_t    *path,
+		     twin_fixed_t   x,
+		     twin_fixed_t   y,
+		     twin_fixed_t   w,
+		     twin_fixed_t   h)
 {
-    int		    sides;
-    int		    n;
-    twin_spoint_t   center;
-    int		    i;
-    twin_matrix_t   save;
-    twin_fixed_t    max_radius;
-
-    save = twin_path_current_matrix (path);
-
-    twin_path_scale (path, x_radius, y_radius);
-
-    center = _twin_path_current_spoint (path);
+    twin_path_move (path, x, y);
+    twin_path_draw (path, x+w, y);
+    twin_path_draw (path, x+w, y+h);
+    twin_path_draw (path, x, y+h);
+    twin_path_close (path);
+}
+		     
+void
+twin_path_rounded_rectangle (twin_path_t	*path,
+			     twin_fixed_t	x,
+			     twin_fixed_t	y,
+			     twin_fixed_t	w,
+			     twin_fixed_t	h,
+			     twin_fixed_t	x_radius,
+			     twin_fixed_t	y_radius)
+{
+    twin_matrix_t   save = twin_path_current_matrix (path);
 
-    _twin_path_sfinish (path);
-    
-    max_radius = _twin_matrix_max_radius (&path->state.matrix);
-    
-    sides = max_radius / twin_sfixed_to_fixed (TWIN_SFIXED_TOLERANCE);
-    
-    if (sides > 1024) sides = 1024;
+    twin_path_translate (path, x, y);
+    twin_path_move  (path,
+		     0, y_radius);
+    twin_path_arc (path, x_radius, y_radius, x_radius, y_radius,
+		   TWIN_ANGLE_180, TWIN_ANGLE_90);
+    twin_path_draw  (path, 
+		     w - x_radius, 0);
+    twin_path_arc (path, w - x_radius, y_radius, x_radius, y_radius,
+		   TWIN_ANGLE_270, TWIN_ANGLE_90);
+    twin_path_draw  (path,
+		     w, h - y_radius);
+    twin_path_arc (path, w - x_radius, h - y_radius, x_radius, y_radius,
+		   TWIN_ANGLE_0, TWIN_ANGLE_90);
+    twin_path_draw  (path,
+		     x_radius, h);
+    twin_path_arc (path, x_radius, h - y_radius, x_radius, y_radius,
+		   TWIN_ANGLE_90, TWIN_ANGLE_90);
+    twin_path_close (path);
+    twin_path_set_matrix (path, save);
+}
+			
+void
+twin_path_lozenge (twin_path_t	*path,
+		   twin_fixed_t	x,
+		   twin_fixed_t	y,
+		   twin_fixed_t	w,
+		   twin_fixed_t	h)
+{
+    twin_fixed_t    radius;
 
-    n = 2;
-    while ((1 << n) < sides)
-	n++;
+    if (w > h)
+	radius = h / 2;
+    else
+	radius = w / 2;
+    twin_path_rounded_rectangle (path, x, y, w, h, radius, radius);
+}
 
-    for (i = 0; i <= (1 << n); i++)
-    {
-	twin_angle_t	a = (i * TWIN_ANGLE_360) >> n;
-	twin_fixed_t	x = twin_cos (a);
-	twin_fixed_t	y = twin_sin (a);
+void
+twin_path_tab (twin_path_t	*path,
+	       twin_fixed_t	x,
+	       twin_fixed_t	y,
+	       twin_fixed_t	w,
+	       twin_fixed_t	h,
+	       twin_fixed_t	x_radius,
+	       twin_fixed_t	y_radius)
+{
+    twin_matrix_t   save = twin_path_current_matrix (path);
 
-	_twin_path_sdraw (path, 
-			  center.x + _twin_matrix_dx (&path->state.matrix, x, y),
-			  center.y + _twin_matrix_dy (&path->state.matrix, x, y));
-    }
-    
-    _twin_path_sfinish (path);
+    twin_path_translate (path, x, y);
+    twin_path_move  (path,
+		     0, y_radius);
+    twin_path_arc (path, x_radius, y_radius, x_radius, y_radius,
+		   TWIN_ANGLE_180, TWIN_ANGLE_90);
+    twin_path_draw  (path, 
+		     w - x_radius, 0);
+    twin_path_arc (path, w - x_radius, y_radius, x_radius, y_radius,
+		   TWIN_ANGLE_270, TWIN_ANGLE_90);
+    twin_path_draw  (path,
+		     w, h);
+    twin_path_draw  (path,
+		     0, h);
+    twin_path_close (path);
     twin_path_set_matrix (path, save);
 }
 
@@ -350,6 +427,18 @@
 }
 
 void
+twin_path_set_cap_style (twin_path_t *path, twin_cap_t cap_style)
+{
+    path->state.cap_style = cap_style;
+}
+
+twin_cap_t
+twin_path_current_cap_style (twin_path_t *path)
+{
+    return path->state.cap_style;
+}
+
+void
 twin_path_empty (twin_path_t *path)
 {
     path->npoints = 0;
@@ -424,6 +513,7 @@
     twin_matrix_identity (&path->state.matrix);
     path->state.font_size = TWIN_FIXED_ONE * 15;
     path->state.font_style = TWIN_TEXT_ROMAN;
+    path->state.cap_style = TwinCapRound;
     return path;
 }
 
@@ -496,7 +586,8 @@
     m.m[2][0] = 0;
     m.m[2][1] = 0;
     twin_path_set_matrix (pen, m);
-    twin_path_circle (pen, pen_width / 2);
+    twin_path_set_cap_style (path, twin_path_current_cap_style (stroke));
+    twin_path_circle (pen, 0, 0, pen_width / 2);
     twin_path_convolve (path, stroke, pen);
     twin_composite_path (dst, src, src_x, src_y, path, operator);
     twin_path_destroy (path);

Index: twin_toplevel.c
===================================================================
RCS file: /local/src/CVS/twin/twin_toplevel.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- twin_toplevel.c	27 Oct 2004 20:09:36 -0000	1.2
+++ twin_toplevel.c	29 Oct 2004 17:33:03 -0000	1.3
@@ -51,7 +51,7 @@
 {
     twin_toplevel_t   *toplevel = window->client_data;
 
-    return (*toplevel->box.widget.dispatch) (&toplevel->box.widget, event);
+    return (*toplevel->box.widget.dispatch) (&toplevel->box.widget, event) == TwinDispatchDone;
 }
 
 static void

Index: twin_widget.c
===================================================================
RCS file: /local/src/CVS/twin/twin_widget.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- twin_widget.c	27 Oct 2004 20:34:55 -0000	1.5
+++ twin_widget.c	29 Oct 2004 17:33:03 -0000	1.6
@@ -24,14 +24,74 @@
 
 #include "twinint.h"
 
-static void
-_twin_widget_paint (twin_widget_t *widget)
+static twin_path_t *
+_twin_path_shape (twin_shape_t	shape,
+		  twin_coord_t	left,
+		  twin_coord_t	top,
+		  twin_coord_t	right,
+		  twin_coord_t	bottom,
+		  twin_fixed_t	radius)
+{
+    twin_path_t	    *path = twin_path_create ();
+    twin_fixed_t    x = twin_int_to_fixed (left);
+    twin_fixed_t    y = twin_int_to_fixed (top);
+    twin_fixed_t    w = twin_int_to_fixed (right - left);
+    twin_fixed_t    h = twin_int_to_fixed (bottom - top);
+
+    if (!path)
+	return 0;
+    switch (shape) {
+    case TwinShapeRectangle:
+	twin_path_rectangle (path, x, y, w, h);
+	break;
+    case TwinShapeRoundedRectangle:
+	twin_path_rounded_rectangle (path, x, h, w, y, radius, radius);
+	break;
+    case TwinShapeLozenge:
+	twin_path_lozenge  (path, x, y, w, h);
+	break;
+    case TwinShapeTab:
+	twin_path_tab (path, x, y, w, h, radius, radius);
+	break;
+    case TwinShapeEllipse:
+	twin_path_ellipse (path, x + w/2, y + h/2, w/2, h/2);
+	break;
+    }
+    return path;
+}
+
+void
+_twin_widget_paint_shape (twin_widget_t *widget,
+			  twin_shape_t	shape,
+			  twin_coord_t	left,
+			  twin_coord_t	top,
+			  twin_coord_t	right,
+			  twin_coord_t	bottom,
+			  twin_fixed_t	radius)
 {
     twin_pixmap_t	*pixmap = widget->window->pixmap;
-    twin_coord_t	w = widget->extents.right - widget->extents.left;
-    twin_coord_t	h = widget->extents.bottom - widget->extents.top;
     
-    twin_fill (pixmap, widget->background, TWIN_SOURCE, 0, 0, w, h);
+    if (shape == TwinShapeRectangle)
+	twin_fill (pixmap, widget->background, TWIN_SOURCE, 
+		   left, top, right, bottom);
+    else
+    {
+	twin_path_t	*path = _twin_path_shape (shape, left, top,
+						  right, bottom, radius);
+	if (path)
+	{
+	    twin_paint_path (pixmap, widget->background, path);
+	    twin_path_destroy (path);
+	}
+    }
+}
+
+static void
+_twin_widget_paint (twin_widget_t *widget)
+{
+    _twin_widget_paint_shape (widget, widget->shape, 0, 0, 
+			      _twin_widget_width (widget), 
+			      _twin_widget_height (widget), widget->radius);
 }
 
 twin_dispatch_result_t
@@ -91,6 +151,8 @@
     widget->extents.right = widget->extents.bottom = 0;
     widget->preferred = preferred;
     widget->dispatch = dispatch;
+    widget->shape = TwinShapeRectangle;
+    widget->radius = twin_int_to_fixed (12);
 }
 
 void
@@ -129,6 +191,19 @@
 	    0 <= y && y < _twin_widget_height(widget)); 
 }
 
+static twin_path_t *
+_twin_path_bevel_shape (twin_shape_t	shape,
+			twin_bool_t	upper,
+			twin_coord_t	left,
+			twin_coord_t	top,
+			twin_coord_t	right,
+			twin_coord_t	bottom,
+			twin_fixed_t	radius,
+			twin_fixed_t	bw)
+{
+    return 0;
+}
+
 void
 _twin_widget_bevel (twin_widget_t   *widget,
 		    twin_fixed_t    b,

Index: twin_window.c
===================================================================
RCS file: /local/src/CVS/twin/twin_window.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- twin_window.c	26 Oct 2004 19:56:19 -0000	1.5
+++ twin_window.c	29 Oct 2004 17:33:03 -0000	1.6
@@ -43,7 +43,7 @@
 		    twin_coord_t	height)
 {
     twin_window_t   *window = malloc (sizeof (twin_window_t));
-    twin_coord_t    left, right, top, bottom;
+    twin_coord_t    left, top, right, bottom;
 
     if (!window) return NULL;
     window->screen = screen;
@@ -66,8 +66,8 @@
     width += left + right;
     height += top + bottom;
     window->client.left = left;
-    window->client.right = width - right;
     window->client.top = top;
+    window->client.right = width - right;
     window->client.bottom = height - bottom;
     window->pixmap = twin_pixmap_create (format, width, height);
     twin_pixmap_clip (window->pixmap,
@@ -334,9 +334,6 @@
     twin_event_t    ev = *event;
     twin_bool_t	    delegate = TWIN_TRUE;
 
-    if (!window->event)
-	delegate = TWIN_FALSE;
-    
     switch (ev.kind) {
     case TwinEventButtonDown:
 	if (window->client.left <= ev.u.pointer.x &&
@@ -380,6 +377,9 @@
     default:
 	break;
     }
+    if (!window->event)
+	delegate = TWIN_FALSE;
+    
     if (delegate && (*window->event) (window, &ev))
 	return TWIN_TRUE;
     

Index: twin_x11.c
===================================================================
RCS file: /local/src/CVS/twin/twin_x11.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- twin_x11.c	26 Oct 2004 06:15:42 -0000	1.8
+++ twin_x11.c	29 Oct 2004 17:33:03 -0000	1.9
@@ -105,6 +105,8 @@
 	case ButtonRelease:
 	    tev.u.pointer.screen_x = ev.xbutton.x;
 	    tev.u.pointer.screen_y = ev.xbutton.y;
+	    tev.u.pointer.button = ((ev.xbutton.state >> 8) |
+				    (1 << (ev.xbutton.button-1)));
 	    tev.kind = ((ev.type == ButtonPress) ? 
 			TwinEventButtonDown : TwinEventButtonUp);
 	    twin_screen_dispatch (tx->screen, &tev);
@@ -113,7 +115,7 @@
 	    tev.u.pointer.screen_x = ev.xmotion.x;
 	    tev.u.pointer.screen_y = ev.xmotion.y;
 	    tev.kind = TwinEventMotion;
-	    tev.u.pointer.button = ev.xmotion.state;
+	    tev.u.pointer.button = ev.xbutton.state >> 8;
 	    twin_screen_dispatch (tx->screen, &tev);
 	    break;
 	}

Index: twinint.h
===================================================================
RCS file: /local/src/CVS/twin/twinint.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- twinint.h	27 Oct 2004 20:09:36 -0000	1.17
+++ twinint.h	29 Oct 2004 17:33:03 -0000	1.18
@@ -468,6 +468,15 @@
 		   twin_widget_layout_t	preferred,
 		   twin_dispatch_proc_t	dispatch);
 
+void
+_twin_widget_paint_shape (twin_widget_t *widget,
+			  twin_shape_t	shape,
+			  twin_coord_t	left,
+			  twin_coord_t	top,
+			  twin_coord_t	right,
+			  twin_coord_t	bottom,
+			  twin_fixed_t	radius);
+
 twin_dispatch_result_t
 _twin_widget_dispatch (twin_widget_t *widget, twin_event_t *event);
 

Index: xtwin.c
===================================================================
RCS file: /local/src/CVS/twin/xtwin.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- xtwin.c	27 Oct 2004 20:34:55 -0000	1.24
+++ xtwin.c	29 Oct 2004 17:33:03 -0000	1.25
@@ -34,6 +34,8 @@
 #include <twin_demo.h>
 #include <twin_hello.h>
 #include <twin_calc.h>
+#include <twin_demoline.h>
+#include <twin_demospline.h>
 
 #define WIDTH	512
 #define HEIGHT	512
@@ -47,14 +49,25 @@
     twin_screen_set_background (x11->screen, twin_make_pattern ());
 #if 0
     twin_demo_start (x11->screen, "Demo", 100, 100, 400, 400);
-    twin_text_start (x11->screen,  "Gettysburg Address",
-		     0, 0, 300, 300);
-    twin_hello_start (x11->screen, "Hello, World",
-		      0, 0, 200, 200);
 #endif
+#if 0
+    twin_text_start (x11->screen,  "Gettysburg Address", 0, 0, 300, 300);
+#endif
+#if 0
+    twin_hello_start (x11->screen, "Hello, World", 0, 0, 200, 200);
+#endif
+#if 1
     twin_clock_start (x11->screen, "Clock", 10, 10, 200, 200);
-    twin_calc_start (x11->screen, "Calculator",
-		     100, 100, 200, 200);
+#endif
+#if 1
+    twin_calc_start (x11->screen, "Calculator", 100, 100, 200, 200);
+#endif
+#if 1
+    twin_demoline_start (x11->screen, "Demo Line", 0, 0, 400, 400);
+#endif
+#if 1
+    twin_demospline_start (x11->screen, "Demo Spline", 20, 20, 400, 400);
+#endif
     twin_dispatch ();
     return 0;
 }




More information about the Commit mailing list