aboutsummaryrefslogtreecommitdiffstats
path: root/sway
diff options
context:
space:
mode:
authorLibravatar Nicolas Cornu <ncornu@aldebaran.com>2016-10-06 21:14:49 +0200
committerLibravatar Nicolas Cornu <ncornu@aldebaran.com>2016-10-06 21:17:45 +0200
commit6ced4098dc7cce8cd097023aacfb91e1cf3198bd (patch)
treec19b76974fa924bbc8f99defb22cb9531cdc74d5 /sway
parentMerge pull request #933 from alkino/click_title_bar (diff)
downloadsway-6ced4098dc7cce8cd097023aacfb91e1cf3198bd.tar.gz
sway-6ced4098dc7cce8cd097023aacfb91e1cf3198bd.tar.zst
sway-6ced4098dc7cce8cd097023aacfb91e1cf3198bd.zip
fix for click on title_bar
- Check null pointer for swayc_parent_by_type - Split lines to follow coding style
Diffstat (limited to 'sway')
-rw-r--r--sway/handlers.c19
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
779bool swayc_border_check(swayc_t *c, const void *_origin) { 779static 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) {