Ensure clicks on the canvas respect head z-order
This commit is contained in:
parent
4b12ba1d0b
commit
ba3b9f339f
23
src/main.c
23
src/main.c
@ -879,20 +879,17 @@ 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;
|
double mouse_x = event->button.x;
|
||||||
if (render != NULL) {
|
double mouse_y = event->button.y;
|
||||||
double mouse_x = event->button.x;
|
if (mouse_x >= render->x1 && mouse_x < render->x2 &&
|
||||||
double mouse_y = event->button.y;
|
mouse_y >= render->y1 && mouse_y < render->y2) {
|
||||||
if (mouse_x >= render->x1 && mouse_x < render->x2 &&
|
state->clicked = render;
|
||||||
mouse_y >= render->y1 && mouse_y < render->y2) {
|
state->click_offset.x = event->button.x - render->x1;
|
||||||
state->clicked = render;
|
state->click_offset.y = event->button.y - render->y1;
|
||||||
state->click_offset.x = event->button.x - render->x1;
|
break;
|
||||||
state->click_offset.y = event->button.y - render->y1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (state->clicked != NULL) {
|
if (state->clicked != NULL) {
|
||||||
|
Loading…
Reference in New Issue
Block a user