diff options
author | Albert Safin <xzfcpw@gmail.com> | 2020-02-19 01:07:05 +0000 |
---|---|---|
committer | Orestis Floros <forestis@kth.se> | 2020-02-19 11:33:49 +0100 |
commit | 670c23600f30a5f0e417c0d3d256356c73e149b4 (patch) | |
tree | 22dcf74fd7c0b133e24c8e9f721b57d4210c066e | |
parent | e6ca7ca06f585fa22662443275d44a407f366c9d (diff) | |
download | i3-670c23600f30a5f0e417c0d3d256356c73e149b4.tar.gz i3-670c23600f30a5f0e417c0d3d256356c73e149b4.zip |
Decoration click/mouse move: iterate children in reverse order
In the case of decoration overlap, we should handle the one that is
drawn on top, i.e., the last one.
-rw-r--r-- | src/click.c | 2 | ||||
-rw-r--r-- | src/handlers.c | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/click.c b/src/click.c index e5dcfa92..19076252 100644 --- a/src/click.c +++ b/src/click.c @@ -361,7 +361,7 @@ int handle_button_press(xcb_button_press_event_t *event) { /* Check if the click was on the decoration of a child */ Con *child; - TAILQ_FOREACH (child, &(con->nodes_head), nodes) { + TAILQ_FOREACH_REVERSE (child, &(con->nodes_head), nodes_head, nodes) { if (!rect_contains(child->deco_rect, event->event_x, event->event_y)) continue; diff --git a/src/handlers.c b/src/handlers.c index 79e5329b..7926fec5 100644 --- a/src/handlers.c +++ b/src/handlers.c @@ -160,7 +160,7 @@ static void handle_enter_notify(xcb_enter_notify_event_t *event) { layout_t layout = (enter_child ? con->parent->layout : con->layout); if (layout == L_DEFAULT) { Con *child; - TAILQ_FOREACH (child, &(con->nodes_head), nodes) { + TAILQ_FOREACH_REVERSE (child, &(con->nodes_head), nodes_head, nodes) { if (rect_contains(child->deco_rect, event->event_x, event->event_y)) { LOG("using child %p / %s instead!\n", child, child->name); con = child; @@ -217,7 +217,7 @@ static void handle_motion_notify(xcb_motion_notify_event_t *event) { /* see over which rect the user is */ Con *current; - TAILQ_FOREACH (current, &(con->nodes_head), nodes) { + TAILQ_FOREACH_REVERSE (current, &(con->nodes_head), nodes_head, nodes) { if (!rect_contains(current->deco_rect, event->event_x, event->event_y)) continue; |