Desktop: decide a titlebar double-click on the press, before the drag can swallow it
ci / build and test (pull_request) Successful in 2m48s
ci / desktop nightly (pull_request) Skipped
ci / api image (pull_request) Successful in 13s
ci / android head (pull_request) Successful in 3m41s

This commit is contained in:
jaap-jan committed 2026-10-02 14:40:50 +02:00
1 parent 079a273d46
commit a2362d1e3e
6 files changed
+127 -3

No files matched your search

+13 -1
View File
@@ -41,6 +41,8 @@ internal sealed partial class TitleBar : UserControl
}
}
private readonly CaptionPresses presses = new();
private Window? Host => TopLevel.GetTopLevel(this) as Window;
/// <remarks>
@@ -55,6 +57,15 @@ internal sealed partial class TitleBar : UserControl
return;
}
// Decided on the press, before the drag would take it: see CaptionPresses.
if (presses.IsSecond(e, this))
{
OnToggleMaximised(sender, e);
e.Handled = true;
return;
}
Host?.BeginMoveDrag(e);
}
@@ -68,7 +79,8 @@ internal sealed partial class TitleBar : UserControl
/// <remarks>
/// Both the button and a double-click on the bar arrive here, which is the convention Windows sets and
/// the one people reach for without thinking about it.
/// the one people reach for without thinking about it. The double-click comes from <see cref="OnDrag"/>
/// rather than <c>DoubleTapped</c>; see <see cref="CaptionPresses"/>.
/// </remarks>
private void OnToggleMaximised(object? sender, RoutedEventArgs e)
{