X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Frtk.c;fp=src%2Frtk.c;h=2ed29e9961c4dd4a0f6630b3b1294c74a58fbee2;hb=3bf187fe037df34459f04bf4e625f38afb80fcf8;hp=4bb93c82b36cde044c1592f9185e7d87c52aeb58;hpb=dd1b78089a43fdbbdf88d10d3d8a4d8f02662491;p=retroray diff --git a/src/rtk.c b/src/rtk.c index 4bb93c8..2ed29e9 100644 --- a/src/rtk.c +++ b/src/rtk.c @@ -818,6 +818,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) {