1
0
mirror of https://github.com/artizirk/wdisplays.git synced 2024-12-22 12:30:15 +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,20 +879,17 @@ 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) {
double mouse_x = event->button.x;
double mouse_y = event->button.y;
if (mouse_x >= render->x1 && mouse_x < render->x2 &&
mouse_y >= render->y1 && mouse_y < render->y2) {
state->clicked = render;
state->click_offset.x = event->button.x - render->x1;
state->click_offset.y = event->button.y - render->y1;
break;
}
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 &&
mouse_y >= render->y1 && mouse_y < render->y2) {
state->clicked = render;
state->click_offset.x = event->button.x - render->x1;
state->click_offset.y = event->button.y - render->y1;
break;
}
}
if (state->clicked != NULL) {