From e5e97c9a11fb7bac0eea70c9ec5a77cf11df7844 Mon Sep 17 00:00:00 2001 From: Pavlos Touboulidis Date: Fri, 25 Apr 2014 18:17:29 +0300 Subject: [PATCH] Fix issue #5149: Make chat window not autoscroll It will autoscroll unless the chat window is open and the scroll position is not at the bottom. --- OpenRA.Game/Widgets/ChatDisplayWidget.cs | 2 +- OpenRA.Mods.RA/Widgets/Logic/IngameChatLogic.cs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/OpenRA.Game/Widgets/ChatDisplayWidget.cs b/OpenRA.Game/Widgets/ChatDisplayWidget.cs index 8c8e22eba8..affee3f5ad 100644 --- a/OpenRA.Game/Widgets/ChatDisplayWidget.cs +++ b/OpenRA.Game/Widgets/ChatDisplayWidget.cs @@ -91,7 +91,7 @@ namespace OpenRA.Widgets return; // This takes advantage of the fact that recentLines is ordered by expiration, from sooner to later - while (recentLines.Count > 0 && totalTicks >= recentLines [0].Expiration) + while (recentLines.Count > 0 && totalTicks >= recentLines[0].Expiration) recentLines.RemoveAt(0); } } diff --git a/OpenRA.Mods.RA/Widgets/Logic/IngameChatLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/IngameChatLogic.cs index 3a0d3c541f..54734050bc 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/IngameChatLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/IngameChatLogic.cs @@ -146,8 +146,11 @@ namespace OpenRA.Mods.RA.Widgets.Logic template.Bounds.Height += dh; } + bool scrolledToBottom = chatScrollPanel.ScrolledToBottom; chatScrollPanel.AddChild(template); - chatScrollPanel.ScrollToBottom(); + if (scrolledToBottom) + chatScrollPanel.ScrollToBottom(); + Sound.PlayNotification(null, "Sounds", "ChatLine", null); } }