summaryrefslogtreecommitdiff
path: root/gtk2_ardour/utils.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gtk2_ardour/utils.cc')
-rw-r--r--gtk2_ardour/utils.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc
index 5e5534222e..a5dcd72438 100644
--- a/gtk2_ardour/utils.cc
+++ b/gtk2_ardour/utils.cc
@@ -923,3 +923,16 @@ convert_bgra_to_rgba (guint8 const* src,
src_pixel += 4;
}
}
+
+void
+resize_window_to_proportion_of_monitor (Gtk::Window* window, int max_width, int max_height)
+{
+ Glib::RefPtr<Gdk::Screen> screen = window->get_screen ();
+ Gdk::Rectangle monitor_rect;
+ screen->get_monitor_geometry (0, monitor_rect);
+
+ int const w = std::min (monitor_rect.get_width(), max_width) * 0.8;
+ int const h = std::min (monitor_rect.get_height(), max_height) * 0.8;
+
+ window->resize (w, h);
+}