diff options
-rw-r--r-- | sway/handlers.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/sway/handlers.c b/sway/handlers.c index b6bc11c0..f37473aa 100644 --- a/sway/handlers.c +++ b/sway/handlers.c | |||
@@ -776,10 +776,13 @@ static bool handle_pointer_motion(wlc_handle handle, uint32_t time, const struct | |||
776 | return EVENT_PASSTHROUGH; | 776 | return EVENT_PASSTHROUGH; |
777 | } | 777 | } |
778 | 778 | ||
779 | bool swayc_border_check(swayc_t *c, const void *_origin) { | 779 | static bool swayc_border_check(swayc_t *c, const void *_origin) { |
780 | const struct wlc_point *origin = _origin; | 780 | const struct wlc_point *origin = _origin; |
781 | if (origin->x >= c->title_bar_geometry.origin.x && origin->y >= c->title_bar_geometry.origin.y | 781 | const struct wlc_geometry title_bar = c->title_bar_geometry; |
782 | && origin->x < (c->title_bar_geometry.origin.x + (int)c->title_bar_geometry.size.w) && origin->y < (c->title_bar_geometry.origin.y + (int)c->title_bar_geometry.size.h)) { | 782 | |
783 | if (origin->x >= title_bar.origin.x && origin->y >= title_bar.origin.y | ||
784 | && origin->x < title_bar.origin.x + (int32_t)title_bar.size.w | ||
785 | && origin->y < title_bar.origin.y + (int32_t)title_bar.size.h) { | ||
783 | return true; | 786 | return true; |
784 | } | 787 | } |
785 | return false; | 788 | return false; |
@@ -849,10 +852,12 @@ static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct w | |||
849 | swayc_t *pointer = pointer_state.view; | 852 | swayc_t *pointer = pointer_state.view; |
850 | if (pointer) { | 853 | if (pointer) { |
851 | swayc_t *ws = swayc_parent_by_type(focused, C_WORKSPACE); | 854 | swayc_t *ws = swayc_parent_by_type(focused, C_WORKSPACE); |
852 | swayc_t *find = container_find(ws, &swayc_border_check, origin); | 855 | if (ws != NULL) { |
853 | if (find != NULL) { | 856 | swayc_t *find = container_find(ws, &swayc_border_check, origin); |
854 | set_focused_container(find); | 857 | if (find != NULL) { |
855 | return EVENT_HANDLED; | 858 | set_focused_container(find); |
859 | return EVENT_HANDLED; | ||
860 | } | ||
856 | } | 861 | } |
857 | 862 | ||
858 | if (focused != pointer) { | 863 | if (focused != pointer) { |