Allow plugin inline displays to shrink
authorJohannes Mueller <github@johannes-mueller.org>
Tue, 15 Aug 2017 19:05:13 +0000 (21:05 +0200)
committerRobin Gareus <robin@gareus.org>
Wed, 20 Jun 2018 19:06:16 +0000 (21:06 +0200)
Plugin inline displays were forbidden to shrink as this might cause a deadlock
when the shrinkage causes the scrollbar to disappear.

display shrink → scrollbar unneeded → scrollbar disappears →
more horizontal space -> display grows -> scrollbar appears →
less horizontal space -> display shrink and so forth

This was formerly avoided by not allowing display shrinkage.

The solution proposed here sets the maximum height of the display to the
current height, if a scrollbar is present during resizing and has not been
present during the last resizing. So if this scrollbar disappears (after
resizing it might no longer be needed), the display would have the possibility
to grow, but it does not grow vertically as the maximum height is limited to
the current height.

gtk2_ardour/processor_box.cc
gtk2_ardour/processor_box.h

index 504ad10f3261b475ce75e7f7fffc3cdb0f202787..9beb7336174aaf39aadaa1fb4be09d496076b2f4 100644 (file)
@@ -1568,6 +1568,7 @@ ProcessorEntry::PluginInlineDisplay::PluginInlineDisplay (ProcessorEntry& e, boo
        : PluginDisplay (p, max_height)
        , _entry (e)
        , _scroll (false)
+       , _given_max_height (max_height)
 {
        std::string postfix = string_compose(_("\n%1+double-click to toggle inline-display"), Keyboard::tertiary_modifier_name ());
 
@@ -1639,11 +1640,15 @@ ProcessorEntry::PluginInlineDisplay::update_height_alloc (uint32_t inline_height
        }
 
        if (shm != _cur_height) {
-               if (_scroll == sc || _cur_height < shm) {
-                       queue_resize ();
+               queue_resize ();
+               if (!_scroll && sc) {
+                       _max_height = shm;
+               } else {
+                       _max_height = _given_max_height;
                }
                _cur_height = shm;
        }
+
        _scroll = sc;
 }
 
index 5772e6dbd142de0612344691094993e92929d479..81c5c8e20fb3a57dee720c9a106a42fe52294063 100644 (file)
@@ -258,6 +258,7 @@ private:
 
                ProcessorEntry& _entry;
                bool _scroll;
+               const uint32_t _given_max_height;
        };
 
        class LuaPluginDisplay : public PluginInlineDisplay {