Skip to content

Commit fb18122

Browse files
committed
WPF - OnMouseLeave send actual x,y coordinates not just the -1 and call SendMouseClickEvent when left mouse button pressed
Resolves #2060 # Conflicts: # CefSharp.Wpf/ChromiumWebBrowser.cs
1 parent 58576c6 commit fb18122

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

CefSharp.Wpf/ChromiumWebBrowser.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2085,8 +2085,16 @@ protected override void OnMouseLeave(MouseEventArgs e)
20852085
if (!e.Handled && browser != null)
20862086
{
20872087
var modifiers = e.GetModifiers();
2088+
var point = e.GetPosition(this);
20882089

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

20912099
((IWebBrowserInternal)this).SetTooltipText(null);
20922100
}

0 commit comments

Comments
 (0)