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

Side by Side Diff: services/ui/public/cpp/window_tree_client.cc

Issue 2248263003: Updates PointerEventRouter to handle switching move type (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge again Created 4 years, 4 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 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/public/cpp/window_tree_client.h" 5 #include "services/ui/public/cpp/window_tree_client.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 base::subtle::Atomic32 location = 625 base::subtle::Atomic32 location =
626 base::subtle::NoBarrier_Load(cursor_location_memory()); 626 base::subtle::NoBarrier_Load(cursor_location_memory());
627 return gfx::Point(static_cast<int16_t>(location >> 16), 627 return gfx::Point(static_cast<int16_t>(location >> 16),
628 static_cast<int16_t>(location & 0xFFFF)); 628 static_cast<int16_t>(location & 0xFFFF));
629 } 629 }
630 630
631 void WindowTreeClient::StartPointerWatcher(bool want_moves) { 631 void WindowTreeClient::StartPointerWatcher(bool want_moves) {
632 if (has_pointer_watcher_) 632 if (has_pointer_watcher_)
633 StopPointerWatcher(); 633 StopPointerWatcher();
634 has_pointer_watcher_ = true; 634 has_pointer_watcher_ = true;
635 pointer_watcher_id_++; 635 tree_->StartPointerWatcher(want_moves);
636 if (pointer_watcher_id_ == 0)
637 pointer_watcher_id_++;
638 tree_->StartPointerWatcher(want_moves, pointer_watcher_id_);
639 } 636 }
640 637
641 void WindowTreeClient::StopPointerWatcher() { 638 void WindowTreeClient::StopPointerWatcher() {
642 DCHECK(has_pointer_watcher_); 639 DCHECK(has_pointer_watcher_);
643 tree_->StopPointerWatcher(); 640 tree_->StopPointerWatcher();
644 has_pointer_watcher_ = false; 641 has_pointer_watcher_ = false;
645 } 642 }
646 643
647 void WindowTreeClient::PerformWindowMove( 644 void WindowTreeClient::PerformWindowMove(
648 Window* window, 645 Window* window,
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 InFlightPropertyChange new_change(window, name, new_data); 971 InFlightPropertyChange new_change(window, name, new_data);
975 if (ApplyServerChangeToExistingInFlightChange(new_change)) 972 if (ApplyServerChangeToExistingInFlightChange(new_change))
976 return; 973 return;
977 974
978 WindowPrivate(window).LocalSetSharedProperty(name, std::move(new_data)); 975 WindowPrivate(window).LocalSetSharedProperty(name, std::move(new_data));
979 } 976 }
980 977
981 void WindowTreeClient::OnWindowInputEvent(uint32_t event_id, 978 void WindowTreeClient::OnWindowInputEvent(uint32_t event_id,
982 Id window_id, 979 Id window_id,
983 std::unique_ptr<ui::Event> event, 980 std::unique_ptr<ui::Event> event,
984 uint32_t pointer_watcher_id) { 981 bool matches_pointer_watcher) {
985 DCHECK(event); 982 DCHECK(event);
986 Window* window = GetWindowByServerId(window_id); // May be null. 983 Window* window = GetWindowByServerId(window_id); // May be null.
987 984
988 // Non-zero pointer_watcher_id means it matched a pointer watcher on the 985 if (matches_pointer_watcher && has_pointer_watcher_) {
989 // server.
990 if (pointer_watcher_id_ != 0 && has_pointer_watcher_ &&
991 pointer_watcher_id == pointer_watcher_id_) {
992 DCHECK(event->IsPointerEvent()); 986 DCHECK(event->IsPointerEvent());
993 delegate_->OnPointerEventObserved(*event->AsPointerEvent(), window); 987 delegate_->OnPointerEventObserved(*event->AsPointerEvent(), window);
994 } 988 }
995 989
996 if (!window || !window->input_event_handler_) { 990 if (!window || !window->input_event_handler_) {
997 tree_->OnWindowInputEventAck(event_id, mojom::EventResult::UNHANDLED); 991 tree_->OnWindowInputEventAck(event_id, mojom::EventResult::UNHANDLED);
998 return; 992 return;
999 } 993 }
1000 994
1001 std::unique_ptr<base::Callback<void(mojom::EventResult)>> ack_callback( 995 std::unique_ptr<base::Callback<void(mojom::EventResult)>> ack_callback(
(...skipping 14 matching lines...) Expand all
1016 &ack_callback); 1010 &ack_callback);
1017 } 1011 }
1018 1012
1019 // The handler did not take ownership of the callback, so we send the ack, 1013 // The handler did not take ownership of the callback, so we send the ack,
1020 // marking the event as not consumed. 1014 // marking the event as not consumed.
1021 if (ack_callback) 1015 if (ack_callback)
1022 ack_callback->Run(mojom::EventResult::UNHANDLED); 1016 ack_callback->Run(mojom::EventResult::UNHANDLED);
1023 } 1017 }
1024 1018
1025 void WindowTreeClient::OnPointerEventObserved(std::unique_ptr<ui::Event> event, 1019 void WindowTreeClient::OnPointerEventObserved(std::unique_ptr<ui::Event> event,
1026 uint32_t pointer_watcher_id,
1027 uint32_t window_id) { 1020 uint32_t window_id) {
1028 DCHECK(event); 1021 DCHECK(event);
1029 DCHECK(event->IsPointerEvent()); 1022 DCHECK(event->IsPointerEvent());
1030 if (has_pointer_watcher_ && pointer_watcher_id == pointer_watcher_id_) { 1023 if (has_pointer_watcher_) {
1031 Window* target_window = GetWindowByServerId(window_id); 1024 Window* target_window = GetWindowByServerId(window_id);
1032 delegate_->OnPointerEventObserved(*event->AsPointerEvent(), target_window); 1025 delegate_->OnPointerEventObserved(*event->AsPointerEvent(), target_window);
1033 } 1026 }
1034 } 1027 }
1035 1028
1036 void WindowTreeClient::OnWindowFocused(Id focused_window_id) { 1029 void WindowTreeClient::OnWindowFocused(Id focused_window_id) {
1037 Window* focused_window = GetWindowByServerId(focused_window_id); 1030 Window* focused_window = GetWindowByServerId(focused_window_id);
1038 InFlightFocusChange new_change(this, focused_window); 1031 InFlightFocusChange new_change(this, focused_window);
1039 if (ApplyServerChangeToExistingInFlightChange(new_change)) 1032 if (ApplyServerChangeToExistingInFlightChange(new_change))
1040 return; 1033 return;
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
1265 Window* window, 1258 Window* window,
1266 const gfx::Vector2d& offset, 1259 const gfx::Vector2d& offset,
1267 const gfx::Insets& hit_area) { 1260 const gfx::Insets& hit_area) {
1268 if (window_manager_internal_client_) { 1261 if (window_manager_internal_client_) {
1269 window_manager_internal_client_->SetUnderlaySurfaceOffsetAndExtendedHitArea( 1262 window_manager_internal_client_->SetUnderlaySurfaceOffsetAndExtendedHitArea(
1270 server_id(window), offset.x(), offset.y(), hit_area); 1263 server_id(window), offset.x(), offset.y(), hit_area);
1271 } 1264 }
1272 } 1265 }
1273 1266
1274 } // namespace ui 1267 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/public/cpp/window_tree_client.h ('k') | services/ui/public/interfaces/window_tree.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698