Skip to content

Commit

Permalink
Two tweaks to improve better shadows/activation
Browse files Browse the repository at this point in the history
. Only create the NonClientFrameController for windows in the user
  container. This is temporary, need to plumb through types to know
  whether the window should have a frame.
. In general we don't want the widgets created by the wm to change
  focus at the mus level. Instead we want to funnel requests to mus
  and then update the widget state from mus. So, create the widgets in
  such a way that they don't automatically focus.

BUG=none
TEST=none
R=ben@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#363501}
  • Loading branch information
sky authored and Commit bot committed Dec 7, 2015
1 parent d615c6e commit 91d0667
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 3 additions & 1 deletion mash/wm/non_client_frame_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,12 @@ NonClientFrameController::NonClientFrameController(
window_->AddObserver(this);

views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
// We initiate focus at the mus level, not at the views level.
params.activatable = views::Widget::InitParams::ACTIVATABLE_NO;
params.delegate = this;
params.native_widget = new WmNativeWidgetMus(widget_, shell, window);
widget_->Init(params);
widget_->Show();
widget_->ShowInactive();

const int shadow_inset =
Shadow::GetInteriorInsetForStyle(Shadow::STYLE_ACTIVE);
Expand Down
10 changes: 7 additions & 3 deletions mash/wm/window_manager_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,13 @@ void WindowManagerImpl::OpenWindow(
state_->GetWindowForContainer(container)->AddChild(child_window);
child_window->Embed(client.Pass());

// NonClientFrameController deletes itself when |child_window| is destroyed.
new NonClientFrameController(state_->app()->shell(), child_window,
state_->window_tree_host());
// TODO(sky): we need more sophisticated heuristics as to when the non-client
// frame is necessary.
if (container == mojom::CONTAINER_USER_WINDOWS) {
// NonClientFrameController deletes itself when |child_window| is destroyed.
new NonClientFrameController(state_->app()->shell(), child_window,
state_->window_tree_host());
}

state_->IncrementWindowCount();
}
Expand Down

0 comments on commit 91d0667

Please sign in to comment.