aboutsummaryrefslogtreecommitdiff
path: root/dwl.c
diff options
context:
space:
mode:
authorLeonardo Hernández Hernández <leohdz172@protonmail.com>2022-08-11 15:25:13 -0500
committerLeonardo Hernández <leohdz172@protonmail.com>2022-08-12 23:21:25 -0500
commit48396a1bf8ce4282c4fc76d853195e1026caf7d7 (patch)
tree58543e178a1e9a9868d81829a22e075e2e1b36a4 /dwl.c
parentb6e3fc1645c5ac53277ab0dc20d7c266e1581b86 (diff)
fix crash when setting a custom mode
Diffstat (limited to 'dwl.c')
-rw-r--r--dwl.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/dwl.c b/dwl.c
index 7d53ab9..5031e0a 100644
--- a/dwl.c
+++ b/dwl.c
@@ -1621,7 +1621,23 @@ outputmgrapplyortest(struct wlr_output_configuration_v1 *config, int test)
ok &= wlr_output_test(wlr_output);
wlr_output_rollback(wlr_output);
} else {
- ok &= wlr_output_commit(wlr_output);
+ int output_ok = 1;
+ /* If it's a custom mode to avoid an assertion failed in wlr_output_commit()
+ * we test if that mode does not fail rather than just call wlr_output_commit().
+ * We do not test normal modes because (at least in my hardware (@sevz17))
+ * wlr_output_test() fails even if that mode can actually be set */
+ if (!config_head->state.mode)
+ ok &= (output_ok = wlr_output_test(wlr_output)
+ && wlr_output_commit(wlr_output));
+ else
+ ok &= wlr_output_commit(wlr_output);
+
+ /* In custom modes we call wlr_output_test(), it it fails
+ * we need to rollback, and normal modes seems to does not cause
+ * assertions failed in wlr_output_commit() which rollback
+ * the output on failure */
+ if (!output_ok)
+ wlr_output_rollback(wlr_output);
}
}