diff options
| author | Federico Angelilli <code@fedang.net> | 2023-11-26 16:05:28 +0100 |
|---|---|---|
| committer | Federico Angelilli <code@fedang.net> | 2023-11-26 16:05:28 +0100 |
| commit | 5a8c1c34a0a739a01853406b737cc7497884ed7a (patch) | |
| tree | 0495b28a4a326beb16e1a224ced73a4c90060afe /src/connect.c | |
| parent | e9bbe8178ab45cb9880c9b6b0324e9b4467f26d5 (diff) | |
Add cpu temperature button
Diffstat (limited to 'src/connect.c')
| -rw-r--r-- | src/connect.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/connect.c b/src/connect.c index fa19ffb..b3e4e92 100644 --- a/src/connect.c +++ b/src/connect.c @@ -48,11 +48,13 @@ static void update_scale(Connection *con) } } +// Check if point (px, py) is inside a rectangle in (x, y), (x+w, y), (x, y+h) and (w+h, y+h) static inline bool in_rect(int px, int py, int x, int y, int w, int h) { return px >= x && px <= x + w && py >= y && py <= y + h; } +// Check if point (px, py) is inside a circle of radius r and center (x, y) static inline bool in_circle(int px, int py, int x, int y, int r) { int dx = x - px; @@ -60,6 +62,7 @@ static inline bool in_circle(int px, int py, int x, int y, int r) return (dx * dx + dy * dy) <= r * r; } +// Check if point (px, py) is inside a capsule in (x, y), (x+w, y), (x, y+h) and (w+h, y+h) static inline bool in_capsule(int px, int py, int x, int y, int w, int h) { g_assert(w >= h); |
