mirror of
https://github.com/swaywm/sway.git
synced 2024-11-26 18:01:29 +00:00
Handle unmanaged surfaces motion
This commit is contained in:
parent
d65d001aa5
commit
641807d920
|
@ -87,6 +87,8 @@ struct sway_xwayland_unmanaged {
|
||||||
struct wlr_xwayland_surface *wlr_xwayland_surface;
|
struct wlr_xwayland_surface *wlr_xwayland_surface;
|
||||||
struct wl_list link;
|
struct wl_list link;
|
||||||
|
|
||||||
|
int lx, ly;
|
||||||
|
|
||||||
struct wl_listener request_configure;
|
struct wl_listener request_configure;
|
||||||
struct wl_listener commit;
|
struct wl_listener commit;
|
||||||
struct wl_listener map;
|
struct wl_listener map;
|
||||||
|
|
|
@ -267,17 +267,14 @@ static void render_output(struct sway_output *output, struct timespec *when,
|
||||||
|
|
||||||
// render unmanaged views on top
|
// render unmanaged views on top
|
||||||
struct wl_list *unmanaged = &root_container.sway_root->xwayland_unmanaged;
|
struct wl_list *unmanaged = &root_container.sway_root->xwayland_unmanaged;
|
||||||
struct sway_xwayland_unmanaged *sway_surface;
|
struct sway_xwayland_unmanaged *unmanaged_surface;
|
||||||
wl_list_for_each(sway_surface, unmanaged, link) {
|
wl_list_for_each(unmanaged_surface, unmanaged, link) {
|
||||||
struct wlr_xwayland_surface *xsurface =
|
struct wlr_xwayland_surface *xsurface =
|
||||||
sway_surface->wlr_xwayland_surface;
|
unmanaged_surface->wlr_xwayland_surface;
|
||||||
if (xsurface->surface == NULL) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
const struct wlr_box view_box = {
|
const struct wlr_box view_box = {
|
||||||
.x = xsurface->x,
|
.x = unmanaged_surface->lx,
|
||||||
.y = xsurface->y,
|
.y = unmanaged_surface->ly,
|
||||||
.width = xsurface->width,
|
.width = xsurface->width,
|
||||||
.height = xsurface->height,
|
.height = xsurface->height,
|
||||||
};
|
};
|
||||||
|
|
|
@ -29,19 +29,35 @@ static void unmanaged_handle_commit(struct wl_listener *listener, void *data) {
|
||||||
struct sway_xwayland_unmanaged *surface =
|
struct sway_xwayland_unmanaged *surface =
|
||||||
wl_container_of(listener, surface, commit);
|
wl_container_of(listener, surface, commit);
|
||||||
struct wlr_xwayland_surface *xsurface = surface->wlr_xwayland_surface;
|
struct wlr_xwayland_surface *xsurface = surface->wlr_xwayland_surface;
|
||||||
desktop_damage_from_surface(xsurface->surface, xsurface->x, xsurface->y);
|
|
||||||
// TODO: handle window motion
|
if (xsurface->x != surface->lx || xsurface->y != surface->ly) {
|
||||||
|
// Surface has moved
|
||||||
|
desktop_damage_whole_surface(xsurface->surface,
|
||||||
|
surface->lx, surface->ly);
|
||||||
|
surface->lx = xsurface->x;
|
||||||
|
surface->ly = xsurface->y;
|
||||||
|
desktop_damage_whole_surface(xsurface->surface,
|
||||||
|
surface->lx, surface->ly);
|
||||||
|
} else {
|
||||||
|
desktop_damage_from_surface(xsurface->surface,
|
||||||
|
xsurface->x, xsurface->y);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void unmanaged_handle_map(struct wl_listener *listener, void *data) {
|
static void unmanaged_handle_map(struct wl_listener *listener, void *data) {
|
||||||
struct sway_xwayland_unmanaged *surface =
|
struct sway_xwayland_unmanaged *surface =
|
||||||
wl_container_of(listener, surface, map);
|
wl_container_of(listener, surface, map);
|
||||||
struct wlr_xwayland_surface *xsurface = surface->wlr_xwayland_surface;
|
struct wlr_xwayland_surface *xsurface = surface->wlr_xwayland_surface;
|
||||||
|
|
||||||
wl_list_insert(&root_container.sway_root->xwayland_unmanaged,
|
wl_list_insert(&root_container.sway_root->xwayland_unmanaged,
|
||||||
&surface->link);
|
&surface->link);
|
||||||
|
|
||||||
wl_signal_add(&xsurface->surface->events.commit, &surface->commit);
|
wl_signal_add(&xsurface->surface->events.commit, &surface->commit);
|
||||||
surface->commit.notify = unmanaged_handle_commit;
|
surface->commit.notify = unmanaged_handle_commit;
|
||||||
desktop_damage_whole_surface(xsurface->surface, xsurface->x, xsurface->y);
|
|
||||||
|
surface->lx = xsurface->x;
|
||||||
|
surface->ly = xsurface->y;
|
||||||
|
desktop_damage_whole_surface(xsurface->surface, surface->lx, surface->ly);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void unmanaged_handle_unmap(struct wl_listener *listener, void *data) {
|
static void unmanaged_handle_unmap(struct wl_listener *listener, void *data) {
|
||||||
|
|
|
@ -48,17 +48,13 @@ static struct sway_container *container_at_cursor(struct sway_cursor *cursor,
|
||||||
struct wlr_surface **surface, double *sx, double *sy) {
|
struct wlr_surface **surface, double *sx, double *sy) {
|
||||||
// check for unmanaged views first
|
// check for unmanaged views first
|
||||||
struct wl_list *unmanaged = &root_container.sway_root->xwayland_unmanaged;
|
struct wl_list *unmanaged = &root_container.sway_root->xwayland_unmanaged;
|
||||||
struct sway_xwayland_unmanaged *sway_surface;
|
struct sway_xwayland_unmanaged *unmanaged_surface;
|
||||||
wl_list_for_each_reverse(sway_surface, unmanaged, link) {
|
wl_list_for_each_reverse(unmanaged_surface, unmanaged, link) {
|
||||||
struct wlr_xwayland_surface *xsurface =
|
struct wlr_xwayland_surface *xsurface =
|
||||||
sway_surface->wlr_xwayland_surface;
|
unmanaged_surface->wlr_xwayland_surface;
|
||||||
if (xsurface->surface == NULL) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct wlr_box box = {
|
struct wlr_box box = {
|
||||||
.x = xsurface->x,
|
.x = unmanaged_surface->lx,
|
||||||
.y = xsurface->y,
|
.y = unmanaged_surface->ly,
|
||||||
.width = xsurface->width,
|
.width = xsurface->width,
|
||||||
.height = xsurface->height,
|
.height = xsurface->height,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue