fix big clock aspect ratio, and add minimum size to avoid resize glitches
authorPaul Davis <paul@linuxaudiosystems.com>
Fri, 2 Jan 2015 14:01:11 +0000 (09:01 -0500)
committerPaul Davis <paul@linuxaudiosystems.com>
Fri, 2 Jan 2015 14:01:11 +0000 (09:01 -0500)
gtk2_ardour/big_clock_window.cc

index 70bad5c0460370531e0d25554d07f8c9a5890b0e..0f688702dd83496b6f8d6f0b1bf167877b54b5d0 100644 (file)
@@ -47,6 +47,7 @@ BigClockWindow::BigClockWindow (AudioClock& c)
        clock.show_all ();
 
        clock.size_request (default_size);
+
        clock.signal_size_allocate().connect (sigc::mem_fun (*this, &BigClockWindow::clock_size_reallocated));
 }
 
@@ -71,6 +72,19 @@ BigClockWindow::on_realize ()
        /* (try to) ensure that resizing is possible.
         */
        get_window()->set_decorations (Gdk::DECOR_BORDER|Gdk::DECOR_RESIZEH);
+
+       /* try to force a fixed aspect ratio so that we don't distort the font
+        */
+
+       float aspect = default_size.width/(float)default_size.height;
+       Gdk::Geometry geom;
+
+       geom.min_aspect = aspect;
+       geom.max_aspect = aspect;
+       geom.min_width = -1; /* use requisition */
+       geom.min_height = -1; /* use requisition */
+
+       get_window()->set_geometry_hints (geom, Gdk::WindowHints (Gdk::HINT_ASPECT|Gdk::HINT_MIN_SIZE));
 }
 
 void