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

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

Issue 2756183003: X11: Fix test flakes related to window focus (Closed)
Patch Set: Created 3 years, 9 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: 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 95f47b90e9cc1c960c94950c4a7d45806cab3d67..2d52d39a8a37ee6c9cb3fbba758df229342b4c82 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
@@ -175,6 +175,10 @@ int XI2ModeToXMode(int xi2_mode) {
}
}
+int IgnoreX11Errors(XDisplay* display, XErrorEvent* error) {
+ return 0;
+}
+
} // namespace
////////////////////////////////////////////////////////////////////////////////
@@ -800,13 +804,10 @@ void DesktopWindowTreeHostX11::Activate() {
} else {
XRaiseWindow(xdisplay_, xwindow_);
// Directly ask the X server to give focus to the window. Note that the call
- // will raise 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);
XSetInputFocus(xdisplay_, xwindow_, RevertToParent, timestamp);
- // At this point, we know we will receive focus, and some 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;
+ XSetErrorHandler(old_error_handler);
}
AfterActivationStateChanged();
}
« 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