Commit ac07b760 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

xdg-shell: handle seat hot-unplug

parent b9341db7
...@@ -53,6 +53,7 @@ struct seat_data ...@@ -53,6 +53,7 @@ struct seat_data
struct xkb_state *keystate; struct xkb_state *keystate;
#endif #endif
uint32_t name;
uint32_t version; uint32_t version;
struct wl_list node; struct wl_list node;
}; };
...@@ -443,6 +444,23 @@ static void seat_destroy(struct seat_data *sd) ...@@ -443,6 +444,23 @@ static void seat_destroy(struct seat_data *sd)
free(sd); free(sd);
} }
int seat_destroy_one(struct wl_list *list, uint32_t name)
{
struct seat_data *sd;
wl_list_for_each(sd, list, node)
{
if (sd->name == name)
{
seat_destroy(sd);
/* Note: return here so no needs for safe walk variant */
return 0;
}
}
return -1;
}
void seat_destroy_all(struct wl_list *list) void seat_destroy_all(struct wl_list *list)
{ {
while (!wl_list_empty(list)) while (!wl_list_empty(list))
......
...@@ -24,4 +24,5 @@ struct wl_list; ...@@ -24,4 +24,5 @@ struct wl_list;
int seat_create(struct vout_window_t *wnd, struct wl_registry *, int seat_create(struct vout_window_t *wnd, struct wl_registry *,
uint32_t name, uint32_t version, struct wl_list *list); uint32_t name, uint32_t version, struct wl_list *list);
int seat_destroy_one(struct wl_list *list, uint32_t name);
void seat_destroy_all(struct wl_list *list); void seat_destroy_all(struct wl_list *list);
...@@ -445,10 +445,14 @@ static void registry_global_remove_cb(void *data, struct wl_registry *registry, ...@@ -445,10 +445,14 @@ static void registry_global_remove_cb(void *data, struct wl_registry *registry,
uint32_t name) uint32_t name)
{ {
vout_window_t *wnd = data; vout_window_t *wnd = data;
vout_window_sys_t *sys = wnd->sys;
char idstr[11]; char idstr[11];
msg_Dbg(wnd, "global remove %3"PRIu32, name); msg_Dbg(wnd, "global remove %3"PRIu32, name);
if (seat_destroy_one(&sys->seats, name) == 0)
return;
/* If the global was an output, this will remove it. Otherwise, no-op. */ /* If the global was an output, this will remove it. Otherwise, no-op. */
sprintf(idstr, "%"PRIu32, name); sprintf(idstr, "%"PRIu32, name);
vout_window_ReportOutputDevice(wnd, idstr, NULL); vout_window_ReportOutputDevice(wnd, idstr, NULL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment