aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sway/desktop/output.c25
-rw-r--r--sway/desktop/xwayland.c13
-rw-r--r--sway/input/cursor.c32
3 files changed, 40 insertions, 30 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;
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index 74af6426..67776f8f 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,
50 struct wl_list *unmanaged = &root_container.sway_root->unmanaged_views; 50 struct wl_list *unmanaged = &root_container.sway_root->unmanaged_views;
51 struct sway_view *view; 51 struct sway_view *view;
52 wl_list_for_each_reverse(view, unmanaged, unmanaged_view_link) { 52 wl_list_for_each_reverse(view, unmanaged, unmanaged_view_link) {
53 if (view->type == SWAY_XWAYLAND_VIEW) { 53 if (view->type != SWAY_XWAYLAND_VIEW) {
54 struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; 54 continue;
55 struct wlr_box box = { 55 }
56 .x = xsurface->x, 56
57 .y = xsurface->y, 57 struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;
58 .width = xsurface->width, 58 struct wlr_box box = {
59 .height = xsurface->height, 59 .x = xsurface->x,
60 }; 60 .y = xsurface->y,
61 61 .width = xsurface->width,
62 if (wlr_box_contains_point(&box, cursor->x, cursor->y)) { 62 .height = xsurface->height,
63 *surface = xsurface->surface; 63 };
64 *sx = cursor->x - box.x; 64
65 *sy = cursor->y - box.y; 65 if (wlr_box_contains_point(&box, cursor->x, cursor->y)) {
66 return NULL; 66 *surface = xsurface->surface;
67 } 67 *sx = cursor->x - box.x;
68 *sy = cursor->y - box.y;
69 return NULL;
68 } 70 }
69 } 71 }
70 72