mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-11-18 06:59:46 -05:00
Add a surface destroy callback and use it for focus tracking
This commit is contained in:
parent
7d564d93eb
commit
c551bd2ae8
4 changed files with 71 additions and 35 deletions
|
|
@ -79,7 +79,14 @@ struct wl_global {
|
|||
struct wl_list link;
|
||||
};
|
||||
|
||||
WL_EXPORT struct wl_surface wl_grab_surface;
|
||||
WL_EXPORT struct wl_surface wl_grab_surface = {
|
||||
{},
|
||||
NULL,
|
||||
{
|
||||
&wl_grab_surface.destroy_listener_list,
|
||||
&wl_grab_surface.destroy_listener_list
|
||||
}
|
||||
};
|
||||
|
||||
static int wl_debug = 0;
|
||||
|
||||
|
|
@ -333,6 +340,11 @@ wl_input_device_set_pointer_focus(struct wl_input_device *device,
|
|||
|
||||
device->pointer_focus = surface;
|
||||
device->pointer_focus_time = time;
|
||||
|
||||
wl_list_remove(&device->pointer_focus_listener.link);
|
||||
if (surface)
|
||||
wl_list_insert(surface->destroy_listener_list.prev,
|
||||
&device->pointer_focus_listener.link);
|
||||
}
|
||||
|
||||
WL_EXPORT void
|
||||
|
|
@ -358,6 +370,11 @@ wl_input_device_set_keyboard_focus(struct wl_input_device *device,
|
|||
|
||||
device->keyboard_focus = surface;
|
||||
device->keyboard_focus_time = time;
|
||||
|
||||
wl_list_remove(&device->keyboard_focus_listener.link);
|
||||
if (surface)
|
||||
wl_list_insert(surface->destroy_listener_list.prev,
|
||||
&device->keyboard_focus_listener.link);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -119,9 +119,16 @@ struct wl_buffer {
|
|||
int32_t x, int32_t y, int32_t width, int32_t height);
|
||||
};
|
||||
|
||||
struct wl_listener {
|
||||
struct wl_list link;
|
||||
void (*func)(struct wl_listener *listener,
|
||||
struct wl_surface *surface);
|
||||
};
|
||||
|
||||
struct wl_surface {
|
||||
struct wl_resource resource;
|
||||
struct wl_client *client;
|
||||
struct wl_list destroy_listener_list;
|
||||
};
|
||||
|
||||
struct wl_shell {
|
||||
|
|
@ -135,6 +142,8 @@ struct wl_input_device {
|
|||
struct wl_array keys;
|
||||
uint32_t pointer_focus_time;
|
||||
uint32_t keyboard_focus_time;
|
||||
struct wl_listener pointer_focus_listener;
|
||||
struct wl_listener keyboard_focus_listener;
|
||||
};
|
||||
|
||||
struct wl_visual {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue