Index: ui/views/win/hwnd_message_handler.cc |
diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc |
index 5cadce12e659ca63c5f77da150f69f00405552f3..3c00691ccb21dc95d924650233e2fbae8995cda3 100644 |
--- a/ui/views/win/hwnd_message_handler.cc |
+++ b/ui/views/win/hwnd_message_handler.cc |
@@ -372,6 +372,13 @@ void HWNDMessageHandler::Init(HWND parent, const gfx::Rect& bounds) { |
prop_window_target_.reset(new ui::ViewProp(hwnd(), |
ui::WindowEventTarget::kWin32InputEventTarget, |
static_cast<ui::WindowEventTarget*>(this))); |
+ |
+ // Direct Manipulation is enabled on Windows 10+. The CreateInstance function |
+ // returns NULL if Direct Manipulation is not available. |
+ direct_manipulation_helper_.reset( |
+ gfx::win::DirectManipulationHelper::CreateInstance()); |
+ if (direct_manipulation_helper_) |
+ direct_manipulation_helper_->Initialize(hwnd()); |
} |
void HWNDMessageHandler::InitModalType(ui::ModalType modal_type) { |
@@ -513,6 +520,9 @@ void HWNDMessageHandler::SetBounds(const gfx::Rect& bounds_in_pixels, |
delegate_->HandleClientSizeChanged(GetClientAreaBounds().size()); |
ResetWindowRegion(false, true); |
} |
+ |
+ if (direct_manipulation_helper_) |
+ direct_manipulation_helper_->SetBounds(bounds_in_pixels); |
} |
void HWNDMessageHandler::SetSize(const gfx::Size& size) { |
@@ -554,6 +564,8 @@ void HWNDMessageHandler::Show() { |
ShowWindowWithState(ui::SHOW_STATE_INACTIVE); |
} |
} |
+ if (direct_manipulation_helper_) |
+ direct_manipulation_helper_->Activate(hwnd()); |
} |
void HWNDMessageHandler::ShowWindowWithState(ui::WindowShowState show_state) { |
@@ -2671,6 +2683,13 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, |
if (!ref.get()) |
return 0; |
+ |
+ if (direct_manipulation_helper_ && |
+ (message == WM_MOUSEWHEEL || message == WM_MOUSEHWHEEL)) { |
+ direct_manipulation_helper_->HandleMouseWheel(hwnd(), message, w_param, |
+ l_param); |
+ } |
+ |
if (!handled && message == WM_NCLBUTTONDOWN && w_param != HTSYSMENU && |
delegate_->IsUsingCustomFrame()) { |
// TODO(vadimt): Remove ScopedTracker below once crbug.com/440919 is fixed. |