summaryrefslogtreecommitdiff
path: root/gui-aoi.c
diff options
context:
space:
mode:
Diffstat (limited to 'gui-aoi.c')
-rw-r--r--gui-aoi.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/gui-aoi.c b/gui-aoi.c
index f44db30..6d8215a 100644
--- a/gui-aoi.c
+++ b/gui-aoi.c
@@ -26,12 +26,12 @@
static const struct aoi *hovering = NULL;
-const struct aoi *aoi_add(struct aoi **aois, const struct aoi *aoi)
+struct aoi *aoi_add(struct aoi **aois, const struct aoi *cfg)
{
struct aoi *new;
new = alloc_type(struct aoi);
- *new = *aoi;
+ *new = *cfg;
new->next = *aois;
*aois = new;
@@ -39,6 +39,15 @@ const struct aoi *aoi_add(struct aoi **aois, const struct aoi *aoi)
}
+void aoi_update(struct aoi *aoi, const struct aoi *cfg)
+{
+ struct aoi *next = aoi->next;
+
+ *aoi = *cfg;
+ aoi->next = next;
+}
+
+
bool aoi_hover(const struct aoi *aois, int x, int y)
{
const struct aoi *aoi;
@@ -85,8 +94,10 @@ bool aoi_click(const struct aoi *aois, int x, int y)
void aoi_remove(struct aoi **aois, const struct aoi *aoi)
{
- if (hovering == aoi)
+ if (hovering == aoi) {
aoi->hover(aoi->user, 0);
+ hovering = NULL;
+ }
while (*aois != aoi)
aois = &(*aois)->next;
*aois = aoi->next;