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

Side by Side Diff: services/ui/ws/window_manager_display_root.cc

Issue 2863913004: chromeos: makes mus send keyevents to display root when nothing has focus (Closed)
Patch Set: GetClientVisibleRoot Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « services/ui/ws/window_manager_display_root.h ('k') | services/ui/ws/window_manager_state.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "services/ui/ws/window_manager_display_root.h" 5 #include "services/ui/ws/window_manager_display_root.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "services/ui/public/interfaces/window_manager.mojom.h" 10 #include "services/ui/public/interfaces/window_manager.mojom.h"
11 #include "services/ui/ws/display.h" 11 #include "services/ui/ws/display.h"
12 #include "services/ui/ws/display_manager.h" 12 #include "services/ui/ws/display_manager.h"
13 #include "services/ui/ws/server_window.h" 13 #include "services/ui/ws/server_window.h"
14 #include "services/ui/ws/window_manager_state.h"
14 #include "services/ui/ws/window_server.h" 15 #include "services/ui/ws/window_server.h"
16 #include "services/ui/ws/window_tree.h"
15 17
16 namespace ui { 18 namespace ui {
17 namespace ws { 19 namespace ws {
18 20
19 WindowManagerDisplayRoot::WindowManagerDisplayRoot(Display* display) 21 WindowManagerDisplayRoot::WindowManagerDisplayRoot(Display* display)
20 : display_(display) { 22 : display_(display) {
21 std::string name = "WindowManagerRoot"; 23 std::string name = "WindowManagerRoot";
22 ServerWindow::Properties properties; 24 ServerWindow::Properties properties;
23 properties[mojom::WindowManager::kName_Property] = 25 properties[mojom::WindowManager::kName_Property] =
24 std::vector<uint8_t>(name.begin(), name.end()); 26 std::vector<uint8_t>(name.begin(), name.end());
25 27
26 root_.reset(window_server()->CreateServerWindow( 28 root_.reset(window_server()->CreateServerWindow(
27 window_server()->display_manager()->GetAndAdvanceNextRootId(), 29 window_server()->display_manager()->GetAndAdvanceNextRootId(),
28 properties)); 30 properties));
29 root_->set_event_targeting_policy( 31 root_->set_event_targeting_policy(
30 mojom::EventTargetingPolicy::DESCENDANTS_ONLY); 32 mojom::EventTargetingPolicy::DESCENDANTS_ONLY);
31 // Our root is always a child of the Display's root. Do this 33 // Our root is always a child of the Display's root. Do this
32 // before the WindowTree has been created so that the client doesn't get 34 // before the WindowTree has been created so that the client doesn't get
33 // notified of the add, bounds change and visibility change. 35 // notified of the add, bounds change and visibility change.
34 root_->SetBounds(gfx::Rect(display->root_window()->bounds().size()), 36 root_->SetBounds(gfx::Rect(display->root_window()->bounds().size()),
35 allocator_.GenerateId()); 37 allocator_.GenerateId());
36 root_->SetVisible(true); 38 root_->SetVisible(true);
37 display->root_window()->Add(root_.get()); 39 display->root_window()->Add(root_.get());
38 } 40 }
39 41
40 WindowManagerDisplayRoot::~WindowManagerDisplayRoot() {} 42 WindowManagerDisplayRoot::~WindowManagerDisplayRoot() {}
41 43
44 const ServerWindow* WindowManagerDisplayRoot::GetClientVisibileRoot() const {
45 if (window_manager_state_->window_tree()
46 ->automatically_create_display_roots()) {
47 return root_.get();
48 }
49
50 return root_->children().empty() ? nullptr : root_->children()[0];
51 }
52
42 WindowServer* WindowManagerDisplayRoot::window_server() { 53 WindowServer* WindowManagerDisplayRoot::window_server() {
43 return display_->window_server(); 54 return display_->window_server();
44 } 55 }
45 56
46 } // namespace ws 57 } // namespace ws
47 } // namespace ui 58 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/ws/window_manager_display_root.h ('k') | services/ui/ws/window_manager_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698