aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sway/output.h2
-rw-r--r--sway/config/output.c2
-rw-r--r--sway/desktop/layer_shell.c11
-rw-r--r--sway/desktop/output.c36
4 files changed, 28 insertions, 23 deletions
diff --git a/include/sway/output.h b/include/sway/output.h
index 44d009d1..f899230f 100644
--- a/include/sway/output.h
+++ b/include/sway/output.h
@@ -1,10 +1,10 @@
1#ifndef _SWAY_OUTPUT_H 1#ifndef _SWAY_OUTPUT_H
2#define _SWAY_OUTPUT_H 2#define _SWAY_OUTPUT_H
3#include <time.h> 3#include <time.h>
4#include <unistd.h>
4#include <wayland-server.h> 5#include <wayland-server.h>
5#include <wlr/types/wlr_box.h> 6#include <wlr/types/wlr_box.h>
6#include <wlr/types/wlr_output.h> 7#include <wlr/types/wlr_output.h>
7#include <unistd.h>
8 8
9struct sway_server; 9struct sway_server;
10struct sway_container; 10struct sway_container;
diff --git a/sway/config/output.c b/sway/config/output.c
index c4168b4f..9e211861 100644
--- a/sway/config/output.c
+++ b/sway/config/output.c
@@ -4,9 +4,9 @@
4#include <string.h> 4#include <string.h>
5#include <signal.h> 5#include <signal.h>
6#include <sys/wait.h> 6#include <sys/wait.h>
7#include <unistd.h>
7#include <wlr/types/wlr_output.h> 8#include <wlr/types/wlr_output.h>
8#include <wlr/types/wlr_output_layout.h> 9#include <wlr/types/wlr_output_layout.h>
9#include <unistd.h>
10#include "sway/config.h" 10#include "sway/config.h"
11#include "sway/output.h" 11#include "sway/output.h"
12#include "log.h" 12#include "log.h"
diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c
index a2506d21..bd62f84a 100644
--- a/sway/desktop/layer_shell.c
+++ b/sway/desktop/layer_shell.c
@@ -192,9 +192,10 @@ void arrange_layers(struct sway_output *output) {
192static void handle_output_destroy(struct wl_listener *listener, void *data) { 192static void handle_output_destroy(struct wl_listener *listener, void *data) {
193 struct sway_layer_surface *sway_layer = 193 struct sway_layer_surface *sway_layer =
194 wl_container_of(listener, sway_layer, output_destroy); 194 wl_container_of(listener, sway_layer, output_destroy);
195 sway_layer->layer_surface->output = NULL;
196 wl_list_remove(&sway_layer->output_destroy.link); 195 wl_list_remove(&sway_layer->output_destroy.link);
197 wl_list_remove(&sway_layer->output_mode.link); 196 wl_list_remove(&sway_layer->output_mode.link);
197 wl_list_remove(&sway_layer->output_transform.link);
198 sway_layer->layer_surface->output = NULL;
198 wlr_layer_surface_close(sway_layer->layer_surface); 199 wlr_layer_surface_close(sway_layer->layer_surface);
199} 200}
200 201
@@ -240,9 +241,11 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
240 wl_list_remove(&sway_layer->map.link); 241 wl_list_remove(&sway_layer->map.link);
241 wl_list_remove(&sway_layer->unmap.link); 242 wl_list_remove(&sway_layer->unmap.link);
242 wl_list_remove(&sway_layer->surface_commit.link); 243 wl_list_remove(&sway_layer->surface_commit.link);
243 wl_list_remove(&sway_layer->output_destroy.link); 244 if (sway_layer->layer_surface->output != NULL) {
244 wl_list_remove(&sway_layer->output_mode.link); 245 wl_list_remove(&sway_layer->output_destroy.link);
245 wl_list_remove(&sway_layer->output_transform.link); 246 wl_list_remove(&sway_layer->output_mode.link);
247 wl_list_remove(&sway_layer->output_transform.link);
248 }
246 struct sway_output *output = sway_layer->layer_surface->output->data; 249 struct sway_output *output = sway_layer->layer_surface->output->data;
247 arrange_layers(output); 250 arrange_layers(output);
248 free(sway_layer); 251 free(sway_layer);
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index 59f79a81..9e7fbcc6 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -81,9 +81,7 @@ static void render_surface(struct wlr_surface *surface,
81 rotate_child_position(&sx, &sy, sw, sh, width, height, rotation); 81 rotate_child_position(&sx, &sy, sw, sh, width, height, rotation);
82 82
83 render_surface(subsurface->surface, wlr_output, when, 83 render_surface(subsurface->surface, wlr_output, when,
84 lx + sx, 84 lx + sx, ly + sy, rotation);
85 ly + sy,
86 rotation);
87 } 85 }
88} 86}
89 87
@@ -142,9 +140,15 @@ static void render_wl_shell_surface(struct wlr_wl_shell_surface *surface,
142 } 140 }
143} 141}
144 142
143struct render_data {
144 struct sway_output *output;
145 struct timespec *now;
146};
145 147
146static void output_frame_view(swayc_t *view, void *data) { 148static void output_frame_view(swayc_t *view, void *data) {
147 struct sway_output *output = data; 149 struct render_data *rdata = data;
150 struct sway_output *output = rdata->output;
151 struct timespec *now = rdata->now;
148 struct wlr_output *wlr_output = output->wlr_output; 152 struct wlr_output *wlr_output = output->wlr_output;
149 struct sway_view *sway_view = view->sway_view; 153 struct sway_view *sway_view = view->sway_view;
150 struct wlr_surface *surface = sway_view->surface; 154 struct wlr_surface *surface = sway_view->surface;
@@ -157,23 +161,18 @@ static void output_frame_view(swayc_t *view, void *data) {
157 case SWAY_XDG_SHELL_V6_VIEW: { 161 case SWAY_XDG_SHELL_V6_VIEW: {
158 int window_offset_x = view->sway_view->wlr_xdg_surface_v6->geometry.x; 162 int window_offset_x = view->sway_view->wlr_xdg_surface_v6->geometry.x;
159 int window_offset_y = view->sway_view->wlr_xdg_surface_v6->geometry.y; 163 int window_offset_y = view->sway_view->wlr_xdg_surface_v6->geometry.y;
160 render_surface(surface, wlr_output, &output->last_frame, 164 render_surface(surface, wlr_output, now,
161 view->x - window_offset_x, 165 view->x - window_offset_x, view->y - window_offset_y, 0);
162 view->y - window_offset_y,
163 0);
164 render_xdg_v6_popups(sway_view->wlr_xdg_surface_v6, wlr_output, 166 render_xdg_v6_popups(sway_view->wlr_xdg_surface_v6, wlr_output,
165 &output->last_frame, 167 now, view->x - window_offset_x, view->y - window_offset_y, 0);
166 view->x - window_offset_x, view->y - window_offset_y,
167 0);
168 break; 168 break;
169 } 169 }
170 case SWAY_WL_SHELL_VIEW: 170 case SWAY_WL_SHELL_VIEW:
171 render_wl_shell_surface(sway_view->wlr_wl_shell_surface, wlr_output, 171 render_wl_shell_surface(sway_view->wlr_wl_shell_surface, wlr_output,
172 &output->last_frame, view->x, view->y, 0, false); 172 now, view->x, view->y, 0, false);
173 break; 173 break;
174 case SWAY_XWAYLAND_VIEW: 174 case SWAY_XWAYLAND_VIEW:
175 render_surface(surface, wlr_output, &output->last_frame, view->x, 175 render_surface(surface, wlr_output, now, view->x, view->y, 0);
176 view->y, 0);
177 break; 176 break;
178 default: 177 default:
179 break; 178 break;
@@ -224,7 +223,11 @@ static void output_frame_notify(struct wl_listener *listener, void *data) {
224 focus : 223 focus :
225 swayc_parent_by_type(focus, C_WORKSPACE)); 224 swayc_parent_by_type(focus, C_WORKSPACE));
226 225
227 swayc_descendants_of_type(workspace, C_VIEW, output_frame_view, soutput); 226 struct render_data rdata = {
227 .output = soutput,
228 .now = &now,
229 };
230 swayc_descendants_of_type(workspace, C_VIEW, output_frame_view, &rdata);
228 231
229 // render unmanaged views on top 232 // render unmanaged views on top
230 struct sway_view *view; 233 struct sway_view *view;
@@ -246,8 +249,7 @@ static void output_frame_notify(struct wl_listener *listener, void *data) {
246 &soutput->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]); 249 &soutput->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]);
247 250
248 wlr_renderer_end(server->renderer); 251 wlr_renderer_end(server->renderer);
249 wlr_output_swap_buffers(wlr_output, &soutput->last_frame, NULL); 252 wlr_output_swap_buffers(wlr_output, &now, NULL);
250
251 soutput->last_frame = now; 253 soutput->last_frame = now;
252} 254}
253 255