From faf1fee64ff8d664bd802259b4ca26104c40be51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Wed, 4 Jan 2012 21:31:03 -0500 Subject: [PATCH] Move default grab implementation to wayland-server --- src/compositor.c | 56 ------------------------------------------------ 1 file changed, 56 deletions(-) diff --git a/src/compositor.c b/src/compositor.c index 8e24f8f2..ef84c930 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -1111,58 +1111,6 @@ weston_compositor_pick_surface(struct weston_compositor *compositor, return NULL; } -static void -default_grab_focus(struct wl_grab *grab, uint32_t time, - struct wl_surface *surface, int32_t x, int32_t y) -{ - struct wl_input_device *device = grab->input_device; - - if (device->button_count > 0) - return; - - wl_input_device_set_pointer_focus(device, surface, time, - device->x, device->y, x, y); -} - -static void -default_grab_motion(struct wl_grab *grab, - uint32_t time, int32_t x, int32_t y) -{ - struct wl_input_device *device = grab->input_device; - struct wl_resource *resource; - - resource = grab->input_device->pointer_focus_resource; - if (resource) - wl_resource_post_event(resource, WL_INPUT_DEVICE_MOTION, - time, device->x, device->y, x, y); -} - -static void -default_grab_button(struct wl_grab *grab, - uint32_t time, int32_t button, int32_t state) -{ - struct wl_input_device *device = grab->input_device; - struct wl_resource *resource; - - if (device->button_count == 0 && state == 0) - wl_input_device_set_pointer_focus(device, - device->current, time, - device->x, device->y, - device->current_x, - device->current_y); - - resource = device->pointer_focus_resource; - if (resource) - wl_resource_post_event(resource, WL_INPUT_DEVICE_BUTTON, - time, button, state); -} - -static const struct wl_grab_interface default_grab_interface = { - default_grab_focus, - default_grab_motion, - default_grab_button -}; - WL_EXPORT void weston_compositor_wake(struct weston_compositor *compositor) { @@ -1665,10 +1613,6 @@ weston_input_device_init(struct weston_input_device *device, device->modifier_state = 0; device->num_tp = 0; - device->input_device.default_grab.interface = &default_grab_interface; - device->input_device.default_grab.input_device = &device->input_device; - device->input_device.grab = &device->input_device.default_grab; - wl_list_insert(ec->input_device_list.prev, &device->link); device->selection_data_source = NULL;