diff options
author | emersion <contact@emersion.fr> | 2018-03-30 13:18:50 -0400 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2018-03-30 17:16:35 -0400 |
commit | a776ecbb860608e0f75430a53ea75a6ed19ac746 (patch) | |
tree | f664978ac74c3fc13993ed709cc1015c025d3344 /sway/desktop/layer_shell.c | |
parent | Merge pull request #1667 from emersion/wlroots-xwayland-map (diff) | |
download | sway-a776ecbb860608e0f75430a53ea75a6ed19ac746.tar.gz sway-a776ecbb860608e0f75430a53ea75a6ed19ac746.tar.zst sway-a776ecbb860608e0f75430a53ea75a6ed19ac746.zip |
Add lite damage tracking
This skips the renderer if nothing has changed, and renders
everything otherwise.
Diffstat (limited to 'sway/desktop/layer_shell.c')
-rw-r--r-- | sway/desktop/layer_shell.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c index f7e5d19c..5c96659a 100644 --- a/sway/desktop/layer_shell.c +++ b/sway/desktop/layer_shell.c | |||
@@ -4,12 +4,13 @@ | |||
4 | #include <wayland-server.h> | 4 | #include <wayland-server.h> |
5 | #include <wlr/types/wlr_box.h> | 5 | #include <wlr/types/wlr_box.h> |
6 | #include <wlr/types/wlr_layer_shell.h> | 6 | #include <wlr/types/wlr_layer_shell.h> |
7 | #include <wlr/types/wlr_output_damage.h> | ||
7 | #include <wlr/types/wlr_output.h> | 8 | #include <wlr/types/wlr_output.h> |
8 | #include <wlr/util/log.h> | 9 | #include <wlr/util/log.h> |
9 | #include "sway/layers.h" | 10 | #include "sway/layers.h" |
10 | #include "sway/tree/layout.h" | ||
11 | #include "sway/output.h" | 11 | #include "sway/output.h" |
12 | #include "sway/server.h" | 12 | #include "sway/server.h" |
13 | #include "sway/tree/layout.h" | ||
13 | 14 | ||
14 | static void apply_exclusive(struct wlr_box *usable_area, | 15 | static void apply_exclusive(struct wlr_box *usable_area, |
15 | uint32_t anchor, int32_t exclusive, | 16 | uint32_t anchor, int32_t exclusive, |
@@ -210,20 +211,26 @@ static void handle_surface_commit(struct wl_listener *listener, void *data) { | |||
210 | } else { | 211 | } else { |
211 | // TODO DAMAGE from surface damage | 212 | // TODO DAMAGE from surface damage |
212 | } | 213 | } |
214 | wlr_output_damage_add_box(output->damage, &old_geo); | ||
215 | wlr_output_damage_add_box(output->damage, &layer->geo); | ||
213 | } | 216 | } |
214 | } | 217 | } |
215 | 218 | ||
216 | static void unmap(struct wlr_layer_surface *layer_surface) { | 219 | static void unmap(struct sway_layer_surface *sway_layer) { |
217 | // TODO DAMAGE | 220 | struct wlr_output *wlr_output = sway_layer->layer_surface->output; |
221 | if (wlr_output != NULL) { | ||
222 | struct sway_output *output = wlr_output->data; | ||
223 | wlr_output_damage_add_box(output->damage, &sway_layer->geo); | ||
224 | } | ||
218 | } | 225 | } |
219 | 226 | ||
220 | static void handle_destroy(struct wl_listener *listener, void *data) { | 227 | static void handle_destroy(struct wl_listener *listener, void *data) { |
221 | struct sway_layer_surface *sway_layer = wl_container_of( | 228 | struct sway_layer_surface *sway_layer = wl_container_of(listener, |
222 | listener, sway_layer, destroy); | 229 | sway_layer, destroy); |
223 | wlr_log(L_DEBUG, "Layer surface destroyed (%s)", | 230 | wlr_log(L_DEBUG, "Layer surface destroyed (%s)", |
224 | sway_layer->layer_surface->namespace); | 231 | sway_layer->layer_surface->namespace); |
225 | if (sway_layer->layer_surface->mapped) { | 232 | if (sway_layer->layer_surface->mapped) { |
226 | unmap(sway_layer->layer_surface); | 233 | unmap(sway_layer); |
227 | } | 234 | } |
228 | wl_list_remove(&sway_layer->link); | 235 | wl_list_remove(&sway_layer->link); |
229 | wl_list_remove(&sway_layer->destroy.link); | 236 | wl_list_remove(&sway_layer->destroy.link); |
@@ -239,13 +246,16 @@ static void handle_destroy(struct wl_listener *listener, void *data) { | |||
239 | } | 246 | } |
240 | 247 | ||
241 | static void handle_map(struct wl_listener *listener, void *data) { | 248 | static void handle_map(struct wl_listener *listener, void *data) { |
242 | // TODO DAMAGE | 249 | struct sway_layer_surface *sway_layer = wl_container_of(listener, |
250 | sway_layer, map); | ||
251 | struct sway_output *output = sway_layer->layer_surface->output->data; | ||
252 | wlr_output_damage_add_box(output->damage, &sway_layer->geo); | ||
243 | } | 253 | } |
244 | 254 | ||
245 | static void handle_unmap(struct wl_listener *listener, void *data) { | 255 | static void handle_unmap(struct wl_listener *listener, void *data) { |
246 | struct sway_layer_surface *sway_layer = wl_container_of( | 256 | struct sway_layer_surface *sway_layer = wl_container_of( |
247 | listener, sway_layer, unmap); | 257 | listener, sway_layer, unmap); |
248 | unmap(sway_layer->layer_surface); | 258 | unmap(sway_layer); |
249 | } | 259 | } |
250 | 260 | ||
251 | void handle_layer_shell_surface(struct wl_listener *listener, void *data) { | 261 | void handle_layer_shell_surface(struct wl_listener *listener, void *data) { |