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

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

Issue 265843004: Avoids releasing capture in EndMoveLoop if capture was switched to another window while dragging (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Avoids releasing capture in EndMoveLoop if capture was switched to another window (comments) Created 6 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 | « ui/views/widget/desktop_aura/x11_whole_screen_move_loop.h ('k') | 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/x11_whole_screen_move_loop.cc
diff --git a/ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc b/ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc
index 1db4a2226ef5bbe561958d839092029211a053d2..6c0b3c6b9e7962b9c3410a2a6916458ee80179f8 100644
--- a/ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc
+++ b/ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc
@@ -62,6 +62,7 @@ X11WholeScreenMoveLoop::X11WholeScreenMoveLoop(
should_reset_mouse_flags_(false),
grab_input_window_(None),
canceled_(false),
+ has_grab_(false),
weak_factory_(this) {
last_xmotion_.type = LASTEvent;
}
@@ -136,6 +137,11 @@ uint32_t X11WholeScreenMoveLoop::DispatchEvent(const ui::PlatformEvent& event) {
}
break;
}
+ case FocusOut: {
+ if (xev->xfocus.mode != NotifyGrab)
+ has_grab_ = false;
+ break;
+ }
case GenericEvent: {
ui::EventType type = ui::EventTypeFromNative(xev);
switch (type) {
@@ -253,8 +259,11 @@ void X11WholeScreenMoveLoop::EndMoveLoop() {
// Ungrab before we let go of the window.
XDisplay* display = gfx::GetXDisplay();
- XUngrabPointer(display, CurrentTime);
- XUngrabKeyboard(display, CurrentTime);
+ // Only ungrab pointer if capture was not switched to another window.
+ if (has_grab_) {
+ XUngrabPointer(display, CurrentTime);
+ XUngrabKeyboard(display, CurrentTime);
+ }
// Restore the previous dispatcher.
nested_dispatcher_.reset();
@@ -295,6 +304,7 @@ bool X11WholeScreenMoveLoop::GrabPointerAndKeyboard(gfx::NativeCursor cursor) {
DLOG(ERROR) << "Grabbing pointer for dragging failed: "
<< ui::GetX11ErrorString(display, ret);
} else {
+ has_grab_ = true;
XUngrabKeyboard(display, CurrentTime);
ret = XGrabKeyboard(
display,
« no previous file with comments | « ui/views/widget/desktop_aura/x11_whole_screen_move_loop.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698