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

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: Fixed comment 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
« ui/views/win/hwnd_message_handler.h ('K') | « 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..ab7268013cc2509a555e3662762eeb235300c50d 100644
--- a/ui/views/win/hwnd_message_handler.cc
+++ b/ui/views/win/hwnd_message_handler.cc
@@ -32,6 +32,7 @@
#include "ui/gfx/path.h"
#include "ui/gfx/path_win.h"
#include "ui/gfx/screen.h"
+#include "ui/gfx/win/direct_manipulation.h"
#include "ui/gfx/win/dpi.h"
#include "ui/gfx/win/hwnd_util.h"
#include "ui/native_theme/native_theme_win.h"
@@ -372,6 +373,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_ =
+ gfx::win::DirectManipulationHelper::CreateInstance();
+ if (direct_manipulation_helper_)
+ direct_manipulation_helper_->Initialize(hwnd());
}
void HWNDMessageHandler::InitModalType(ui::ModalType modal_type) {
@@ -513,6 +521,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 +565,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 +2684,13 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message,
if (!ref.get())
return 0;
+
+ if (direct_manipulation_helper_ && track_mouse &&
+ (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.
« ui/views/win/hwnd_message_handler.h ('K') | « 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