Move focus tracking surface destroy callbacks into core

dev
Kristian Høgsberg 14 years ago
parent a9e8961ea2
commit 02ef1c1aca
  1. 34
      compositor/compositor.c
  2. 35
      wayland/wayland-server.c
  3. 3
      wayland/wayland-server.h

@ -1161,37 +1161,12 @@ static const struct wl_drag_interface drag_interface = {
drag_cancel,
};
static void
lose_pointer_focus(struct wl_listener *listener,
struct wl_surface *surface)
{
struct wlsc_input_device *device =
container_of(listener, struct wlsc_input_device,
input_device.pointer_focus_listener);
uint32_t time;
time = wl_display_get_time(wl_client_get_display(surface->client));
wl_input_device_set_pointer_focus(&device->input_device,
NULL, time, 0, 0, 0, 0);
}
static void
lose_keyboard_focus(struct wl_listener *listener,
struct wl_surface *surface)
{
struct wlsc_input_device *device =
container_of(listener, struct wlsc_input_device,
input_device.keyboard_focus_listener);
uint32_t time;
time = wl_display_get_time(wl_client_get_display(surface->client));
wl_input_device_set_keyboard_focus(&device->input_device, NULL, time);
}
void
wlsc_input_device_init(struct wlsc_input_device *device,
struct wlsc_compositor *ec)
{
wl_input_device_init(&device->input_device);
device->input_device.object.interface = &wl_input_device_interface;
device->input_device.object.implementation =
(void (**)(void)) &input_device_interface;
@ -1206,11 +1181,6 @@ wlsc_input_device_init(struct wlsc_input_device *device,
device->hotspot_x = 16;
device->hotspot_y = 16;
wl_list_init(&device->input_device.pointer_focus_listener.link);
device->input_device.pointer_focus_listener.func = lose_pointer_focus;
wl_list_init(&device->input_device.keyboard_focus_listener.link);
device->input_device.keyboard_focus_listener.func = lose_keyboard_focus;
wl_list_insert(ec->input_device_list.prev, &device->link);
wlsc_input_device_set_pointer_image(device, WLSC_POINTER_LEFT_PTR);

@ -317,6 +317,41 @@ wl_client_destroy(struct wl_client *client)
free(client);
}
static void
lose_pointer_focus(struct wl_listener *listener,
struct wl_surface *surface)
{
struct wl_input_device *device =
container_of(listener, struct wl_input_device,
pointer_focus_listener);
uint32_t time;
time = wl_display_get_time(wl_client_get_display(surface->client));
wl_input_device_set_pointer_focus(device, NULL, time, 0, 0, 0, 0);
}
static void
lose_keyboard_focus(struct wl_listener *listener,
struct wl_surface *surface)
{
struct wl_input_device *device =
container_of(listener, struct wl_input_device,
keyboard_focus_listener);
uint32_t time;
time = wl_display_get_time(wl_client_get_display(surface->client));
wl_input_device_set_keyboard_focus(device, NULL, time);
}
WL_EXPORT void
wl_input_device_init(struct wl_input_device *device)
{
wl_list_init(&device->pointer_focus_listener.link);
device->pointer_focus_listener.func = lose_pointer_focus;
wl_list_init(&device->keyboard_focus_listener.link);
device->keyboard_focus_listener.func = lose_keyboard_focus;
}
WL_EXPORT void
wl_input_device_set_pointer_focus(struct wl_input_device *device,
struct wl_surface *surface,

@ -194,6 +194,9 @@ wl_client_get_display(struct wl_client *client);
void
wl_resource_destroy(struct wl_resource *resource, struct wl_client *client);
void
wl_input_device_init(struct wl_input_device *device);
void
wl_input_device_set_pointer_focus(struct wl_input_device *device,
struct wl_surface *surface,

Loading…
Cancel
Save