Fix bug when dragging to a window before mouse events have been detected (issue #262).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@256 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2011-06-14 15:45:00 +00:00
parent 02d6f3e384
commit 2a0299fc29
3 changed files with 13 additions and 3 deletions

View File

@ -59,6 +59,7 @@ DWORD WebDropTarget::OnDragEnter(IDataObject* data_object,
POINT cursor_position, POINT cursor_position,
DWORD effects) { DWORD effects) {
current_wvh_ = _Context->current_webviewhost(); current_wvh_ = _Context->current_webviewhost();
DCHECK(current_wvh_);
// TODO(tc): PopulateWebDropData can be slow depending on what is in the // TODO(tc): PopulateWebDropData can be slow depending on what is in the
// IDataObject. Maybe we can do this in a background thread. // IDataObject. Maybe we can do this in a background thread.

View File

@ -56,9 +56,7 @@ class WebViewHost : public WebWidgetHost {
WebViewHost(); WebViewHost();
#if defined(OS_WIN) #if defined(OS_WIN)
virtual bool WndProc(UINT message, WPARAM wparam, LPARAM lparam) { virtual bool WndProc(UINT message, WPARAM wparam, LPARAM lparam);
return false;
}
virtual void MouseEvent(UINT message, WPARAM wparam, LPARAM lparam); virtual void MouseEvent(UINT message, WPARAM wparam, LPARAM lparam);
#endif #endif

View File

@ -64,6 +64,17 @@ WebView* WebViewHost::webview() const {
return static_cast<WebView*>(webwidget_); return static_cast<WebView*>(webwidget_);
} }
bool WebViewHost::WndProc(UINT message, WPARAM wparam, LPARAM lparam) {
switch (message) {
case WM_SETFOCUS:
// Set the current WebViewHost in case a drag action is started before mouse
// events are detected for the window.
_Context->set_current_webviewhost(this);
break;
}
return false;
}
void WebViewHost::MouseEvent(UINT message, WPARAM wparam, LPARAM lparam) { void WebViewHost::MouseEvent(UINT message, WPARAM wparam, LPARAM lparam) {
_Context->set_current_webviewhost(this); _Context->set_current_webviewhost(this);
WebWidgetHost::MouseEvent(message, wparam, lparam); WebWidgetHost::MouseEvent(message, wparam, lparam);