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

Unified Diff: ui/views/win/hwnd_message_handler.cc

Issue 1283913002: Improve scroll performance on Windows 10 with high precision touchpads. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments Created 5 years, 4 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
« no previous file with comments | « ui/views/win/hwnd_message_handler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « ui/views/win/hwnd_message_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698