[Commit] twin ChangeLog, 1.21, 1.22 Makefile.am, 1.10, 1.11 twin.h,
1.16, 1.17 twin_box.c, NONE, 1.1 twin_clock.c, 1.1,
1.2 twin_demo.c, 1.1, 1.2 twin_glyphs.c, 1.5, 1.6 twin_hello.c,
NONE, 1.1 twin_label.c, NONE, 1.1 twin_pixmap.c, 1.6,
1.7 twin_screen.c, 1.8, 1.9 twin_text.c, 1.1,
1.2 twin_toplevel.c, NONE, 1.1 twin_widget.c, NONE,
1.1 twin_window.c, 1.3, 1.4 twin_x11.c, 1.7, 1.8 twinint.h,
1.13, 1.14 xtwin.c, 1.20, 1.21
Keith Packard
commit at keithp.com
Mon Oct 25 23:15:46 PDT 2004
- Previous message: [Commit] twin ChangeLog, 1.20, 1.21 Makefile.am, 1.9,
1.10 configure.ac, 1.3, 1.4 twin.h, 1.15, 1.16 twin_clock.c,
NONE, 1.1 twin_clock.h, NONE, 1.1 twin_demo.c, NONE,
1.1 twin_demo.h, NONE, 1.1 twin_dispatch.c, NONE,
1.1 twin_draw.c, 1.6, 1.7 twin_file.c, NONE, 1.1 twin_icon.c,
NONE, 1.1 twin_path.c, 1.11, 1.12 twin_pixmap.c, 1.5,
1.6 twin_poly.c, 1.8, 1.9 twin_queue.c, NONE,
1.1 twin_screen.c, 1.7, 1.8 twin_text.c, NONE, 1.1 twin_text.h,
NONE, 1.1 twin_timeout.c, NONE, 1.1 twin_window.c, 1.2,
1.3 twin_work.c, NONE, 1.1 twin_x11.c, 1.6, 1.7 twin_x11.h,
1.3, 1.4 twinint.h, 1.12, 1.13 xtwin.c, 1.19, 1.20
- Next message: [Commit] twin ChangeLog, 1.22, 1.23 Makefile.am, 1.11, 1.12 twin.h,
1.17, 1.18 twin_button.c, NONE, 1.1 twin_hello.c, 1.1,
1.2 twin_hello.h, NONE, 1.1 twin_label.c, 1.1,
1.2 twin_widget.c, 1.1, 1.2 twin_window.c, 1.4, 1.5 twinint.h,
1.14, 1.15 xtwin.c, 1.21, 1.22
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: keithp
Update of /local/src/CVS/twin
In directory home.keithp.com:/tmp/cvs-serv21003
Modified Files:
ChangeLog Makefile.am twin.h twin_clock.c twin_demo.c
twin_glyphs.c twin_pixmap.c twin_screen.c twin_text.c
twin_window.c twin_x11.c twinint.h xtwin.c
Added Files:
twin_box.c twin_hello.c twin_label.c twin_toplevel.c
twin_widget.c
Log Message:
2004-10-25 Keith Packard <keithp at keithp.com>
* Makefile.am:
* twin.h:
* twin_box.c: (_twin_box_init), (_twin_box_query_geometry),
(_twin_box_configure), (_twin_box_xy_to_widget),
(_twin_box_dispatch), (twin_box_create):
* twin_label.c: (_twin_label_query_geometry), (_twin_label_paint),
(_twin_label_dispatch), (twin_label_set), (_twin_label_init),
(twin_label_create):
* twin_toplevel.c: (_twin_toplevel_dispatch),
(_twin_toplevel_event), (_twin_toplevel_draw),
(_twin_toplevel_destroy), (_twin_toplevel_init),
(twin_toplevel_create), (_twin_toplevel_paint),
(_twin_toplevel_queue_paint), (_twin_toplevel_layout),
(_twin_toplevel_queue_layout), (twin_toplevel_show):
* twin_widget.c: (_twin_widget_paint), (_twin_widget_dispatch),
(_twin_widget_init), (_twin_widget_queue_paint),
(_twin_widget_queue_layout), (twin_widget_create),
(twin_widget_set):
* twinint.h:
Add initial widget implementation.
* twin_glyphs.c:
Fix numbers to have the same width.
* twin_pixmap.c: (twin_pixmap_set_clip):
Add new relative-origin clip setting function
* twin_screen.c: (twin_screen_set_active), (twin_screen_dispatch):
* twin_window.c: (twin_window_create), (twin_window_style_size),
(twin_window_draw), (twin_window_dispatch):
* twin_x11.c: (twin_x11_read_events):
* twin_clock.c: (twin_clock_start):
* twin_demo.c: (twin_example_start), (twin_line_start),
(twin_circletext_start), (twin_quickbrown_start),
(twin_ascii_start), (twin_jelly_start):
* twin_text.c: (twin_text_start):
Change enumerated constants to include Twin prefix
* twin_hello.c: (_twin_hello_timeout), (twin_hello_start):
Add new widget-based demo
* xtwin.c: (main):
Start widget based demo
Index: ChangeLog
===================================================================
RCS file: /local/src/CVS/twin/ChangeLog,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- ChangeLog 25 Oct 2004 19:09:35 -0000 1.21
+++ ChangeLog 26 Oct 2004 06:15:42 -0000 1.22
@@ -1,6 +1,52 @@
2004-10-25 Keith Packard <keithp at keithp.com>
* Makefile.am:
+ * twin.h:
+ * twin_box.c: (_twin_box_init), (_twin_box_query_geometry),
+ (_twin_box_configure), (_twin_box_xy_to_widget),
+ (_twin_box_dispatch), (twin_box_create):
+ * twin_label.c: (_twin_label_query_geometry), (_twin_label_paint),
+ (_twin_label_dispatch), (twin_label_set), (_twin_label_init),
+ (twin_label_create):
+ * twin_toplevel.c: (_twin_toplevel_dispatch),
+ (_twin_toplevel_event), (_twin_toplevel_draw),
+ (_twin_toplevel_destroy), (_twin_toplevel_init),
+ (twin_toplevel_create), (_twin_toplevel_paint),
+ (_twin_toplevel_queue_paint), (_twin_toplevel_layout),
+ (_twin_toplevel_queue_layout), (twin_toplevel_show):
+ * twin_widget.c: (_twin_widget_paint), (_twin_widget_dispatch),
+ (_twin_widget_init), (_twin_widget_queue_paint),
+ (_twin_widget_queue_layout), (twin_widget_create),
+ (twin_widget_set):
+ * twinint.h:
+ Add initial widget implementation.
+
+ * twin_glyphs.c:
+ Fix numbers to have the same width.
+
+ * twin_pixmap.c: (twin_pixmap_set_clip):
+ Add new relative-origin clip setting function
+
+ * twin_screen.c: (twin_screen_set_active), (twin_screen_dispatch):
+ * twin_window.c: (twin_window_create), (twin_window_style_size),
+ (twin_window_draw), (twin_window_dispatch):
+ * twin_x11.c: (twin_x11_read_events):
+ * twin_clock.c: (twin_clock_start):
+ * twin_demo.c: (twin_example_start), (twin_line_start),
+ (twin_circletext_start), (twin_quickbrown_start),
+ (twin_ascii_start), (twin_jelly_start):
+ * twin_text.c: (twin_text_start):
+ Change enumerated constants to include Twin prefix
+
+ * twin_hello.c: (_twin_hello_timeout), (twin_hello_start):
+ Add new widget-based demo
+
+ * xtwin.c: (main):
+ Start widget based demo
+
+2004-10-25 Keith Packard <keithp at keithp.com>
+
+ * Makefile.am:
* configure.ac:
* twin_dispatch.c: (twin_dispatch):
* twin_file.c: (_twin_file_order), (_twin_run_file),
Index: Makefile.am
===================================================================
RCS file: /local/src/CVS/twin/Makefile.am,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- Makefile.am 25 Oct 2004 19:09:35 -0000 1.10
+++ Makefile.am 26 Oct 2004 06:15:42 -0000 1.11
@@ -1,4 +1,3 @@
-AM_CFLAGS=-O0 -g
INCLUDES= @X_CFLAGS@ @WARN_CFLAGS@
#libtwin_la_SOURCES = \
@@ -16,6 +15,7 @@
xtwin_SOURCES = \
twin.h \
+ twin_box.c \
twin_convolve.c \
twin_dispatch.c \
twin_draw.c \
@@ -26,25 +26,28 @@
twin_fixed.c \
twin_font.c \
twin_geom.c \
+ twin_label.c \
twin_matrix.c \
twin_path.c \
twin_pattern.c \
twin_pixmap.c \
twin_poly.c \
twin_primitive.c \
+ twin_queue.c \
twin_screen.c \
twin_spline.c \
+ twin_timeout.c \
+ twin_toplevel.c \
twin_trig.c \
+ twin_widget.c \
twin_window.c \
- twin_x11.c \
- twinint.h \
- twin_queue.c \
- twin_timeout.c \
twin_work.c \
+ twin_x11.c \
twinint.h \
twin_clock.c \
twin_text.c \
twin_demo.c \
+ twin_hello.c \
xtwin.c
xtwin_LDADD = @X_LIBS@ -lm
Index: twin.h
===================================================================
RCS file: /local/src/CVS/twin/twin.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- twin.h 25 Oct 2004 19:09:35 -0000 1.16
+++ twin.h 26 Oct 2004 06:15:42 -0000 1.17
@@ -41,6 +41,7 @@
typedef int16_t twin_keysym_t;
typedef int32_t twin_area_t;
typedef int32_t twin_time_t;
+typedef int16_t twin_stretch_t;
#define TWIN_FALSE 0
#define TWIN_TRUE 1
@@ -251,9 +252,14 @@
*/
typedef enum _twin_event_kind {
- EventButtonDown, EventButtonUp, EventMotion,
- EventKeyDown, EventKeyUp, EventUcs4,
- EventActivate, EventDeactivate,
+ TwinEventButtonDown, TwinEventButtonUp, TwinEventMotion,
+ TwinEventKeyDown, TwinEventKeyUp, TwinEventUcs4,
+ TwinEventActivate, TwinEventDeactivate,
+ TwinEventPaint,
+ TwinEventShow,
+ TwinEventQueryGeometry,
+ TwinEventConfigure,
+ TwinEventDestroy,
} twin_event_kind_t;
typedef struct _twin_event {
@@ -270,6 +276,9 @@
struct {
twin_ucs4_t ucs4;
} ucs4;
+ struct {
+ twin_rect_t extents;
+ } configure;
} u;
} twin_event_t;
@@ -283,11 +292,11 @@
*/
typedef enum _twin_window_style {
- WindowPlain,
- WindowApplication,
- WindowFullScreen,
- WindowDialog,
- WindowAlert,
+ TwinWindowPlain,
+ TwinWindowApplication,
+ TwinWindowFullScreen,
+ TwinWindowDialog,
+ TwinWindowAlert,
} twin_window_style_t;
typedef void (*twin_draw_func_t) (twin_window_t *window);
@@ -324,28 +333,6 @@
} twin_icon_t;
/*
- * Widgets
- */
-
-typedef enum _twin_box_layout {
- TwinLayoutHorz, TwinLayoutVert
-} twin_box_layout_t;
-
-typedef struct _twin_box {
- twin_box_layout_t layout;
- twin_rect_t geometry;
-
-} twin_box_t;
-
-typedef struct {
- twin_rect_t geometry;
-} twin_widget_t;
-
-typedef struct {
- twin_widget_t core;
-} twin_button_t;
-
-/*
* Timeout and work procs return TWIN_TRUE to remain in the queue,
* timeout procs are called every 'delay' ms
*/
@@ -364,16 +351,85 @@
twin_file_op_t ops,
void *closure);
-typedef void (*twin_block_proc_t) (void *closure);
-typedef void (*twin_wakeup_proc_t) (void *closure);
-
#define twin_time_compare(a,op,b) (((a) - (b)) op 0)
typedef struct _twin_timeout twin_timeout_t;
typedef struct _twin_work twin_work_t;
typedef struct _twin_file twin_file_t;
-typedef struct _twin_block twin_block_t;
-typedef struct _twin_wakeup twin_wakeup_t;
+
+/*
+ * Widgets
+ */
+
+typedef struct _twin_widget twin_widget_t;
+typedef struct _twin_box twin_box_t;
+
+typedef enum _twin_widget_kind_t {
+ TwinWidgetToplevel,
+ TwinWidgetBox,
+ TwinWidgetLabel,
+ TwinWidgetGlue,
+} twin_widget_kind_t;
+
+typedef enum _twin_dispatch_result {
+ TwinDispatchNone,
+ TwinDispatchPaint,
+ TwinDispatchConfigure,
+} twin_dispatch_result_t;
+
+typedef enum _twin_layout {
+ TwinLayoutHorz, TwinLayoutVert
+} twin_layout_t;
+
+typedef twin_dispatch_result_t (*twin_dispatch_proc_t) (twin_widget_t *widget,
+ twin_event_t *event);
+
+struct _twin_widget {
+ twin_window_t *window;
+ twin_widget_t *next;
+ twin_box_t *parent;
+ twin_bool_t paint;
+ twin_bool_t layout;
+ twin_bool_t want_focus;
+ twin_argb32_t background;
+ twin_rect_t extents; /* current geometry */
+ twin_rect_t preferred; /* desired geometry */
+ twin_stretch_t hstretch; /* stretch ratio in horizontal dir */
+ twin_stretch_t vstretch; /* stretch ratio in vertical dir */
+ twin_dispatch_proc_t dispatch;
+};
+
+struct _twin_box {
+ twin_widget_t widget;
+ twin_layout_t layout;
+ twin_widget_t *children;
+ twin_widget_t *button_down;
+ twin_widget_t *focus;
+};
+
+typedef struct _twin_toplevel {
+ twin_box_t box;
+} twin_toplevel_t;
+
+typedef struct _twin_label {
+ twin_widget_t widget;
+ char *label;
+ twin_argb32_t foreground;
+ twin_fixed_t font_size;
+ twin_style_t font_style;
+} twin_label_t;
+
+typedef struct _twin_glue {
+ twin_widget_t widget;
+} twin_glue_t;
+
+/*
+ * twin_box.c
+ */
+
+twin_box_t *
+twin_box_create (twin_box_t *parent,
+ twin_layout_t layout);
/*
* twin_convolve.c
@@ -508,6 +564,24 @@
twin_icon_draw (twin_pixmap_t *pixmap, twin_icon_t icon, twin_matrix_t matrix);
/*
+ * twin_label.c
+ */
+
+twin_label_t *
+twin_label_create (twin_box_t *parent,
+ const char *value,
+ twin_argb32_t foreground,
+ twin_fixed_t font_size,
+ twin_style_t font_style);
+
+void
+twin_label_set (twin_label_t *label,
+ const char *value,
+ twin_argb32_t foreground,
+ twin_fixed_t font_size,
+ twin_style_t font_style);
+
+/*
* twin_matrix.c
*/
@@ -676,6 +750,9 @@
twin_coord_t left, twin_coord_t top,
twin_coord_t right, twin_coord_t bottom);
+void
+twin_pixmap_set_clip (twin_pixmap_t *pixmap, twin_rect_t clip);
+
twin_rect_t
twin_pixmap_current_clip (twin_pixmap_t *pixmap);
@@ -795,9 +872,9 @@
#define twin_time_compare(a,op,b) (((a) - (b)) op 0)
twin_timeout_t *
-twin_set_timeout (twin_timeout_proc_t timeout_proc,
- twin_time_t delay,
- void *closure);
+twin_set_timeout (twin_timeout_proc_t timeout_proc,
+ twin_time_t delay,
+ void *closure);
void
twin_clear_timeout (twin_timeout_t *timeout);
@@ -806,6 +883,22 @@
twin_now (void);
/*
+ * twin_toplevel.c
+ */
+twin_toplevel_t *
+twin_toplevel_create (twin_screen_t *screen,
+ twin_format_t format,
+ twin_window_style_t style,
+ twin_coord_t x,
+ twin_coord_t y,
+ twin_coord_t width,
+ twin_coord_t height,
+ const char *name);
+
+void
+twin_toplevel_show (twin_toplevel_t *toplevel);
+
+/*
* twin_trig.c
*/
@@ -819,6 +912,21 @@
twin_tan (twin_angle_t a);
/*
+ * twin_widget.c
+ */
+
+twin_widget_t *
+twin_widget_create (twin_box_t *parent,
+ twin_argb32_t background,
+ twin_coord_t width,
+ twin_coord_t height,
+ twin_stretch_t hstretch,
+ twin_stretch_t vstretch);
+
+void
+twin_widget_set (twin_widget_t *widget, twin_argb32_t background);
+
+/*
* twin_window.c
*/
@@ -866,12 +974,14 @@
* twin_work.c
*/
-#define TWIN_WORK_REDISPLAY 0
+#define TWIN_WORK_REDISPLAY 0
+#define TWIN_WORK_PAINT 1
+#define TWIN_WORK_LAYOUT 2
twin_work_t *
-twin_set_work (twin_work_proc_t work_proc,
- int priority,
- void *closure);
+twin_set_work (twin_work_proc_t work_proc,
+ int priority,
+ void *closure);
void
twin_clear_work (twin_work_t *work);
--- NEW FILE: twin_box.c ---
(This appears to be a binary file; contents omitted.)
Index: twin_clock.c
===================================================================
RCS file: /local/src/CVS/twin/twin_clock.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- twin_clock.c 25 Oct 2004 19:09:35 -0000 1.1
+++ twin_clock.c 26 Oct 2004 06:15:42 -0000 1.2
@@ -223,7 +223,7 @@
struct timeval tv;
twin_time_t to;
twin_window_t *clock = twin_window_create (screen, TWIN_ARGB32,
- WindowApplication,
+ TwinWindowApplication,
x, y, w, h);
twin_window_set_name (clock, name);
twin_clock_timeout (0, clock);
Index: twin_demo.c
===================================================================
RCS file: /local/src/CVS/twin/twin_demo.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- twin_demo.c 25 Oct 2004 19:09:35 -0000 1.1
+++ twin_demo.c 26 Oct 2004 06:15:42 -0000 1.2
@@ -26,18 +26,21 @@
#define D(x) twin_double_to_fixed(x)
+#if 0
static int styles[] = {
TWIN_TEXT_ROMAN,
TWIN_TEXT_OBLIQUE,
TWIN_TEXT_BOLD,
TWIN_TEXT_BOLD|TWIN_TEXT_OBLIQUE
};
+#endif
+#if 0
static void
twin_example_start (twin_screen_t *screen, int x, int y, int w, int h)
{
twin_window_t *window = twin_window_create (screen, TWIN_ARGB32,
- WindowApplication,
+ TwinWindowApplication,
x, y, w, h);
int wid = window->client.right - window->client.left;
int hei = window->client.bottom - window->client.top;
@@ -67,12 +70,13 @@
twin_pixmap_destroy (alpha);
twin_window_show (window);
}
+#endif
static void
twin_line_start (twin_screen_t *screen, int x, int y, int w, int h)
{
twin_window_t *window = twin_window_create (screen, TWIN_ARGB32,
- WindowApplication,
+ TwinWindowApplication,
x, y, w, h);
int wid = window->client.right - window->client.left;
int hei = window->client.bottom - window->client.top;
@@ -120,7 +124,7 @@
twin_circletext_start (twin_screen_t *screen, int x, int y, int w, int h)
{
twin_window_t *window = twin_window_create (screen, TWIN_ARGB32,
- WindowApplication,
+ TwinWindowApplication,
x, y, w, h);
int wid = window->client.right - window->client.left;
int hei = window->client.bottom - window->client.top;
@@ -165,7 +169,7 @@
twin_quickbrown_start (twin_screen_t *screen, int x, int y, int w, int h)
{
twin_window_t *window = twin_window_create (screen, TWIN_ARGB32,
- WindowApplication,
+ TwinWindowApplication,
x, y, w, h);
int wid = window->client.right - window->client.left;
int hei = window->client.bottom - window->client.top;
@@ -214,7 +218,7 @@
twin_ascii_start (twin_screen_t *screen, int x, int y, int w, int h)
{
twin_window_t *window = twin_window_create (screen, TWIN_ARGB32,
- WindowApplication,
+ TwinWindowApplication,
x, y, w, h);
int wid = window->client.right - window->client.left;
int hei = window->client.bottom - window->client.top;
@@ -268,7 +272,7 @@
twin_jelly_start (twin_screen_t *screen, int x, int y, int w, int h)
{
twin_window_t *window = twin_window_create (screen, TWIN_ARGB32,
- WindowApplication,
+ TwinWindowApplication,
x, y, w, h);
int wid = window->client.right - window->client.left;
int hei = window->client.bottom - window->client.top;
@@ -321,11 +325,6 @@
twin_window_show (window);
}
-static void
-twin_extents_start (twin_screen_t *screen, const char *name, int x, int y, int w, int h)
-{
-}
-
void
twin_demo_start (twin_screen_t *screen, const char *name, int x, int y, int w, int h)
{
Index: twin_glyphs.c
===================================================================
RCS file: /local/src/CVS/twin/twin_glyphs.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- twin_glyphs.c 4 Oct 2004 08:30:35 -0000 1.5
+++ twin_glyphs.c 26 Oct 2004 06:15:42 -0000 1.6
@@ -208,12 +208,12 @@
'c', 28, -42, 19, -42, 14, -42,
'e',
/* 0x31 '1' offset 666 */
- 0, 10, 42, 0, 2, 3,
- 0, 10, /* snap_x */
+ 0, 28, 42, 0, 2, 3,
+ 0, 14, 28 /* snap_x */
-21, -15, 0, /* snap_y */
- 'm', 0, -34,
- 'c', 4, -35, 8, -38, 10, -42,
- 'l', 10, 0,
+ 'm', 4, -34,
+ 'c', 8, -35, 12, -38, 14, -42,
+ 'l', 14, 0,
'e',
/* 0x32 '2' offset 691 */
0, 28, 42, 0, 4, 4,
@@ -238,7 +238,7 @@
'c', 8, 0, 3, -1, 0, -8,
'e',
/* 0x34 '4' offset 780 */
- 0, 30, 42, 0, 3, 4,
+ 0, 28, 42, 0, 3, 4,
0, 20, 30, /* snap_x */
-21, -15, -14, 0, /* snap_y */
'm', 20, -42,
@@ -260,7 +260,7 @@
'c', 10, 0, 3, 0, 0, -8,
'e',
/* 0x36 '6' offset 860 */
- 0, 26, 42, 0, 2, 5,
+ 0, 28, 42, 0, 2, 5,
0, 26, /* snap_x */
-42, -26, -21, -15, 0, /* snap_y */
'm', 24, -36,
@@ -293,7 +293,7 @@
'c', 26, -40, 23, -42, 14, -42,
'e',
/* 0x39 '9' offset 1004 */
- 0, 26, 42, 0, 2, 5,
+ 0, 28, 42, 0, 2, 5,
0, 26, /* snap_x */
-42, -21, -16, -15, 0, /* snap_y */
'm', 26, -28,
--- NEW FILE: twin_hello.c ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: twin_label.c ---
(This appears to be a binary file; contents omitted.)
Index: twin_pixmap.c
===================================================================
RCS file: /local/src/CVS/twin/twin_pixmap.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- twin_pixmap.c 25 Oct 2004 19:09:36 -0000 1.6
+++ twin_pixmap.c 26 Oct 2004 06:15:42 -0000 1.7
@@ -196,6 +196,16 @@
pixmap->clip.bottom = pixmap->clip.top = 0;
}
+void
+twin_pixmap_set_clip (twin_pixmap_t *pixmap, twin_rect_t clip)
+{
+ twin_pixmap_clip (pixmap,
+ clip.left + pixmap->clip.left,
+ clip.top + pixmap->clip.top,
+ clip.right + pixmap->clip.left,
+ clip.bottom+ pixmap->clip.top);
+}
+
twin_rect_t
twin_pixmap_current_clip (twin_pixmap_t *pixmap)
{
Index: twin_screen.c
===================================================================
RCS file: /local/src/CVS/twin/twin_screen.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- twin_screen.c 25 Oct 2004 19:09:36 -0000 1.8
+++ twin_screen.c 26 Oct 2004 06:15:42 -0000 1.9
@@ -225,12 +225,12 @@
screen->active = pixmap;
if (old)
{
- ev.kind = EventDeactivate;
+ ev.kind = TwinEventDeactivate;
twin_pixmap_dispatch (old, &ev);
}
if (pixmap)
{
- ev.kind = EventActivate;
+ ev.kind = TwinEventActivate;
twin_pixmap_dispatch (pixmap, &ev);
}
}
@@ -263,9 +263,9 @@
twin_pixmap_t *pixmap;
switch (event->kind) {
- case EventMotion:
- case EventButtonDown:
- case EventButtonUp:
+ case TwinEventMotion:
+ case TwinEventButtonDown:
+ case TwinEventButtonUp:
pixmap = screen->pointer;
if (!pixmap)
{
@@ -276,10 +276,10 @@
{
break;
}
- if (event->kind == EventButtonDown)
+ if (event->kind == TwinEventButtonDown)
screen->pointer = pixmap;
}
- if (event->kind == EventButtonUp)
+ if (event->kind == TwinEventButtonUp)
screen->pointer = NULL;
if (pixmap)
{
@@ -287,9 +287,9 @@
event->u.pointer.y = event->u.pointer.screen_y - pixmap->y;
}
break;
- case EventKeyDown:
- case EventKeyUp:
- case EventUcs4:
+ case TwinEventKeyDown:
+ case TwinEventKeyUp:
+ case TwinEventUcs4:
pixmap = screen->active;
break;
default:
Index: twin_text.c
===================================================================
RCS file: /local/src/CVS/twin/twin_text.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- twin_text.c 25 Oct 2004 19:09:36 -0000 1.1
+++ twin_text.c 26 Oct 2004 06:15:42 -0000 1.2
@@ -30,7 +30,7 @@
twin_text_start (twin_screen_t *screen, const char *name, int x, int y, int w, int h)
{
twin_window_t *text = twin_window_create (screen, TWIN_ARGB32,
- WindowApplication,
+ TwinWindowApplication,
x,y,w,h);
twin_fixed_t fx, fy;
static const char *lines[] = {
--- NEW FILE: twin_toplevel.c ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: twin_widget.c ---
(This appears to be a binary file; contents omitted.)
Index: twin_window.c
===================================================================
RCS file: /local/src/CVS/twin/twin_window.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- twin_window.c 25 Oct 2004 19:09:36 -0000 1.3
+++ twin_window.c 26 Oct 2004 06:15:42 -0000 1.4
@@ -49,13 +49,13 @@
window->screen = screen;
window->style = style;
switch (window->style) {
- case WindowApplication:
+ case TwinWindowApplication:
left = TWIN_BW;
top = TWIN_BW + TWIN_TITLE_HEIGHT + TWIN_BW;
right = TWIN_BW + TWIN_RESIZE_SIZE;
bottom = TWIN_BW + TWIN_RESIZE_SIZE;
break;
- case WindowPlain:
+ case TwinWindowPlain:
default:
left = 0;
top = 0;
@@ -153,11 +153,11 @@
twin_rect_t *size)
{
switch (style) {
- case WindowPlain:
+ case TwinWindowPlain:
default:
size->left = size->right = size->top = size->bottom = 0;
break;
- case WindowApplication:
+ case TwinWindowApplication:
size->left = TWIN_BW;
size->right = TWIN_BW;
size->top = TWIN_BW + TWIN_TITLE_HEIGHT + TWIN_BW;
@@ -315,10 +315,10 @@
twin_window_draw (twin_window_t *window)
{
switch (window->style) {
- case WindowPlain:
+ case TwinWindowPlain:
default:
break;
- case WindowApplication:
+ case TwinWindowApplication:
twin_window_frame (window);
break;
}
@@ -329,18 +329,47 @@
twin_bool_t
twin_window_dispatch (twin_window_t *window, twin_event_t *event)
{
- if (window->event && (*window->event) (window, event))
+ twin_event_t ev = *event;
+ twin_bool_t delegate = TWIN_TRUE;
+
+ if (!window->event)
+ delegate = TWIN_FALSE;
+
+ switch (ev.kind) {
+ case TwinEventButtonDown:
+ if (ev.u.pointer.x < window->client.left ||
+ window->client.right <= ev.u.pointer.x ||
+ ev.u.pointer.y < window->client.top ||
+ window->client.bottom <= ev.u.pointer.y)
+ {
+ delegate = TWIN_FALSE;
+ break;
+ }
+ /* fall through... */
+ case TwinEventButtonUp:
+ case TwinEventMotion:
+ ev.u.pointer.x -= window->client.left;
+ ev.u.pointer.y -= window->client.top;
+ break;
+ default:
+ break;
+ }
+ if (delegate && (*window->event) (window, &ev))
return TWIN_TRUE;
+
+ /*
+ * simple window management
+ */
switch (event->kind) {
- case EventButtonDown:
+ case TwinEventButtonDown:
twin_window_show (window);
window->screen->button_x = event->u.pointer.x;
window->screen->button_y = event->u.pointer.y;
return TWIN_TRUE;
- case EventButtonUp:
+ case TwinEventButtonUp:
window->screen->button_x = -1;
window->screen->button_y = -1;
- case EventMotion:
+ case TwinEventMotion:
if (window->screen->button_x >= 0)
{
twin_coord_t x, y;
Index: twin_x11.c
===================================================================
RCS file: /local/src/CVS/twin/twin_x11.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- twin_x11.c 25 Oct 2004 19:09:36 -0000 1.7
+++ twin_x11.c 26 Oct 2004 06:15:42 -0000 1.8
@@ -106,13 +106,13 @@
tev.u.pointer.screen_x = ev.xbutton.x;
tev.u.pointer.screen_y = ev.xbutton.y;
tev.kind = ((ev.type == ButtonPress) ?
- EventButtonDown : EventButtonUp);
+ TwinEventButtonDown : TwinEventButtonUp);
twin_screen_dispatch (tx->screen, &tev);
break;
case MotionNotify:
tev.u.pointer.screen_x = ev.xmotion.x;
tev.u.pointer.screen_y = ev.xmotion.y;
- tev.kind = EventMotion;
+ tev.kind = TwinEventMotion;
tev.u.pointer.button = ev.xmotion.state;
twin_screen_dispatch (tx->screen, &tev);
break;
Index: twinint.h
===================================================================
RCS file: /local/src/CVS/twin/twinint.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- twinint.h 25 Oct 2004 19:09:36 -0000 1.13
+++ twinint.h 26 Oct 2004 06:15:42 -0000 1.14
@@ -412,18 +412,6 @@
void *closure;
};
-struct _twin_block {
- twin_queue_t queue;
- twin_block_proc_t proc;
- void *closure;
-};
-
-struct _twin_wakeup {
- twin_queue_t queue;
- twin_wakeup_proc_t proc;
- void *closure;
-};
-
typedef enum _twin_order {
TWIN_BEFORE = -1,
TWIN_AT = 0,
@@ -463,4 +451,58 @@
void
_twin_run_work (void);
+void
+_twin_box_init (twin_box_t *box,
+ twin_box_t *parent,
+ twin_window_t *window,
+ twin_layout_t layout,
+ twin_dispatch_proc_t dispatch);
+
+twin_dispatch_result_t
+_twin_box_dispatch (twin_widget_t *widget, twin_event_t *event);
+
+void
+_twin_widget_init (twin_widget_t *widget,
+ twin_box_t *parent,
+ twin_window_t *window,
+ twin_rect_t preferred,
+ twin_stretch_t hstretch,
+ twin_stretch_t vstretch,
+ twin_dispatch_proc_t dispatch);
+
+twin_dispatch_result_t
+_twin_widget_dispatch (twin_widget_t *widget, twin_event_t *event);
+
+void
+_twin_widget_queue_paint (twin_widget_t *widget);
+
+void
+_twin_widget_queue_layout (twin_widget_t *widget);
+
+void
+_twin_label_init (twin_label_t *label,
+ twin_box_t *parent,
+ const char *value,
+ twin_argb32_t foreground,
+ twin_fixed_t font_size,
+ twin_style_t font_style);
+
+twin_dispatch_result_t
+_twin_label_dispatch (twin_widget_t *widget, twin_event_t *event);
+
+twin_dispatch_result_t
+_twin_toplevel_dispatch (twin_widget_t *widget, twin_event_t *event);
+
+void
+_twin_toplevel_init (twin_toplevel_t *toplevel,
+ twin_dispatch_proc_t dispatch,
+ twin_window_t *window,
+ const char *name);
+
+void
+_twin_toplevel_queue_paint (twin_widget_t *widget);
+
+void
+_twin_toplevel_queue_layout (twin_widget_t *widget);
+
#endif /* _TWININT_H_ */
Index: xtwin.c
===================================================================
RCS file: /local/src/CVS/twin/xtwin.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- xtwin.c 25 Oct 2004 19:09:36 -0000 1.20
+++ xtwin.c 26 Oct 2004 06:15:42 -0000 1.21
@@ -43,10 +43,14 @@
twin_x11_t *x11 = twin_x11_create (dpy, WIDTH, HEIGHT);
twin_screen_set_background (x11->screen, twin_make_pattern ());
+#if 0
twin_demo_start (x11->screen, "Demo", 100, 100, 400, 400);
twin_clock_start (x11->screen, "Clock", 10, 10, 200, 200);
twin_text_start (x11->screen, "Gettysburg Address",
0, 0, 300, 300);
+#endif
+ twin_hello_start (x11->screen, "Hello, World",
+ 0, 0, 100, 100);
twin_dispatch ();
return 0;
}
- Previous message: [Commit] twin ChangeLog, 1.20, 1.21 Makefile.am, 1.9,
1.10 configure.ac, 1.3, 1.4 twin.h, 1.15, 1.16 twin_clock.c,
NONE, 1.1 twin_clock.h, NONE, 1.1 twin_demo.c, NONE,
1.1 twin_demo.h, NONE, 1.1 twin_dispatch.c, NONE,
1.1 twin_draw.c, 1.6, 1.7 twin_file.c, NONE, 1.1 twin_icon.c,
NONE, 1.1 twin_path.c, 1.11, 1.12 twin_pixmap.c, 1.5,
1.6 twin_poly.c, 1.8, 1.9 twin_queue.c, NONE,
1.1 twin_screen.c, 1.7, 1.8 twin_text.c, NONE, 1.1 twin_text.h,
NONE, 1.1 twin_timeout.c, NONE, 1.1 twin_window.c, 1.2,
1.3 twin_work.c, NONE, 1.1 twin_x11.c, 1.6, 1.7 twin_x11.h,
1.3, 1.4 twinint.h, 1.12, 1.13 xtwin.c, 1.19, 1.20
- Next message: [Commit] twin ChangeLog, 1.22, 1.23 Makefile.am, 1.11, 1.12 twin.h,
1.17, 1.18 twin_button.c, NONE, 1.1 twin_hello.c, 1.1,
1.2 twin_hello.h, NONE, 1.1 twin_label.c, 1.1,
1.2 twin_widget.c, 1.1, 1.2 twin_window.c, 1.4, 1.5 twinint.h,
1.14, 1.15 xtwin.c, 1.21, 1.22
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Commit
mailing list