+ if(hover != w) {
+ sethover(w);
+ return 1;
+ }
+ return 0;
+}
+
+void rtk_fix_rect(rtk_rect *rect)
+{
+ int x, y, w, h;
+
+ x = rect->x;
+ y = rect->y;
+
+ if(rect->width < 0) {
+ w = -rect->width;
+ x += rect->width;
+ } else {
+ w = rect->width;
+ }
+ if(rect->height < 0) {
+ h = -rect->height;
+ y += rect->height;
+ } else {
+ h = rect->height;
+ }
+
+ rect->x = x;
+ rect->y = y;
+ rect->width = w;
+ rect->height = h;
+}
+
+void rtk_rect_union(rtk_rect *a, const rtk_rect *b)
+{
+ int x0, y0, x1, y1;
+
+ x0 = a->x;
+ y0 = a->y;
+ x1 = a->x + a->width;
+ y1 = a->y + a->height;
+
+ if(b->x < x0) x0 = b->x;
+ if(b->y < y0) y0 = b->y;
+ if(b->x + b->width > x1) x1 = b->x + b->width;
+ if(b->y + b->height > y1) y1 = b->y + b->height;
+
+ a->x = x0;
+ a->y = y0;
+ a->width = x1 - x0;
+ a->height = y1 - y0;
+}
+
+static void invalfb(rtk_widget *w)
+{
+ app_redisplay(w->any.x, w->any.y, w->any.width, w->any.height);