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

Unified Diff: ui/views/mus/native_widget_mus.cc

Issue 1862853002: Makes WindowTree::SetFocus(null) work (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: moar cleanup Created 4 years, 8 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 | « components/mus/ws/window_tree.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/mus/native_widget_mus.cc
diff --git a/ui/views/mus/native_widget_mus.cc b/ui/views/mus/native_widget_mus.cc
index c501c6e6b843dd4bb60e8ccbbba3b23f4d0526f3..751912f9a257691a5bacb0fc970116e47658db70 100644
--- a/ui/views/mus/native_widget_mus.cc
+++ b/ui/views/mus/native_widget_mus.cc
@@ -690,12 +690,14 @@ void NativeWidgetMus::Activate() {
}
void NativeWidgetMus::Deactivate() {
- // NOTIMPLEMENTED();
+ if (IsActive())
+ window_->connection()->ClearFocus();
}
bool NativeWidgetMus::IsActive() const {
- // NOTIMPLEMENTED();
- return true;
+ mus::Window* focused =
+ window_ ? window_->connection()->GetFocusedWindow() : nullptr;
+ return focused && window_->Contains(focused);
}
void NativeWidgetMus::SetAlwaysOnTop(bool always_on_top) {
@@ -807,7 +809,12 @@ bool NativeWidgetMus::IsMouseEventsEnabled() const {
}
void NativeWidgetMus::ClearNativeFocus() {
- // NOTIMPLEMENTED();
+ if (!IsActive())
+ return;
+ mus::Window* focused =
+ window_ ? window_->connection()->GetFocusedWindow() : nullptr;
+ if (focused && window_->Contains(focused) && focused != window_)
+ window_->SetFocus();
}
gfx::Rect NativeWidgetMus::GetWorkAreaBoundsInScreen() const {
« no previous file with comments | « components/mus/ws/window_tree.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698