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

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

Issue 2378883002: mus ws: Consistently use mojom::Cursor instead of int32_t. (Closed)
Patch Set: Created 4 years, 2 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_server.h ('k') | services/ui/ws/window_tree.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 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_server.h" 5 #include "services/ui/ws/window_server.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 pair.second->ProcessWindowReorder(window, relative_window, direction, 413 pair.second->ProcessWindowReorder(window, relative_window, direction,
414 IsOperationSource(pair.first)); 414 IsOperationSource(pair.first));
415 } 415 }
416 } 416 }
417 417
418 void WindowServer::ProcessWindowDeleted(ServerWindow* window) { 418 void WindowServer::ProcessWindowDeleted(ServerWindow* window) {
419 for (auto& pair : tree_map_) 419 for (auto& pair : tree_map_)
420 pair.second->ProcessWindowDeleted(window, IsOperationSource(pair.first)); 420 pair.second->ProcessWindowDeleted(window, IsOperationSource(pair.first));
421 } 421 }
422 422
423 void WindowServer::ProcessWillChangeWindowPredefinedCursor(ServerWindow* window, 423 void WindowServer::ProcessWillChangeWindowPredefinedCursor(
424 int32_t cursor_id) { 424 ServerWindow* window, mojom::Cursor cursor_id) {
425 for (auto& pair : tree_map_) { 425 for (auto& pair : tree_map_) {
426 pair.second->ProcessCursorChanged(window, cursor_id, 426 pair.second->ProcessCursorChanged(window, cursor_id,
427 IsOperationSource(pair.first)); 427 IsOperationSource(pair.first));
428 } 428 }
429 } 429 }
430 430
431 void WindowServer::SendToPointerWatchers(const ui::Event& event, 431 void WindowServer::SendToPointerWatchers(const ui::Event& event,
432 const UserId& user_id, 432 const UserId& user_id,
433 ServerWindow* target_window, 433 ServerWindow* target_window,
434 WindowTree* ignore_tree) { 434 WindowTree* ignore_tree) {
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 current_operation_ = nullptr; 573 current_operation_ = nullptr;
574 } 574 }
575 575
576 void WindowServer::UpdateNativeCursorFromMouseLocation(ServerWindow* window) { 576 void WindowServer::UpdateNativeCursorFromMouseLocation(ServerWindow* window) {
577 WindowManagerDisplayRoot* display_root = 577 WindowManagerDisplayRoot* display_root =
578 display_manager_->GetWindowManagerDisplayRoot(window); 578 display_manager_->GetWindowManagerDisplayRoot(window);
579 if (display_root) { 579 if (display_root) {
580 EventDispatcher* event_dispatcher = 580 EventDispatcher* event_dispatcher =
581 display_root->window_manager_state()->event_dispatcher(); 581 display_root->window_manager_state()->event_dispatcher();
582 event_dispatcher->UpdateCursorProviderByLastKnownLocation(); 582 event_dispatcher->UpdateCursorProviderByLastKnownLocation();
583 int32_t cursor_id = 0; 583 mojom::Cursor cursor_id = mojom::Cursor::CURSOR_NULL;
584 if (event_dispatcher->GetCurrentMouseCursor(&cursor_id)) 584 if (event_dispatcher->GetCurrentMouseCursor(&cursor_id))
585 display_root->display()->UpdateNativeCursor(cursor_id); 585 display_root->display()->UpdateNativeCursor(cursor_id);
586 } 586 }
587 } 587 }
588 588
589 void WindowServer::UpdateNativeCursorIfOver(ServerWindow* window) { 589 void WindowServer::UpdateNativeCursorIfOver(ServerWindow* window) {
590 WindowManagerDisplayRoot* display_root = 590 WindowManagerDisplayRoot* display_root =
591 display_manager_->GetWindowManagerDisplayRoot(window); 591 display_manager_->GetWindowManagerDisplayRoot(window);
592 if (!display_root) 592 if (!display_root)
593 return; 593 return;
594 594
595 EventDispatcher* event_dispatcher = 595 EventDispatcher* event_dispatcher =
596 display_root->window_manager_state()->event_dispatcher(); 596 display_root->window_manager_state()->event_dispatcher();
597 if (window != event_dispatcher->mouse_cursor_source_window()) 597 if (window != event_dispatcher->mouse_cursor_source_window())
598 return; 598 return;
599 599
600 event_dispatcher->UpdateNonClientAreaForCurrentWindow(); 600 event_dispatcher->UpdateNonClientAreaForCurrentWindow();
601 int32_t cursor_id = 0; 601 mojom::Cursor cursor_id = mojom::Cursor::CURSOR_NULL;
602 if (event_dispatcher->GetCurrentMouseCursor(&cursor_id)) 602 if (event_dispatcher->GetCurrentMouseCursor(&cursor_id))
603 display_root->display()->UpdateNativeCursor(cursor_id); 603 display_root->display()->UpdateNativeCursor(cursor_id);
604 } 604 }
605 605
606 bool WindowServer::IsUserInHighContrastMode(const UserId& user) const { 606 bool WindowServer::IsUserInHighContrastMode(const UserId& user) const {
607 const auto iter = high_contrast_mode_.find(user); 607 const auto iter = high_contrast_mode_.find(user);
608 return (iter == high_contrast_mode_.end()) ? false : iter->second; 608 return (iter == high_contrast_mode_.end()) ? false : iter->second;
609 } 609 }
610 610
611 void WindowServer::OnScheduleWindowPaint(ServerWindow* window) { 611 void WindowServer::OnScheduleWindowPaint(ServerWindow* window) {
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 return; 737 return;
738 738
739 WindowManagerDisplayRoot* display_root = 739 WindowManagerDisplayRoot* display_root =
740 display_manager_->GetWindowManagerDisplayRoot(window); 740 display_manager_->GetWindowManagerDisplayRoot(window);
741 if (display_root) 741 if (display_root)
742 display_root->window_manager_state()->ReleaseCaptureBlockedByModalWindow( 742 display_root->window_manager_state()->ReleaseCaptureBlockedByModalWindow(
743 window); 743 window);
744 } 744 }
745 745
746 void WindowServer::OnWindowPredefinedCursorChanged(ServerWindow* window, 746 void WindowServer::OnWindowPredefinedCursorChanged(ServerWindow* window,
747 int32_t cursor_id) { 747 mojom::Cursor cursor_id) {
748 if (in_destructor_) 748 if (in_destructor_)
749 return; 749 return;
750 750
751 ProcessWillChangeWindowPredefinedCursor(window, cursor_id); 751 ProcessWillChangeWindowPredefinedCursor(window, cursor_id);
752 752
753 UpdateNativeCursorIfOver(window); 753 UpdateNativeCursorIfOver(window);
754 } 754 }
755 755
756 void WindowServer::OnWindowNonClientCursorChanged(ServerWindow* window, 756 void WindowServer::OnWindowNonClientCursorChanged(ServerWindow* window,
757 int32_t cursor_id) { 757 mojom::Cursor cursor_id) {
758 if (in_destructor_) 758 if (in_destructor_)
759 return; 759 return;
760 760
761 UpdateNativeCursorIfOver(window); 761 UpdateNativeCursorIfOver(window);
762 } 762 }
763 763
764 void WindowServer::OnWindowSharedPropertyChanged( 764 void WindowServer::OnWindowSharedPropertyChanged(
765 ServerWindow* window, 765 ServerWindow* window,
766 const std::string& name, 766 const std::string& name,
767 const std::vector<uint8_t>* new_data) { 767 const std::vector<uint8_t>* new_data) {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 void WindowServer::OnUserIdAdded(const UserId& id) { 819 void WindowServer::OnUserIdAdded(const UserId& id) {
820 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr); 820 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr);
821 } 821 }
822 822
823 void WindowServer::OnUserIdRemoved(const UserId& id) { 823 void WindowServer::OnUserIdRemoved(const UserId& id) {
824 activity_monitor_map_.erase(id); 824 activity_monitor_map_.erase(id);
825 } 825 }
826 826
827 } // namespace ws 827 } // namespace ws
828 } // namespace ui 828 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/ws/window_server.h ('k') | services/ui/ws/window_tree.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698