From 7e097c5efcf10f17434c0497d404e6353f087a40 Mon Sep 17 00:00:00 2001 From: Nikolay Date: Wed, 25 Mar 2015 10:55:55 +0200 Subject: [Summary] Bug fix #44332 "Please fit the Pan values monitor to channel borders" [Feature reviewed] AMishyn [Reviewed] VKamyshniy Fixed up by Paul Davis to fix logic mistakes and unnecessary complexity, and indentation. Conflicts: libs/gtkmm2ext/persistent_tooltip.cc --- libs/gtkmm2ext/persistent_tooltip.cc | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'libs/gtkmm2ext') diff --git a/libs/gtkmm2ext/persistent_tooltip.cc b/libs/gtkmm2ext/persistent_tooltip.cc index d9ccfa15f7..61eb4884f5 100644 --- a/libs/gtkmm2ext/persistent_tooltip.cc +++ b/libs/gtkmm2ext/persistent_tooltip.cc @@ -21,6 +21,8 @@ #include #include "gtkmm2ext/persistent_tooltip.h" +#include "pbd/stacktrace.h" + #include "i18n.h" using namespace std; @@ -60,7 +62,7 @@ bool PersistentTooltip::timeout () { show (); - return false; + return true; } bool @@ -114,6 +116,7 @@ PersistentTooltip::show () if (_tip.empty()) { return; } + if (!_window) { _window = new Window (WINDOW_POPUP); _window->set_name (X_("ContrastingPopup")); @@ -136,18 +139,22 @@ PersistentTooltip::show () set_tip (_tip); if (!_window->is_visible ()) { - int rx, ry, sw; - sw= gdk_screen_width(); - _target->get_window()->get_origin (rx, ry); - _window->move (rx, ry + _target->get_height() + _margin_y); - _window->present (); + int rx, ry; + int sw = gdk_screen_width(); + _target->get_window()->get_origin (rx, ry); + /* the window needs to be realized first * for _window->get_width() to be correct. */ + + _window->present (); + if (sw < rx + _window->get_width()) { rx = sw - _window->get_width(); _window->move (rx, ry + _target->get_height()); + } else { + _window->move (rx + (_target->get_width () - _window->get_width ()) / 2, ry + _target->get_height()); } } } -- cgit v1.2.3