-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* fix: touch events not recognized by WCO on windows (#35117) * chore: update patches Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
- Loading branch information
1 parent
511f275
commit 5871f81
Showing
4 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
patches/chromium/chore_allow_chromium_to_handle_synthetic_mouse_events_for_touch.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
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 | ||
|
||
With WCO, allow chromium to handle synthetic mouse events generated for touch | ||
actions in the non-client caption area. | ||
|
||
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 65b9f5e5f81e8ef8b591ef2e027e095df11c0d7b..b5d764db353e758e8feefd5fd0a045be27cf09c6 100644 | ||
--- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc | ||
+++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc | ||
@@ -1169,6 +1169,10 @@ void DesktopWindowTreeHostWin::HandleWindowScaleFactorChanged( | ||
} | ||
} | ||
|
||
+bool DesktopWindowTreeHostWin::HandleMouseEventForCaption(UINT message) const { | ||
+ return false; | ||
+} | ||
+ | ||
DesktopNativeCursorManager* | ||
DesktopWindowTreeHostWin::GetSingletonDesktopNativeCursorManager() { | ||
return new DesktopNativeCursorManagerWin(); | ||
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h | ||
index 444581249014a8ce301591f269dbb194f0520732..9377f26b081b717db6b50c13ce3795907cf2fcd2 100644 | ||
--- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h | ||
+++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h | ||
@@ -262,6 +262,7 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin | ||
void HandleWindowSizeChanging() override; | ||
void HandleWindowSizeUnchanged() override; | ||
void HandleWindowScaleFactorChanged(float window_scale_factor) override; | ||
+ bool HandleMouseEventForCaption(UINT message) const override; | ||
|
||
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 86f06d2a2c9588a2210a9f78f47e73f1b7c5e329..f943179d0071ed77fe49f5e4e9cff05eeff665e0 100644 | ||
--- a/ui/views/win/hwnd_message_handler.cc | ||
+++ b/ui/views/win/hwnd_message_handler.cc | ||
@@ -3049,15 +3049,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. | ||
+ bool simulate_mouse_event_for_caption = false; | ||
if (delegate_->GetFrameMode() == FrameMode::SYSTEM_DRAWN && | ||
(hittest == HTCLOSE || hittest == HTMINBUTTON || | ||
hittest == HTMAXBUTTON)) { | ||
- SetMsgHandled(FALSE); | ||
+ simulate_mouse_event_for_caption = | ||
+ delegate_->HandleMouseEventForCaption(message); | ||
+ if (!simulate_mouse_event_for_caption) | ||
+ SetMsgHandled(FALSE); | ||
} | ||
// Let resize events fall through. Ignore everything else, as we're either | ||
// letting Windows handle it above or we've already handled the equivalent | ||
// touch message. | ||
- if (!IsHitTestOnResizeHandle(hittest)) | ||
+ if (!IsHitTestOnResizeHandle(hittest) && !simulate_mouse_event_for_caption) | ||
return 0; | ||
} | ||
|
||
diff --git a/ui/views/win/hwnd_message_handler_delegate.h b/ui/views/win/hwnd_message_handler_delegate.h | ||
index 5dbb192d0840ca0ded61397c399b774a8cb05cce..098a9c3140e9e140fdc8f0dc9cf4e8ec84451221 100644 | ||
--- a/ui/views/win/hwnd_message_handler_delegate.h | ||
+++ b/ui/views/win/hwnd_message_handler_delegate.h | ||
@@ -258,6 +258,10 @@ class VIEWS_EXPORT HWNDMessageHandlerDelegate { | ||
// Called when the window scale factor has changed. | ||
virtual void HandleWindowScaleFactorChanged(float window_scale_factor) = 0; | ||
|
||
+ // Called when synthetic mouse event is generated for touch event on | ||
+ // caption buttons. | ||
+ virtual bool HandleMouseEventForCaption(UINT message) const = 0; | ||
+ | ||
protected: | ||
virtual ~HWNDMessageHandlerDelegate() = default; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters