diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-08-19 11:29:59 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-08-19 16:17:24 +1000 |
commit | f9563d88f30fd70c5999520fa7f4b3d0dffd1a4c (patch) | |
tree | e042ef90214040470a7a3e6371a23d97032786c6 | |
parent | Standardise debug variables (diff) | |
download | sway-f9563d88f30fd70c5999520fa7f4b3d0dffd1a4c.tar.gz sway-f9563d88f30fd70c5999520fa7f4b3d0dffd1a4c.tar.zst sway-f9563d88f30fd70c5999520fa7f4b3d0dffd1a4c.zip |
Use enum for damage debug options
-rw-r--r-- | include/sway/debug.h | 8 | ||||
-rw-r--r-- | sway/desktop/render.c | 6 | ||||
-rw-r--r-- | sway/desktop/transaction.c | 4 | ||||
-rw-r--r-- | sway/main.c | 8 |
4 files changed, 14 insertions, 12 deletions
diff --git a/include/sway/debug.h b/include/sway/debug.h index 5dcd9e00..bf3a5f6d 100644 --- a/include/sway/debug.h +++ b/include/sway/debug.h | |||
@@ -3,12 +3,16 @@ | |||
3 | #include <stdbool.h> | 3 | #include <stdbool.h> |
4 | 4 | ||
5 | struct sway_debug { | 5 | struct sway_debug { |
6 | bool highlight_damage; // Highlight regions of the screen being damaged | ||
7 | bool noatomic; // Ignore atomic layout updates | 6 | bool noatomic; // Ignore atomic layout updates |
8 | bool nodamage; // Render the full output on each frame | ||
9 | bool render_tree; // Render the tree overlay | 7 | bool render_tree; // Render the tree overlay |
10 | bool txn_timings; // Log verbose messages about transactions | 8 | bool txn_timings; // Log verbose messages about transactions |
11 | bool txn_wait; // Always wait for the timeout before applying | 9 | bool txn_wait; // Always wait for the timeout before applying |
10 | |||
11 | enum { | ||
12 | DAMAGE_DEFAULT, // Default behaviour | ||
13 | DAMAGE_HIGHLIGHT, // Highlight regions of the screen being damaged | ||
14 | DAMAGE_RERENDER, // Render the full output when any damage occurs | ||
15 | } damage; | ||
12 | }; | 16 | }; |
13 | 17 | ||
14 | extern struct sway_debug debug; | 18 | extern struct sway_debug debug; |
diff --git a/sway/desktop/render.c b/sway/desktop/render.c index 8fc642a6..f6afb82b 100644 --- a/sway/desktop/render.c +++ b/sway/desktop/render.c | |||
@@ -834,9 +834,9 @@ void output_render(struct sway_output *output, struct timespec *when, | |||
834 | goto renderer_end; | 834 | goto renderer_end; |
835 | } | 835 | } |
836 | 836 | ||
837 | if (debug.highlight_damage) { | 837 | if (debug.damage == DAMAGE_HIGHLIGHT) { |
838 | wlr_renderer_clear(renderer, (float[]){1, 1, 0, 1}); | 838 | wlr_renderer_clear(renderer, (float[]){1, 1, 0, 1}); |
839 | } else if (debug.nodamage) { | 839 | } else if (debug.damage == DAMAGE_RERENDER) { |
840 | int width, height; | 840 | int width, height; |
841 | wlr_output_transformed_resolution(wlr_output, &width, &height); | 841 | wlr_output_transformed_resolution(wlr_output, &width, &height); |
842 | pixman_region32_union_rect(damage, damage, 0, 0, width, height); | 842 | pixman_region32_union_rect(damage, damage, 0, 0, width, height); |
@@ -918,7 +918,7 @@ renderer_end: | |||
918 | wlr_render_texture(renderer, root_container.sway_root->debug_tree, | 918 | wlr_render_texture(renderer, root_container.sway_root->debug_tree, |
919 | wlr_output->transform_matrix, 0, 40, 1); | 919 | wlr_output->transform_matrix, 0, 40, 1); |
920 | } | 920 | } |
921 | if (debug.highlight_damage) { | 921 | if (debug.damage == DAMAGE_HIGHLIGHT) { |
922 | int width, height; | 922 | int width, height; |
923 | wlr_output_transformed_resolution(wlr_output, &width, &height); | 923 | wlr_output_transformed_resolution(wlr_output, &width, &height); |
924 | pixman_region32_union_rect(damage, damage, 0, 0, width, height); | 924 | pixman_region32_union_rect(damage, damage, 0, 0, width, height); |
diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c index 219f5362..8688fa13 100644 --- a/sway/desktop/transaction.c +++ b/sway/desktop/transaction.c | |||
@@ -345,9 +345,7 @@ static void set_instruction_ready( | |||
345 | } | 345 | } |
346 | 346 | ||
347 | instruction->container->instruction = NULL; | 347 | instruction->container->instruction = NULL; |
348 | if (!txn_debug) { | 348 | transaction_progress_queue(); |
349 | transaction_progress_queue(); | ||
350 | } | ||
351 | } | 349 | } |
352 | 350 | ||
353 | void transaction_notify_view_ready_by_serial(struct sway_view *view, | 351 | void transaction_notify_view_ready_by_serial(struct sway_view *view, |
diff --git a/sway/main.c b/sway/main.c index 7a1afd4c..3ba4ba75 100644 --- a/sway/main.c +++ b/sway/main.c | |||
@@ -235,12 +235,12 @@ static void drop_permissions(bool keep_caps) { | |||
235 | } | 235 | } |
236 | 236 | ||
237 | void enable_debug_flag(const char *flag) { | 237 | void enable_debug_flag(const char *flag) { |
238 | if (strcmp(flag, "highlight-damage") == 0) { | 238 | if (strcmp(flag, "damage=highlight") == 0) { |
239 | debug.highlight_damage = true; | 239 | debug.damage = DAMAGE_HIGHLIGHT; |
240 | } else if (strcmp(flag, "damage=rerender") == 0) { | ||
241 | debug.damage = DAMAGE_RERENDER; | ||
240 | } else if (strcmp(flag, "noatomic") == 0) { | 242 | } else if (strcmp(flag, "noatomic") == 0) { |
241 | debug.noatomic = true; | 243 | debug.noatomic = true; |
242 | } else if (strcmp(flag, "nodamage") == 0) { | ||
243 | debug.nodamage = true; | ||
244 | } else if (strcmp(flag, "render-tree") == 0) { | 244 | } else if (strcmp(flag, "render-tree") == 0) { |
245 | debug.render_tree = true; | 245 | debug.render_tree = true; |
246 | } else if (strcmp(flag, "txn-wait") == 0) { | 246 | } else if (strcmp(flag, "txn-wait") == 0) { |