chore: chase wlroots map logic unification

master
Kirill Primak 2 years ago committed by Simon Ser
parent 72881b5d12
commit c9e1dab318

@ -160,6 +160,8 @@ struct sway_xwayland_view {
struct wl_listener set_window_type; struct wl_listener set_window_type;
struct wl_listener set_hints; struct wl_listener set_hints;
struct wl_listener set_decorations; struct wl_listener set_decorations;
struct wl_listener associate;
struct wl_listener dissociate;
struct wl_listener map; struct wl_listener map;
struct wl_listener unmap; struct wl_listener unmap;
struct wl_listener destroy; struct wl_listener destroy;
@ -177,6 +179,8 @@ struct sway_xwayland_unmanaged {
struct wl_listener request_fullscreen; struct wl_listener request_fullscreen;
struct wl_listener commit; struct wl_listener commit;
struct wl_listener set_geometry; struct wl_listener set_geometry;
struct wl_listener associate;
struct wl_listener dissociate;
struct wl_listener map; struct wl_listener map;
struct wl_listener unmap; struct wl_listener unmap;
struct wl_listener destroy; struct wl_listener destroy;

@ -219,7 +219,7 @@ void arrange_layers(struct sway_output *output) {
wl_list_for_each_reverse(layer, wl_list_for_each_reverse(layer,
&output->layers[layers_above_shell[i]], link) { &output->layers[layers_above_shell[i]], link) {
if (layer->layer_surface->current.keyboard_interactive && if (layer->layer_surface->current.keyboard_interactive &&
layer->layer_surface->mapped) { layer->layer_surface->surface->mapped) {
topmost = layer; topmost = layer;
break; break;
} }
@ -253,7 +253,7 @@ static struct sway_layer_surface *find_mapped_layer_by_client(
&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], link) { &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], link) {
struct wl_resource *resource = lsurface->layer_surface->resource; struct wl_resource *resource = lsurface->layer_surface->resource;
if (wl_resource_get_client(resource) == client if (wl_resource_get_client(resource) == client
&& lsurface->layer_surface->mapped) { && lsurface->layer_surface->surface->mapped) {
return lsurface; return lsurface;
} }
} }
@ -293,8 +293,8 @@ static void handle_surface_commit(struct wl_listener *listener, void *data) {
bool layer_changed = false; bool layer_changed = false;
if (layer_surface->current.committed != 0 if (layer_surface->current.committed != 0
|| layer->mapped != layer_surface->mapped) { || layer->mapped != layer_surface->surface->mapped) {
layer->mapped = layer_surface->mapped; layer->mapped = layer_surface->surface->mapped;
layer_changed = layer->layer != layer_surface->current.layer; layer_changed = layer->layer != layer_surface->current.layer;
if (layer_changed) { if (layer_changed) {
wl_list_remove(&layer->link); wl_list_remove(&layer->link);
@ -349,7 +349,7 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
wl_container_of(listener, sway_layer, destroy); wl_container_of(listener, sway_layer, destroy);
sway_log(SWAY_DEBUG, "Layer surface destroyed (%s)", sway_log(SWAY_DEBUG, "Layer surface destroyed (%s)",
sway_layer->layer_surface->namespace); sway_layer->layer_surface->namespace);
if (sway_layer->layer_surface->mapped) { if (sway_layer->layer_surface->surface->mapped) {
unmap(sway_layer); unmap(sway_layer);
} }
@ -454,9 +454,9 @@ static struct sway_layer_subsurface *create_subsurface(
wl_list_insert(&layer_surface->subsurfaces, &subsurface->link); wl_list_insert(&layer_surface->subsurfaces, &subsurface->link);
subsurface->map.notify = subsurface_handle_map; subsurface->map.notify = subsurface_handle_map;
wl_signal_add(&wlr_subsurface->events.map, &subsurface->map); wl_signal_add(&wlr_subsurface->surface->events.map, &subsurface->map);
subsurface->unmap.notify = subsurface_handle_unmap; subsurface->unmap.notify = subsurface_handle_unmap;
wl_signal_add(&wlr_subsurface->events.unmap, &subsurface->unmap); wl_signal_add(&wlr_subsurface->surface->events.unmap, &subsurface->unmap);
subsurface->destroy.notify = subsurface_handle_destroy; subsurface->destroy.notify = subsurface_handle_destroy;
wl_signal_add(&wlr_subsurface->events.destroy, &subsurface->destroy); wl_signal_add(&wlr_subsurface->events.destroy, &subsurface->destroy);
subsurface->commit.notify = subsurface_handle_commit; subsurface->commit.notify = subsurface_handle_commit;
@ -571,9 +571,9 @@ static struct sway_layer_popup *create_popup(struct wlr_xdg_popup *wlr_popup,
popup->parent_layer = parent; popup->parent_layer = parent;
popup->map.notify = popup_handle_map; popup->map.notify = popup_handle_map;
wl_signal_add(&wlr_popup->base->events.map, &popup->map); wl_signal_add(&wlr_popup->base->surface->events.map, &popup->map);
popup->unmap.notify = popup_handle_unmap; popup->unmap.notify = popup_handle_unmap;
wl_signal_add(&wlr_popup->base->events.unmap, &popup->unmap); wl_signal_add(&wlr_popup->base->surface->events.unmap, &popup->unmap);
popup->destroy.notify = popup_handle_destroy; popup->destroy.notify = popup_handle_destroy;
wl_signal_add(&wlr_popup->base->events.destroy, &popup->destroy); wl_signal_add(&wlr_popup->base->events.destroy, &popup->destroy);
popup->commit.notify = popup_handle_commit; popup->commit.notify = popup_handle_commit;
@ -661,9 +661,9 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) {
sway_layer->destroy.notify = handle_destroy; sway_layer->destroy.notify = handle_destroy;
wl_signal_add(&layer_surface->events.destroy, &sway_layer->destroy); wl_signal_add(&layer_surface->events.destroy, &sway_layer->destroy);
sway_layer->map.notify = handle_map; sway_layer->map.notify = handle_map;
wl_signal_add(&layer_surface->events.map, &sway_layer->map); wl_signal_add(&layer_surface->surface->events.map, &sway_layer->map);
sway_layer->unmap.notify = handle_unmap; sway_layer->unmap.notify = handle_unmap;
wl_signal_add(&layer_surface->events.unmap, &sway_layer->unmap); wl_signal_add(&layer_surface->surface->events.unmap, &sway_layer->unmap);
sway_layer->new_popup.notify = handle_new_popup; sway_layer->new_popup.notify = handle_new_popup;
wl_signal_add(&layer_surface->events.new_popup, &sway_layer->new_popup); wl_signal_add(&layer_surface->events.new_popup, &sway_layer->new_popup);
sway_layer->new_subsurface.notify = handle_new_subsurface; sway_layer->new_subsurface.notify = handle_new_subsurface;

@ -265,7 +265,7 @@ void output_drag_icons_for_each_surface(struct sway_output *output,
double ox = drag_icon->x - output->lx; double ox = drag_icon->x - output->lx;
double oy = drag_icon->y - output->ly; double oy = drag_icon->y - output->ly;
if (drag_icon->wlr_drag_icon->mapped) { if (drag_icon->wlr_drag_icon->surface->mapped) {
output_surface_for_each_surface(output, output_surface_for_each_surface(output,
drag_icon->wlr_drag_icon->surface, ox, oy, drag_icon->wlr_drag_icon->surface, ox, oy,
iterator, user_data); iterator, user_data);
@ -295,7 +295,7 @@ static void output_for_each_surface(struct sway_output *output,
if (lock_surface->output != output->wlr_output) { if (lock_surface->output != output->wlr_output) {
continue; continue;
} }
if (!lock_surface->mapped) { if (!lock_surface->surface->mapped) {
continue; continue;
} }

@ -1065,7 +1065,7 @@ void output_render(struct render_context *ctx) {
if (lock_surface->output != wlr_output) { if (lock_surface->output != wlr_output) {
continue; continue;
} }
if (!lock_surface->mapped) { if (!lock_surface->surface->mapped) {
continue; continue;
} }

@ -104,8 +104,8 @@ static struct sway_xdg_popup *popup_create(
wl_signal_add(&xdg_surface->events.destroy, &popup->destroy); wl_signal_add(&xdg_surface->events.destroy, &popup->destroy);
popup->destroy.notify = popup_handle_destroy; popup->destroy.notify = popup_handle_destroy;
wl_signal_add(&xdg_surface->events.map, &popup->child.surface_map); wl_signal_add(&xdg_surface->surface->events.map, &popup->child.surface_map);
wl_signal_add(&xdg_surface->events.unmap, &popup->child.surface_unmap); wl_signal_add(&xdg_surface->surface->events.unmap, &popup->child.surface_unmap);
popup_unconstrain(popup); popup_unconstrain(popup);
@ -344,7 +344,7 @@ static void handle_request_fullscreen(struct wl_listener *listener, void *data)
struct wlr_xdg_toplevel *toplevel = xdg_shell_view->view.wlr_xdg_toplevel; struct wlr_xdg_toplevel *toplevel = xdg_shell_view->view.wlr_xdg_toplevel;
struct sway_view *view = &xdg_shell_view->view; struct sway_view *view = &xdg_shell_view->view;
if (!toplevel->base->mapped) { if (!toplevel->base->surface->mapped) {
return; return;
} }
@ -529,10 +529,10 @@ void handle_xdg_shell_surface(struct wl_listener *listener, void *data) {
xdg_shell_view->view.wlr_xdg_toplevel = xdg_surface->toplevel; xdg_shell_view->view.wlr_xdg_toplevel = xdg_surface->toplevel;
xdg_shell_view->map.notify = handle_map; xdg_shell_view->map.notify = handle_map;
wl_signal_add(&xdg_surface->events.map, &xdg_shell_view->map); wl_signal_add(&xdg_surface->surface->events.map, &xdg_shell_view->map);
xdg_shell_view->unmap.notify = handle_unmap; xdg_shell_view->unmap.notify = handle_unmap;
wl_signal_add(&xdg_surface->events.unmap, &xdg_shell_view->unmap); wl_signal_add(&xdg_surface->surface->events.unmap, &xdg_shell_view->unmap);
xdg_shell_view->destroy.notify = handle_destroy; xdg_shell_view->destroy.notify = handle_destroy;
wl_signal_add(&xdg_surface->events.destroy, &xdg_shell_view->destroy); wl_signal_add(&xdg_surface->events.destroy, &xdg_shell_view->destroy);

@ -128,7 +128,7 @@ static void unmanaged_handle_request_activate(struct wl_listener *listener, void
struct sway_xwayland_unmanaged *surface = struct sway_xwayland_unmanaged *surface =
wl_container_of(listener, surface, request_activate); wl_container_of(listener, surface, request_activate);
struct wlr_xwayland_surface *xsurface = surface->wlr_xwayland_surface; struct wlr_xwayland_surface *xsurface = surface->wlr_xwayland_surface;
if (!xsurface->mapped) { if (xsurface->surface == NULL || !xsurface->surface->mapped) {
return; return;
} }
struct sway_seat *seat = input_manager_current_seat(); struct sway_seat *seat = input_manager_current_seat();
@ -140,12 +140,29 @@ static void unmanaged_handle_request_activate(struct wl_listener *listener, void
seat_set_focus_surface(seat, xsurface->surface, false); seat_set_focus_surface(seat, xsurface->surface, false);
} }
static void unmanaged_handle_associate(struct wl_listener *listener, void *data) {
struct sway_xwayland_unmanaged *surface =
wl_container_of(listener, surface, associate);
struct wlr_xwayland_surface *xsurface = surface->wlr_xwayland_surface;
wl_signal_add(&xsurface->surface->events.map, &surface->map);
surface->map.notify = unmanaged_handle_map;
wl_signal_add(&xsurface->surface->events.unmap, &surface->unmap);
surface->unmap.notify = unmanaged_handle_unmap;
}
static void unmanaged_handle_dissociate(struct wl_listener *listener, void *data) {
struct sway_xwayland_unmanaged *surface =
wl_container_of(listener, surface, dissociate);
wl_list_remove(&surface->map.link);
wl_list_remove(&surface->unmap.link);
}
static void unmanaged_handle_destroy(struct wl_listener *listener, void *data) { static void unmanaged_handle_destroy(struct wl_listener *listener, void *data) {
struct sway_xwayland_unmanaged *surface = struct sway_xwayland_unmanaged *surface =
wl_container_of(listener, surface, destroy); wl_container_of(listener, surface, destroy);
wl_list_remove(&surface->request_configure.link); wl_list_remove(&surface->request_configure.link);
wl_list_remove(&surface->map.link); wl_list_remove(&surface->associate.link);
wl_list_remove(&surface->unmap.link); wl_list_remove(&surface->dissociate.link);
wl_list_remove(&surface->destroy.link); wl_list_remove(&surface->destroy.link);
wl_list_remove(&surface->override_redirect.link); wl_list_remove(&surface->override_redirect.link);
wl_list_remove(&surface->request_activate.link); wl_list_remove(&surface->request_activate.link);
@ -161,7 +178,7 @@ static void unmanaged_handle_override_redirect(struct wl_listener *listener, voi
wl_container_of(listener, surface, override_redirect); wl_container_of(listener, surface, override_redirect);
struct wlr_xwayland_surface *xsurface = surface->wlr_xwayland_surface; struct wlr_xwayland_surface *xsurface = surface->wlr_xwayland_surface;
bool mapped = xsurface->mapped; bool mapped = xsurface->surface != NULL || xsurface->surface->mapped;
if (mapped) { if (mapped) {
unmanaged_handle_unmap(&surface->unmap, NULL); unmanaged_handle_unmap(&surface->unmap, NULL);
} }
@ -188,10 +205,10 @@ static struct sway_xwayland_unmanaged *create_unmanaged(
wl_signal_add(&xsurface->events.request_configure, wl_signal_add(&xsurface->events.request_configure,
&surface->request_configure); &surface->request_configure);
surface->request_configure.notify = unmanaged_handle_request_configure; surface->request_configure.notify = unmanaged_handle_request_configure;
wl_signal_add(&xsurface->events.map, &surface->map); wl_signal_add(&xsurface->events.associate, &surface->associate);
surface->map.notify = unmanaged_handle_map; surface->associate.notify = unmanaged_handle_associate;
wl_signal_add(&xsurface->events.unmap, &surface->unmap); wl_signal_add(&xsurface->events.dissociate, &surface->dissociate);
surface->unmap.notify = unmanaged_handle_unmap; surface->dissociate.notify = unmanaged_handle_dissociate;
wl_signal_add(&xsurface->events.destroy, &surface->destroy); wl_signal_add(&xsurface->events.destroy, &surface->destroy);
surface->destroy.notify = unmanaged_handle_destroy; surface->destroy.notify = unmanaged_handle_destroy;
wl_signal_add(&xsurface->events.set_override_redirect, &surface->override_redirect); wl_signal_add(&xsurface->events.set_override_redirect, &surface->override_redirect);
@ -474,8 +491,8 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
wl_list_remove(&xwayland_view->set_window_type.link); wl_list_remove(&xwayland_view->set_window_type.link);
wl_list_remove(&xwayland_view->set_hints.link); wl_list_remove(&xwayland_view->set_hints.link);
wl_list_remove(&xwayland_view->set_decorations.link); wl_list_remove(&xwayland_view->set_decorations.link);
wl_list_remove(&xwayland_view->map.link); wl_list_remove(&xwayland_view->associate.link);
wl_list_remove(&xwayland_view->unmap.link); wl_list_remove(&xwayland_view->dissociate.link);
wl_list_remove(&xwayland_view->override_redirect.link); wl_list_remove(&xwayland_view->override_redirect.link);
view_begin_destroy(&xwayland_view->view); view_begin_destroy(&xwayland_view->view);
} }
@ -520,7 +537,7 @@ static void handle_override_redirect(struct wl_listener *listener, void *data) {
struct sway_view *view = &xwayland_view->view; struct sway_view *view = &xwayland_view->view;
struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;
bool mapped = xsurface->mapped; bool mapped = xsurface->surface != NULL || xsurface->surface->mapped;
if (mapped) { if (mapped) {
handle_unmap(&xwayland_view->unmap, NULL); handle_unmap(&xwayland_view->unmap, NULL);
} }
@ -539,7 +556,7 @@ static void handle_request_configure(struct wl_listener *listener, void *data) {
struct wlr_xwayland_surface_configure_event *ev = data; struct wlr_xwayland_surface_configure_event *ev = data;
struct sway_view *view = &xwayland_view->view; struct sway_view *view = &xwayland_view->view;
struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;
if (!xsurface->mapped) { if (xsurface->surface == NULL || !xsurface->surface->mapped) {
wlr_xwayland_surface_configure(xsurface, ev->x, ev->y, wlr_xwayland_surface_configure(xsurface, ev->x, ev->y,
ev->width, ev->height); ev->width, ev->height);
return; return;
@ -568,7 +585,7 @@ static void handle_request_fullscreen(struct wl_listener *listener, void *data)
wl_container_of(listener, xwayland_view, request_fullscreen); wl_container_of(listener, xwayland_view, request_fullscreen);
struct sway_view *view = &xwayland_view->view; struct sway_view *view = &xwayland_view->view;
struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;
if (!xsurface->mapped) { if (xsurface->surface == NULL || !xsurface->surface->mapped) {
return; return;
} }
container_set_fullscreen(view->container, xsurface->fullscreen); container_set_fullscreen(view->container, xsurface->fullscreen);
@ -582,7 +599,7 @@ static void handle_request_minimize(struct wl_listener *listener, void *data) {
wl_container_of(listener, xwayland_view, request_minimize); wl_container_of(listener, xwayland_view, request_minimize);
struct sway_view *view = &xwayland_view->view; struct sway_view *view = &xwayland_view->view;
struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;
if (!xsurface->mapped) { if (xsurface->surface == NULL || !xsurface->surface->mapped) {
return; return;
} }
@ -597,7 +614,7 @@ static void handle_request_move(struct wl_listener *listener, void *data) {
wl_container_of(listener, xwayland_view, request_move); wl_container_of(listener, xwayland_view, request_move);
struct sway_view *view = &xwayland_view->view; struct sway_view *view = &xwayland_view->view;
struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;
if (!xsurface->mapped) { if (xsurface->surface == NULL || !xsurface->surface->mapped) {
return; return;
} }
if (!container_is_floating(view->container) || if (!container_is_floating(view->container) ||
@ -613,7 +630,7 @@ static void handle_request_resize(struct wl_listener *listener, void *data) {
wl_container_of(listener, xwayland_view, request_resize); wl_container_of(listener, xwayland_view, request_resize);
struct sway_view *view = &xwayland_view->view; struct sway_view *view = &xwayland_view->view;
struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;
if (!xsurface->mapped) { if (xsurface->surface == NULL || !xsurface->surface->mapped) {
return; return;
} }
if (!container_is_floating(view->container)) { if (!container_is_floating(view->container)) {
@ -629,7 +646,7 @@ static void handle_request_activate(struct wl_listener *listener, void *data) {
wl_container_of(listener, xwayland_view, request_activate); wl_container_of(listener, xwayland_view, request_activate);
struct sway_view *view = &xwayland_view->view; struct sway_view *view = &xwayland_view->view;
struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;
if (!xsurface->mapped) { if (xsurface->surface == NULL || !xsurface->surface->mapped) {
return; return;
} }
view_request_activate(view, NULL); view_request_activate(view, NULL);
@ -642,7 +659,7 @@ static void handle_set_title(struct wl_listener *listener, void *data) {
wl_container_of(listener, xwayland_view, set_title); wl_container_of(listener, xwayland_view, set_title);
struct sway_view *view = &xwayland_view->view; struct sway_view *view = &xwayland_view->view;
struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;
if (!xsurface->mapped) { if (xsurface->surface == NULL || !xsurface->surface->mapped) {
return; return;
} }
view_update_title(view, false); view_update_title(view, false);
@ -654,7 +671,7 @@ static void handle_set_class(struct wl_listener *listener, void *data) {
wl_container_of(listener, xwayland_view, set_class); wl_container_of(listener, xwayland_view, set_class);
struct sway_view *view = &xwayland_view->view; struct sway_view *view = &xwayland_view->view;
struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;
if (!xsurface->mapped) { if (xsurface->surface == NULL || !xsurface->surface->mapped) {
return; return;
} }
view_execute_criteria(view); view_execute_criteria(view);
@ -665,7 +682,7 @@ static void handle_set_role(struct wl_listener *listener, void *data) {
wl_container_of(listener, xwayland_view, set_role); wl_container_of(listener, xwayland_view, set_role);
struct sway_view *view = &xwayland_view->view; struct sway_view *view = &xwayland_view->view;
struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;
if (!xsurface->mapped) { if (xsurface->surface == NULL || !xsurface->surface->mapped) {
return; return;
} }
view_execute_criteria(view); view_execute_criteria(view);
@ -701,7 +718,7 @@ static void handle_set_window_type(struct wl_listener *listener, void *data) {
wl_container_of(listener, xwayland_view, set_window_type); wl_container_of(listener, xwayland_view, set_window_type);
struct sway_view *view = &xwayland_view->view; struct sway_view *view = &xwayland_view->view;
struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;
if (!xsurface->mapped) { if (xsurface->surface == NULL || !xsurface->surface->mapped) {
return; return;
} }
view_execute_criteria(view); view_execute_criteria(view);
@ -712,7 +729,7 @@ static void handle_set_hints(struct wl_listener *listener, void *data) {
wl_container_of(listener, xwayland_view, set_hints); wl_container_of(listener, xwayland_view, set_hints);
struct sway_view *view = &xwayland_view->view; struct sway_view *view = &xwayland_view->view;
struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;
if (!xsurface->mapped) { if (xsurface->surface == NULL || !xsurface->surface->mapped) {
return; return;
} }
const bool hints_urgency = xcb_icccm_wm_hints_get_urgency(xsurface->hints); const bool hints_urgency = xcb_icccm_wm_hints_get_urgency(xsurface->hints);
@ -727,6 +744,24 @@ static void handle_set_hints(struct wl_listener *listener, void *data) {
} }
} }
static void handle_associate(struct wl_listener *listener, void *data) {
struct sway_xwayland_view *xwayland_view =
wl_container_of(listener, xwayland_view, associate);
struct wlr_xwayland_surface *xsurface =
xwayland_view->view.wlr_xwayland_surface;
wl_signal_add(&xsurface->surface->events.unmap, &xwayland_view->unmap);
xwayland_view->unmap.notify = handle_unmap;
wl_signal_add(&xsurface->surface->events.map, &xwayland_view->map);
xwayland_view->map.notify = handle_map;
}
static void handle_dissociate(struct wl_listener *listener, void *data) {
struct sway_xwayland_view *xwayland_view =
wl_container_of(listener, xwayland_view, dissociate);
wl_list_remove(&xwayland_view->map.link);
wl_list_remove(&xwayland_view->unmap.link);
}
struct sway_view *view_from_wlr_xwayland_surface( struct sway_view *view_from_wlr_xwayland_surface(
struct wlr_xwayland_surface *xsurface) { struct wlr_xwayland_surface *xsurface) {
return xsurface->data; return xsurface->data;
@ -796,11 +831,11 @@ struct sway_xwayland_view *create_xwayland_view(struct wlr_xwayland_surface *xsu
&xwayland_view->set_decorations); &xwayland_view->set_decorations);
xwayland_view->set_decorations.notify = handle_set_decorations; xwayland_view->set_decorations.notify = handle_set_decorations;
wl_signal_add(&xsurface->events.unmap, &xwayland_view->unmap); wl_signal_add(&xsurface->events.associate, &xwayland_view->associate);
xwayland_view->unmap.notify = handle_unmap; xwayland_view->associate.notify = handle_associate;
wl_signal_add(&xsurface->events.map, &xwayland_view->map); wl_signal_add(&xsurface->events.dissociate, &xwayland_view->dissociate);
xwayland_view->map.notify = handle_map; xwayland_view->dissociate.notify = handle_dissociate;
wl_signal_add(&xsurface->events.set_override_redirect, wl_signal_add(&xsurface->events.set_override_redirect,
&xwayland_view->override_redirect); &xwayland_view->override_redirect);

@ -367,7 +367,7 @@ static void handle_new_node(struct wl_listener *listener, void *data) {
} }
static void drag_icon_damage_whole(struct sway_drag_icon *icon) { static void drag_icon_damage_whole(struct sway_drag_icon *icon) {
if (!icon->wlr_drag_icon->mapped) { if (!icon->wlr_drag_icon->surface->mapped) {
return; return;
} }
desktop_damage_surface(icon->wlr_drag_icon->surface, icon->x, icon->y, true); desktop_damage_surface(icon->wlr_drag_icon->surface, icon->x, icon->y, true);
@ -511,9 +511,9 @@ static void handle_start_drag(struct wl_listener *listener, void *data) {
icon->surface_commit.notify = drag_icon_handle_surface_commit; icon->surface_commit.notify = drag_icon_handle_surface_commit;
wl_signal_add(&wlr_drag_icon->surface->events.commit, &icon->surface_commit); wl_signal_add(&wlr_drag_icon->surface->events.commit, &icon->surface_commit);
icon->unmap.notify = drag_icon_handle_unmap; icon->unmap.notify = drag_icon_handle_unmap;
wl_signal_add(&wlr_drag_icon->events.unmap, &icon->unmap); wl_signal_add(&wlr_drag_icon->surface->events.unmap, &icon->unmap);
icon->map.notify = drag_icon_handle_map; icon->map.notify = drag_icon_handle_map;
wl_signal_add(&wlr_drag_icon->events.map, &icon->map); wl_signal_add(&wlr_drag_icon->surface->events.map, &icon->map);
icon->destroy.notify = drag_icon_handle_destroy; icon->destroy.notify = drag_icon_handle_destroy;
wl_signal_add(&wlr_drag_icon->events.destroy, &icon->destroy); wl_signal_add(&wlr_drag_icon->events.destroy, &icon->destroy);
@ -1350,7 +1350,7 @@ void seat_set_focus_layer(struct sway_seat *seat,
} else if (!layer || seat->focused_layer == layer) { } else if (!layer || seat->focused_layer == layer) {
return; return;
} }
assert(layer->mapped); assert(layer->surface->mapped);
seat_set_focus_surface(seat, layer->surface, true); seat_set_focus_surface(seat, layer->surface, true);
if (layer->current.layer >= ZWLR_LAYER_SHELL_V1_LAYER_TOP) { if (layer->current.layer >= ZWLR_LAYER_SHELL_V1_LAYER_TOP) {
seat->focused_layer = layer; seat->focused_layer = layer;

@ -60,7 +60,7 @@ static void destroy_lock_surface(struct sway_session_lock_surface *surf) {
struct wlr_session_lock_surface_v1 *other; struct wlr_session_lock_surface_v1 *other;
wl_list_for_each(other, &server.session_lock.lock->surfaces, link) { wl_list_for_each(other, &server.session_lock.lock->surfaces, link) {
if (other != surf->lock_surface && other->mapped) { if (other != surf->lock_surface && other->surface->mapped) {
next_focus = other->surface; next_focus = other->surface;
break; break;
} }

@ -17,7 +17,7 @@ void xdg_activation_v1_handle_request_activate(struct wl_listener *listener,
return; return;
} }
if (!xdg_surface->mapped) { if (!xdg_surface->surface->mapped) {
// This is a startup notification. If we are tracking it, the data // This is a startup notification. If we are tracking it, the data
// field is a launcher_ctx. // field is a launcher_ctx.
struct launcher_ctx *ctx = event->token->data; struct launcher_ctx *ctx = event->token->data;

Loading…
Cancel
Save