Skip to content

Commit

Permalink
Handle X1 and X2 in chromium web view
Browse files Browse the repository at this point in the history
  • Loading branch information
FrayxRulez committed Oct 21, 2024
1 parent 8e20f14 commit 3ab2976
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Telegram/Controls/WebViewer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,8 @@ protected override async void OnApplyTemplate()
View.NavigationCompleted += OnNavigationCompleted;
View.WebMessageReceived += OnWebMessageReceived;

View.PointerPressed += OnPointerPressed;

await View.EnsureCoreWebView2Async();

if (View.CoreWebView2 != null)
Expand Down Expand Up @@ -405,6 +407,15 @@ await View.CoreWebView2.AddScriptToExecuteOnDocumentCreatedAsync(@"
}
}

private void OnPointerPressed(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
{
var pointer = e.GetCurrentPoint(this);
if (pointer.Properties.IsXButton1Pressed || pointer.Properties.IsXButton2Pressed)
{
e.Handled = true;
}
}

private void OnNavigationStarting(WebView2 sender, CoreWebView2NavigationStartingEventArgs args)
{
args.Cancel = OnNavigating(args.Uri);
Expand Down

0 comments on commit 3ab2976

Please sign in to comment.