aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2018-07-14 11:24:22 -0400
committerLibravatar Drew DeVault <sir@cmpwn.com>2018-07-14 20:44:32 -0400
commitb1afcc69fa70c20d815940fc25189063ed59ae0f (patch)
treeb5876df0592a14729b09de80fc7fabfaf01065b4 /sway/desktop
parentMerge pull request #2271 from RedSoxFan/implement-1569 (diff)
downloadsway-b1afcc69fa70c20d815940fc25189063ed59ae0f.tar.gz
sway-b1afcc69fa70c20d815940fc25189063ed59ae0f.tar.zst
sway-b1afcc69fa70c20d815940fc25189063ed59ae0f.zip
Add extended debugging flags
We currently have several ways of setting debug flags, including command line arguments, environment variables, and compile-time macros. This replaces the lot with command line flags.
Diffstat (limited to 'sway/desktop')
-rw-r--r--sway/desktop/render.c4
-rw-r--r--sway/desktop/transaction.c16
2 files changed, 11 insertions, 9 deletions
diff --git a/sway/desktop/render.c b/sway/desktop/render.c
index b370f8a2..4bfc573b 100644
--- a/sway/desktop/render.c
+++ b/sway/desktop/render.c
@@ -15,6 +15,7 @@
15#include <wlr/util/region.h> 15#include <wlr/util/region.h>
16#include "log.h" 16#include "log.h"
17#include "sway/config.h" 17#include "sway/config.h"
18#include "sway/debug.h"
18#include "sway/input/input-manager.h" 19#include "sway/input/input-manager.h"
19#include "sway/input/seat.h" 20#include "sway/input/seat.h"
20#include "sway/layers.h" 21#include "sway/layers.h"
@@ -786,6 +787,8 @@ static void render_floating(struct sway_output *soutput,
786 } 787 }
787} 788}
788 789
790const char *damage_debug = NULL;
791
789void output_render(struct sway_output *output, struct timespec *when, 792void output_render(struct sway_output *output, struct timespec *when,
790 pixman_region32_t *damage) { 793 pixman_region32_t *damage) {
791 struct wlr_output *wlr_output = output->wlr_output; 794 struct wlr_output *wlr_output = output->wlr_output;
@@ -805,7 +808,6 @@ void output_render(struct sway_output *output, struct timespec *when,
805 goto renderer_end; 808 goto renderer_end;
806 } 809 }
807 810
808 const char *damage_debug = getenv("SWAY_DAMAGE_DEBUG");
809 if (damage_debug != NULL) { 811 if (damage_debug != NULL) {
810 if (strcmp(damage_debug, "highlight") == 0) { 812 if (strcmp(damage_debug, "highlight") == 0) {
811 wlr_renderer_clear(renderer, (float[]){1, 1, 0, 1}); 813 wlr_renderer_clear(renderer, (float[]){1, 1, 0, 1});
diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c
index 2b3f87c3..5e42fde5 100644
--- a/sway/desktop/transaction.c
+++ b/sway/desktop/transaction.c
@@ -19,14 +19,14 @@
19 * How long we should wait for views to respond to the configure before giving 19 * How long we should wait for views to respond to the configure before giving
20 * up and applying the transaction anyway. 20 * up and applying the transaction anyway.
21 */ 21 */
22#define TIMEOUT_MS 200 22int txn_timeout_ms = 200;
23 23
24/** 24/**
25 * If enabled, sway will always wait for the transaction timeout before 25 * If enabled, sway will always wait for the transaction timeout before
26 * applying it, rather than applying it when the views are ready. This allows us 26 * applying it, rather than applying it when the views are ready. This allows us
27 * to observe the rendered state while a transaction is in progress. 27 * to observe the rendered state while a transaction is in progress.
28 */ 28 */
29#define TRANSACTION_DEBUG false 29bool txn_debug = false;
30 30
31struct sway_transaction { 31struct sway_transaction {
32 struct wl_event_source *timer; 32 struct wl_event_source *timer;
@@ -330,7 +330,7 @@ void transaction_commit(struct sway_transaction *transaction) {
330 // Set up a timer which the views must respond within 330 // Set up a timer which the views must respond within
331 transaction->timer = wl_event_loop_add_timer(server.wl_event_loop, 331 transaction->timer = wl_event_loop_add_timer(server.wl_event_loop,
332 handle_timeout, transaction); 332 handle_timeout, transaction);
333 wl_event_source_timer_update(transaction->timer, TIMEOUT_MS); 333 wl_event_source_timer_update(transaction->timer, txn_timeout_ms);
334 } 334 }
335 335
336 // The debug tree shows the pending/live tree. Here is a good place to 336 // The debug tree shows the pending/live tree. Here is a good place to
@@ -361,11 +361,11 @@ static void set_instruction_ready(
361 // If all views are ready, apply the transaction. 361 // If all views are ready, apply the transaction.
362 // If the transaction has timed out then its num_waiting will be 0 already. 362 // If the transaction has timed out then its num_waiting will be 0 already.
363 if (transaction->num_waiting > 0 && --transaction->num_waiting == 0) { 363 if (transaction->num_waiting > 0 && --transaction->num_waiting == 0) {
364#if !TRANSACTION_DEBUG 364 if (!txn_debug) {
365 wlr_log(WLR_DEBUG, "Transaction %p is ready", transaction); 365 wlr_log(WLR_DEBUG, "Transaction %p is ready", transaction);
366 wl_event_source_timer_update(transaction->timer, 0); 366 wl_event_source_timer_update(transaction->timer, 0);
367 transaction_progress_queue(); 367 transaction_progress_queue();
368#endif 368 }
369 } 369 }
370} 370}
371 371