From 351fc6617305cc1ce0c686e9a46c43421b41450d Mon Sep 17 00:00:00 2001 From: Bastien Dejean Date: Mon, 26 Nov 2018 12:00:17 +0100 Subject: [PATCH] Don't honor pointer_follows_focus in apply_layout The assumption here was that, when the focused node's geometry changes, pointer_follows_focus needs to be taken care of. But we probably don't want to do that when the pointer is still inside the node despite the change of geometry. Of course this would also need to be taken care of in {move,resize}_client, etc. We chose the simpler approach here: only honor pointer_follows_focus in focus_node. Fixes #884. --- src/geometry.c | 7 +++++++ src/geometry.h | 1 + src/tree.c | 14 -------------- src/tree.h | 1 - 4 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/geometry.c b/src/geometry.c index 98de5db..8699db9 100644 --- a/src/geometry.c +++ b/src/geometry.c @@ -33,6 +33,13 @@ bool is_inside(xcb_point_t p, xcb_rectangle_t r) p.y >= r.y && p.y < (r.y + r.height)); } +/* Returns true if a contains b */ +bool contains(xcb_rectangle_t a, xcb_rectangle_t b) +{ + return (a.x <= b.x && (a.x + a.width) >= (b.x + b.width) && + a.y <= b.y && (a.y + a.height) >= (b.y + b.height)); +} + unsigned int area(xcb_rectangle_t r) { return r.width * r.height; diff --git a/src/geometry.h b/src/geometry.h index 3f794e1..d13838c 100644 --- a/src/geometry.h +++ b/src/geometry.h @@ -29,6 +29,7 @@ #include bool is_inside(xcb_point_t p, xcb_rectangle_t r); +bool contains(xcb_rectangle_t a, xcb_rectangle_t b); unsigned int area(xcb_rectangle_t r); uint32_t boundary_distance(xcb_rectangle_t r1, xcb_rectangle_t r2, direction_t dir); bool on_dir_side(xcb_rectangle_t r1, xcb_rectangle_t r2, direction_t dir); diff --git a/src/tree.c b/src/tree.c index 5f27ed9..aeeb1d8 100644 --- a/src/tree.c +++ b/src/tree.c @@ -84,13 +84,6 @@ void apply_layout(monitor_t *m, desktop_t *d, node_t *n, layout_t l, xcb_rectang n->rectangle = rect; - if (pointer_follows_focus && mon->desk->focus == n) { - xcb_rectangle_t r = rect; - r.width -= d->window_gap; - r.height -= d->window_gap; - center_pointer(r); - } - if (n->presel != NULL) { draw_presel_feedback(m, d, n); } @@ -1991,13 +1984,6 @@ void set_urgent(monitor_t *m, desktop_t *d, node_t *n, bool value) put_status(SBSC_MASK_REPORT); } -/* Returns true if a contains b */ -bool contains(xcb_rectangle_t a, xcb_rectangle_t b) -{ - return (a.x <= b.x && (a.x + a.width) >= (b.x + b.width) && - a.y <= b.y && (a.y + a.height) >= (b.y + b.height)); -} - xcb_rectangle_t get_rectangle(monitor_t *m, desktop_t *d, node_t *n) { if (n == NULL) { diff --git a/src/tree.h b/src/tree.h index 11fd280..25e638f 100644 --- a/src/tree.h +++ b/src/tree.h @@ -107,7 +107,6 @@ void set_private(monitor_t *m, desktop_t *d, node_t *n, bool value); void set_locked(monitor_t *m, desktop_t *d, node_t *n, bool value); void set_marked(monitor_t *m, desktop_t *d, node_t *n, bool value); void set_urgent(monitor_t *m, desktop_t *d, node_t *n, bool value); -bool contains(xcb_rectangle_t a, xcb_rectangle_t b); xcb_rectangle_t get_rectangle(monitor_t *m, desktop_t *d, node_t *n); void listen_enter_notify(node_t *n, bool enable); void regenerate_ids_in(node_t *n);