Commit 71a7f7b3 authored by Tom Anderson's avatar Tom Anderson Committed by Commit Bot

X11: Ensure a window IsActive() after Activate()

A window's focus state has an effect on webdriver tests, and some
tests depend on a window being focused soon after window.focus().  CL
[1] made the assumption that Chromium tests were the only ones that
relied on this and so removed that code.  This CL is a selective
revert of that one.

[1] https://chromium.googlesource.com/chromium/src/+/9b35aa2cb18ff78d6cfc843f0e9414ccb6c22150

BUG=b/63325409
R=erg@chromium.org
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_chromium_dbg_ng

Change-Id: I98fdfce4b8168084b3b87a9937acef36e4e504cc
Reviewed-on: https://chromium-review.googlesource.com/567269Reviewed-by: default avatarElliot Glaysher <erg@chromium.org>
Commit-Queue: Thomas Anderson <thomasanderson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#485780}
parent ed833edc
...@@ -763,6 +763,13 @@ void DesktopWindowTreeHostX11::Activate() { ...@@ -763,6 +763,13 @@ void DesktopWindowTreeHostX11::Activate() {
// would have raised an X error if the window is not mapped. // would have raised an X error if the window is not mapped.
auto old_error_handler = XSetErrorHandler(IgnoreX11Errors); auto old_error_handler = XSetErrorHandler(IgnoreX11Errors);
XSetInputFocus(xdisplay_, xwindow_, RevertToParent, timestamp); XSetInputFocus(xdisplay_, xwindow_, RevertToParent, timestamp);
// At this point, we know we will receive focus, and some
// webdriver tests depend on a window being IsActive() immediately
// after an Activate(), so just set this state now.
has_pointer_focus_ = false;
has_window_focus_ = true;
// window_mapped_in_client_ == true based on the IsVisible() check above.
window_mapped_in_server_ = true;
XSetErrorHandler(old_error_handler); XSetErrorHandler(old_error_handler);
} }
AfterActivationStateChanged(); AfterActivationStateChanged();
......
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