1
0
mirror of https://github.com/artizirk/wdisplays.git synced 2024-11-22 08:50:59 +02:00

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

View File

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