more logical handling of x/y in button events

click at x/y refers to the toplevel window and the widget knows
its own x/y position, so let's keep the x/y of the click as is
and let the down widget handle translation by itself

something like that
This commit is contained in:
Cedric Roux
2016-05-04 17:13:38 +02:00
parent e299a7e4d3
commit a74f865917
2 changed files with 4 additions and 2 deletions
+2 -2
View File
@@ -237,7 +237,7 @@ static void horizontal_button(gui *_g, widget *_this, int x, int y,
l = this->common.children;
while (l) {
if (l->item->x <= x && x < l->item->x + l->item->width) {
l->item->button(g, l->item, x - l->item->x, y, button, up);
l->item->button(g, l->item, x, y, button, up);
break;
}
l = l->next;
@@ -255,7 +255,7 @@ static void vertical_button(gui *_g, widget *_this, int x, int y,
l = this->common.children;
while (l) {
if (l->item->y <= y && y < l->item->y + l->item->height) {
l->item->button(g, l->item, x, y - l->item->y, button, up);
l->item->button(g, l->item, x, y, button, up);
break;
}
l = l->next;