update atari frontend for corewindow API change

This commit is contained in:
Vincent Sanders 2017-05-23 09:45:24 +01:00
parent 6f2670ec42
commit ab676ec917
2 changed files with 33 additions and 21 deletions

View File

@ -31,10 +31,12 @@
lbuf[7] = (long)sbuf[7]; lbuf[7] = (long)sbuf[7];
#define RECT_TO_GRECT(r,g) \ #define RECT_TO_GRECT(r,g) \
(g)->g_x = (r->x0 < r->x1) ? r->x0 : r->x1 ; \ do { \
(g)->g_y = (r->y0 < r->y1) ? r->y0 : r->y1 ; \ (g)->g_x = (r->x0 < r->x1) ? r->x0 : r->x1 ; \
(g)->g_w = (r->x0 < r->x1) ? r->x1 - r->x0 : r->x0 - r->x1 ; \ (g)->g_y = (r->y0 < r->y1) ? r->y0 : r->y1 ; \
(g)->g_h = (r->y0 < r->y1) ? r->y1 - r->y0 : r->y0 - r->y1 ; (g)->g_w = (r->x0 < r->x1) ? r->x1 - r->x0 : r->x0 - r->x1 ; \
(g)->g_h = (r->y0 < r->y1) ? r->y1 - r->y0 : r->y0 - r->y1 ; \
} while(0)

View File

@ -44,8 +44,7 @@
* Declare Core Window Callbacks: * Declare Core Window Callbacks:
*/ */
void atari_treeview_redraw_request(struct core_window *cw, nserror atari_treeview_invalidate_area(struct core_window *cw, const struct rect *r);
const struct rect *r);
void atari_treeview_update_size(struct core_window *cw, int width, int height); void atari_treeview_update_size(struct core_window *cw, int width, int height);
void atari_treeview_scroll_visible(struct core_window *cw, void atari_treeview_scroll_visible(struct core_window *cw,
const struct rect *r); const struct rect *r);
@ -56,7 +55,7 @@ void atari_treeview_drag_status(struct core_window *cw,
core_window_drag_status ds); core_window_drag_status ds);
static struct core_window_callback_table cw_t = { static struct core_window_callback_table cw_t = {
.redraw_request = atari_treeview_redraw_request, .invalidate = atari_treeview_invalidate_area,
.update_size = atari_treeview_update_size, .update_size = atari_treeview_update_size,
.scroll_visible = atari_treeview_scroll_visible, .scroll_visible = atari_treeview_scroll_visible,
.get_window_dimensions = atari_treeview_get_window_dimensions, .get_window_dimensions = atari_treeview_get_window_dimensions,
@ -655,32 +654,43 @@ void atari_treeview_close(struct core_window *cw)
*/ */
/** /**
* Request a redraw of the window * callback from core to request an invalidation of a window area.
* *
* \param cw the core window object * The specified area of the window should now be considered
* \param r rectangle to redraw * out of date. If the area is NULL the entire window must be
* invalidated.
*
* \param[in] cw The core window to invalidate.
* \param[in] r area to redraw or NULL for the entire window area.
* \return NSERROR_OK on success or appropriate error code.
*/ */
void atari_treeview_redraw_request(struct core_window *cw, const struct rect *r) nserror atari_treeview_invalidate_area(struct core_window *cw, const struct rect *r)
{ {
GRECT area; GRECT area;
struct gemtk_wm_scroll_info_s * slid; struct gemtk_wm_scroll_info_s * slid;
struct atari_treeview_window * tv = (struct atari_treeview_window *)cw; struct atari_treeview_window * tv = (struct atari_treeview_window *)cw;
RECT_TO_GRECT(r, &area)
assert(tv); assert(tv);
slid = gemtk_wm_get_scroll_info(tv->window); if (r != NULL) {
RECT_TO_GRECT(r, &area);
//dbg_rect("redraw rect request", r); slid = gemtk_wm_get_scroll_info(tv->window);
// treeview redraw is always full window width: //dbg_rect("redraw rect request", r);
area.g_x = 0;
area.g_w = 8000; // treeview redraw is always full window width:
// but vertical redraw region is clipped: area.g_x = 0;
area.g_y = r->y0 - (slid->y_pos*slid->y_unit_px); area.g_w = 8000;
area.g_h = r->y1 - r->y0; // but vertical redraw region is clipped:
area.g_y = r->y0 - (slid->y_pos*slid->y_unit_px);
area.g_h = r->y1 - r->y0;
} else {
atari_treeview_get_grect(cw, TREEVIEW_AREA_CONTENT, &area);
}
atari_treeview_redraw_grect_request(cw, &area); atari_treeview_redraw_grect_request(cw, &area);
return NSERROR_OK;
} }
/** /**