| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/mus/ws/window_manager_state.h" | 5 #include "components/mus/ws/window_manager_state.h" |
| 6 | 6 |
| 7 #include <queue> | 7 #include <queue> |
| 8 | 8 |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "components/mus/common/event_matcher_util.h" | 10 #include "components/mus/common/event_matcher_util.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 const bool in_nonclient_area_; | 88 const bool in_nonclient_area_; |
| 89 base::WeakPtr<Accelerator> accelerator_; | 89 base::WeakPtr<Accelerator> accelerator_; |
| 90 | 90 |
| 91 DISALLOW_COPY_AND_ASSIGN(ProcessedEventTarget); | 91 DISALLOW_COPY_AND_ASSIGN(ProcessedEventTarget); |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 WindowManagerState::QueuedEvent::QueuedEvent() {} | 94 WindowManagerState::QueuedEvent::QueuedEvent() {} |
| 95 WindowManagerState::QueuedEvent::~QueuedEvent() {} | 95 WindowManagerState::QueuedEvent::~QueuedEvent() {} |
| 96 | 96 |
| 97 WindowManagerState::WindowManagerState(Display* display, | 97 WindowManagerState::WindowManagerState(Display* display, |
| 98 PlatformDisplay* platform_display, | 98 PlatformDisplay* platform_display) |
| 99 cc::SurfaceId surface_id) | |
| 100 : WindowManagerState(display, | 99 : WindowManagerState(display, |
| 101 platform_display, | 100 platform_display, |
| 102 surface_id, | |
| 103 false, | 101 false, |
| 104 shell::mojom::kRootUserID) {} | 102 shell::mojom::kRootUserID) {} |
| 105 | 103 |
| 106 WindowManagerState::WindowManagerState(Display* display, | 104 WindowManagerState::WindowManagerState(Display* display, |
| 107 PlatformDisplay* platform_display, | 105 PlatformDisplay* platform_display, |
| 108 cc::SurfaceId surface_id, | |
| 109 const UserId& user_id) | 106 const UserId& user_id) |
| 110 : WindowManagerState(display, platform_display, surface_id, true, user_id) { | 107 : WindowManagerState(display, platform_display, true, user_id) {} |
| 111 } | |
| 112 | 108 |
| 113 WindowManagerState::~WindowManagerState() {} | 109 WindowManagerState::~WindowManagerState() {} |
| 114 | 110 |
| 115 void WindowManagerState::SetFrameDecorationValues( | 111 void WindowManagerState::SetFrameDecorationValues( |
| 116 mojom::FrameDecorationValuesPtr values) { | 112 mojom::FrameDecorationValuesPtr values) { |
| 117 got_frame_decoration_values_ = true; | 113 got_frame_decoration_values_ = true; |
| 118 frame_decoration_values_ = values.Clone(); | 114 frame_decoration_values_ = values.Clone(); |
| 119 display_->display_manager() | 115 display_->display_manager() |
| 120 ->GetUserDisplayManager(user_id_) | 116 ->GetUserDisplayManager(user_id_) |
| 121 ->OnFrameDecorationValuesChanged(this); | 117 ->OnFrameDecorationValuesChanged(this); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 // The WindowTree is dying. So it's not going to ack the event. | 156 // The WindowTree is dying. So it's not going to ack the event. |
| 161 // If the dying tree matches the root |tree_| marked as handled so we don't | 157 // If the dying tree matches the root |tree_| marked as handled so we don't |
| 162 // notify it of accelerators. | 158 // notify it of accelerators. |
| 163 OnEventAck(tree_awaiting_input_ack_, tree == tree_ | 159 OnEventAck(tree_awaiting_input_ack_, tree == tree_ |
| 164 ? mojom::EventResult::HANDLED | 160 ? mojom::EventResult::HANDLED |
| 165 : mojom::EventResult::UNHANDLED); | 161 : mojom::EventResult::UNHANDLED); |
| 166 } | 162 } |
| 167 | 163 |
| 168 WindowManagerState::WindowManagerState(Display* display, | 164 WindowManagerState::WindowManagerState(Display* display, |
| 169 PlatformDisplay* platform_display, | 165 PlatformDisplay* platform_display, |
| 170 cc::SurfaceId surface_id, | |
| 171 bool is_user_id_valid, | 166 bool is_user_id_valid, |
| 172 const UserId& user_id) | 167 const UserId& user_id) |
| 173 : display_(display), | 168 : display_(display), |
| 174 platform_display_(platform_display), | 169 platform_display_(platform_display), |
| 175 is_user_id_valid_(is_user_id_valid), | 170 is_user_id_valid_(is_user_id_valid), |
| 176 user_id_(user_id), | 171 user_id_(user_id), |
| 177 event_dispatcher_(this) { | 172 event_dispatcher_(this) { |
| 178 frame_decoration_values_ = mojom::FrameDecorationValues::New(); | 173 frame_decoration_values_ = mojom::FrameDecorationValues::New(); |
| 179 frame_decoration_values_->normal_client_area_insets = mojo::Insets::New(); | 174 frame_decoration_values_->normal_client_area_insets = mojo::Insets::New(); |
| 180 frame_decoration_values_->maximized_client_area_insets = mojo::Insets::New(); | 175 frame_decoration_values_->maximized_client_area_insets = mojo::Insets::New(); |
| 181 frame_decoration_values_->max_title_bar_button_width = 0u; | 176 frame_decoration_values_->max_title_bar_button_width = 0u; |
| 182 | 177 |
| 183 root_.reset(window_server()->CreateServerWindow( | 178 root_.reset(window_server()->CreateServerWindow( |
| 184 window_server()->display_manager()->GetAndAdvanceNextRootId(), | 179 window_server()->display_manager()->GetAndAdvanceNextRootId(), |
| 185 ServerWindow::Properties())); | 180 ServerWindow::Properties())); |
| 186 // Our root is always a child of the Display's root. Do this | 181 // Our root is always a child of the Display's root. Do this |
| 187 // before the WindowTree has been created so that the client doesn't get | 182 // before the WindowTree has been created so that the client doesn't get |
| 188 // notified of the add, bounds change and visibility change. | 183 // notified of the add, bounds change and visibility change. |
| 189 root_->SetBounds(gfx::Rect(display->root_window()->bounds().size())); | 184 root_->SetBounds(gfx::Rect(display->root_window()->bounds().size())); |
| 190 root_->SetVisible(true); | 185 root_->SetVisible(true); |
| 191 display->root_window()->Add(root_.get()); | 186 display->root_window()->Add(root_.get()); |
| 192 | 187 |
| 193 event_dispatcher_.set_root(root_.get()); | 188 event_dispatcher_.set_root(root_.get()); |
| 194 event_dispatcher_.set_surface_id(surface_id); | |
| 195 | 189 |
| 196 AddDebugAccelerators(); | 190 AddDebugAccelerators(); |
| 197 } | 191 } |
| 198 | 192 |
| 199 bool WindowManagerState::IsActive() const { | 193 bool WindowManagerState::IsActive() const { |
| 200 return display()->GetActiveWindowManagerState() == this; | 194 return display()->GetActiveWindowManagerState() == this; |
| 201 } | 195 } |
| 202 | 196 |
| 203 void WindowManagerState::Activate(const gfx::Point& mouse_location_on_screen) { | 197 void WindowManagerState::Activate(const gfx::Point& mouse_location_on_screen) { |
| 204 root_->SetVisible(true); | 198 root_->SetVisible(true); |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 weak_accelerator); | 418 weak_accelerator); |
| 425 } | 419 } |
| 426 | 420 |
| 427 void WindowManagerState::OnEventTargetNotFound(const ui::Event& event) { | 421 void WindowManagerState::OnEventTargetNotFound(const ui::Event& event) { |
| 428 window_server()->SendToEventObservers(event, user_id_, | 422 window_server()->SendToEventObservers(event, user_id_, |
| 429 nullptr /* ignore_tree */); | 423 nullptr /* ignore_tree */); |
| 430 } | 424 } |
| 431 | 425 |
| 432 } // namespace ws | 426 } // namespace ws |
| 433 } // namespace mus | 427 } // namespace mus |
| OLD | NEW |