summaryrefslogtreecommitdiff
path: root/gui/input.c
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-08-18 18:29:23 -0300
committerWerner Almesberger <werner@almesberger.net>2016-08-18 18:29:23 -0300
commit9e65d63432b334111b78bebbf29525b330e54730 (patch)
treeac89e077227e69e8a03701c7cdcd5e57f8604a0c /gui/input.c
parent07043aea2c2179a495b72c30e3378695dc421329 (diff)
downloadeeshow-9e65d63432b334111b78bebbf29525b330e54730.tar.gz
eeshow-9e65d63432b334111b78bebbf29525b330e54730.tar.bz2
eeshow-9e65d63432b334111b78bebbf29525b330e54730.zip
eeshow/gui/input.c (hover_update): handle a few more rare cases
Diffstat (limited to 'gui/input.c')
-rw-r--r--gui/input.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/gui/input.c b/gui/input.c
index 82c7ac3..c03d5da 100644
--- a/gui/input.c
+++ b/gui/input.c
@@ -104,10 +104,10 @@ static void hover_update(int x, int y)
{
const struct input *old_sp = sp;
- assert(sp->state == input_hovering);
+ assert(sp->state == input_hovering || sp->state == input_hovering_down);
if (!sp->ops->hover_update)
- return;
+ return;
/*
* Caution: hover_update may switch input layers. If this happens,
@@ -118,7 +118,23 @@ static void hover_update(int x, int y)
if (sp != old_sp)
return;
- sp->state = sp->state == input_hovering ? input_idle : input_clicking;
+ progress(3, "hover_update %s\n", state());
+
+ switch (sp->state) {
+ case input_idle:
+ case input_hovering:
+ case input_ignoring:
+ sp->state = input_idle;
+ break;
+ case input_clicking:
+ case input_hovering_down:
+ sp->state = input_clicking;
+ break;
+ case input_dragging:
+ default:
+ abort();
+ }
+
if (sp->ops->hover_end)
sp->ops->hover_end(sp->user);
}