Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1524)

Unified Diff: webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.cc

Issue 2889063002: Linux desktopCapture: fix the cursor position issue in Window sharing (Closed)
Patch Set: re-do the cl with applying XTranslateCoordinates() method Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.cc
diff --git a/webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.cc b/webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.cc
index 4870bae7ff0baade0c476f670d074ee36f0b295b..22339d4221c9e48d9a55aec48a6ba8801a14e2f0 100644
--- a/webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.cc
+++ b/webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.cc
@@ -185,6 +185,21 @@ void MouseCursorMonitorX11::Capture() {
(window_ == root_window || child_window != None) ? INSIDE : OUTSIDE;
}
+ // As the comments to GetTopLevelWindow() above indicate, in window capture,
+ // the cursor position capture happens in |window_|, while the frame catpure
+ // happens in |child_window|. These two windows are not alwyas same, as
+ // window manager may add some decorations to the |window_|. So translate
+ // the coordinate in |window_| to the coordinate space of |child_window|.
+ if (window_ != root_window && state == INSIDE) {
+ int translated_x, translated_y;
+ Window unused;
+ if (XTranslateCoordinates(display(), window_, child_window, win_x, win_y,
+ &translated_x, &translated_y, &unused)) {
+ win_x = translated_x;
+ win_y = translated_y;
+ }
+ }
+
callback_->OnMouseCursorPosition(state,
webrtc::DesktopVector(win_x, win_y));
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698