mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-11-26 06:54:03 +02:00
eeshow/gui/aoi.c: make searches only consider AoIs supporting desired function
This commit is contained in:
parent
10c1d0ede0
commit
96fa1a2f62
@ -57,17 +57,6 @@ static bool in_aoi(const struct aoi *aoi, int x, int y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static const struct aoi *find_aoi(const struct aoi *aois, int x, int y)
|
|
||||||
{
|
|
||||||
const struct aoi *aoi;
|
|
||||||
|
|
||||||
for (aoi = aois; aoi; aoi = aoi->next)
|
|
||||||
if (in_aoi(aoi, x, y))
|
|
||||||
break;
|
|
||||||
return aoi;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool aoi_hover(const struct aoi *aois, int x, int y)
|
bool aoi_hover(const struct aoi *aois, int x, int y)
|
||||||
{
|
{
|
||||||
const struct aoi *aoi;
|
const struct aoi *aoi;
|
||||||
@ -79,11 +68,12 @@ bool aoi_hover(const struct aoi *aois, int x, int y)
|
|||||||
hovering = NULL;
|
hovering = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
aoi = find_aoi(aois, x, y);
|
for (aoi = aois; aoi; aoi = aoi->next)
|
||||||
if (aoi && aoi->hover && aoi->hover(aoi->user, 1)) {
|
if (aoi->hover && in_aoi(aoi, x, y) &&
|
||||||
hovering = aoi;
|
aoi->hover(aoi->user, 1)) {
|
||||||
return 1;
|
hovering = aoi;
|
||||||
}
|
return 1;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,11 +100,12 @@ bool aoi_click(const struct aoi *aois, int x, int y)
|
|||||||
if (need_dehover(aois, x, y))
|
if (need_dehover(aois, x, y))
|
||||||
aoi_dehover();
|
aoi_dehover();
|
||||||
|
|
||||||
aoi = find_aoi(aois, x, y);
|
for (aoi = aois; aoi; aoi = aoi->next)
|
||||||
if (!aoi || !aoi->click)
|
if (aoi->click && in_aoi(aoi, x, y)) {
|
||||||
return 0;
|
aoi->click(aoi->user);
|
||||||
aoi->click(aoi->user);
|
return 1;
|
||||||
return 1;
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user