heed resolution options, and cross-version resizing
[retroray] / src / rtk.c
index 4bb93c8..95ad604 100644 (file)
--- a/src/rtk.c
+++ b/src/rtk.c
@@ -497,7 +497,6 @@ void rtk_draw_widget(rtk_widget *w)
        int dirty;
 
        if(need_relayout(w)) {
-               dbgmsg("calc layout %s\n", w->any.text ? w->any.text : "?");
                calc_layout(w);
        }
 
@@ -818,6 +817,31 @@ int rtk_input_mmotion(rtk_widget *w, int x, int y)
        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)
 {