From 868607710204d8a249290531a2efde1ef4362a0e Mon Sep 17 00:00:00 2001 From: Zijie He Date: Tue, 31 Oct 2017 17:55:56 -0700 Subject: [PATCH] [Window Capturer] Inaccurate cursor position on cinnamon When cinnamon is used, it always wraps the application window with its own window. Instead of (0, 0), the DesktopRect from XWindowAttributes starts from (10, 36). So this change considers this difference when translating the DesktopRect in GetWindowRect() function. Bug: chromium:778035 Change-Id: I4944b2d1e13a4c379e114fd1749d74e95a63003b Reviewed-on: https://webrtc-review.googlesource.com/17660 Reviewed-by: Jamie Walch Commit-Queue: Zijie He Cr-Commit-Position: refs/heads/master@{#20538} --- modules/desktop_capture/x11/window_list_utils.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/desktop_capture/x11/window_list_utils.cc b/modules/desktop_capture/x11/window_list_utils.cc index 13bb94172c..13542baeac 100644 --- a/modules/desktop_capture/x11/window_list_utils.cc +++ b/modules/desktop_capture/x11/window_list_utils.cc @@ -237,14 +237,16 @@ bool GetWindowRect(::Display* display, return false; } } + *rect = DesktopRectFromXAttributes(*attributes); + { XErrorTrap error_trap(display); ::Window child; if (!XTranslateCoordinates(display, window, attributes->root, - 0, - 0, + -rect->left(), + -rect->top(), &offset_x, &offset_y, &child) || @@ -252,8 +254,6 @@ bool GetWindowRect(::Display* display, return false; } } - - *rect = DesktopRectFromXAttributes(*attributes); rect->Translate(offset_x, offset_y); return true; }