diff options
Diffstat (limited to 'sway/handlers.c')
-rw-r--r-- | sway/handlers.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/sway/handlers.c b/sway/handlers.c index 1afdcbbb..b6bc11c0 100644 --- a/sway/handlers.c +++ b/sway/handlers.c | |||
@@ -776,6 +776,14 @@ 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) { | ||
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 | ||
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)) { | ||
783 | return true; | ||
784 | } | ||
785 | return false; | ||
786 | } | ||
779 | 787 | ||
780 | static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct wlc_modifiers *modifiers, | 788 | static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct wlc_modifiers *modifiers, |
781 | uint32_t button, enum wlc_button_state state, const struct wlc_point *origin) { | 789 | uint32_t button, enum wlc_button_state state, const struct wlc_point *origin) { |
@@ -840,6 +848,13 @@ static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct w | |||
840 | // Check whether to change focus | 848 | // Check whether to change focus |
841 | swayc_t *pointer = pointer_state.view; | 849 | swayc_t *pointer = pointer_state.view; |
842 | if (pointer) { | 850 | if (pointer) { |
851 | swayc_t *ws = swayc_parent_by_type(focused, C_WORKSPACE); | ||
852 | swayc_t *find = container_find(ws, &swayc_border_check, origin); | ||
853 | if (find != NULL) { | ||
854 | set_focused_container(find); | ||
855 | return EVENT_HANDLED; | ||
856 | } | ||
857 | |||
843 | if (focused != pointer) { | 858 | if (focused != pointer) { |
844 | set_focused_container(pointer_state.view); | 859 | set_focused_container(pointer_state.view); |
845 | } | 860 | } |