mirror of
https://github.com/swaywm/sway.git
synced 2024-12-29 16:36:26 +01:00
xwm handle map and unmap
This commit is contained in:
parent
83ddd2d9db
commit
ddc49ede46
2 changed files with 33 additions and 7 deletions
|
@ -180,6 +180,10 @@ static void output_frame_view(swayc_t *view, void *data) {
|
|||
struct sway_view *sway_view = view->sway_view;
|
||||
struct wlr_surface *surface = sway_view->surface;
|
||||
|
||||
if (!surface) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (sway_view->type) {
|
||||
case SWAY_XDG_SHELL_V6_VIEW: {
|
||||
int window_offset_x = view->sway_view->wlr_xdg_surface_v6->geometry->x;
|
||||
|
|
|
@ -101,22 +101,32 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
|
|||
if (xsurface->mapped) {
|
||||
wl_list_remove(&sway_surface->view->unmanaged_view_link);
|
||||
}
|
||||
} else {
|
||||
swayc_t *parent = destroy_view(sway_surface->view->swayc);
|
||||
}
|
||||
|
||||
swayc_t *parent = destroy_view(sway_surface->view->swayc);
|
||||
if (parent) {
|
||||
arrange_windows(parent, -1, -1);
|
||||
}
|
||||
|
||||
free(sway_surface->view);
|
||||
free(sway_surface);
|
||||
}
|
||||
|
||||
static void handle_unmap_notify(struct wl_listener *listener, void *data) {
|
||||
// TODO take the view out of the tree
|
||||
struct sway_xwayland_surface *sway_surface =
|
||||
wl_container_of(listener, sway_surface, unmap_notify);
|
||||
struct wlr_xwayland_surface *xsurface = data;
|
||||
if (xsurface->override_redirect) {
|
||||
wl_list_remove(&sway_surface->view->unmanaged_view_link);
|
||||
}
|
||||
|
||||
// take it out of the tree
|
||||
swayc_t *parent = destroy_view(sway_surface->view->swayc);
|
||||
if (parent) {
|
||||
arrange_windows(parent, -1, -1);
|
||||
}
|
||||
|
||||
sway_surface->view->swayc = NULL;
|
||||
sway_surface->view->surface = NULL;
|
||||
}
|
||||
|
||||
|
@ -125,11 +135,26 @@ static void handle_map_notify(struct wl_listener *listener, void *data) {
|
|||
struct sway_xwayland_surface *sway_surface =
|
||||
wl_container_of(listener, sway_surface, map_notify);
|
||||
struct wlr_xwayland_surface *xsurface = data;
|
||||
|
||||
sway_surface->view->surface = xsurface->surface;
|
||||
|
||||
// put it back into the tree
|
||||
if (xsurface->override_redirect) {
|
||||
wl_list_insert(&root_container.sway_root->unmanaged_views,
|
||||
&sway_surface->view->unmanaged_view_link);
|
||||
} else {
|
||||
struct sway_view *view = sway_surface->view;
|
||||
destroy_view(view->swayc);
|
||||
|
||||
swayc_t *parent = root_container.children->items[0];
|
||||
parent = parent->children->items[0]; // workspace
|
||||
|
||||
swayc_t *cont = new_view(parent, view);
|
||||
view->swayc = cont;
|
||||
|
||||
arrange_windows(cont->parent, -1, -1);
|
||||
sway_input_manager_set_focus(input_manager, cont);
|
||||
}
|
||||
sway_surface->view->surface = xsurface->surface;
|
||||
}
|
||||
|
||||
static void handle_configure_request(struct wl_listener *listener, void *data) {
|
||||
|
@ -169,13 +194,10 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
|
|||
sway_view->iface.set_activated = set_activated;
|
||||
sway_view->wlr_xwayland_surface = xsurface;
|
||||
sway_view->sway_xwayland_surface = sway_surface;
|
||||
// TODO remove from the tree when the surface goes away (unmapped)
|
||||
sway_view->surface = xsurface->surface;
|
||||
sway_surface->view = sway_view;
|
||||
|
||||
// TODO:
|
||||
// - Wire up listeners
|
||||
// - Handle popups
|
||||
// - Look up pid and open on appropriate workspace
|
||||
// - Set new view to maximized so it behaves nicely
|
||||
// - Criteria
|
||||
|
|
Loading…
Reference in a new issue