From 65797179944b146e6e16894eb6c8e9d71fda09eb Mon Sep 17 00:00:00 2001 From: emersion Date: Sat, 31 Mar 2018 10:28:01 -0400 Subject: [PATCH 1/3] Fix xwayland configure position --- sway/desktop/xwayland.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index 01c993b38..5f9c99a3b 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c @@ -67,13 +67,10 @@ static void set_position(struct sway_view *view, double ox, double oy) { view->swayc->x = ox; view->swayc->y = oy; - if (view->width == 0 || view->height == 0) { - return; - } - wlr_xwayland_surface_configure(view->wlr_xwayland_surface, ox + loutput->x, oy + loutput->y, - view->width, view->height); + view->wlr_xwayland_surface->width, + view->wlr_xwayland_surface->height); } static void set_activated(struct sway_view *view, bool activated) { From 0f7936735cfc8224f9926199b7e807e95d86d900 Mon Sep 17 00:00:00 2001 From: emersion Date: Sat, 31 Mar 2018 10:56:49 -0400 Subject: [PATCH 2/3] Fix unmanaged views rendering on all outputs --- sway/desktop/output.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/sway/desktop/output.c b/sway/desktop/output.c index c248b29eb..24c0bf403 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c @@ -243,14 +243,23 @@ static void render_output(struct sway_output *output, struct timespec *when, 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, &output->last_frame, - view_x, view_y, 0); + if (view->type != SWAY_XWAYLAND_VIEW) { + continue; } + + const struct wlr_box view_box = { + .x = view->wlr_xwayland_surface->x, + .y = view->wlr_xwayland_surface->y, + .width = view->wlr_xwayland_surface->width, + .height = view->wlr_xwayland_surface->height, + }; + struct wlr_box intersection; + if (!wlr_box_intersection(&view_box, output_box, &intersection)) { + continue; + } + + render_surface(view->surface, wlr_output, &output->last_frame, + view_box.x - output_box->x, view_box.y - output_box->y, 0); } // TODO: Consider revising this when fullscreen windows are supported From 98b67e2399df70d1e8354d5641744d1730a60189 Mon Sep 17 00:00:00 2001 From: emersion Date: Sat, 31 Mar 2018 11:30:15 -0400 Subject: [PATCH 3/3] Fix xwayland configure in set_size --- sway/desktop/output.c | 10 ++++++---- sway/desktop/xwayland.c | 6 +++--- sway/input/cursor.c | 30 ++++++++++++++++-------------- 3 files changed, 25 insertions(+), 21 deletions(-) diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 24c0bf403..0d706c528 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c @@ -247,11 +247,13 @@ static void render_output(struct sway_output *output, struct timespec *when, continue; } + struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; + const struct wlr_box view_box = { - .x = view->wlr_xwayland_surface->x, - .y = view->wlr_xwayland_surface->y, - .width = view->wlr_xwayland_surface->width, - .height = view->wlr_xwayland_surface->height, + .x = xsurface->x, + .y = xsurface->y, + .width = xsurface->width, + .height = xsurface->height, }; struct wlr_box intersection; if (!wlr_box_intersection(&view_box, output_box, &intersection)) { diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index 5f9c99a3b..bbaa88c81 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c @@ -41,7 +41,7 @@ static void set_size(struct sway_view *view, int width, int height) { view->sway_xwayland_surface->pending_height = height; struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; - wlr_xwayland_surface_configure(xsurface, view->swayc->x, view->swayc->y, + wlr_xwayland_surface_configure(xsurface, xsurface->x, xsurface->y, width, height); } @@ -151,7 +151,7 @@ static void handle_map(struct wl_listener *listener, void *data) { view_damage_whole(sway_surface->view); } -static void handle_configure_request(struct wl_listener *listener, void *data) { +static void handle_request_configure(struct wl_listener *listener, void *data) { struct sway_xwayland_surface *sway_surface = wl_container_of(listener, sway_surface, request_configure); struct wlr_xwayland_surface_configure_event *ev = data; @@ -206,7 +206,7 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) { wl_signal_add(&xsurface->events.request_configure, &sway_surface->request_configure); - sway_surface->request_configure.notify = handle_configure_request; + sway_surface->request_configure.notify = handle_request_configure; wl_signal_add(&xsurface->events.unmap, &sway_surface->unmap); sway_surface->unmap.notify = handle_unmap; diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 74af64268..67776f8fe 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c @@ -50,21 +50,23 @@ static struct sway_container *container_at_cursor(struct sway_cursor *cursor, struct wl_list *unmanaged = &root_container.sway_root->unmanaged_views; struct sway_view *view; wl_list_for_each_reverse(view, unmanaged, unmanaged_view_link) { - if (view->type == SWAY_XWAYLAND_VIEW) { - struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; - struct wlr_box box = { - .x = xsurface->x, - .y = xsurface->y, - .width = xsurface->width, - .height = xsurface->height, - }; + if (view->type != SWAY_XWAYLAND_VIEW) { + continue; + } - if (wlr_box_contains_point(&box, cursor->x, cursor->y)) { - *surface = xsurface->surface; - *sx = cursor->x - box.x; - *sy = cursor->y - box.y; - return NULL; - } + struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; + struct wlr_box box = { + .x = xsurface->x, + .y = xsurface->y, + .width = xsurface->width, + .height = xsurface->height, + }; + + if (wlr_box_contains_point(&box, cursor->x, cursor->y)) { + *surface = xsurface->surface; + *sx = cursor->x - box.x; + *sy = cursor->y - box.y; + return NULL; } }