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

Side by Side Diff: components/mus/ws/window_manager_state.cc

Issue 2060513002: Tab dragging as implemented as a mus API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use not not pattern to fix win compile Created 4 years, 5 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
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 "components/mus/ws/window_manager_state.h" 5 #include "components/mus/ws/window_manager_state.h"
6 6
7 #include "base/memory/weak_ptr.h" 7 #include "base/memory/weak_ptr.h"
8 #include "components/mus/common/event_matcher_util.h" 8 #include "components/mus/common/event_matcher_util.h"
9 #include "components/mus/ws/accelerator.h" 9 #include "components/mus/ws/accelerator.h"
10 #include "components/mus/ws/display_manager.h" 10 #include "components/mus/ws/display_manager.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 std::unique_ptr<ui::Event> CoalesceEvents(std::unique_ptr<ui::Event> first, 49 std::unique_ptr<ui::Event> CoalesceEvents(std::unique_ptr<ui::Event> first,
50 std::unique_ptr<ui::Event> second) { 50 std::unique_ptr<ui::Event> second) {
51 DCHECK(first->type() == ui::ET_POINTER_MOVED) 51 DCHECK(first->type() == ui::ET_POINTER_MOVED)
52 << " Non-move events cannot be merged yet."; 52 << " Non-move events cannot be merged yet.";
53 // For mouse moves, the new event just replaces the old event. 53 // For mouse moves, the new event just replaces the old event.
54 return second; 54 return second;
55 } 55 }
56 56
57 } // namespace 57 } // namespace
58 58
59 struct WindowManagerState::CurrentMoveLoopState {
60 uint32_t change_id;
61 WindowId window_id;
62 gfx::Rect revert_bounds;
63 };
64
59 class WindowManagerState::ProcessedEventTarget { 65 class WindowManagerState::ProcessedEventTarget {
60 public: 66 public:
61 ProcessedEventTarget(ServerWindow* window, 67 ProcessedEventTarget(ServerWindow* window,
62 ClientSpecificId client_id, 68 ClientSpecificId client_id,
63 Accelerator* accelerator) 69 Accelerator* accelerator)
64 : client_id_(client_id) { 70 : client_id_(client_id) {
65 tracker_.Add(window); 71 tracker_.Add(window);
66 if (accelerator) 72 if (accelerator)
67 accelerator_ = accelerator->GetWeakPtr(); 73 accelerator_ = accelerator->GetWeakPtr();
68 } 74 }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 #if !defined(NDEBUG) 128 #if !defined(NDEBUG)
123 if (window) { 129 if (window) {
124 WindowManagerDisplayRoot* display_root = 130 WindowManagerDisplayRoot* display_root =
125 display_manager()->GetWindowManagerDisplayRoot(window); 131 display_manager()->GetWindowManagerDisplayRoot(window);
126 DCHECK(display_root && display_root->window_manager_state() == this); 132 DCHECK(display_root && display_root->window_manager_state() == this);
127 } 133 }
128 #endif 134 #endif
129 return event_dispatcher_.SetCaptureWindow(window, client_id); 135 return event_dispatcher_.SetCaptureWindow(window, client_id);
130 } 136 }
131 137
138 void WindowManagerState::StartMoveLoop(uint32_t change_id,
139 WindowId window_id,
140 const gfx::Rect& revert_bounds) {
141 current_move_loop_.reset(
142 new CurrentMoveLoopState{change_id, window_id, revert_bounds});
143 }
144
145 void WindowManagerState::EndMoveLoop() {
146 current_move_loop_.reset();
147 }
148
149 uint32_t WindowManagerState::GetCurrentMoveLoopChangeId() {
150 if (current_move_loop_)
151 return current_move_loop_->change_id;
152 return 0;
153 }
154
155 WindowId WindowManagerState::GetCurrentMoveLoopWindowId() {
156 if (current_move_loop_)
157 return current_move_loop_->window_id;
158 return WindowId();
159 }
160
161 gfx::Rect WindowManagerState::GetCurrentMoveLoopRevertBounds() {
162 if (current_move_loop_)
163 return current_move_loop_->revert_bounds;
164 return gfx::Rect();
165 }
166
132 void WindowManagerState::ReleaseCaptureBlockedByModalWindow( 167 void WindowManagerState::ReleaseCaptureBlockedByModalWindow(
133 const ServerWindow* modal_window) { 168 const ServerWindow* modal_window) {
134 event_dispatcher_.ReleaseCaptureBlockedByModalWindow(modal_window); 169 event_dispatcher_.ReleaseCaptureBlockedByModalWindow(modal_window);
135 } 170 }
136 171
137 void WindowManagerState::ReleaseCaptureBlockedByAnyModalWindow() { 172 void WindowManagerState::ReleaseCaptureBlockedByAnyModalWindow() {
138 event_dispatcher_.ReleaseCaptureBlockedByAnyModalWindow(); 173 event_dispatcher_.ReleaseCaptureBlockedByAnyModalWindow();
139 } 174 }
140 175
141 void WindowManagerState::AddSystemModalWindow(ServerWindow* window) { 176 void WindowManagerState::AddSystemModalWindow(ServerWindow* window) {
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 return display_root ? display_root->root() : nullptr; 492 return display_root ? display_root->root() : nullptr;
458 } 493 }
459 494
460 void WindowManagerState::OnEventTargetNotFound(const ui::Event& event) { 495 void WindowManagerState::OnEventTargetNotFound(const ui::Event& event) {
461 window_server()->SendToEventObservers(event, user_id(), 496 window_server()->SendToEventObservers(event, user_id(),
462 nullptr /* ignore_tree */); 497 nullptr /* ignore_tree */);
463 } 498 }
464 499
465 } // namespace ws 500 } // namespace ws
466 } // namespace mus 501 } // namespace mus
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698