mirror of
https://github.com/swaywm/sway.git
synced 2026-04-20 06:47:03 -04:00
render override redirect
This commit is contained in:
parent
2ce1d8d6cd
commit
83ddd2d9db
7 changed files with 97 additions and 12 deletions
|
|
@ -218,6 +218,19 @@ static void output_frame_notify(struct wl_listener *listener, void *data) {
|
|||
swayc_descendants_of_type(
|
||||
&root_container, C_VIEW, output_frame_view, soutput);
|
||||
|
||||
// render unmanaged views on top
|
||||
struct sway_view *view;
|
||||
wl_list_for_each(view, &root_container.sway_root->unmanaged_views,
|
||||
unmanaged_view_link) {
|
||||
if (view->type == SWAY_XWAYLAND_VIEW) {
|
||||
// the only kind of unamanged view right now is xwayland override redirect
|
||||
int view_x = view->wlr_xwayland_surface->x;
|
||||
int view_y = view->wlr_xwayland_surface->y;
|
||||
render_surface(view->surface, wlr_output, &soutput->last_frame,
|
||||
view_x, view_y, 0);
|
||||
}
|
||||
}
|
||||
|
||||
wlr_renderer_end(server->renderer);
|
||||
wlr_output_swap_buffers(wlr_output);
|
||||
|
||||
|
|
|
|||
|
|
@ -93,13 +93,43 @@ static void handle_commit(struct wl_listener *listener, void *data) {
|
|||
static void handle_destroy(struct wl_listener *listener, void *data) {
|
||||
struct sway_xwayland_surface *sway_surface =
|
||||
wl_container_of(listener, sway_surface, destroy);
|
||||
struct wlr_xwayland_surface *xsurface = data;
|
||||
wl_list_remove(&sway_surface->commit.link);
|
||||
wl_list_remove(&sway_surface->destroy.link);
|
||||
wl_list_remove(&sway_surface->request_configure.link);
|
||||
swayc_t *parent = destroy_view(sway_surface->view->swayc);
|
||||
if (xsurface->override_redirect) {
|
||||
if (xsurface->mapped) {
|
||||
wl_list_remove(&sway_surface->view->unmanaged_view_link);
|
||||
}
|
||||
} else {
|
||||
swayc_t *parent = destroy_view(sway_surface->view->swayc);
|
||||
arrange_windows(parent, -1, -1);
|
||||
}
|
||||
free(sway_surface->view);
|
||||
free(sway_surface);
|
||||
arrange_windows(parent, -1, -1);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
sway_surface->view->surface = NULL;
|
||||
}
|
||||
|
||||
static void handle_map_notify(struct wl_listener *listener, void *data) {
|
||||
// TODO put the view back into the tree
|
||||
struct sway_xwayland_surface *sway_surface =
|
||||
wl_container_of(listener, sway_surface, map_notify);
|
||||
struct wlr_xwayland_surface *xsurface = data;
|
||||
if (xsurface->override_redirect) {
|
||||
wl_list_insert(&root_container.sway_root->unmanaged_views,
|
||||
&sway_surface->view->unmanaged_view_link);
|
||||
}
|
||||
sway_surface->view->surface = xsurface->surface;
|
||||
}
|
||||
|
||||
static void handle_configure_request(struct wl_listener *listener, void *data) {
|
||||
|
|
@ -119,11 +149,6 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
|
|||
listener, server, xwayland_surface);
|
||||
struct wlr_xwayland_surface *xsurface = data;
|
||||
|
||||
if (xsurface->override_redirect) {
|
||||
// TODO: floating popups
|
||||
return;
|
||||
}
|
||||
|
||||
wlr_log(L_DEBUG, "New xwayland surface title='%s' class='%s'",
|
||||
xsurface->title, xsurface->class);
|
||||
|
||||
|
|
@ -155,15 +180,29 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
|
|||
// - Set new view to maximized so it behaves nicely
|
||||
// - Criteria
|
||||
|
||||
sway_surface->commit.notify = handle_commit;
|
||||
wl_signal_add(&xsurface->surface->events.commit, &sway_surface->commit);
|
||||
sway_surface->destroy.notify = handle_destroy;
|
||||
sway_surface->commit.notify = handle_commit;
|
||||
|
||||
wl_signal_add(&xsurface->events.destroy, &sway_surface->destroy);
|
||||
sway_surface->request_configure.notify = handle_configure_request;
|
||||
sway_surface->destroy.notify = handle_destroy;
|
||||
|
||||
wl_signal_add(&xsurface->events.request_configure,
|
||||
&sway_surface->request_configure);
|
||||
sway_surface->request_configure.notify = handle_configure_request;
|
||||
|
||||
wl_signal_add(&xsurface->events.unmap_notify, &sway_surface->unmap_notify);
|
||||
sway_surface->unmap_notify.notify = handle_unmap_notify;
|
||||
|
||||
wl_signal_add(&xsurface->events.map_notify, &sway_surface->map_notify);
|
||||
sway_surface->map_notify.notify = handle_map_notify;
|
||||
|
||||
if (xsurface->override_redirect) {
|
||||
// these don't get a container in the tree
|
||||
wl_list_insert(&root_container.sway_root->unmanaged_views,
|
||||
&sway_view->unmanaged_view_link);
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: actual focus semantics
|
||||
swayc_t *parent = root_container.children->items[0];
|
||||
parent = parent->children->items[0]; // workspace
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue