Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "win8/metro_driver/stdafx.h" | 5 #include "win8/metro_driver/stdafx.h" |
| 6 #include "win8/metro_driver/chrome_app_view_ash.h" | 6 #include "win8/metro_driver/chrome_app_view_ash.h" |
| 7 | 7 |
| 8 #include <corewindow.h> | 8 #include <corewindow.h> |
| 9 #include <shellapi.h> | 9 #include <shellapi.h> |
| 10 #include <windows.foundation.h> | 10 #include <windows.foundation.h> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
| 15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
| 16 #include "base/path_service.h" | 16 #include "base/path_service.h" |
| 17 #include "base/threading/thread.h" | 17 #include "base/threading/thread.h" |
| 18 #include "base/win/metro.h" | 18 #include "base/win/metro.h" |
| 19 #include "base/win/win_util.h" | 19 #include "base/win/win_util.h" |
| 20 #include "base/win/windows_version.h" | 20 #include "base/win/windows_version.h" |
| 21 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
| 22 #include "ipc/ipc_channel.h" | 22 #include "ipc/ipc_channel.h" |
| 23 #include "ipc/ipc_channel_proxy.h" | 23 #include "ipc/ipc_channel_proxy.h" |
| 24 #include "ipc/ipc_sender.h" | 24 #include "ipc/ipc_sender.h" |
| 25 #include "ui/events/gestures/gesture_sequence.h" | 25 #include "ui/events/gestures/gesture_sequence.h" |
| 26 #include "ui/gfx/geometry/point_conversions.h" | |
| 27 #include "ui/gfx/win/dpi.h" | |
| 26 #include "ui/metro_viewer/metro_viewer_messages.h" | 28 #include "ui/metro_viewer/metro_viewer_messages.h" |
| 27 #include "win8/metro_driver/file_picker_ash.h" | 29 #include "win8/metro_driver/file_picker_ash.h" |
| 28 #include "win8/metro_driver/ime/ime_popup_monitor.h" | 30 #include "win8/metro_driver/ime/ime_popup_monitor.h" |
| 29 #include "win8/metro_driver/ime/input_source.h" | 31 #include "win8/metro_driver/ime/input_source.h" |
| 30 #include "win8/metro_driver/ime/text_service.h" | 32 #include "win8/metro_driver/ime/text_service.h" |
| 31 #include "win8/metro_driver/metro_driver.h" | 33 #include "win8/metro_driver/metro_driver.h" |
| 32 #include "win8/metro_driver/winrt_utils.h" | 34 #include "win8/metro_driver/winrt_utils.h" |
| 33 #include "win8/viewer/metro_viewer_constants.h" | 35 #include "win8/viewer/metro_viewer_constants.h" |
| 34 | 36 |
| 35 typedef winfoundtn::ITypedEventHandler< | 37 typedef winfoundtn::ITypedEventHandler< |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 355 sei.lpParameters = parameters.c_str(); | 357 sei.lpParameters = parameters.c_str(); |
| 356 ::ShellExecuteEx(&sei); | 358 ::ShellExecuteEx(&sei); |
| 357 return true; | 359 return true; |
| 358 } | 360 } |
| 359 | 361 |
| 360 } // namespace | 362 } // namespace |
| 361 | 363 |
| 362 // This class helps decoding the pointer properties of an event. | 364 // This class helps decoding the pointer properties of an event. |
| 363 class ChromeAppViewAsh::PointerInfoHandler { | 365 class ChromeAppViewAsh::PointerInfoHandler { |
| 364 public: | 366 public: |
| 365 PointerInfoHandler() | 367 PointerInfoHandler(float metro_dpi_scale, float win32_dpi_scale) |
| 366 : x_(0), | 368 : x_(0), |
| 367 y_(0), | 369 y_(0), |
| 368 wheel_delta_(0), | 370 wheel_delta_(0), |
| 369 update_kind_(winui::Input::PointerUpdateKind_Other), | 371 update_kind_(winui::Input::PointerUpdateKind_Other), |
| 370 timestamp_(0), | 372 timestamp_(0), |
| 371 pointer_id_(0), | 373 pointer_id_(0), |
| 372 mouse_down_flags_(0), | 374 mouse_down_flags_(0), |
| 373 is_horizontal_wheel_(0) {} | 375 is_horizontal_wheel_(0), |
| 376 metro_dpi_scale_(metro_dpi_scale), | |
| 377 win32_dpi_scale_(win32_dpi_scale) {} | |
| 374 | 378 |
| 375 HRESULT Init(winui::Core::IPointerEventArgs* args) { | 379 HRESULT Init(winui::Core::IPointerEventArgs* args) { |
| 376 HRESULT hr = args->get_CurrentPoint(&pointer_point_); | 380 HRESULT hr = args->get_CurrentPoint(&pointer_point_); |
| 377 if (FAILED(hr)) | 381 if (FAILED(hr)) |
| 378 return hr; | 382 return hr; |
| 379 | 383 |
| 380 winfoundtn::Point point; | 384 winfoundtn::Point point; |
| 381 hr = pointer_point_->get_Position(&point); | 385 hr = pointer_point_->get_Position(&point); |
| 382 if (FAILED(hr)) | 386 if (FAILED(hr)) |
| 383 return hr; | 387 return hr; |
| 384 | 388 |
| 385 mswr::ComPtr<winui::Input::IPointerPointProperties> properties; | 389 mswr::ComPtr<winui::Input::IPointerPointProperties> properties; |
| 386 hr = pointer_point_->get_Properties(&properties); | 390 hr = pointer_point_->get_Properties(&properties); |
| 387 if (FAILED(hr)) | 391 if (FAILED(hr)) |
| 388 return hr; | 392 return hr; |
| 389 | 393 |
| 390 hr = properties->get_PointerUpdateKind(&update_kind_); | 394 hr = properties->get_PointerUpdateKind(&update_kind_); |
| 391 if (FAILED(hr)) | 395 if (FAILED(hr)) |
| 392 return hr; | 396 return hr; |
| 393 | 397 |
| 394 hr = properties->get_MouseWheelDelta(&wheel_delta_); | 398 hr = properties->get_MouseWheelDelta(&wheel_delta_); |
| 395 if (FAILED(hr)) | 399 if (FAILED(hr)) |
| 396 return hr; | 400 return hr; |
| 397 | 401 |
| 398 is_horizontal_wheel_ = 0; | 402 is_horizontal_wheel_ = 0; |
| 399 properties->get_IsHorizontalMouseWheel(&is_horizontal_wheel_); | 403 properties->get_IsHorizontalMouseWheel(&is_horizontal_wheel_); |
| 400 | 404 |
| 401 x_ = point.X; | 405 // The input coordinates are in DIP based on the metro scale factor. |
| 402 y_ = point.Y; | 406 // We want to convert it to DIP based on the win32 scale factor. |
| 403 | 407 // We scale the point by the metro scale factor and then scale down |
| 408 // via the win32 scale factor which achieves the needful. | |
|
cpu_(ooo_6.6-7.5)
2014/05/27 21:56:27
keep up to "scale factor."
ananta
2014/05/27 22:46:16
Please elaborate. Did you indicate changing "We sc
| |
| 409 gfx::Point dip_point_metro(point.X, point.Y); | |
| 410 gfx::Point scaled_point_metro = | |
| 411 gfx::ToCeiledPoint(gfx::ScalePoint(dip_point_metro, metro_dpi_scale_)); | |
| 412 gfx::Point dip_point_win32 = | |
| 413 gfx::ToCeiledPoint(gfx::ScalePoint(scaled_point_metro, | |
| 414 1.0 / win32_dpi_scale_)); | |
| 415 x_ = dip_point_win32.x(); | |
| 416 y_ = dip_point_win32.y(); | |
| 417 | |
| 404 pointer_point_->get_Timestamp(×tamp_); | 418 pointer_point_->get_Timestamp(×tamp_); |
| 405 pointer_point_->get_PointerId(&pointer_id_); | 419 pointer_point_->get_PointerId(&pointer_id_); |
| 406 // Map the OS touch event id to a range allowed by the gesture recognizer. | 420 // Map the OS touch event id to a range allowed by the gesture recognizer. |
| 407 if (IsTouch()) | 421 if (IsTouch()) |
| 408 pointer_id_ %= ui::GestureSequence::kMaxGesturePoints; | 422 pointer_id_ %= ui::GestureSequence::kMaxGesturePoints; |
| 409 | 423 |
| 410 boolean left_button_state; | 424 boolean left_button_state; |
| 411 hr = properties->get_IsLeftButtonPressed(&left_button_state); | 425 hr = properties->get_IsLeftButtonPressed(&left_button_state); |
| 412 if (FAILED(hr)) | 426 if (FAILED(hr)) |
| 413 return hr; | 427 return hr; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 495 mswr::ComPtr<winui::Input::IPointerPoint> pointer_point_; | 509 mswr::ComPtr<winui::Input::IPointerPoint> pointer_point_; |
| 496 uint64 timestamp_; | 510 uint64 timestamp_; |
| 497 | 511 |
| 498 // Bitmask of ui::EventFlags corresponding to the buttons that are currently | 512 // Bitmask of ui::EventFlags corresponding to the buttons that are currently |
| 499 // down. | 513 // down. |
| 500 uint32 mouse_down_flags_; | 514 uint32 mouse_down_flags_; |
| 501 | 515 |
| 502 // Set to true for a horizontal wheel message. | 516 // Set to true for a horizontal wheel message. |
| 503 boolean is_horizontal_wheel_; | 517 boolean is_horizontal_wheel_; |
| 504 | 518 |
| 519 // The metro device scale factor as reported by the winrt interfaces. | |
| 520 float metro_dpi_scale_; | |
| 521 // The win32 dpi scale which is queried via GetDeviceCaps. Please refer to | |
| 522 // ui/gfx/win/dpi.cc for more information. | |
| 523 float win32_dpi_scale_; | |
| 524 | |
| 505 DISALLOW_COPY_AND_ASSIGN(PointerInfoHandler); | 525 DISALLOW_COPY_AND_ASSIGN(PointerInfoHandler); |
| 506 }; | 526 }; |
| 507 | 527 |
| 508 ChromeAppViewAsh::ChromeAppViewAsh() | 528 ChromeAppViewAsh::ChromeAppViewAsh() |
| 509 : mouse_down_flags_(ui::EF_NONE), | 529 : mouse_down_flags_(ui::EF_NONE), |
| 510 ui_channel_(nullptr), | 530 ui_channel_(nullptr), |
| 511 core_window_hwnd_(NULL), | 531 core_window_hwnd_(NULL), |
| 512 scale_(0) { | 532 metro_dpi_scale_(0), |
| 533 win32_dpi_scale_(0) { | |
| 513 DVLOG(1) << __FUNCTION__; | 534 DVLOG(1) << __FUNCTION__; |
| 514 globals.previous_state = | 535 globals.previous_state = |
| 515 winapp::Activation::ApplicationExecutionState_NotRunning; | 536 winapp::Activation::ApplicationExecutionState_NotRunning; |
| 516 } | 537 } |
| 517 | 538 |
| 518 ChromeAppViewAsh::~ChromeAppViewAsh() { | 539 ChromeAppViewAsh::~ChromeAppViewAsh() { |
| 519 DVLOG(1) << __FUNCTION__; | 540 DVLOG(1) << __FUNCTION__; |
| 520 } | 541 } |
| 521 | 542 |
| 522 IFACEMETHODIMP | 543 IFACEMETHODIMP |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 622 this, &ChromeAppViewAsh::OnEdgeGestureCompleted).Get(), | 643 this, &ChromeAppViewAsh::OnEdgeGestureCompleted).Get(), |
| 623 &edgeevent_token_); | 644 &edgeevent_token_); |
| 624 CheckHR(hr); | 645 CheckHR(hr); |
| 625 } | 646 } |
| 626 | 647 |
| 627 // By initializing the direct 3D swap chain with the corewindow | 648 // By initializing the direct 3D swap chain with the corewindow |
| 628 // we can now directly blit to it from the browser process. | 649 // we can now directly blit to it from the browser process. |
| 629 direct3d_helper_.Initialize(window); | 650 direct3d_helper_.Initialize(window); |
| 630 DVLOG(1) << "Initialized Direct3D."; | 651 DVLOG(1) << "Initialized Direct3D."; |
| 631 | 652 |
| 632 scale_ = GetModernUIScale(); | 653 // On Windows 8+ the WinRT interface IDisplayProperties which we use to get |
| 633 DVLOG(1) << "Scale is " << scale_; | 654 // device scale factor does not return the correct values in metro mode. |
| 655 // To workaround this we retrieve the device scale factor via the win32 way | |
| 656 // and scale input coordinates accordingly to pass them in DIP to chrome. | |
| 657 // TODO(ananta). Investigate and fix. | |
| 658 metro_dpi_scale_ = GetModernUIScale(); | |
| 659 win32_dpi_scale_ = gfx::GetDPIScale(); | |
| 660 DVLOG(1) << "Metro Scale is " << metro_dpi_scale_; | |
| 661 DVLOG(1) << "Win32 Scale is " << win32_dpi_scale_; | |
| 634 return S_OK; | 662 return S_OK; |
| 635 } | 663 } |
| 636 | 664 |
| 637 IFACEMETHODIMP | 665 IFACEMETHODIMP |
| 638 ChromeAppViewAsh::Load(HSTRING entryPoint) { | 666 ChromeAppViewAsh::Load(HSTRING entryPoint) { |
| 639 // On Win7 |entryPoint| is NULL. | 667 // On Win7 |entryPoint| is NULL. |
| 640 DVLOG(1) << __FUNCTION__; | 668 DVLOG(1) << __FUNCTION__; |
| 641 return S_OK; | 669 return S_OK; |
| 642 } | 670 } |
| 643 | 671 |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 668 ChromeChannelListener ui_channel_listener(&ui_loop_, this); | 696 ChromeChannelListener ui_channel_listener(&ui_loop_, this); |
| 669 IPC::ChannelProxy ui_channel(win8::kMetroViewerIPCChannelName, | 697 IPC::ChannelProxy ui_channel(win8::kMetroViewerIPCChannelName, |
| 670 IPC::Channel::MODE_NAMED_CLIENT, | 698 IPC::Channel::MODE_NAMED_CLIENT, |
| 671 &ui_channel_listener, | 699 &ui_channel_listener, |
| 672 io_thread.message_loop_proxy()); | 700 io_thread.message_loop_proxy()); |
| 673 ui_channel_ = &ui_channel; | 701 ui_channel_ = &ui_channel; |
| 674 | 702 |
| 675 // Upon receipt of the MetroViewerHostMsg_SetTargetSurface message the | 703 // Upon receipt of the MetroViewerHostMsg_SetTargetSurface message the |
| 676 // browser will use D3D from the browser process to present to our Window. | 704 // browser will use D3D from the browser process to present to our Window. |
| 677 ui_channel_->Send(new MetroViewerHostMsg_SetTargetSurface( | 705 ui_channel_->Send(new MetroViewerHostMsg_SetTargetSurface( |
| 678 gfx::NativeViewId(core_window_hwnd_), scale_)); | 706 gfx::NativeViewId(core_window_hwnd_), win32_dpi_scale_)); |
| 679 DVLOG(1) << "ICoreWindow sent " << core_window_hwnd_; | 707 DVLOG(1) << "ICoreWindow sent " << core_window_hwnd_; |
| 680 | 708 |
| 681 // Send an initial size message so that the Ash root window host gets sized | 709 // Send an initial size message so that the Ash root window host gets sized |
| 682 // correctly. | 710 // correctly. |
| 683 RECT rect = {0}; | 711 RECT rect = {0}; |
| 684 ::GetWindowRect(core_window_hwnd_, &rect); | 712 ::GetWindowRect(core_window_hwnd_, &rect); |
| 685 ui_channel_->Send( | 713 ui_channel_->Send( |
| 686 new MetroViewerHostMsg_WindowSizeChanged(rect.right - rect.left, | 714 new MetroViewerHostMsg_WindowSizeChanged(rect.right - rect.left, |
| 687 rect.bottom - rect.top)); | 715 rect.bottom - rect.top)); |
| 688 | 716 |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1040 // in turn launches the chrome browser process in desktop mode via | 1068 // in turn launches the chrome browser process in desktop mode via |
| 1041 // ShellExecute. If we call ICoreWindow::Activate before this, then | 1069 // ShellExecute. If we call ICoreWindow::Activate before this, then |
| 1042 // Windows kills the metro chrome process when it calls ShellExecute. Seems | 1070 // Windows kills the metro chrome process when it calls ShellExecute. Seems |
| 1043 // to be a bug. | 1071 // to be a bug. |
| 1044 window_->Activate(); | 1072 window_->Activate(); |
| 1045 return S_OK; | 1073 return S_OK; |
| 1046 } | 1074 } |
| 1047 | 1075 |
| 1048 HRESULT ChromeAppViewAsh::OnPointerMoved(winui::Core::ICoreWindow* sender, | 1076 HRESULT ChromeAppViewAsh::OnPointerMoved(winui::Core::ICoreWindow* sender, |
| 1049 winui::Core::IPointerEventArgs* args) { | 1077 winui::Core::IPointerEventArgs* args) { |
| 1050 PointerInfoHandler pointer; | 1078 PointerInfoHandler pointer(metro_dpi_scale_, win32_dpi_scale_); |
| 1051 HRESULT hr = pointer.Init(args); | 1079 HRESULT hr = pointer.Init(args); |
| 1052 if (FAILED(hr)) | 1080 if (FAILED(hr)) |
| 1053 return hr; | 1081 return hr; |
| 1054 | 1082 |
| 1055 if (pointer.IsMouse()) { | 1083 if (pointer.IsMouse()) { |
| 1056 GenerateMouseEventFromMoveIfNecessary(pointer); | 1084 GenerateMouseEventFromMoveIfNecessary(pointer); |
| 1057 ui_channel_->Send(new MetroViewerHostMsg_MouseMoved( | 1085 ui_channel_->Send(new MetroViewerHostMsg_MouseMoved( |
| 1058 pointer.x(), | 1086 pointer.x(), |
| 1059 pointer.y(), | 1087 pointer.y(), |
| 1060 mouse_down_flags_ | GetKeyboardEventFlags())); | 1088 mouse_down_flags_ | GetKeyboardEventFlags())); |
| 1061 } else { | 1089 } else { |
| 1062 DCHECK(pointer.IsTouch()); | 1090 DCHECK(pointer.IsTouch()); |
| 1063 ui_channel_->Send(new MetroViewerHostMsg_TouchMoved(pointer.x(), | 1091 ui_channel_->Send(new MetroViewerHostMsg_TouchMoved(pointer.x(), |
| 1064 pointer.y(), | 1092 pointer.y(), |
| 1065 pointer.timestamp(), | 1093 pointer.timestamp(), |
| 1066 pointer.pointer_id())); | 1094 pointer.pointer_id())); |
| 1067 } | 1095 } |
| 1068 return S_OK; | 1096 return S_OK; |
| 1069 } | 1097 } |
| 1070 | 1098 |
| 1071 // NOTE: From experimentation, it seems like Metro only sends a PointerPressed | 1099 // NOTE: From experimentation, it seems like Metro only sends a PointerPressed |
| 1072 // event for the first button pressed and the last button released in a sequence | 1100 // event for the first button pressed and the last button released in a sequence |
| 1073 // of mouse events. | 1101 // of mouse events. |
| 1074 // For example, a sequence of LEFT_DOWN, RIGHT_DOWN, LEFT_UP, RIGHT_UP results | 1102 // For example, a sequence of LEFT_DOWN, RIGHT_DOWN, LEFT_UP, RIGHT_UP results |
| 1075 // only in PointerPressed(LEFT)/PointerReleased(RIGHT) events. Intermediary | 1103 // only in PointerPressed(LEFT)/PointerReleased(RIGHT) events. Intermediary |
| 1076 // presses and releases are tracked in OnPointMoved(). | 1104 // presses and releases are tracked in OnPointMoved(). |
| 1077 HRESULT ChromeAppViewAsh::OnPointerPressed( | 1105 HRESULT ChromeAppViewAsh::OnPointerPressed( |
| 1078 winui::Core::ICoreWindow* sender, | 1106 winui::Core::ICoreWindow* sender, |
| 1079 winui::Core::IPointerEventArgs* args) { | 1107 winui::Core::IPointerEventArgs* args) { |
| 1080 PointerInfoHandler pointer; | 1108 PointerInfoHandler pointer(metro_dpi_scale_, win32_dpi_scale_); |
| 1081 HRESULT hr = pointer.Init(args); | 1109 HRESULT hr = pointer.Init(args); |
| 1082 if (FAILED(hr)) | 1110 if (FAILED(hr)) |
| 1083 return hr; | 1111 return hr; |
| 1084 | 1112 |
| 1085 if (pointer.IsMouse()) { | 1113 if (pointer.IsMouse()) { |
| 1086 mouse_down_flags_ = pointer.mouse_down_flags(); | 1114 mouse_down_flags_ = pointer.mouse_down_flags(); |
| 1087 SendMouseButton(pointer.x(), pointer.y(), 0, ui::ET_MOUSE_PRESSED, | 1115 SendMouseButton(pointer.x(), pointer.y(), 0, ui::ET_MOUSE_PRESSED, |
| 1088 mouse_down_flags_ | GetKeyboardEventFlags(), | 1116 mouse_down_flags_ | GetKeyboardEventFlags(), |
| 1089 pointer.changed_button(), pointer.is_horizontal_wheel()); | 1117 pointer.changed_button(), pointer.is_horizontal_wheel()); |
| 1090 } else { | 1118 } else { |
| 1091 DCHECK(pointer.IsTouch()); | 1119 DCHECK(pointer.IsTouch()); |
| 1092 ui_channel_->Send(new MetroViewerHostMsg_TouchDown(pointer.x(), | 1120 ui_channel_->Send(new MetroViewerHostMsg_TouchDown(pointer.x(), |
| 1093 pointer.y(), | 1121 pointer.y(), |
| 1094 pointer.timestamp(), | 1122 pointer.timestamp(), |
| 1095 pointer.pointer_id())); | 1123 pointer.pointer_id())); |
| 1096 } | 1124 } |
| 1097 return S_OK; | 1125 return S_OK; |
| 1098 } | 1126 } |
| 1099 | 1127 |
| 1100 HRESULT ChromeAppViewAsh::OnPointerReleased( | 1128 HRESULT ChromeAppViewAsh::OnPointerReleased( |
| 1101 winui::Core::ICoreWindow* sender, | 1129 winui::Core::ICoreWindow* sender, |
| 1102 winui::Core::IPointerEventArgs* args) { | 1130 winui::Core::IPointerEventArgs* args) { |
| 1103 PointerInfoHandler pointer; | 1131 PointerInfoHandler pointer(metro_dpi_scale_, win32_dpi_scale_); |
| 1104 HRESULT hr = pointer.Init(args); | 1132 HRESULT hr = pointer.Init(args); |
| 1105 if (FAILED(hr)) | 1133 if (FAILED(hr)) |
| 1106 return hr; | 1134 return hr; |
| 1107 | 1135 |
| 1108 if (pointer.IsMouse()) { | 1136 if (pointer.IsMouse()) { |
| 1109 mouse_down_flags_ = ui::EF_NONE; | 1137 mouse_down_flags_ = ui::EF_NONE; |
| 1110 SendMouseButton(pointer.x(), pointer.y(), 0, ui::ET_MOUSE_RELEASED, | 1138 SendMouseButton(pointer.x(), pointer.y(), 0, ui::ET_MOUSE_RELEASED, |
| 1111 static_cast<uint32>(pointer.changed_button()) | | 1139 static_cast<uint32>(pointer.changed_button()) | |
| 1112 GetKeyboardEventFlags(), | 1140 GetKeyboardEventFlags(), |
| 1113 pointer.changed_button(), | 1141 pointer.changed_button(), |
| 1114 pointer.is_horizontal_wheel()); | 1142 pointer.is_horizontal_wheel()); |
| 1115 } else { | 1143 } else { |
| 1116 DCHECK(pointer.IsTouch()); | 1144 DCHECK(pointer.IsTouch()); |
| 1117 ui_channel_->Send(new MetroViewerHostMsg_TouchUp(pointer.x(), | 1145 ui_channel_->Send(new MetroViewerHostMsg_TouchUp(pointer.x(), |
| 1118 pointer.y(), | 1146 pointer.y(), |
| 1119 pointer.timestamp(), | 1147 pointer.timestamp(), |
| 1120 pointer.pointer_id())); | 1148 pointer.pointer_id())); |
| 1121 } | 1149 } |
| 1122 return S_OK; | 1150 return S_OK; |
| 1123 } | 1151 } |
| 1124 | 1152 |
| 1125 HRESULT ChromeAppViewAsh::OnWheel( | 1153 HRESULT ChromeAppViewAsh::OnWheel( |
| 1126 winui::Core::ICoreWindow* sender, | 1154 winui::Core::ICoreWindow* sender, |
| 1127 winui::Core::IPointerEventArgs* args) { | 1155 winui::Core::IPointerEventArgs* args) { |
| 1128 PointerInfoHandler pointer; | 1156 PointerInfoHandler pointer(metro_dpi_scale_, win32_dpi_scale_); |
| 1129 HRESULT hr = pointer.Init(args); | 1157 HRESULT hr = pointer.Init(args); |
| 1130 if (FAILED(hr)) | 1158 if (FAILED(hr)) |
| 1131 return hr; | 1159 return hr; |
| 1132 DCHECK(pointer.IsMouse()); | 1160 DCHECK(pointer.IsMouse()); |
| 1133 SendMouseButton(pointer.x(), pointer.y(), pointer.wheel_delta(), | 1161 SendMouseButton(pointer.x(), pointer.y(), pointer.wheel_delta(), |
| 1134 ui::ET_MOUSEWHEEL, ui::EF_NONE, ui::EF_NONE, | 1162 ui::ET_MOUSEWHEEL, ui::EF_NONE, ui::EF_NONE, |
| 1135 pointer.is_horizontal_wheel()); | 1163 pointer.is_horizontal_wheel()); |
| 1136 return S_OK; | 1164 return S_OK; |
| 1137 } | 1165 } |
| 1138 | 1166 |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1361 mswr::ComPtr<winapp::Core::ICoreApplicationExit> app_exit; | 1389 mswr::ComPtr<winapp::Core::ICoreApplicationExit> app_exit; |
| 1362 CheckHR(core_app.As(&app_exit)); | 1390 CheckHR(core_app.As(&app_exit)); |
| 1363 globals.app_exit = app_exit.Detach(); | 1391 globals.app_exit = app_exit.Detach(); |
| 1364 } | 1392 } |
| 1365 | 1393 |
| 1366 IFACEMETHODIMP | 1394 IFACEMETHODIMP |
| 1367 ChromeAppViewFactory::CreateView(winapp::Core::IFrameworkView** view) { | 1395 ChromeAppViewFactory::CreateView(winapp::Core::IFrameworkView** view) { |
| 1368 *view = mswr::Make<ChromeAppViewAsh>().Detach(); | 1396 *view = mswr::Make<ChromeAppViewAsh>().Detach(); |
| 1369 return (*view) ? S_OK : E_OUTOFMEMORY; | 1397 return (*view) ? S_OK : E_OUTOFMEMORY; |
| 1370 } | 1398 } |
| OLD | NEW |