Commit c178471b authored by pkotwicz@chromium.org's avatar pkotwicz@chromium.org

Revert of Simplify the logic in DesktopWindowTreeHostX11 for FocusOut...

Revert of Simplify the logic in DesktopWindowTreeHostX11 for FocusOut (https://codereview.chromium.org/379773003/)

Reason for revert:
I am reverting this CL because it causes regressions like crbug.com/395985. This CL is in the right direction, but I need to make the capture code for tab dragging less crazy first. See comment #3 in crbug.com/395985 for more details

Original issue's description:
> Simplify the logic in DesktopWindowTreeHostX11 for FocusOut
> 
> We should have the same handling regardless of whether the 'mode' member is
> NotifyGrab or NotifyUngrab. According to
> http://tronche.com/gui/x/xlib/events/input-focus/grab.html, whether the mode
> field is NotifyGrab or NotifyUngrab depends on whether there is a new
> capturer for the keyboard. The X window has lost keyboard capture in both cases.
> 
> BUG=392480
> TEST=None
> 
> Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=283823

TBR=erg@chromium.org,erg@google.com,sadrul@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=392480

Review URL: https://codereview.chromium.org/409223003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284919 0039d316-1c4b-4281-b951-d872f2087c98
parent 4449c253
...@@ -201,6 +201,11 @@ gfx::Point WindowEventDispatcher::GetLastMouseLocationInRoot() const { ...@@ -201,6 +201,11 @@ gfx::Point WindowEventDispatcher::GetLastMouseLocationInRoot() const {
return location; return location;
} }
void WindowEventDispatcher::OnHostLostMouseGrab() {
mouse_pressed_handler_ = NULL;
mouse_moved_handler_ = NULL;
}
void WindowEventDispatcher::OnCursorMovedToRootLocation( void WindowEventDispatcher::OnCursorMovedToRootLocation(
const gfx::Point& root_location) { const gfx::Point& root_location) {
SetLastMouseLocation(window(), root_location); SetLastMouseLocation(window(), root_location);
......
...@@ -107,6 +107,7 @@ class AURA_EXPORT WindowEventDispatcher : public ui::EventProcessor, ...@@ -107,6 +107,7 @@ class AURA_EXPORT WindowEventDispatcher : public ui::EventProcessor,
// coordinates. This may return a point outside the root window's bounds. // coordinates. This may return a point outside the root window's bounds.
gfx::Point GetLastMouseLocationInRoot() const; gfx::Point GetLastMouseLocationInRoot() const;
void OnHostLostMouseGrab();
void OnCursorMovedToRootLocation(const gfx::Point& root_location); void OnCursorMovedToRootLocation(const gfx::Point& root_location);
// TODO(beng): This is only needed because this cleanup needs to happen after // TODO(beng): This is only needed because this cleanup needs to happen after
......
...@@ -416,7 +416,8 @@ uint32_t WindowTreeHostX11::DispatchEvent(const ui::PlatformEvent& event) { ...@@ -416,7 +416,8 @@ uint32_t WindowTreeHostX11::DispatchEvent(const ui::PlatformEvent& event) {
break; break;
} }
case FocusOut: case FocusOut:
OnHostLostWindowCapture(); if (xev->xfocus.mode != NotifyGrab)
OnHostLostWindowCapture();
break; break;
case ConfigureNotify: { case ConfigureNotify: {
DCHECK_EQ(xwindow_, xev->xconfigure.event); DCHECK_EQ(xwindow_, xev->xconfigure.event);
......
...@@ -1618,8 +1618,13 @@ uint32_t DesktopWindowTreeHostX11::DispatchEvent( ...@@ -1618,8 +1618,13 @@ uint32_t DesktopWindowTreeHostX11::DispatchEvent(
break; break;
} }
case FocusOut: case FocusOut:
ReleaseCapture(); if (xev->xfocus.mode != NotifyGrab) {
X11DesktopHandler::get()->ProcessXEvent(xev); ReleaseCapture();
OnHostLostWindowCapture();
X11DesktopHandler::get()->ProcessXEvent(xev);
} else {
dispatcher()->OnHostLostMouseGrab();
}
break; break;
case FocusIn: case FocusIn:
X11DesktopHandler::get()->ProcessXEvent(xev); X11DesktopHandler::get()->ProcessXEvent(xev);
......
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