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

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

Issue 2685883003: chromeos: converts observed pointer events to DIPs (Closed)
Patch Set: merge Created 3 years, 10 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_tree.h ('k') | services/ui/ws/window_tree_client_unittest.cc » ('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_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 780 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 if (!IsWindowKnown(window, &client_window_id) || 791 if (!IsWindowKnown(window, &client_window_id) ||
792 !IsWindowKnown(parent_window, &parent_client_window_id) || 792 !IsWindowKnown(parent_window, &parent_client_window_id) ||
793 !created_window_map_.count(parent_window->id())) { 793 !created_window_map_.count(parent_window->id())) {
794 return; 794 return;
795 } 795 }
796 796
797 client()->OnWindowSurfaceChanged(client_window_id.id, surface_info); 797 client()->OnWindowSurfaceChanged(client_window_id.id, surface_info);
798 } 798 }
799 799
800 void WindowTree::SendToPointerWatcher(const ui::Event& event, 800 void WindowTree::SendToPointerWatcher(const ui::Event& event,
801 ServerWindow* target_window) { 801 ServerWindow* target_window,
802 int64_t display_id) {
802 if (!EventMatchesPointerWatcher(event)) 803 if (!EventMatchesPointerWatcher(event))
803 return; 804 return;
804 805
805 ClientWindowId client_window_id; 806 ClientWindowId client_window_id;
806 // Ignore the return value from IsWindowKnown() as in the case of the client 807 // Ignore the return value from IsWindowKnown() as in the case of the client
807 // not knowing the window we'll send 0, which corresponds to no window. 808 // not knowing the window we'll send 0, which corresponds to no window.
808 IsWindowKnown(target_window, &client_window_id); 809 IsWindowKnown(target_window, &client_window_id);
809 client()->OnPointerEventObserved(ui::Event::Clone(event), 810 client()->OnPointerEventObserved(ui::Event::Clone(event), client_window_id.id,
810 client_window_id.id); 811 display_id);
811 } 812 }
812 813
813 bool WindowTree::ShouldRouteToWindowManager(const ServerWindow* window) const { 814 bool WindowTree::ShouldRouteToWindowManager(const ServerWindow* window) const {
814 if (window_manager_state_) 815 if (window_manager_state_)
815 return false; // We are the window manager, don't route to ourself. 816 return false; // We are the window manager, don't route to ourself.
816 817
817 // If the client created this window, then do not route it through the WM. 818 // If the client created this window, then do not route it through the WM.
818 if (window->id().client_id == id_) 819 if (window->id().client_id == id_)
819 return false; 820 return false;
820 821
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
1139 1140
1140 void WindowTree::DispatchInputEventImpl(ServerWindow* target, 1141 void WindowTree::DispatchInputEventImpl(ServerWindow* target,
1141 const ui::Event& event) { 1142 const ui::Event& event) {
1142 GenerateEventAckId(); 1143 GenerateEventAckId();
1143 WindowManagerDisplayRoot* display_root = GetWindowManagerDisplayRoot(target); 1144 WindowManagerDisplayRoot* display_root = GetWindowManagerDisplayRoot(target);
1144 DCHECK(display_root); 1145 DCHECK(display_root);
1145 event_source_wms_ = display_root->window_manager_state(); 1146 event_source_wms_ = display_root->window_manager_state();
1146 // Should only get events from windows attached to a host. 1147 // Should only get events from windows attached to a host.
1147 DCHECK(event_source_wms_); 1148 DCHECK(event_source_wms_);
1148 bool matched_pointer_watcher = EventMatchesPointerWatcher(event); 1149 bool matched_pointer_watcher = EventMatchesPointerWatcher(event);
1150 Display* display = GetDisplay(target);
1151 DCHECK(display);
1149 client()->OnWindowInputEvent( 1152 client()->OnWindowInputEvent(
1150 event_ack_id_, ClientWindowIdForWindow(target).id, 1153 event_ack_id_, ClientWindowIdForWindow(target).id, display->GetId(),
1151 ui::Event::Clone(event), matched_pointer_watcher); 1154 ui::Event::Clone(event), matched_pointer_watcher);
1152 } 1155 }
1153 1156
1154 bool WindowTree::EventMatchesPointerWatcher(const ui::Event& event) const { 1157 bool WindowTree::EventMatchesPointerWatcher(const ui::Event& event) const {
1155 if (!has_pointer_watcher_) 1158 if (!has_pointer_watcher_)
1156 return false; 1159 return false;
1157 if (!event.IsPointerEvent()) 1160 if (!event.IsPointerEvent())
1158 return false; 1161 return false;
1159 if (pointer_watcher_want_moves_ && event.type() == ui::ET_POINTER_MOVED) 1162 if (pointer_watcher_want_moves_ && event.type() == ui::ET_POINTER_MOVED)
1160 return true; 1163 return true;
(...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after
2151 client()->OnCompleteDrop(client_window_id.id, event_flags, cursor_offset, 2154 client()->OnCompleteDrop(client_window_id.id, event_flags, cursor_offset,
2152 effect_bitmask, callback); 2155 effect_bitmask, callback);
2153 } 2156 }
2154 2157
2155 void WindowTree::PerformOnDragDropDone() { 2158 void WindowTree::PerformOnDragDropDone() {
2156 client()->OnDragDropDone(); 2159 client()->OnDragDropDone();
2157 } 2160 }
2158 2161
2159 } // namespace ws 2162 } // namespace ws
2160 } // namespace ui 2163 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/ws/window_tree.h ('k') | services/ui/ws/window_tree_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698