Use enum for damage debug options

master
Ryan Dwyer 6 years ago
parent 8d1dd03823
commit f9563d88f3

@ -3,12 +3,16 @@
#include <stdbool.h>
struct sway_debug {
bool highlight_damage; // Highlight regions of the screen being damaged
bool noatomic; // Ignore atomic layout updates
bool nodamage; // Render the full output on each frame
bool render_tree; // Render the tree overlay
bool txn_timings; // Log verbose messages about transactions
bool txn_wait; // Always wait for the timeout before applying
enum {
DAMAGE_DEFAULT, // Default behaviour
DAMAGE_HIGHLIGHT, // Highlight regions of the screen being damaged
DAMAGE_RERENDER, // Render the full output when any damage occurs
} damage;
};
extern struct sway_debug debug;

@ -834,9 +834,9 @@ void output_render(struct sway_output *output, struct timespec *when,
goto renderer_end;
}
if (debug.highlight_damage) {
if (debug.damage == DAMAGE_HIGHLIGHT) {
wlr_renderer_clear(renderer, (float[]){1, 1, 0, 1});
} else if (debug.nodamage) {
} else if (debug.damage == DAMAGE_RERENDER) {
int width, height;
wlr_output_transformed_resolution(wlr_output, &width, &height);
pixman_region32_union_rect(damage, damage, 0, 0, width, height);
@ -918,7 +918,7 @@ renderer_end:
wlr_render_texture(renderer, root_container.sway_root->debug_tree,
wlr_output->transform_matrix, 0, 40, 1);
}
if (debug.highlight_damage) {
if (debug.damage == DAMAGE_HIGHLIGHT) {
int width, height;
wlr_output_transformed_resolution(wlr_output, &width, &height);
pixman_region32_union_rect(damage, damage, 0, 0, width, height);

@ -345,9 +345,7 @@ static void set_instruction_ready(
}
instruction->container->instruction = NULL;
if (!txn_debug) {
transaction_progress_queue();
}
transaction_progress_queue();
}
void transaction_notify_view_ready_by_serial(struct sway_view *view,

@ -235,12 +235,12 @@ static void drop_permissions(bool keep_caps) {
}
void enable_debug_flag(const char *flag) {
if (strcmp(flag, "highlight-damage") == 0) {
debug.highlight_damage = true;
if (strcmp(flag, "damage=highlight") == 0) {
debug.damage = DAMAGE_HIGHLIGHT;
} else if (strcmp(flag, "damage=rerender") == 0) {
debug.damage = DAMAGE_RERENDER;
} else if (strcmp(flag, "noatomic") == 0) {
debug.noatomic = true;
} else if (strcmp(flag, "nodamage") == 0) {
debug.nodamage = true;
} else if (strcmp(flag, "render-tree") == 0) {
debug.render_tree = true;
} else if (strcmp(flag, "txn-wait") == 0) {

Loading…
Cancel
Save