Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(560)

Unified Diff: ui/views/widget/native_widget_win.cc

Issue 16950030: Handle alternate types in HandleMouseEvent. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add support for MouseWheelEvent Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« ui/base/events/event.h ('K') | « ui/base/events/event.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/native_widget_win.cc
diff --git a/ui/views/widget/native_widget_win.cc b/ui/views/widget/native_widget_win.cc
index 2123600168a169c4d30f013f019e2a742a678971..f46284f567dd29ef1d3d0f1e6bf28b96a3e59d8c 100644
--- a/ui/views/widget/native_widget_win.cc
+++ b/ui/views/widget/native_widget_win.cc
@@ -743,11 +743,32 @@ void NativeWidgetWin::HandleNativeBlur(HWND focused_window) {
}
bool NativeWidgetWin::HandleMouseEvent(const ui::MouseEvent& event) {
- ui::MouseEvent dpi_event(event);
- dpi_event.set_location(ui::win::ScreenToDIPPoint(event.location()));
- dpi_event.set_root_location(ui::win::ScreenToDIPPoint(event.location()));
- delegate_->OnMouseEvent(&dpi_event);
- return dpi_event.handled();
+ if (event.IsMouseWheelEvent()) {
+ ui::MouseWheelEvent dpi_event(event,
+ static_cast<const ui::MouseWheelEvent&>(event).x_offset() /
+ ui::win::GetDeviceScaleFactor(),
+ static_cast<const ui::MouseWheelEvent&>(event).y_offset() /
+ ui::win::GetDeviceScaleFactor());
sadrul 2013/06/24 02:09:35 Most of the ui::Events are copyable. Looks like Mo
girard 2013/06/24 20:37:07 If we do this, we'd still need the static_cast in
+ dpi_event.set_location(ui::win::ScreenToDIPPoint(event.location()));
+ dpi_event.set_root_location(ui::win::ScreenToDIPPoint(event.location()));
+ delegate_->OnMouseEvent(&dpi_event);
+ return dpi_event.handled();
+ } else if (event.IsScrollEvent()) {
sadrul 2013/06/24 02:09:35 scroll events (i.e. ET_SCROLL*) are never generate
girard 2013/06/24 20:37:07 Thanks - cleaned this up. (I was trying to be more
+ ui::ScrollEvent dpi_event(static_cast<const ui::ScrollEvent&>(event));
+ dpi_event.Scale(1/ui::win::GetDeviceScaleFactor());
+ dpi_event.set_location(ui::win::ScreenToDIPPoint(event.location()));
+ dpi_event.set_root_location(ui::win::ScreenToDIPPoint(event.location()));
+ delegate_->OnMouseEvent(&dpi_event);
+ return dpi_event.handled();
+ } else if (event.IsMouseEvent()) {
+ ui::MouseEvent dpi_event(event);
+ dpi_event.set_location(ui::win::ScreenToDIPPoint(event.location()));
+ dpi_event.set_root_location(ui::win::ScreenToDIPPoint(event.location()));
+ delegate_->OnMouseEvent(&dpi_event);
+ return dpi_event.handled();
+ }
+ NOTREACHED();
+ return false;
}
bool NativeWidgetWin::HandleKeyEvent(const ui::KeyEvent& event) {
« ui/base/events/event.h ('K') | « ui/base/events/event.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698