aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2018-03-31 11:40:34 -0400
committerLibravatar GitHub <noreply@github.com>2018-03-31 11:40:34 -0400
commit89ca6676bedca3580a2db45a2f60f34c136cd3d0 (patch)
tree8131a6e50f159d30b6bc936384fdd3fb460e95b3 /sway/desktop
parentMerge pull request #1677 from emersion/maximize-xwayland-views (diff)
parentFix xwayland configure in set_size (diff)
downloadsway-89ca6676bedca3580a2db45a2f60f34c136cd3d0.tar.gz
sway-89ca6676bedca3580a2db45a2f60f34c136cd3d0.tar.zst
sway-89ca6676bedca3580a2db45a2f60f34c136cd3d0.zip
Merge pull request #1681 from emersion/xwayland-configure-position
Fix various xwayland issues
Diffstat (limited to 'sway/desktop')
-rw-r--r--sway/desktop/output.c25
-rw-r--r--sway/desktop/xwayland.c13
2 files changed, 23 insertions, 15 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index c248b29e..0d706c52 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -243,14 +243,25 @@ static void render_output(struct sway_output *output, struct timespec *when,
243 struct sway_view *view; 243 struct sway_view *view;
244 wl_list_for_each(view, &root_container.sway_root->unmanaged_views, 244 wl_list_for_each(view, &root_container.sway_root->unmanaged_views,
245 unmanaged_view_link) { 245 unmanaged_view_link) {
246 if (view->type == SWAY_XWAYLAND_VIEW) { 246 if (view->type != SWAY_XWAYLAND_VIEW) {
247 // the only kind of unamanged view right now is xwayland override 247 continue;
248 // redirect
249 int view_x = view->wlr_xwayland_surface->x;
250 int view_y = view->wlr_xwayland_surface->y;
251 render_surface(view->surface, wlr_output, &output->last_frame,
252 view_x, view_y, 0);
253 } 248 }
249
250 struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;
251
252 const struct wlr_box view_box = {
253 .x = xsurface->x,
254 .y = xsurface->y,
255 .width = xsurface->width,
256 .height = xsurface->height,
257 };
258 struct wlr_box intersection;
259 if (!wlr_box_intersection(&view_box, output_box, &intersection)) {
260 continue;
261 }
262
263 render_surface(view->surface, wlr_output, &output->last_frame,
264 view_box.x - output_box->x, view_box.y - output_box->y, 0);
254 } 265 }
255 266
256 // TODO: Consider revising this when fullscreen windows are supported 267 // TODO: Consider revising this when fullscreen windows are supported
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c
index 83e97a4b..273ca2bf 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) {
41 view->sway_xwayland_surface->pending_height = height; 41 view->sway_xwayland_surface->pending_height = height;
42 42
43 struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; 43 struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;
44 wlr_xwayland_surface_configure(xsurface, view->swayc->x, view->swayc->y, 44 wlr_xwayland_surface_configure(xsurface, xsurface->x, xsurface->y,
45 width, height); 45 width, height);
46} 46}
47 47
@@ -67,13 +67,10 @@ static void set_position(struct sway_view *view, double ox, double oy) {
67 view->swayc->x = ox; 67 view->swayc->x = ox;
68 view->swayc->y = oy; 68 view->swayc->y = oy;
69 69
70 if (view->width == 0 || view->height == 0) {
71 return;
72 }
73
74 wlr_xwayland_surface_configure(view->wlr_xwayland_surface, 70 wlr_xwayland_surface_configure(view->wlr_xwayland_surface,
75 ox + loutput->x, oy + loutput->y, 71 ox + loutput->x, oy + loutput->y,
76 view->width, view->height); 72 view->wlr_xwayland_surface->width,
73 view->wlr_xwayland_surface->height);
77} 74}
78 75
79static void set_activated(struct sway_view *view, bool activated) { 76static void set_activated(struct sway_view *view, bool activated) {
@@ -157,7 +154,7 @@ static void handle_map(struct wl_listener *listener, void *data) {
157 view_damage_whole(sway_surface->view); 154 view_damage_whole(sway_surface->view);
158} 155}
159 156
160static void handle_configure_request(struct wl_listener *listener, void *data) { 157static void handle_request_configure(struct wl_listener *listener, void *data) {
161 struct sway_xwayland_surface *sway_surface = 158 struct sway_xwayland_surface *sway_surface =
162 wl_container_of(listener, sway_surface, request_configure); 159 wl_container_of(listener, sway_surface, request_configure);
163 struct wlr_xwayland_surface_configure_event *ev = data; 160 struct wlr_xwayland_surface_configure_event *ev = data;
@@ -212,7 +209,7 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
212 209
213 wl_signal_add(&xsurface->events.request_configure, 210 wl_signal_add(&xsurface->events.request_configure,
214 &sway_surface->request_configure); 211 &sway_surface->request_configure);
215 sway_surface->request_configure.notify = handle_configure_request; 212 sway_surface->request_configure.notify = handle_request_configure;
216 213
217 wl_signal_add(&xsurface->events.unmap, &sway_surface->unmap); 214 wl_signal_add(&xsurface->events.unmap, &sway_surface->unmap);
218 sway_surface->unmap.notify = handle_unmap; 215 sway_surface->unmap.notify = handle_unmap;