Chromium Code Reviews| 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 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 891 return; | 891 return; |
| 892 | 892 |
| 893 ClientWindowId client_window_id; | 893 ClientWindowId client_window_id; |
| 894 if (IsWindowKnown(window, &client_window_id)) { | 894 if (IsWindowKnown(window, &client_window_id)) { |
| 895 client()->OnWindowOpacityChanged(client_window_id.id, old_opacity, | 895 client()->OnWindowOpacityChanged(client_window_id.id, old_opacity, |
| 896 new_opacity); | 896 new_opacity); |
| 897 } | 897 } |
| 898 } | 898 } |
| 899 | 899 |
| 900 void WindowTree::ProcessCursorChanged(const ServerWindow* window, | 900 void WindowTree::ProcessCursorChanged(const ServerWindow* window, |
| 901 mojom::CursorType cursor_id, | 901 const ui::CursorData& cursor, |
| 902 bool originated_change) { | 902 bool originated_change) { |
| 903 if (originated_change) | 903 if (originated_change) |
| 904 return; | 904 return; |
| 905 ClientWindowId client_window_id; | 905 ClientWindowId client_window_id; |
| 906 if (!IsWindowKnown(window, &client_window_id)) | 906 if (!IsWindowKnown(window, &client_window_id)) |
| 907 return; | 907 return; |
| 908 | 908 |
| 909 client()->OnWindowPredefinedCursorChanged(client_window_id.id, cursor_id); | 909 client()->OnWindowCursorChanged(client_window_id.id, cursor); |
| 910 } | 910 } |
| 911 | 911 |
| 912 void WindowTree::ProcessFocusChanged(const ServerWindow* old_focused_window, | 912 void WindowTree::ProcessFocusChanged(const ServerWindow* old_focused_window, |
| 913 const ServerWindow* new_focused_window) { | 913 const ServerWindow* new_focused_window) { |
| 914 if (window_server_->current_operation_type() == OperationType::SET_FOCUS && | 914 if (window_server_->current_operation_type() == OperationType::SET_FOCUS && |
| 915 window_server_->IsOperationSource(id_)) { | 915 window_server_->IsOperationSource(id_)) { |
| 916 return; | 916 return; |
| 917 } | 917 } |
| 918 const ServerWindow* window = | 918 const ServerWindow* window = |
| 919 new_focused_window | 919 new_focused_window |
| (...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1766 | 1766 |
| 1767 void WindowTree::SetEventTargetingPolicy(Id transport_window_id, | 1767 void WindowTree::SetEventTargetingPolicy(Id transport_window_id, |
| 1768 mojom::EventTargetingPolicy policy) { | 1768 mojom::EventTargetingPolicy policy) { |
| 1769 ServerWindow* window = | 1769 ServerWindow* window = |
| 1770 GetWindowByClientId(ClientWindowId(transport_window_id)); | 1770 GetWindowByClientId(ClientWindowId(transport_window_id)); |
| 1771 // TODO(riajiang): check |event_queue_| is empty for |window|. | 1771 // TODO(riajiang): check |event_queue_| is empty for |window|. |
| 1772 if (window && access_policy_->CanSetEventTargetingPolicy(window)) | 1772 if (window && access_policy_->CanSetEventTargetingPolicy(window)) |
| 1773 window->set_event_targeting_policy(policy); | 1773 window->set_event_targeting_policy(policy); |
| 1774 } | 1774 } |
| 1775 | 1775 |
| 1776 void WindowTree::SetPredefinedCursor(uint32_t change_id, | 1776 void WindowTree::SetCursor(uint32_t change_id, |
| 1777 Id transport_window_id, | 1777 Id transport_window_id, |
| 1778 ui::mojom::CursorType cursor_id) { | 1778 ui::CursorData cursor) { |
| 1779 ServerWindow* window = | 1779 ServerWindow* window = |
|
sky
2017/04/26 22:16:16
Should this fail if cursor type is custom and curs
Elliot Glaysher
2017/04/26 23:09:04
Changed this method to do lots of validation with
sky
2017/04/26 23:35:01
I think you meant *love* :)
Seriously though, I ha
| |
| 1780 GetWindowByClientId(ClientWindowId(transport_window_id)); | 1780 GetWindowByClientId(ClientWindowId(transport_window_id)); |
| 1781 | 1781 |
| 1782 // Only the owner of the window can change the bounds. | 1782 // Only the owner of the window can change the bounds. |
| 1783 bool success = window && access_policy_->CanSetCursorProperties(window); | 1783 bool success = window && access_policy_->CanSetCursorProperties(window); |
| 1784 if (success) { | 1784 if (success) { |
| 1785 Operation op(this, window_server_, | 1785 Operation op(this, window_server_, |
| 1786 OperationType::SET_WINDOW_PREDEFINED_CURSOR); | 1786 OperationType::SET_WINDOW_PREDEFINED_CURSOR); |
| 1787 window->SetPredefinedCursor(cursor_id); | 1787 window->SetCursor(cursor); |
| 1788 } | 1788 } |
| 1789 client()->OnChangeCompleted(change_id, success); | 1789 client()->OnChangeCompleted(change_id, success); |
| 1790 } | 1790 } |
| 1791 | 1791 |
| 1792 void WindowTree::DeactivateWindow(Id window_id) { | 1792 void WindowTree::DeactivateWindow(Id window_id) { |
| 1793 ServerWindow* window = | 1793 ServerWindow* window = |
| 1794 GetWindowByClientId(ClientWindowId(window_id)); | 1794 GetWindowByClientId(ClientWindowId(window_id)); |
| 1795 if (!window) { | 1795 if (!window) { |
| 1796 DVLOG(1) << "DeactivateWindow failed (invalid id)"; | 1796 DVLOG(1) << "DeactivateWindow failed (invalid id)"; |
| 1797 return; | 1797 return; |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2225 // TODO(sky): think about what else case means. | 2225 // TODO(sky): think about what else case means. |
| 2226 } | 2226 } |
| 2227 | 2227 |
| 2228 void WindowTree::WmSetFrameDecorationValues( | 2228 void WindowTree::WmSetFrameDecorationValues( |
| 2229 mojom::FrameDecorationValuesPtr values) { | 2229 mojom::FrameDecorationValuesPtr values) { |
| 2230 DCHECK(window_manager_state_); | 2230 DCHECK(window_manager_state_); |
| 2231 window_manager_state_->SetFrameDecorationValues(std::move(values)); | 2231 window_manager_state_->SetFrameDecorationValues(std::move(values)); |
| 2232 } | 2232 } |
| 2233 | 2233 |
| 2234 void WindowTree::WmSetNonClientCursor(uint32_t window_id, | 2234 void WindowTree::WmSetNonClientCursor(uint32_t window_id, |
| 2235 mojom::CursorType cursor_id) { | 2235 ui::CursorData cursor) { |
| 2236 DCHECK(window_manager_state_); | 2236 DCHECK(window_manager_state_); |
| 2237 ServerWindow* window = GetWindowByClientId(ClientWindowId(window_id)); | 2237 ServerWindow* window = GetWindowByClientId(ClientWindowId(window_id)); |
| 2238 if (window) { | 2238 if (window) { |
| 2239 window->SetNonClientCursor(cursor_id); | 2239 window->SetNonClientCursor(cursor); |
| 2240 } else { | 2240 } else { |
| 2241 DVLOG(1) << "trying to update non-client cursor of invalid window"; | 2241 DVLOG(1) << "trying to update non-client cursor of invalid window"; |
| 2242 } | 2242 } |
| 2243 } | 2243 } |
| 2244 | 2244 |
| 2245 void WindowTree::OnWmCreatedTopLevelWindow(uint32_t change_id, | 2245 void WindowTree::OnWmCreatedTopLevelWindow(uint32_t change_id, |
| 2246 Id transport_window_id) { | 2246 Id transport_window_id) { |
| 2247 ServerWindow* window = | 2247 ServerWindow* window = |
| 2248 GetWindowByClientId(ClientWindowId(transport_window_id)); | 2248 GetWindowByClientId(ClientWindowId(transport_window_id)); |
| 2249 if (window && window->id().client_id != id_) { | 2249 if (window && window->id().client_id != id_) { |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2418 client()->OnCompleteDrop(client_window_id.id, event_flags, cursor_offset, | 2418 client()->OnCompleteDrop(client_window_id.id, event_flags, cursor_offset, |
| 2419 effect_bitmask, callback); | 2419 effect_bitmask, callback); |
| 2420 } | 2420 } |
| 2421 | 2421 |
| 2422 void WindowTree::PerformOnDragDropDone() { | 2422 void WindowTree::PerformOnDragDropDone() { |
| 2423 client()->OnDragDropDone(); | 2423 client()->OnDragDropDone(); |
| 2424 } | 2424 } |
| 2425 | 2425 |
| 2426 } // namespace ws | 2426 } // namespace ws |
| 2427 } // namespace ui | 2427 } // namespace ui |
| OLD | NEW |