From 9655ae7d6ae9de4b467d197957bb3c7a152e3ddd Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Fri, 9 Feb 2024 09:44:46 -0600 Subject: [PATCH] fix: `GetCursorScreenpoint()` sometimes wrongly returns `(0,0)` (#41275) --- patches/chromium/.patches | 1 + ...ursorscreenpoint_wrongly_returns_0_0.patch | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 patches/chromium/fix_getcursorscreenpoint_wrongly_returns_0_0.patch diff --git a/patches/chromium/.patches b/patches/chromium/.patches index 89d22941f086..7b76ce5b0374 100644 --- a/patches/chromium/.patches +++ b/patches/chromium/.patches @@ -127,3 +127,4 @@ fix_restore_original_resize_performance_on_macos.patch feat_allow_code_cache_in_custom_schemes.patch build_run_reclient_cfg_generator_after_chrome.patch fix_suppress_clang_-wimplicit-const-int-float-conversion_in.patch +fix_getcursorscreenpoint_wrongly_returns_0_0.patch diff --git a/patches/chromium/fix_getcursorscreenpoint_wrongly_returns_0_0.patch b/patches/chromium/fix_getcursorscreenpoint_wrongly_returns_0_0.patch new file mode 100644 index 000000000000..d2e4bed589c7 --- /dev/null +++ b/patches/chromium/fix_getcursorscreenpoint_wrongly_returns_0_0.patch @@ -0,0 +1,25 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Charles Kerr +Date: Thu, 8 Feb 2024 00:41:40 -0600 +Subject: fix: GetCursorScreenPoint() wrongly returns 0, 0 + +Fixes #41143. Discussion of the issue at +https://github.com/electron/electron/issues/41143#issuecomment-1933443163 + +This patch should be backported to e29, upstreamed to Chromium, and then +removed if it lands upstream. + +diff --git a/ui/events/x/events_x_utils.cc b/ui/events/x/events_x_utils.cc +index aa047f2bd39643dc471b25eeb567b0dd3731e0e0..eb312fb1c115751041930539d0d5f15208461e04 100644 +--- a/ui/events/x/events_x_utils.cc ++++ b/ui/events/x/events_x_utils.cc +@@ -586,6 +586,9 @@ gfx::Point EventLocationFromXEvent(const x11::Event& xev) { + gfx::Point EventSystemLocationFromXEvent(const x11::Event& xev) { + if (auto* crossing = xev.As()) + return gfx::Point(crossing->root_x, crossing->root_y); ++ if (auto* crossing = xev.As()) ++ return gfx::Point(Fp1616ToDouble(crossing->root_x), ++ Fp1616ToDouble(crossing->root_y)); + if (auto* button = xev.As()) + return gfx::Point(button->root_x, button->root_y); + if (auto* motion = xev.As())