From f0b81d5bf0787f8420d8d604db177aa12c1e1dd4 Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 1 Feb 2022 17:25:43 +0100 Subject: [PATCH] gtk-stats: Fix top row in piano roll chart being cut off with high DPI --- pandatool/src/gtk-stats/gtkStatsPianoRoll.cxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pandatool/src/gtk-stats/gtkStatsPianoRoll.cxx b/pandatool/src/gtk-stats/gtkStatsPianoRoll.cxx index 74e4de6318..720e5aa6ea 100644 --- a/pandatool/src/gtk-stats/gtkStatsPianoRoll.cxx +++ b/pandatool/src/gtk-stats/gtkStatsPianoRoll.cxx @@ -39,8 +39,15 @@ GtkStatsPianoRoll(GtkStatsMonitor *monitor, int thread_index) : G_CALLBACK(draw_callback), this); gtk_box_pack_start(GTK_BOX(_graph_vbox), _scale_area, FALSE, FALSE, 0); - gtk_widget_set_size_request(_scale_area, 0, 20); + // It should be large enough to display the labels. + { + PangoLayout *layout = gtk_widget_create_pango_layout(_window, "0123456789 ms"); + int width, height; + pango_layout_get_pixel_size(layout, &width, &height); + gtk_widget_set_size_request(_scale_area, 0, height + 1); + g_object_unref(layout); + } gtk_widget_set_size_request(_graph_window, default_piano_roll_width, default_piano_roll_height);