From 2bd33c1869051f59b8f9aba59507e1260d2d4096 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Mon, 11 Mar 2019 19:19:54 +0000 Subject: [PATCH] Fix viewport hovering when hover mode is set to right-click --- src/main_gui.cpp | 2 +- src/misc_gui.cpp | 4 +++- src/viewport_gui.cpp | 2 +- src/window.cpp | 2 ++ 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main_gui.cpp b/src/main_gui.cpp index bb236a9520..66319c92a2 100644 --- a/src/main_gui.cpp +++ b/src/main_gui.cpp @@ -471,7 +471,7 @@ struct MainWindow : Window virtual void OnMouseOver(Point pt, int widget) { - if (pt.x != -1 && _game_mode != GM_MENU && _mouse_hovering) { + if (pt.x != -1 && _game_mode != GM_MENU && (_mouse_hovering || _settings_client.gui.hover_delay_ms == 0)) { /* Show tooltip with last month production or town name */ const Point p = GetTileBelowCursor(); const TileIndex tile = TileVirtXY(p.x, p.y); diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index ec123b871f..72a3ffa59a 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -776,7 +776,9 @@ struct TooltipsWindow : public Window case TCC_HOVER: if (!_mouse_hovering) delete this; break; case TCC_HOVER_VIEWPORT: - if (!_mouse_hovering) { + if (_settings_client.gui.hover_delay_ms == 0) { + this->delete_next_mouse_loop = true; + } else if (!_mouse_hovering) { delete this; break; } diff --git a/src/viewport_gui.cpp b/src/viewport_gui.cpp index 4fec81117d..cfbbfd742d 100644 --- a/src/viewport_gui.cpp +++ b/src/viewport_gui.cpp @@ -155,7 +155,7 @@ public: virtual void OnMouseOver(Point pt, int widget) { - if (pt.x != -1 && _mouse_hovering) { + if (pt.x != -1 && (_mouse_hovering || _settings_client.gui.hover_delay_ms == 0)) { /* Show tooltip with last month production or town name */ const Point p = GetTileBelowCursor(); const TileIndex tile = TileVirtXY(p.x, p.y); diff --git a/src/window.cpp b/src/window.cpp index f8f7460b00..f434288af6 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -3040,6 +3040,8 @@ void HandleMouseEvents() _mouse_hovering = true; } } + } else { + _mouse_hovering = false; } /* Handle sprite picker before any GUI interaction */