From: Julien "_FrnchFrgg_" RIVAUD Date: Thu, 25 Aug 2016 17:00:05 +0000 (+0200) Subject: Avoid 1px size changes when sizing_text() is used X-Git-Tag: 5.2~37 X-Git-Url: https://main.carlh.net/gitweb/?p=ardour.git;a=commitdiff_plain;h=3921e33c2a6c5ae5d745a8313ad9981b55a5aa5c Avoid 1px size changes when sizing_text() is used When requesting a size for ArdourButton, the width and height of the button could be increased by one to ensure the center of the text would lie exactly at the center of the button. I initially thought that it was a good idea even when the text used for sizing was frozen, but the main (and only?) use-case for that is to actually freeze the size of the button regardless of the actual displayed text, so jittering by one pixel is not welcome. Only do the centering tweak if there is no sizing text. --- diff --git a/gtk2_ardour/ardour_button.cc b/gtk2_ardour/ardour_button.cc index e817882a5d..922ba84d2c 100644 --- a/gtk2_ardour/ardour_button.cc +++ b/gtk2_ardour/ardour_button.cc @@ -649,7 +649,7 @@ ArdourButton::on_size_request (Gtk::Requisition* req) req->width = req->height; if (req->height < req->width) req->height = req->width; - } else if (_text_width > 0 && !(_elements & (Menu | Indicator))) { + } else if (_sizing_text.empty() && _text_width > 0 && !(_elements & (Menu | Indicator))) { // properly centered text for those elements that are centered // (no sub-pixel offset) if ((req->width - _text_width) & 1) { ++req->width; }