libweston: Split notify_pointer focus into notify/clear

This lets us say what we really mean instead of passing a NULL output
and garbage co-ordinates.

This will help later when manufacturing garbage coordinates becomes much
harder to do.

The clear_pointer_focus() path continues to do nothing, and is just a FIXME
macro, as it has been for a very long time...

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
Derek Foreman 2022-10-25 15:58:24 -05:00
parent bdc39b5909
commit 2ca2eac39a
5 changed files with 22 additions and 15 deletions

View file

@ -130,7 +130,7 @@ ss_seat_handle_pointer_enter(void *data, struct wl_pointer *pointer,
/* No transformation of input position is required here because we are
* always receiving the input in the same coordinates as the output. */
notify_pointer_focus(&seat->base, NULL, 0, 0);
clear_pointer_focus(&seat->base);
}
static void
@ -139,7 +139,7 @@ ss_seat_handle_pointer_leave(void *data, struct wl_pointer *pointer,
{
struct ss_seat *seat = data;
notify_pointer_focus(&seat->base, NULL, 0, 0);
clear_pointer_focus(&seat->base);
}
static void

View file

@ -1661,7 +1661,7 @@ input_handle_pointer_enter(void *data, struct wl_pointer *pointer,
if (!surface) {
input->output = NULL;
input->has_focus = false;
notify_pointer_focus(&input->base, NULL, 0, 0);
clear_pointer_focus(&input->base);
return;
}
@ -1695,7 +1695,7 @@ input_handle_pointer_enter(void *data, struct wl_pointer *pointer,
input->enter_serial, NULL, 0, 0);
} else {
input->has_focus = false;
notify_pointer_focus(&input->base, NULL, 0, 0);
clear_pointer_focus(&input->base);
input_set_cursor(input);
}
}
@ -1716,7 +1716,7 @@ input_handle_pointer_leave(void *data, struct wl_pointer *pointer,
weston_output_schedule_repaint(&input->output->base);
}
notify_pointer_focus(&input->base, NULL, 0, 0);
clear_pointer_focus(&input->base);
input->output = NULL;
input->has_focus = false;
}
@ -1755,7 +1755,7 @@ input_handle_motion(void *data, struct wl_pointer *pointer,
if (input->has_focus && location != THEME_LOCATION_CLIENT_AREA) {
input_set_cursor(input);
notify_pointer_focus(&input->base, NULL, 0, 0);
clear_pointer_focus(&input->base);
input->has_focus = false;
want_frame = true;
} else if (!input->has_focus &&

View file

@ -1613,7 +1613,7 @@ x11_backend_handle_event(int fd, uint32_t mask, void *data)
break;
if (!b->has_xkb)
update_xkb_state_from_core(b, enter_notify->state);
notify_pointer_focus(&b->core_seat, NULL, 0, 0);
clear_pointer_focus(&b->core_seat);
break;
case XCB_CLIENT_MESSAGE:

View file

@ -217,6 +217,9 @@ void
notify_pointer_focus(struct weston_seat *seat, struct weston_output *output,
double x, double y);
void
clear_pointer_focus(struct weston_seat *seat);
/* weston_touch_device */
void

View file

@ -2242,20 +2242,24 @@ notify_key(struct weston_seat *seat, const struct timespec *time, uint32_t key,
}
}
WL_EXPORT void
clear_pointer_focus(struct weston_seat *seat)
{
/* FIXME: We should call weston_pointer_set_focus(seat, NULL) here,
* but somehow that breaks re-entry... */
}
WL_EXPORT void
notify_pointer_focus(struct weston_seat *seat, struct weston_output *output,
double x, double y)
{
struct weston_pointer *pointer = weston_seat_get_pointer(seat);
if (output) {
weston_pointer_move_to(pointer,
wl_fixed_from_double(x),
wl_fixed_from_double(y));
} else {
/* FIXME: We should call weston_pointer_set_focus(seat,
* NULL) here, but somehow that breaks re-entry... */
}
assert(output);
weston_pointer_move_to(pointer,
wl_fixed_from_double(x),
wl_fixed_from_double(y));
}
static void