const struct weston_pointer_grab_interface *interface;
struct weston_surface *surface, *focus;
struct weston_pointer *pointer = seat->pointer;
+ wl_fixed_t sx, sy;
if (!pointer)
return;
surface = weston_compositor_pick_surface(seat->compositor,
pointer->x,
pointer->y,
- &pointer->current_x,
- &pointer->current_y);
-
- if (surface != pointer->current) {
- interface = pointer->grab->interface;
- weston_pointer_set_current(pointer, surface);
- interface->focus(pointer->grab, surface,
- pointer->current_x, pointer->current_y);
- }
+ &sx, &sy);
+
+ interface = pointer->grab->interface;
+ interface->focus(pointer->grab, surface, sx, sy);
focus = (struct weston_surface *) pointer->grab->focus;
if (focus)
if (pointer->button_count > 0)
return;
- weston_pointer_set_focus(pointer, surface, x, y);
+ if (pointer->focus != surface)
+ weston_pointer_set_focus(pointer, surface, x, y);
}
static void
uint32_t time, uint32_t button, uint32_t state_w)
{
struct weston_pointer *pointer = grab->pointer;
+ struct weston_compositor *compositor = pointer->seat->compositor;
+ struct weston_surface *surface;
struct wl_resource *resource;
uint32_t serial;
enum wl_pointer_button_state state = state_w;
struct wl_display *display;
+ wl_fixed_t sx, sy;
resource = pointer->focus_resource;
if (resource) {
}
if (pointer->button_count == 0 &&
- state == WL_POINTER_BUTTON_STATE_RELEASED)
- weston_pointer_set_focus(pointer, pointer->current,
- pointer->current_x,
- pointer->current_y);
+ state == WL_POINTER_BUTTON_STATE_RELEASED) {
+ surface = weston_compositor_pick_surface(compositor,
+ pointer->x,
+ pointer->y,
+ &sx, &sy);
+
+ weston_pointer_set_focus(pointer, surface, sx, sy);
+ }
}
static const struct weston_pointer_grab_interface
struct weston_pointer_grab *grab)
{
const struct weston_pointer_grab_interface *interface;
+ struct weston_compositor *compositor = pointer->seat->compositor;
+ struct weston_surface *surface;
+ wl_fixed_t sx, sy;
pointer->grab = grab;
interface = pointer->grab->interface;
grab->pointer = pointer;
- if (pointer->current)
- interface->focus(pointer->grab, pointer->current,
- pointer->current_x, pointer->current_y);
+ surface = weston_compositor_pick_surface(compositor,
+ pointer->x, pointer->y,
+ &sx, &sy);
+
+ if (surface)
+ interface->focus(pointer->grab, surface, sx, sy);
}
WL_EXPORT void
weston_pointer_end_grab(struct weston_pointer *pointer)
{
const struct weston_pointer_grab_interface *interface;
+ struct weston_compositor *compositor = pointer->seat->compositor;
+ struct weston_surface *surface;
+ wl_fixed_t sx, sy;
+
+ surface = weston_compositor_pick_surface(compositor,
+ pointer->x, pointer->y,
+ &sx, &sy);
pointer->grab = &pointer->default_grab;
interface = pointer->grab->interface;
- interface->focus(pointer->grab, pointer->current,
- pointer->current_x, pointer->current_y);
-}
-
-static void
-current_surface_destroy(struct wl_listener *listener, void *data)
-{
- struct weston_pointer *pointer =
- container_of(listener, struct weston_pointer, current_listener);
-
- pointer->current = NULL;
-}
-
-WL_EXPORT void
-weston_pointer_set_current(struct weston_pointer *pointer,
- struct weston_surface *surface)
-{
- if (pointer->current)
- wl_list_remove(&pointer->current_listener.link);
-
- pointer->current = surface;
-
- if (!surface)
- return;
-
- wl_signal_add(&surface->resource.destroy_signal,
- &pointer->current_listener);
- pointer->current_listener.notify = current_surface_destroy;
+ interface->focus(pointer->grab, surface, sx, sy);
}
WL_EXPORT void
uint32_t time, uint32_t button, uint32_t state)
{
struct shell_grab *grab = (struct shell_grab *) base;
- struct shell_surface *shsurf;
- struct weston_surface *surface =
- (struct weston_surface *) grab->grab.pointer->current;
+ struct shell_surface *shsurf = grab->shsurf;
struct weston_seat *seat = grab->grab.pointer->seat;
- shsurf = get_shell_surface(surface);
if (shsurf && button == BTN_LEFT && state) {
activate(shsurf->shell, shsurf->surface, seat);
surface_move(shsurf, seat);
{
struct shell_grab *grab = (struct shell_grab *) pointer->grab;
- if (grab->grab.interface == &busy_cursor_grab_interface) {
+ if (grab->grab.interface == &busy_cursor_grab_interface &&
+ grab->shsurf == shsurf) {
shell_grab_end(grab);
free(grab);
}
uint32_t serial)
{
struct shell_surface *shsurf = resource->data;
- struct desktop_shell *shell = shsurf->shell;
struct weston_seat *seat;
struct weston_compositor *ec = shsurf->surface->compositor;
- struct weston_pointer *pointer;
- int was_unresponsive;
if (shsurf->ping_timer == NULL)
/* Just ignore unsolicited pong. */
return;
if (shsurf->ping_timer->serial == serial) {
- was_unresponsive = shsurf->unresponsive;
shsurf->unresponsive = 0;
- if (was_unresponsive) {
- /* Received pong from previously unresponsive client */
- wl_list_for_each(seat, &ec->seat_list, link) {
- pointer = seat->pointer;
- if (pointer->focus == shell->grab_surface &&
- pointer->current == shsurf->surface)
- end_busy_cursor(shsurf, pointer);
- }
- }
+ wl_list_for_each(seat, &ec->seat_list, link)
+ end_busy_cursor(shsurf, seat->pointer);
ping_timer_destroy(shsurf);
}
}