summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
Diffstat (limited to 'desktop')
-rw-r--r--desktop/tree.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/desktop/tree.c b/desktop/tree.c
index 1f7d8ffc3..dd34cb64a 100644
--- a/desktop/tree.c
+++ b/desktop/tree.c
@@ -46,9 +46,9 @@
#define TREE_TEXT_SIZE_PT 11
#define TREE_ICON_SIZE 17
#define NODE_INSTEP 20
-#define TREE_LINE_HEIGHT 20
static int tree_text_size_px;
+static int TREE_LINE_HEIGHT;
static plot_font_style_t plot_fstyle = {
.family = PLOT_FONT_FAMILY_SANS_SERIF,
@@ -206,6 +206,19 @@ struct tree *tree_create(unsigned int flags,
tree->callbacks = callbacks;
tree->client_data = client_data;
+ /* Set text height in pixels */
+ tree_text_size_px =
+ (TREE_TEXT_SIZE_PT * FIXTOINT(nscss_screen_dpi) + 36) /
+ 72;
+ /* Set line height appropriate for this text height in pixels
+ * Using 4/3 text height */
+ TREE_LINE_HEIGHT = (tree_text_size_px * 8 + 3) / 6;
+
+ /* But if that's too small for the icons, base the line height on
+ * the icon height. */
+ if (TREE_LINE_HEIGHT < TREE_ICON_SIZE + 2)
+ TREE_LINE_HEIGHT = TREE_ICON_SIZE + 2;
+
return tree;
}
@@ -1795,10 +1808,6 @@ void tree_draw(struct tree *tree, int x, int y,
if (tree->root->child == NULL || !tree->redraw)
return;
- tree_text_size_px =
- (TREE_TEXT_SIZE_PT * FIXTOINT(nscss_screen_dpi) + 36) /
- 72;
-
/* Set up clip rectangle */
clip.x0 = x + clip_x;
clip.y0 = y + clip_y;