From b5be2cbcf5fa37833af8dacde6b7eecd69a5fc12 Mon Sep 17 00:00:00 2001 From: anthony taranto Date: Tue, 6 Mar 2012 15:26:02 -0800 Subject: [PATCH] Wpf.WebBrowser: capture/uncapture _after_ handling button up/down --- CefSharp.Wpf/WebView.cpp | 14 +++++--------- CefSharp.Wpf/WebView.h | 2 +- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/CefSharp.Wpf/WebView.cpp b/CefSharp.Wpf/WebView.cpp index 49f866403..f4bc74744 100644 --- a/CefSharp.Wpf/WebView.cpp +++ b/CefSharp.Wpf/WebView.cpp @@ -138,7 +138,7 @@ namespace Wpf } } - void WebView::OnMouse(MouseButtonEventArgs^ e) + void WebView::OnMouseButton(MouseButtonEventArgs^ e) { Point point = e->GetPosition(this); @@ -152,8 +152,8 @@ namespace Wpf bool mouseUp = e->ButtonState == MouseButtonState::Released; - _clientAdapter->GetCefBrowser()->SendMouseClickEvent((int)point.X, (int)point.Y, type, - mouseUp, e->ClickCount); + _clientAdapter->GetCefBrowser()->SendMouseClickEvent((int)point.X, (int)point.Y, + type, mouseUp, e->ClickCount); } Size WebView::ArrangeOverride(Size size) @@ -194,7 +194,6 @@ namespace Wpf void WebView::OnMouseMove(MouseEventArgs^ e) { Point point = e->GetPosition(this); - Console::WriteLine("OnMouseMove: {0}", point); _clientAdapter->GetCefBrowser()->SendMouseMoveEvent((int)point.X, (int)point.Y, false); } @@ -206,22 +205,19 @@ namespace Wpf void WebView::OnMouseDown(MouseButtonEventArgs^ e) { - Console::WriteLine("OnMouseDown"); Focus(); + OnMouseButton(e); Mouse::Capture(this); - OnMouse(e); } void WebView::OnMouseUp(MouseButtonEventArgs^ e) { - Console::WriteLine("OnMosueUp"); + OnMouseButton(e); Mouse::Capture(nullptr); - OnMouse(e); } void WebView::OnMouseLeave(MouseEventArgs^ e) { - Console::WriteLine("OnMouseLeave"); _clientAdapter->GetCefBrowser()->SendMouseMoveEvent(0, 0, true); } diff --git a/CefSharp.Wpf/WebView.h b/CefSharp.Wpf/WebView.h index d7d61fdac..296ab8ce9 100644 --- a/CefSharp.Wpf/WebView.h +++ b/CefSharp.Wpf/WebView.h @@ -51,7 +51,7 @@ namespace Wpf IntPtr SourceHook(IntPtr hWnd, int message, IntPtr wParam, IntPtr lParam, bool% handled); void SetBitmap(); void OnPreviewKey(KeyEventArgs^ e); - void OnMouse(MouseButtonEventArgs^ e); + void OnMouseButton(MouseButtonEventArgs^ e); protected: virtual Size ArrangeOverride(Size size) override;