Ensure clicks on the canvas respect head z-order

This commit is contained in:
Jason Francis 2019-08-18 11:33:30 -04:00
parent 4b12ba1d0b
commit ba3b9f339f
1 changed files with 10 additions and 13 deletions

View File

@ -879,11 +879,9 @@ static gboolean canvas_click(GtkWidget *widget, GdkEvent *event,
struct wd_state *state = data;
if (event->button.type == GDK_BUTTON_PRESS) {
if (event->button.button == 1) {
struct wd_head *head;
struct wd_render_head_data *render;
state->clicked = NULL;
wl_list_for_each(head, &state->heads, link) {
struct wd_render_head_data *render = head->render;
if (render != NULL) {
wl_list_for_each(render, &state->render.heads, link) {
double mouse_x = event->button.x;
double mouse_y = event->button.y;
if (mouse_x >= render->x1 && mouse_x < render->x2 &&
@ -894,7 +892,6 @@ static gboolean canvas_click(GtkWidget *widget, GdkEvent *event,
break;
}
}
}
if (state->clicked != NULL) {
wl_list_remove(&state->clicked->link);
wl_list_insert(&state->render.heads, &state->clicked->link);