increase meterbridge with if scrollbar is not visible..
authorRobin Gareus <robin@gareus.org>
Wed, 24 Jul 2013 13:26:40 +0000 (15:26 +0200)
committerRobin Gareus <robin@gareus.org>
Wed, 24 Jul 2013 13:48:03 +0000 (15:48 +0200)
gtk2_ardour/meterbridge.cc

index a2bc047bdb29ba18a8d4e0b6611574de042a3aea..3042ba1d0e68eda91cec0746a43565fe89ae9a43 100644 (file)
@@ -338,9 +338,25 @@ Meterbridge::on_size_request (Gtk::Requisition* r)
 
        Gdk::Geometry geom;
        Gtk::Requisition mr = meterarea.size_request();
+
        geom.max_width = mr.width + metrics_left.get_width() + metrics_right.get_width();
        geom.max_height = max_height;
 
+       const Gtk::Scrollbar * hsc = scroller.get_hscrollbar();
+       Glib::RefPtr<Gdk::Screen> screen = get_screen ();
+       Gdk::Rectangle monitor_rect;
+       screen->get_monitor_geometry (0, monitor_rect);
+       const int scr_w = monitor_rect.get_width() - 44;
+
+       if (cur_max_width < geom.max_width
+                       && cur_max_width < scr_w
+                       && !(scroller.get_hscrollbar_visible() && hsc)) {
+               int h = r->height;
+               *r = Gtk::Requisition();
+               r->width = geom.max_width;
+               r->height = h;
+       }
+
        if (cur_max_width != geom.max_width) {
                cur_max_width = geom.max_width;
                geom.height_inc = 16;