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

Unified Diff: ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc

Issue 749063003: Fix grabbing capture when the mouse is pressed on Desktop Linux. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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: ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
index 3c992813568aa97c66c5617ef3a75b1be63f99dd..781000ed1fdbd3f8784aa136cde909919522b269 100644
--- a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
+++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
@@ -958,8 +958,17 @@ void DesktopWindowTreeHostX11::SetCapture() {
unsigned int event_mask = PointerMotionMask | ButtonReleaseMask |
ButtonPressMask;
- XGrabPointer(xdisplay_, xwindow_, True, event_mask, GrabModeAsync,
- GrabModeAsync, None, None, CurrentTime);
+ int success =
+ XGrabPointer(xdisplay_, xwindow_, True, event_mask, GrabModeAsync,
+ GrabModeAsync, None, None, CurrentTime);
+ if (success == AlreadyGrabbed) {
sadrul 2014/11/24 15:46:01 Can you link to some doc here? man XGrabPointer cl
pkotwicz 2014/11/24 16:07:41 The docs are not great. However man XUngrabPointer
sadrul 2014/11/27 17:48:18 Do we have example of any other clients doing simi
+ // Try ungrabbing the pointer and regrabbing it. If the OS grabbed capture
+ // as a result of a mouse button being pressed, ungrabbing and regrabbing
+ // the pointer will succeed.
+ XUngrabPointer(xdisplay_, CurrentTime);
+ XGrabPointer(xdisplay_, xwindow_, True, event_mask, GrabModeAsync,
+ GrabModeAsync, None, None, CurrentTime);
+ }
}
void DesktopWindowTreeHostX11::ReleaseCapture() {
« 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