From b36e6b8341ef8e044b1fbadd9462c454a82b85e3 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 12 May 2020 13:22:11 +0200 Subject: Optimize drawing of buttons with changing text When a button has a fixed size, there's no need to call queue_resize(). This fixes an issue with the ArdourClock info displays when slaved. The Timecode and Delta display text changes in small intervals and caused excessive CPU load due to GUI size-requests + redraws. --- libs/widgets/ardour_button.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libs/widgets/ardour_button.cc b/libs/widgets/ardour_button.cc index 4c1ac05a93..a0000e4dc6 100644 --- a/libs/widgets/ardour_button.cc +++ b/libs/widgets/ardour_button.cc @@ -212,7 +212,12 @@ ArdourButton::set_text (const std::string& str, bool markup) set_text_internal (); /* on_size_request() will fill in _text_width/height * so queue it even if _sizing_text != "" */ - queue_resize (); + if (_sizing_text.empty ()) { + queue_resize (); + } else { + _layout->get_pixel_size (_text_width, _text_height); + CairoWidget::set_dirty (); + } } } -- cgit v1.2.3