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

Side by Side 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: Move virtual override to end of class/public. Created 7 years, 5 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 unified diff | Download patch
« no previous file with comments | « ui/base/events/event.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/widget/native_widget_win.h" 5 #include "ui/views/widget/native_widget_win.h"
6 6
7 #include <dwmapi.h> 7 #include <dwmapi.h>
8 #include <shellapi.h> 8 #include <shellapi.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 } 736 }
737 737
738 void NativeWidgetWin::HandleNativeBlur(HWND focused_window) { 738 void NativeWidgetWin::HandleNativeBlur(HWND focused_window) {
739 delegate_->OnNativeBlur(focused_window); 739 delegate_->OnNativeBlur(focused_window);
740 InputMethod* input_method = GetInputMethod(); 740 InputMethod* input_method = GetInputMethod();
741 if (input_method) 741 if (input_method)
742 input_method->OnBlur(); 742 input_method->OnBlur();
743 } 743 }
744 744
745 bool NativeWidgetWin::HandleMouseEvent(const ui::MouseEvent& event) { 745 bool NativeWidgetWin::HandleMouseEvent(const ui::MouseEvent& event) {
746 ui::MouseEvent dpi_event(event); 746 static gfx::Transform scale_transform(
747 dpi_event.set_location(ui::win::ScreenToDIPPoint(event.location())); 747 1/ui::win::GetDeviceScaleFactor(), 0.0,
748 dpi_event.set_root_location(ui::win::ScreenToDIPPoint(event.location())); 748 0.0, 1/ui::win::GetDeviceScaleFactor(),
749 delegate_->OnMouseEvent(&dpi_event); 749 0.0, 0.0);
750 return dpi_event.handled(); 750 if (event.IsMouseWheelEvent()) {
751 ui::MouseWheelEvent dpi_event(
752 static_cast<const ui::MouseWheelEvent&>(event));
753 dpi_event.UpdateForRootTransform(scale_transform);
754 delegate_->OnMouseEvent(&dpi_event);
755 return dpi_event.handled();
756 } else if (event.IsMouseEvent()) {
757 CHECK(!event.IsScrollEvent()); // Scroll events don't happen in Windows.
758 ui::MouseEvent dpi_event(event);
759 dpi_event.UpdateForRootTransform(scale_transform);
760 delegate_->OnMouseEvent(&dpi_event);
761 return dpi_event.handled();
762 }
763 NOTREACHED();
764 return false;
751 } 765 }
752 766
753 bool NativeWidgetWin::HandleKeyEvent(const ui::KeyEvent& event) { 767 bool NativeWidgetWin::HandleKeyEvent(const ui::KeyEvent& event) {
754 delegate_->OnKeyEvent(const_cast<ui::KeyEvent*>(&event)); 768 delegate_->OnKeyEvent(const_cast<ui::KeyEvent*>(&event));
755 return event.handled(); 769 return event.handled();
756 } 770 }
757 771
758 bool NativeWidgetWin::HandleUntranslatedKeyEvent(const ui::KeyEvent& event) { 772 bool NativeWidgetWin::HandleUntranslatedKeyEvent(const ui::KeyEvent& event) {
759 InputMethod* input_method = GetInputMethod(); 773 InputMethod* input_method = GetInputMethod();
760 if (input_method) 774 if (input_method)
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 // static 1027 // static
1014 bool NativeWidgetPrivate::IsTouchDown() { 1028 bool NativeWidgetPrivate::IsTouchDown() {
1015 // This currently isn't necessary because we're not generating touch events on 1029 // This currently isn't necessary because we're not generating touch events on
1016 // windows. When we do, this will need to be updated. 1030 // windows. When we do, this will need to be updated.
1017 return false; 1031 return false;
1018 } 1032 }
1019 1033
1020 } // namespace internal 1034 } // namespace internal
1021 1035
1022 } // namespace views 1036 } // namespace views
OLDNEW
« no previous file with comments | « ui/base/events/event.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698