| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_tree.h" | 5 #include "services/ui/ws/window_tree.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 1607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1618 } | 1618 } |
| 1619 | 1619 |
| 1620 DCHECK(!parent->children().empty()); | 1620 DCHECK(!parent->children().empty()); |
| 1621 if (parent->children().back() == window) { | 1621 if (parent->children().back() == window) { |
| 1622 // Ignore this call; the client didn't know they were already at the top. | 1622 // Ignore this call; the client didn't know they were already at the top. |
| 1623 DVLOG(3) << "StackAtTop ignored (already at top)"; | 1623 DVLOG(3) << "StackAtTop ignored (already at top)"; |
| 1624 client()->OnChangeCompleted(change_id, true); | 1624 client()->OnChangeCompleted(change_id, true); |
| 1625 return; | 1625 return; |
| 1626 } | 1626 } |
| 1627 | 1627 |
| 1628 ServerWindow* relative_window = parent->children().back(); | 1628 WindowManagerDisplayRoot* display_root = GetWindowManagerDisplayRoot(window); |
| 1629 Operation op(this, window_server_, OperationType::REORDER_WINDOW); | 1629 if (!display_root) { |
| 1630 window->Reorder(relative_window, mojom::OrderDirection::ABOVE); | 1630 DVLOG(1) << "StackAtTop (no display root)"; |
| 1631 window_server_->ProcessWindowReorder(window, relative_window, | 1631 client()->OnChangeCompleted(change_id, false); |
| 1632 mojom::OrderDirection::ABOVE); | 1632 return; |
| 1633 } |
| 1633 | 1634 |
| 1634 client()->OnChangeCompleted(change_id, true); | 1635 // Window reordering assumes that it is the owner of parent who is sending |
| 1636 // the message, and does not deal gracefully with other clients reordering |
| 1637 // their windows. So tell the window manager to send us a reorder message. |
| 1638 WindowTree* wm_tree = display_root->window_manager_state()->window_tree(); |
| 1639 const uint32_t wm_change_id = |
| 1640 window_server_->GenerateWindowManagerChangeId(this, change_id); |
| 1641 wm_tree->window_manager_internal_->WmStackAtTop( |
| 1642 wm_change_id, wm_tree->ClientWindowIdForWindow(window).id); |
| 1635 } | 1643 } |
| 1636 | 1644 |
| 1637 void WindowTree::GetWindowManagerClient( | 1645 void WindowTree::GetWindowManagerClient( |
| 1638 mojo::AssociatedInterfaceRequest<mojom::WindowManagerClient> internal) { | 1646 mojo::AssociatedInterfaceRequest<mojom::WindowManagerClient> internal) { |
| 1639 if (!access_policy_->CanSetWindowManager() || !window_manager_internal_ || | 1647 if (!access_policy_->CanSetWindowManager() || !window_manager_internal_ || |
| 1640 window_manager_internal_client_binding_) { | 1648 window_manager_internal_client_binding_) { |
| 1641 return; | 1649 return; |
| 1642 } | 1650 } |
| 1643 window_manager_internal_client_binding_.reset( | 1651 window_manager_internal_client_binding_.reset( |
| 1644 new mojo::AssociatedBinding<mojom::WindowManagerClient>( | 1652 new mojo::AssociatedBinding<mojom::WindowManagerClient>( |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2072 client()->OnCompleteDrop(client_window_id.id, event_flags, cursor_offset, | 2080 client()->OnCompleteDrop(client_window_id.id, event_flags, cursor_offset, |
| 2073 effect_bitmask, callback); | 2081 effect_bitmask, callback); |
| 2074 } | 2082 } |
| 2075 | 2083 |
| 2076 void WindowTree::PerformOnDragDropDone() { | 2084 void WindowTree::PerformOnDragDropDone() { |
| 2077 client()->OnDragDropDone(); | 2085 client()->OnDragDropDone(); |
| 2078 } | 2086 } |
| 2079 | 2087 |
| 2080 } // namespace ws | 2088 } // namespace ws |
| 2081 } // namespace ui | 2089 } // namespace ui |
| OLD | NEW |