Skip to content

Commit 5b20050

Browse files
committed
Revert "Update pointer focus on surface resize, move, show, and hide"
This reverts commit 0013242. 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.
1 parent bc1c4f5 commit 5b20050

File tree

1 file changed

+23
-33
lines changed

1 file changed

+23
-33
lines changed

libswc/compositor.c

+23-33
Original file line numberDiff line numberDiff line change
@@ -174,30 +174,6 @@ target_new(struct screen *screen)
174174
return NULL;
175175
}
176176

177-
static void
178-
update_pointer_focus(void)
179-
{
180-
struct compositor_view *view;
181-
bool found = false;
182-
int32_t x = wl_fixed_to_int(swc.seat->pointer->x);
183-
int32_t y = wl_fixed_to_int(swc.seat->pointer->y);
184-
struct swc_rectangle *geom;
185-
186-
wl_list_for_each (view, &compositor.views, link) {
187-
if (!view->visible)
188-
continue;
189-
geom = &view->base.geometry;
190-
if (rectangle_contains_point(geom, x, y)) {
191-
if (pixman_region32_contains_point(&view->surface->state.input, x - geom->x, y - geom->y, NULL)) {
192-
found = true;
193-
break;
194-
}
195-
}
196-
}
197-
198-
pointer_set_focus(swc.seat->pointer, found ? view : NULL);
199-
}
200-
201177
/* Rendering {{{ */
202178

203179
static void
@@ -403,7 +379,6 @@ attach(struct view *base, struct wld_buffer *buffer)
403379
view_update_screens(&view->base);
404380
damage_below_view(view);
405381
update(&view->base);
406-
update_pointer_focus();
407382
}
408383
}
409384

@@ -431,7 +406,6 @@ move(struct view *base, int32_t x, int32_t y)
431406
view_update_screens(&view->base);
432407
damage_below_view(view);
433408
update(&view->base);
434-
update_pointer_focus();
435409
}
436410
}
437411

@@ -525,8 +499,6 @@ compositor_view_show(struct compositor_view *view)
525499
if (other->parent == view)
526500
compositor_view_show(other);
527501
}
528-
529-
update_pointer_focus();
530502
}
531503

532504
void
@@ -548,8 +520,6 @@ compositor_view_hide(struct compositor_view *view)
548520
if (other->parent == view)
549521
compositor_view_hide(other);
550522
}
551-
552-
update_pointer_focus();
553523
}
554524

555525
void
@@ -714,9 +684,29 @@ perform_update(void *data)
714684
bool
715685
handle_motion(struct pointer_handler *handler, uint32_t time, wl_fixed_t fx, wl_fixed_t fy)
716686
{
717-
/* Only change pointer focus if no buttons are pressed. */
718-
if (swc.seat->pointer->buttons.size == 0)
719-
update_pointer_focus();
687+
struct compositor_view *view;
688+
bool found = false;
689+
int32_t x = wl_fixed_to_int(fx), y = wl_fixed_to_int(fy);
690+
struct swc_rectangle *geom;
691+
692+
/* If buttons are pressed, don't change pointer focus. */
693+
if (swc.seat->pointer->buttons.size > 0)
694+
return false;
695+
696+
wl_list_for_each (view, &compositor.views, link) {
697+
if (!view->visible)
698+
continue;
699+
geom = &view->base.geometry;
700+
if (rectangle_contains_point(geom, x, y)) {
701+
if (pixman_region32_contains_point(&view->surface->state.input, x - geom->x, y - geom->y, NULL)) {
702+
found = true;
703+
break;
704+
}
705+
}
706+
}
707+
708+
pointer_set_focus(swc.seat->pointer, found ? view : NULL);
709+
720710
return false;
721711
}
722712

0 commit comments

Comments
 (0)