compositor: Repick surface when grab ends

We were doing it manually in a few places and forgetting it in the
implicit grab case.
dev
Kristian Høgsberg 13 years ago
parent e7b5b41e93
commit 4eaa830381
  1. 8
      compositor/compositor.c
  2. 24
      compositor/shell.c

@ -1408,6 +1408,7 @@ notify_button(struct wl_input_device *device,
struct wlsc_binding *b; struct wlsc_binding *b;
struct wlsc_surface *surface = struct wlsc_surface *surface =
(struct wlsc_surface *) device->pointer_focus; (struct wlsc_surface *) device->pointer_focus;
int32_t sx, sy;
if (state) if (state)
wlsc_compositor_idle_inhibit(compositor); wlsc_compositor_idle_inhibit(compositor);
@ -1434,8 +1435,13 @@ notify_button(struct wl_input_device *device,
device->grab->interface->button(device->grab, time, device->grab->interface->button(device->grab, time,
button, state); button, state);
if (!state && device->grab && device->grab_button == button) if (!state && device->grab && device->grab_button == button) {
wl_input_device_end_grab(device, time); wl_input_device_end_grab(device, time);
surface = pick_surface(device, &sx, &sy);
wl_input_device_set_pointer_focus(device, &surface->surface,
time, device->x, device->y,
sx, sy);
}
} }
static void static void

@ -58,14 +58,6 @@ move_grab_button(struct wl_grab *grab,
static void static void
move_grab_end(struct wl_grab *grab, uint32_t time) move_grab_end(struct wl_grab *grab, uint32_t time)
{ {
struct wlsc_surface *es;
struct wl_input_device *device = grab->input_device;
int32_t sx, sy;
es = pick_surface(grab->input_device, &sx, &sy);
wl_input_device_set_pointer_focus(device,
&es->surface, time,
device->x, device->y, sx, sy);
free(grab); free(grab);
} }
@ -162,14 +154,6 @@ resize_grab_button(struct wl_grab *grab,
static void static void
resize_grab_end(struct wl_grab *grab, uint32_t time) resize_grab_end(struct wl_grab *grab, uint32_t time)
{ {
struct wlsc_surface *es;
struct wl_input_device *device = grab->input_device;
int32_t sx, sy;
es = pick_surface(grab->input_device, &sx, &sy);
wl_input_device_set_pointer_focus(device,
&es->surface, time,
device->x, device->y, sx, sy);
free(grab); free(grab);
} }
@ -481,20 +465,12 @@ static void
drag_grab_end(struct wl_grab *grab, uint32_t time) drag_grab_end(struct wl_grab *grab, uint32_t time)
{ {
struct wl_drag *drag = container_of(grab, struct wl_drag, grab); struct wl_drag *drag = container_of(grab, struct wl_drag, grab);
struct wlsc_surface *es;
struct wl_input_device *device = grab->input_device;
int32_t sx, sy;
if (drag->target) if (drag->target)
wl_resource_post_event(&drag->drag_offer.resource, wl_resource_post_event(&drag->drag_offer.resource,
WL_DRAG_OFFER_DROP); WL_DRAG_OFFER_DROP);
wl_drag_set_pointer_focus(drag, NULL, time, 0, 0, 0, 0); wl_drag_set_pointer_focus(drag, NULL, time, 0, 0, 0, 0);
es = pick_surface(grab->input_device, &sx, &sy);
wl_input_device_set_pointer_focus(device,
&es->surface, time,
device->x, device->y, sx, sy);
} }
static const struct wl_grab_interface drag_grab_interface = { static const struct wl_grab_interface drag_grab_interface = {

Loading…
Cancel
Save