commit 5b20050872f8ad29cfc97729f8af47b6b3df5393
parent bc1c4f515a9b59933a8305a1c6ad8591536e52c6
Author: Michael Forney <mforney@mforney.org>
Date: Tue, 27 Jun 2017 21:51:56 -0700
Revert "Update pointer focus on surface resize, move, show, and hide"
This reverts commit 0013242c02a32f880bed4a84867903db30121152.
This causes problems because mod-Return in velox causes the windows to
move around, and we don't want to change focus in this case. I'll need
to think of another solution.
Diffstat:
1 file changed, 23 insertions(+), 33 deletions(-)
diff --git a/libswc/compositor.c b/libswc/compositor.c
@@ -174,30 +174,6 @@ error0:
return NULL;
}
-static void
-update_pointer_focus(void)
-{
- struct compositor_view *view;
- bool found = false;
- int32_t x = wl_fixed_to_int(swc.seat->pointer->x);
- int32_t y = wl_fixed_to_int(swc.seat->pointer->y);
- struct swc_rectangle *geom;
-
- wl_list_for_each (view, &compositor.views, link) {
- if (!view->visible)
- continue;
- geom = &view->base.geometry;
- if (rectangle_contains_point(geom, x, y)) {
- if (pixman_region32_contains_point(&view->surface->state.input, x - geom->x, y - geom->y, NULL)) {
- found = true;
- break;
- }
- }
- }
-
- pointer_set_focus(swc.seat->pointer, found ? view : NULL);
-}
-
/* Rendering {{{ */
static void
@@ -403,7 +379,6 @@ attach(struct view *base, struct wld_buffer *buffer)
view_update_screens(&view->base);
damage_below_view(view);
update(&view->base);
- update_pointer_focus();
}
}
@@ -431,7 +406,6 @@ move(struct view *base, int32_t x, int32_t y)
view_update_screens(&view->base);
damage_below_view(view);
update(&view->base);
- update_pointer_focus();
}
}
@@ -525,8 +499,6 @@ compositor_view_show(struct compositor_view *view)
if (other->parent == view)
compositor_view_show(other);
}
-
- update_pointer_focus();
}
void
@@ -548,8 +520,6 @@ compositor_view_hide(struct compositor_view *view)
if (other->parent == view)
compositor_view_hide(other);
}
-
- update_pointer_focus();
}
void
@@ -714,9 +684,29 @@ perform_update(void *data)
bool
handle_motion(struct pointer_handler *handler, uint32_t time, wl_fixed_t fx, wl_fixed_t fy)
{
- /* Only change pointer focus if no buttons are pressed. */
- if (swc.seat->pointer->buttons.size == 0)
- update_pointer_focus();
+ struct compositor_view *view;
+ bool found = false;
+ int32_t x = wl_fixed_to_int(fx), y = wl_fixed_to_int(fy);
+ struct swc_rectangle *geom;
+
+ /* If buttons are pressed, don't change pointer focus. */
+ if (swc.seat->pointer->buttons.size > 0)
+ return false;
+
+ wl_list_for_each (view, &compositor.views, link) {
+ if (!view->visible)
+ continue;
+ geom = &view->base.geometry;
+ if (rectangle_contains_point(geom, x, y)) {
+ if (pixman_region32_contains_point(&view->surface->state.input, x - geom->x, y - geom->y, NULL)) {
+ found = true;
+ break;
+ }
+ }
+ }
+
+ pointer_set_focus(swc.seat->pointer, found ? view : NULL);
+
return false;
}