|
@@ -1,11 +1,38 @@
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
From: deepak1556 <[email protected]>
|
|
|
Date: Fri, 29 Jul 2022 00:29:35 +0900
|
|
|
-Subject: chore: allow chromium to handle synthetic mouse events for touch
|
|
|
+Subject: chore: modify chromium handling of mouse events
|
|
|
|
|
|
-With WCO, allow chromium to handle synthetic mouse events generated for touch
|
|
|
+This patch does the following:
|
|
|
+
|
|
|
+1. When Windows Control Overlay is enabled, it allows chromium to handle synthetic mouse events generated for touch
|
|
|
actions in the non-client caption area.
|
|
|
+2. It calls HandleMouseEvent on the delegate earlier in HandleMouseEventInternal, so that Electron can selectively disable
|
|
|
+draggable regions to allow events to propagate to the underlying renderer.
|
|
|
|
|
|
+diff --git a/ui/events/event.h b/ui/events/event.h
|
|
|
+index 39b5a8fdd165efd74b00256552b51b5413107958..bfc4ef4f50efff4a77f2aef64335bb7e34c69f34 100644
|
|
|
+--- a/ui/events/event.h
|
|
|
++++ b/ui/events/event.h
|
|
|
+@@ -587,6 +587,9 @@ class EVENTS_EXPORT MouseEvent : public LocatedEvent {
|
|
|
+
|
|
|
+ const PointerDetails& pointer_details() const { return pointer_details_; }
|
|
|
+
|
|
|
++ bool is_system_menu() const { return is_system_menu_; }
|
|
|
++ void set_is_system_menu(bool is_menu) { is_system_menu_ = is_menu; }
|
|
|
++
|
|
|
+ // Event:
|
|
|
+ std::string ToString() const override;
|
|
|
+ std::unique_ptr<Event> Clone() const override;
|
|
|
+@@ -619,6 +622,8 @@ class EVENTS_EXPORT MouseEvent : public LocatedEvent {
|
|
|
+
|
|
|
+ // Structure for holding pointer details for implementing PointerEvents API.
|
|
|
+ PointerDetails pointer_details_;
|
|
|
++
|
|
|
++ bool is_system_menu_ = false;
|
|
|
+ };
|
|
|
+
|
|
|
+ class ScrollEvent;
|
|
|
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
|
|
|
index e2146f0a06fb70d16c48fe6e06d0615caf7d4619..f7d38f5d308eadc1dc27fd1dde706259b9197ad9 100644
|
|
|
--- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
|
|
@@ -34,10 +61,10 @@ index 1e2c5bb35cc314d44dba85a9bafc5e55bf2b5f14..d110d0a2f005888c4450262fc1887cbf
|
|
|
Widget* GetWidget();
|
|
|
const Widget* GetWidget() const;
|
|
|
diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc
|
|
|
-index 9ac53e223aa095acdf90b68bc1e6bc81e3021ab9..026b0f9b404267b17e1ea6b61b5ebb188b9b0bed 100644
|
|
|
+index b5d8f82255764a42df816e58bfcbd588534de2e4..8ad548a445ff7f66a7fe61e0f18d04d08668a69b 100644
|
|
|
--- a/ui/views/win/hwnd_message_handler.cc
|
|
|
+++ b/ui/views/win/hwnd_message_handler.cc
|
|
|
-@@ -3042,15 +3042,19 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message,
|
|
|
+@@ -3063,15 +3063,19 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message,
|
|
|
SetMsgHandled(FALSE);
|
|
|
// We must let Windows handle the caption buttons if it's drawing them, or
|
|
|
// they won't work.
|
|
@@ -59,6 +86,25 @@ index 9ac53e223aa095acdf90b68bc1e6bc81e3021ab9..026b0f9b404267b17e1ea6b61b5ebb18
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+@@ -3099,7 +3103,17 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message,
|
|
|
+ w_param = static_cast<WPARAM>(SendMessage(
|
|
|
+ hwnd(), WM_NCHITTEST, 0, MAKELPARAM(screen_point.x, screen_point.y)));
|
|
|
+ if (w_param == HTCAPTION || w_param == HTSYSMENU) {
|
|
|
+- ShowSystemMenuAtScreenPixelLocation(hwnd(), gfx::Point(screen_point));
|
|
|
++ LONG message_time = GetMessageTime();
|
|
|
++ CHROME_MSG msg = {hwnd(),
|
|
|
++ message,
|
|
|
++ w_param,
|
|
|
++ l_param,
|
|
|
++ static_cast<DWORD>(message_time),
|
|
|
++ {CR_GET_X_LPARAM(l_param), CR_GET_Y_LPARAM(l_param)}};
|
|
|
++ ui::MouseEvent event(msg);
|
|
|
++ event.set_is_system_menu(true);
|
|
|
++ if (!delegate_->HandleMouseEvent(&event))
|
|
|
++ ShowSystemMenuAtScreenPixelLocation(hwnd(), gfx::Point(screen_point));
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ } else if (message == WM_NCLBUTTONDOWN &&
|
|
|
diff --git a/ui/views/win/hwnd_message_handler_delegate.h b/ui/views/win/hwnd_message_handler_delegate.h
|
|
|
index 04dea68d74ea4f559db60f716c919e555db9ec80..2f8bd1a3c156bb6c04663c74b7279bb59926fc3d 100644
|
|
|
--- a/ui/views/win/hwnd_message_handler_delegate.h
|