changeset 15870:c9d9786c445d draft

(svn r20552) -Fix: Never show tooltips when the mouse cursor is outside the window.
author terkhen <terkhen@openttd.org>
date Thu, 19 Aug 2010 08:22:08 +0000
parents 12aec8924c8c
children 792676d7443d
files src/misc_gui.cpp src/window.cpp
diffstat 2 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/misc_gui.cpp
+++ b/src/misc_gui.cpp
@@ -890,8 +890,14 @@
 
 	virtual void OnMouseLoop()
 	{
+		/* Always close tooltips when the cursor is not in our window. */
+		if (!_cursor.in_window) {
+			delete this;
+			return;
+		}
+
 		/* We can show tooltips while dragging tools. These are shown as long as
-		 * we are dragging the tool. Normal tooltips work with rmb */
+		 * we are dragging the tool. Normal tooltips work with hover or rmb. */
 		switch (this->close_cond) {
 			case TCC_RIGHT_CLICK: if (!_right_button_down) delete this; break;
 			case TCC_LEFT_CLICK: if (!_left_button_down) delete this; break;
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -2275,7 +2275,7 @@
 	static Point hover_pos = {0, 0};
 
 	if (_settings_client.gui.hover_delay > 0) {
-		if (click != MC_NONE || mousewheel != 0 || _left_button_down || _right_button_down ||
+		if (!_cursor.in_window || click != MC_NONE || mousewheel != 0 || _left_button_down || _right_button_down ||
 				hover_pos.x == 0 || abs(_cursor.pos.x - hover_pos.x) >= MAX_OFFSET_HOVER  ||
 				hover_pos.y == 0 || abs(_cursor.pos.y - hover_pos.y) >= MAX_OFFSET_HOVER) {
 			hover_pos = _cursor.pos;