Skip to content
Snippets Groups Projects
Commit a74f8659 authored by Cedric Roux's avatar Cedric Roux
Browse files

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
parent e299a7e4
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
......@@ -49,6 +49,8 @@ static void button(gui *_g, widget *_this, int x, int y, int button, int up)
struct gui *g = _g;
struct textlist_widget *this = _this;
LOGD("BUTTON textlist %p xy %d %d button %d up %d\n", _this, x, y, button, up);
y -= this->common.y;
x -= this->common.x;
/* scroll up */
if (button == 4 && up == 0) {
gui_notify(g, "scrollup", _this, NULL);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment