diff options
author | Robin Gareus <robin@gareus.org> | 2015-06-27 00:56:07 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2015-06-27 01:00:03 +0200 |
commit | 1bd7199f4f623b4e0d69605953ffcfbb9e88eb16 (patch) | |
tree | dc6a2b5a076fc286649e56fa8f61c76e13836200 /gtk2_ardour/utils.cc | |
parent | 4fc3d98af81c09c605048ec981d5f0c9dcd84d28 (diff) |
consolidate code
Diffstat (limited to 'gtk2_ardour/utils.cc')
-rw-r--r-- | gtk2_ardour/utils.cc | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc index c903e591b4..fcfdbe644c 100644 --- a/gtk2_ardour/utils.cc +++ b/gtk2_ardour/utils.cc @@ -921,3 +921,40 @@ ARDOUR_UI_UTILS::rate_as_string (float r) } return buf; } + +bool +ARDOUR_UI_UTILS::windows_overlap (Gtk::Window *a, Gtk::Window *b) +{ + + if (!a || !b) { + return false; + } + if (a->get_screen() == b->get_screen()) { + gint ex, ey, ew, eh; + gint mx, my, mw, mh; + + a->get_position (ex, ey); + a->get_size (ew, eh); + b->get_position (mx, my); + b->get_size (mw, mh); + + GdkRectangle e; + GdkRectangle m; + GdkRectangle r; + + e.x = ex; + e.y = ey; + e.width = ew; + e.height = eh; + + m.x = mx; + m.y = my; + m.width = mw; + m.height = mh; + + if (gdk_rectangle_intersect (&e, &m, &r)) { + return true; + } + } + return false; +} |