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.
This commit is contained in:
Bastien Dejean 2018-11-26 12:00:17 +01:00
parent 875defe469
commit 351fc66173
4 changed files with 8 additions and 15 deletions

View file

@ -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;

View file

@ -29,6 +29,7 @@
#include <xcb/xcb.h>
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);

View file

@ -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) {

View file

@ -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);