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

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

Issue 2183163002: mus: Change PointerWatcher to observe all pointer events, with moves optional. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ifs 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 #ifndef SERVICES_UI_WS_WINDOW_TREE_H_ 5 #ifndef SERVICES_UI_WS_WINDOW_TREE_H_
6 #define SERVICES_UI_WS_WINDOW_TREE_H_ 6 #define SERVICES_UI_WS_WINDOW_TREE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 const ServerWindow* new_focused_window); 234 const ServerWindow* new_focused_window);
235 void ProcessLostCapture(const ServerWindow* old_lost_capture, 235 void ProcessLostCapture(const ServerWindow* old_lost_capture,
236 bool originated_change); 236 bool originated_change);
237 void ProcessTransientWindowAdded(const ServerWindow* window, 237 void ProcessTransientWindowAdded(const ServerWindow* window,
238 const ServerWindow* transient_window, 238 const ServerWindow* transient_window,
239 bool originated_change); 239 bool originated_change);
240 void ProcessTransientWindowRemoved(const ServerWindow* window, 240 void ProcessTransientWindowRemoved(const ServerWindow* window,
241 const ServerWindow* transient_window, 241 const ServerWindow* transient_window,
242 bool originated_change); 242 bool originated_change);
243 243
244 // Sends this event to the client if it matches an active event observer. 244 // Sends this event to the client if it matches an active pointer watcher.
245 void SendToEventObserver(const ui::Event& event); 245 void SendToPointerWatcher(const ui::Event& event);
246 246
247 private: 247 private:
248 friend class test::WindowTreeTestApi; 248 friend class test::WindowTreeTestApi;
249 249
250 struct WaitingForTopLevelWindowInfo { 250 struct WaitingForTopLevelWindowInfo {
251 WaitingForTopLevelWindowInfo(const ClientWindowId& client_window_id, 251 WaitingForTopLevelWindowInfo(const ClientWindowId& client_window_id,
252 uint32_t wm_change_id) 252 uint32_t wm_change_id)
253 : client_window_id(client_window_id), wm_change_id(wm_change_id) {} 253 : client_window_id(client_window_id), wm_change_id(wm_change_id) {}
254 ~WaitingForTopLevelWindowInfo() {} 254 ~WaitingForTopLevelWindowInfo() {}
255 255
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 bool CanEmbed(const ClientWindowId& window_id) const; 330 bool CanEmbed(const ClientWindowId& window_id) const;
331 void PrepareForEmbed(ServerWindow* window); 331 void PrepareForEmbed(ServerWindow* window);
332 void RemoveChildrenAsPartOfEmbed(ServerWindow* window); 332 void RemoveChildrenAsPartOfEmbed(ServerWindow* window);
333 333
334 // Generates a new event id for an accelerator or event ack, sets it in 334 // Generates a new event id for an accelerator or event ack, sets it in
335 // |event_ack_id_| and returns it. 335 // |event_ack_id_| and returns it.
336 uint32_t GenerateEventAckId(); 336 uint32_t GenerateEventAckId();
337 337
338 void DispatchInputEventImpl(ServerWindow* target, const ui::Event& event); 338 void DispatchInputEventImpl(ServerWindow* target, const ui::Event& event);
339 339
340 // Returns true if the client has a pointer watcher and this event matches.
341 bool EventMatchesPointerWatcher(const ui::Event& event);
342
340 // Calls OnChangeCompleted() on the client. 343 // Calls OnChangeCompleted() on the client.
341 void NotifyChangeCompleted(uint32_t change_id, 344 void NotifyChangeCompleted(uint32_t change_id,
342 mojom::WindowManagerErrorCode error_code); 345 mojom::WindowManagerErrorCode error_code);
343 346
344 // WindowTree: 347 // WindowTree:
345 void NewWindow(uint32_t change_id, 348 void NewWindow(uint32_t change_id,
346 Id transport_window_id, 349 Id transport_window_id,
347 mojo::Map<mojo::String, mojo::Array<uint8_t>> 350 mojo::Map<mojo::String, mojo::Array<uint8_t>>
348 transport_properties) override; 351 transport_properties) override;
349 void NewTopLevelWindow(uint32_t change_id, 352 void NewTopLevelWindow(uint32_t change_id,
(...skipping 12 matching lines...) Expand all
362 void ReorderWindow(uint32_t change_Id, 365 void ReorderWindow(uint32_t change_Id,
363 Id window_id, 366 Id window_id,
364 Id relative_window_id, 367 Id relative_window_id,
365 mojom::OrderDirection direction) override; 368 mojom::OrderDirection direction) override;
366 void GetWindowTree( 369 void GetWindowTree(
367 Id window_id, 370 Id window_id,
368 const base::Callback<void(mojo::Array<mojom::WindowDataPtr>)>& callback) 371 const base::Callback<void(mojo::Array<mojom::WindowDataPtr>)>& callback)
369 override; 372 override;
370 void SetCapture(uint32_t change_id, Id window_id) override; 373 void SetCapture(uint32_t change_id, Id window_id) override;
371 void ReleaseCapture(uint32_t change_id, Id window_id) override; 374 void ReleaseCapture(uint32_t change_id, Id window_id) override;
372 void SetEventObserver(mojom::EventMatcherPtr matcher, 375 void StartPointerWatcher(bool want_moves,
373 uint32_t observer_id) override; 376 uint32_t pointer_watcher_id) override;
377 void StopPointerWatcher() override;
374 void SetWindowBounds(uint32_t change_id, 378 void SetWindowBounds(uint32_t change_id,
375 Id window_id, 379 Id window_id,
376 const gfx::Rect& bounds) override; 380 const gfx::Rect& bounds) override;
377 void SetWindowVisibility(uint32_t change_id, 381 void SetWindowVisibility(uint32_t change_id,
378 Id window_id, 382 Id window_id,
379 bool visible) override; 383 bool visible) override;
380 void SetWindowProperty(uint32_t change_id, 384 void SetWindowProperty(uint32_t change_id,
381 Id transport_window_id, 385 Id transport_window_id,
382 const mojo::String& name, 386 const mojo::String& name,
383 mojo::Array<uint8_t> value) override; 387 mojo::Array<uint8_t> value) override;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 // client (ClientWindowId). 482 // client (ClientWindowId).
479 base::hash_map<ClientWindowId, WindowId> client_id_to_window_id_map_; 483 base::hash_map<ClientWindowId, WindowId> client_id_to_window_id_map_;
480 base::hash_map<WindowId, ClientWindowId> window_id_to_client_id_map_; 484 base::hash_map<WindowId, ClientWindowId> window_id_to_client_id_map_;
481 485
482 uint32_t event_ack_id_; 486 uint32_t event_ack_id_;
483 487
484 // A client is considered janky if it hasn't ACK'ed input events within a 488 // A client is considered janky if it hasn't ACK'ed input events within a
485 // reasonable timeframe. 489 // reasonable timeframe.
486 bool janky_ = false; 490 bool janky_ = false;
487 491
488 // Set when the client is using SetEventObserver() to observe events, 492 // Whether the client is observing pointer events.
489 // otherwise null. 493 bool has_pointer_watcher_ = false;
490 std::unique_ptr<EventMatcher> event_observer_matcher_;
491 494
492 // The ID supplied by the client for the current event observer. 495 // For performance reasons, only send move events if the client explicitly
493 uint32_t event_observer_id_ = 0; 496 // requests them.
497 bool pointer_watcher_want_moves_ = false;
498
499 // The ID supplied by the client for the current pointer watcher.
500 uint32_t pointer_watcher_id_ = 0;
494 501
495 // WindowManager the current event came from. 502 // WindowManager the current event came from.
496 WindowManagerState* event_source_wms_ = nullptr; 503 WindowManagerState* event_source_wms_ = nullptr;
497 504
498 std::queue<std::unique_ptr<TargetedEvent>> event_queue_; 505 std::queue<std::unique_ptr<TargetedEvent>> event_queue_;
499 506
500 std::unique_ptr<mojo::AssociatedBinding<mojom::WindowManagerClient>> 507 std::unique_ptr<mojo::AssociatedBinding<mojom::WindowManagerClient>>
501 window_manager_internal_client_binding_; 508 window_manager_internal_client_binding_;
502 mojom::WindowManager* window_manager_internal_; 509 mojom::WindowManager* window_manager_internal_;
503 std::unique_ptr<WindowManagerState> window_manager_state_; 510 std::unique_ptr<WindowManagerState> window_manager_state_;
504 511
505 std::unique_ptr<WaitingForTopLevelWindowInfo> 512 std::unique_ptr<WaitingForTopLevelWindowInfo>
506 waiting_for_top_level_window_info_; 513 waiting_for_top_level_window_info_;
507 bool embedder_intercepts_events_ = false; 514 bool embedder_intercepts_events_ = false;
508 515
509 DISALLOW_COPY_AND_ASSIGN(WindowTree); 516 DISALLOW_COPY_AND_ASSIGN(WindowTree);
510 }; 517 };
511 518
512 } // namespace ws 519 } // namespace ws
513 } // namespace ui 520 } // namespace ui
514 521
515 #endif // SERVICES_UI_WS_WINDOW_TREE_H_ 522 #endif // SERVICES_UI_WS_WINDOW_TREE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698