Skip to content

Commit

Permalink
WPF - OnMouseLeave send actual x,y coordinates not just the -1 and ca…
Browse files Browse the repository at this point in the history
…ll SendMouseClickEvent when left mouse button pressed

Resolves #2060

# Conflicts:
#	CefSharp.Wpf/ChromiumWebBrowser.cs
  • Loading branch information
amaitland committed Jan 2, 2018
1 parent a6132ad commit 49463b2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion CefSharp.Wpf/ChromiumWebBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2159,8 +2159,16 @@ protected override void OnMouseLeave(MouseEventArgs e)
if (!e.Handled && browser != null)
{
var modifiers = e.GetModifiers();
var point = e.GetPosition(this);

browser.GetHost().SendMouseMoveEvent(-1, -1, true, modifiers);
//If the LeftMouse button is pressed when leaving the control we send a mouse click with mouseUp: true
//to let the browser know the mouse has been released
if (e.LeftButton == MouseButtonState.Pressed)
{
browser.GetHost().SendMouseClickEvent((int)point.X, (int)point.Y, MouseButtonType.Left, mouseUp: true, clickCount: 1, modifiers: modifiers);
}

browser.GetHost().SendMouseMoveEvent((int)point.X, (int)point.Y, true, modifiers);

((IWebBrowserInternal)this).SetTooltipText(null);
}
Expand Down

0 comments on commit 49463b2

Please sign in to comment.