# HG changeset patch # User David Demelier # Date 1676750388 -3600 # Node ID c4f31658104d34ecddb08e5acec0892c1e745794 # Parent 3e92d83099334d70d2cbaff54813642aa3fceed3 core: maths -> mlk_maths diff -r 3e92d8309933 -r c4f31658104d libmlk-core/mlk/core/maths.c --- a/libmlk-core/mlk/core/maths.c Sat Feb 18 20:58:16 2023 +0100 +++ b/libmlk-core/mlk/core/maths.c Sat Feb 18 20:59:48 2023 +0100 @@ -19,7 +19,7 @@ #include "maths.h" int -maths_is_boxed(int x, int y, unsigned int w, unsigned int h, int px, int py) +mlk_maths_is_boxed(int x, int y, unsigned int w, unsigned int h, int px, int py) { return px > x && py > y && @@ -28,7 +28,7 @@ } float -maths_scale(float in, float old_min, float old_max, float new_min, float new_max) +mlk_maths_scale(float in, float old_min, float old_max, float new_min, float new_max) { return (in / ((old_max - old_min) / (new_max - new_min))) + new_min; } diff -r 3e92d8309933 -r c4f31658104d libmlk-core/mlk/core/maths.h --- a/libmlk-core/mlk/core/maths.h Sat Feb 18 20:58:16 2023 +0100 +++ b/libmlk-core/mlk/core/maths.h Sat Feb 18 20:59:48 2023 +0100 @@ -24,10 +24,10 @@ CORE_BEGIN_DECLS int -maths_is_boxed(int, int, unsigned int, unsigned int, int, int); +mlk_maths_is_boxed(int, int, unsigned int, unsigned int, int, int); float -maths_scale(float, float, float, float, float); +mlk_maths_scale(float, float, float, float, float); CORE_END_DECLS diff -r 3e92d8309933 -r c4f31658104d libmlk-ui/mlk/ui/button.c --- a/libmlk-ui/mlk/ui/button.c Sat Feb 18 20:58:16 2023 +0100 +++ b/libmlk-ui/mlk/ui/button.c Sat Feb 18 20:59:48 2023 +0100 @@ -36,7 +36,7 @@ assert(click); assert(click->type == MLK_EVENT_CLICKDOWN || click->type == MLK_EVENT_CLICKUP); - return maths_is_boxed(button->x, button->y, button->w, button->h, + return mlk_maths_is_boxed(button->x, button->y, button->w, button->h, click->x, click->y); } diff -r 3e92d8309933 -r c4f31658104d libmlk-ui/mlk/ui/checkbox.c --- a/libmlk-ui/mlk/ui/checkbox.c Sat Feb 18 20:58:16 2023 +0100 +++ b/libmlk-ui/mlk/ui/checkbox.c Sat Feb 18 20:59:48 2023 +0100 @@ -33,7 +33,7 @@ assert(cb); assert(click && click->type == MLK_EVENT_CLICKDOWN); - return maths_is_boxed(cb->x, cb->y, cb->w, cb->h, click->x, click->y); + return mlk_maths_is_boxed(cb->x, cb->y, cb->w, cb->h, click->x, click->y); } void diff -r 3e92d8309933 -r c4f31658104d libmlk-ui/mlk/ui/gridmenu.c --- a/libmlk-ui/mlk/ui/gridmenu.c Sat Feb 18 20:58:16 2023 +0100 +++ b/libmlk-ui/mlk/ui/gridmenu.c Sat Feb 18 20:59:48 2023 +0100 @@ -206,7 +206,7 @@ x = menu->x + theme->padding + (c * menu->eltw) + (c * menu->spacew); y = menu->y + theme->padding + (r * menu->elth) + (r * menu->spaceh); - if (maths_is_boxed(x, y, menu->eltw, menu->elth, click->x, click->y)) { + if (mlk_maths_is_boxed(x, y, menu->eltw, menu->elth, click->x, click->y)) { selected = c + r * menu->ncols; selected += pagesz * pagenr;