From ccb75758b4671bf326385d429d3ff4d3b26d1d5e Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Mon, 23 Aug 2021 16:11:17 +0200 Subject: [PATCH] [dialogs] Make 9 / 10 ratio configurable at compile time. DIALOG_WIDTH_RATIO and DIALOG_HEIGHT_RATIO in src/setup.h --- src/bfu/dialog.h | 4 ++-- src/setup.h | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/bfu/dialog.h b/src/bfu/dialog.h index e6a277bd..6236511f 100644 --- a/src/bfu/dialog.h +++ b/src/bfu/dialog.h @@ -131,7 +131,7 @@ struct dialog { static inline int dialog_max_width(struct terminal *term) { - int width = term->width * 9 / 10 - 2 * DIALOG_LB; + int width = term->width * DIALOG_WIDTH_RATIO - 2 * DIALOG_LB; int_bounds(&width, 1, int_max(term->width - 2 * DIALOG_LB, 1)); @@ -141,7 +141,7 @@ dialog_max_width(struct terminal *term) static inline int dialog_max_height(struct terminal *term) { - int height = term->height * 9 / 10 - 2 * DIALOG_TB; + int height = term->height * DIALOG_HEIGHT_RATIO - 2 * DIALOG_TB; int_bounds(&height, 1, int_max(term->height - 2 * DIALOG_TB, 1)); diff --git a/src/setup.h b/src/setup.h index 7f76be3e..589ff064 100644 --- a/src/setup.h +++ b/src/setup.h @@ -51,6 +51,9 @@ #define DIALOG_FRAME 2 #define DIALOG_MIN_WIDTH 42 +#define DIALOG_WIDTH_RATIO 0.9 +#define DIALOG_HEIGHT_RATIO 0.9 + #define DIALOG_LB (DIALOG_LEFT_BORDER + DIALOG_LEFT_INNER_BORDER + 1) #define DIALOG_TB (DIALOG_TOP_BORDER + DIALOG_TOP_INNER_BORDER + 1)