Commit f5773918 authored by Tom Anderson's avatar Tom Anderson Committed by Commit Bot

Fix redundant XQueryPointer() calls

On Linux, this is a blocking call that makes a round trip to the X
server.  On my machine (with a local X server), this call usually takes
over 1ms (and much longer for a remote server!).

This call gets made on every mouse motion event in the web contents,
and in many other cases like tab dragging and DND.  The issue is that
value_or() was added in [1] which always calls GetCursorLocation(),
even when the cached cursor location is available.

[1] https://chromium-review.googlesource.com/c/chromium/src/+/2104428

BUG=None
R=sky

Change-Id: If2d0fd4bfb62927e4a408c4f3d5ccf72da8a0b81
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2128941
Commit-Queue: Thomas Anderson <thomasanderson@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Auto-Submit: Thomas Anderson <thomasanderson@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#754761}
parent c8f449a2
...@@ -49,7 +49,9 @@ gfx::Point DesktopScreenX11::GetCursorScreenPoint() { ...@@ -49,7 +49,9 @@ gfx::Point DesktopScreenX11::GetCursorScreenPoint() {
point = event_source->GetRootCursorLocationFromCurrentEvent(); point = event_source->GetRootCursorLocationFromCurrentEvent();
return gfx::ConvertPointToDIP( return gfx::ConvertPointToDIP(
GetXDisplayScaleFactor(), GetXDisplayScaleFactor(),
point.value_or(x11_display_manager_->GetCursorLocation())); // NB: Do NOT call value_or() here, since that would defeat the purpose of
// caching |point|.
point ? point.value() : x11_display_manager_->GetCursorLocation());
} }
bool DesktopScreenX11::IsWindowUnderCursor(gfx::NativeWindow window) { bool DesktopScreenX11::IsWindowUnderCursor(gfx::NativeWindow window) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment