From 360a5b293d5c85553a5fa37523f1135ec1dd88ec Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Wed, 21 Dec 2022 10:06:53 +1300 Subject: [PATCH] Bubble unhandled double-click events to OnClick. --- OpenRA.Mods.Common/Widgets/ButtonWidget.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Common/Widgets/ButtonWidget.cs b/OpenRA.Mods.Common/Widgets/ButtonWidget.cs index b29158889c..f4624d3f9a 100644 --- a/OpenRA.Mods.Common/Widgets/ButtonWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ButtonWidget.cs @@ -62,7 +62,7 @@ namespace OpenRA.Mods.Common.Widgets // Equivalent to OnMouseUp, but without an input arg public Action OnClick = () => { }; - public Action OnDoubleClick = () => { }; + public Action OnDoubleClick = null; public Action OnKeyPress = _ => { }; public string Cursor = ChromeMetrics.Get("ButtonCursor"); @@ -163,7 +163,7 @@ namespace OpenRA.Mods.Common.Widgets return false; var disabled = IsDisabled(); - if (HasMouseFocus && mi.Event == MouseInputEvent.Up && mi.MultiTapCount == 2) + if (HasMouseFocus && mi.Event == MouseInputEvent.Up && mi.MultiTapCount == 2 && OnDoubleClick != null) { if (!disabled) {