Mercurial > MadButterfly
changeset 37:943acee7f346
update exposed area
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Wed, 06 Aug 2008 10:14:45 +0800 |
parents | 51a20f240ce3 |
children | 8d219ebd729e |
files | src/X_main.c src/redraw_man.c src/redraw_man.h |
diffstat | 3 files changed, 30 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/X_main.c Wed Aug 06 02:20:28 2008 +0800 +++ b/src/X_main.c Wed Aug 06 10:14:45 2008 +0800 @@ -38,7 +38,7 @@ shape_t *shape = NULL; int in_stroke; - XSelectInput(display, win, PointerMotionMask); + XSelectInput(display, win, PointerMotionMask | ExposureMask); while((r = XNextEvent(display, &evt)) == 0) { switch(evt.type) { case MotionNotify: @@ -48,6 +48,11 @@ shape = find_shape_at_pos(rdman, x, y, &in_stroke); hint_shape(rdman, shape); break; + case Expose: + rdman_redraw_all(rdman); + /* rdman_redraw_area(rdman, evt.xexpose.x, evt.xexpose.y, + evt.xexpose.width, evt.xexpose.height); */ + break; } } }
--- a/src/redraw_man.c Wed Aug 06 02:20:28 2008 +0800 +++ b/src/redraw_man.c Wed Aug 06 10:14:45 2008 +0800 @@ -78,8 +78,10 @@ int r; if(rdman->n_dirty_areas >= rdman->max_dirty_areas) { - /* every geo object and coord object can contribute 2 areas. */ - max_dirty_areas = (rdman->n_geos + rdman->n_coords) * 2; + /* every geo object and coord object can contribute 2 areas. + * rdman_draw_area() may also contribute 1 area. + */ + max_dirty_areas = (rdman->n_geos + rdman->n_coords) * 2 + 1; r = extend_memblk((void **)&rdman->dirty_areas, sizeof(area_t *) * rdman->n_dirty_areas, sizeof(area_t *) * max_dirty_areas); @@ -616,7 +618,6 @@ } static void reset_clip(redraw_man_t *rdman) { - cairo_reset_clip(rdman->cr); cairo_reset_clip(rdman->backend); } @@ -723,6 +724,8 @@ if(r != OK) return ERR; + clean_canvas(rdman->cr); + for(geo = STAILQ_HEAD(rdman->all_geos); geo != NULL; geo = STAILQ_NEXT(geo_t, next, geo)) { @@ -734,6 +737,22 @@ return OK; } +int rdman_redraw_area(redraw_man_t *rdman, co_aix x, co_aix y, + co_aix w, co_aix h) { + area_t area; + int r; + + area.x = x; + area.y = y; + area.w = w; + area.h = h; + add_dirty_area(rdman, &area); + + r = rdman_redraw_changed(rdman); + + return r; +} + int rdman_force_clean(redraw_man_t *rdman) { int r;
--- a/src/redraw_man.h Wed Aug 06 02:20:28 2008 +0800 +++ b/src/redraw_man.h Wed Aug 06 10:14:45 2008 +0800 @@ -70,6 +70,8 @@ extern int rdman_shape_changed(redraw_man_t *rdman, shape_t *shape); extern int rdman_redraw_changed(redraw_man_t *rdman); extern int rdman_redraw_all(redraw_man_t *rdman); +extern int rdman_redraw_area(redraw_man_t *rdman, co_aix x, co_aix y, + co_aix w, co_aix h); extern int rdman_force_clean(redraw_man_t *rdman); extern shnode_t *shnode_new(redraw_man_t *rdman, shape_t *shape); #define shnode_free(rdman, node) elmpool_elm_free((rdman)->shnode_pool, node)