compositor: Repick surface when grab ends

We were doing it manually in a few places and forgetting it in the
implicit grab case.
This commit is contained in:
Kristian Høgsberg 2011-09-06 13:41:47 -04:00
parent e7b5b41e93
commit 4eaa830381
2 changed files with 7 additions and 25 deletions

View File

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

View File

@ -58,14 +58,6 @@ move_grab_button(struct wl_grab *grab,
static void
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);
}
@ -162,14 +154,6 @@ resize_grab_button(struct wl_grab *grab,
static void
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);
}
@ -481,20 +465,12 @@ static void
drag_grab_end(struct wl_grab *grab, uint32_t time)
{
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)
wl_resource_post_event(&drag->drag_offer.resource,
WL_DRAG_OFFER_DROP);
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 = {