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

Side by Side Diff: services/ui/public/interfaces/window_tree.mojom

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: DCHECK 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 module ui.mojom; 5 module ui.mojom;
6 6
7 import "cc/ipc/surface_id.mojom"; 7 import "cc/ipc/surface_id.mojom";
8 import "services/ui/public/interfaces/cursor.mojom"; 8 import "services/ui/public/interfaces/cursor.mojom";
9 import "services/ui/public/interfaces/event_matcher.mojom"; 9 import "services/ui/public/interfaces/event_matcher.mojom";
10 import "services/ui/public/interfaces/mus_constants.mojom"; 10 import "services/ui/public/interfaces/mus_constants.mojom";
(...skipping 14 matching lines...) Expand all
25 // WindowTree completes processing of a function WindowTree calls 25 // WindowTree completes processing of a function WindowTree calls
26 // WindowTreeClient::OnChangeCompleted() with the change_id supplied by the 26 // WindowTreeClient::OnChangeCompleted() with the change_id supplied by the
27 // client and the result of the function. This allows the client to track 27 // client and the result of the function. This allows the client to track
28 // whether the call succeeded or not. Calls are done via the client interface 28 // whether the call succeeded or not. Calls are done via the client interface
29 // rather than a callback to ensure ordering. The server does not interpret the 29 // rather than a callback to ensure ordering. The server does not interpret the
30 // change id in anyway, it is up to the client to assign a value and use it. 30 // change id in anyway, it is up to the client to assign a value and use it.
31 // Generally the change id is an ever increasing integer. 31 // Generally the change id is an ever increasing integer.
32 // 32 //
33 // Event processing happens in the following order: 33 // Event processing happens in the following order:
34 // . The event is sent to the accelerator registered for the PRE_TARGET. If 34 // . The event is sent to the accelerator registered for the PRE_TARGET. If
35 // the client consumes the event, matching event observers are notified and 35 // the client consumes the event, matching pointer watchers are notified and
36 // processing stops. If the client does not consume the event processing 36 // processing stops. If the client does not consume the event processing
37 // continues. 37 // continues.
38 // . Target window (lookup of the target window depends upon the event type) and 38 // . Target window (lookup of the target window depends upon the event type) and
39 // matching event observers are notified at the same time. The target is only 39 // matching pointer watchers are notified at the same time. The target is only
40 // notified once, even if it has a matching event observer registered. If the 40 // notified once, even if it has a matching pointer watcher registered. If the
41 // target consumes the event, processing stops. 41 // target consumes the event, processing stops.
42 // . Accelerator registered for POST_TARGET. No response is expected from the 42 // . Accelerator registered for POST_TARGET. No response is expected from the
43 // client for the POST_TARGET and processing of the next continues 43 // client for the POST_TARGET and processing of the next continues
44 // immediately. 44 // immediately.
45 interface WindowTree { 45 interface WindowTree {
46 // Creates a new window with the specified id. It is up to the client to 46 // Creates a new window with the specified id. It is up to the client to
47 // ensure the id is unique to the connection (the id need not be globally 47 // ensure the id is unique to the connection (the id need not be globally
48 // unique). Additionally the connection id (embedded in |window_id|) must 48 // unique). Additionally the connection id (embedded in |window_id|) must
49 // match that of the connection. 49 // match that of the connection.
50 // Errors: 50 // Errors:
(...skipping 22 matching lines...) Expand all
73 // current input events are canceled. The given window will receive all 73 // current input events are canceled. The given window will receive all
74 // subsequent input until an alternate window is set via SetCapture, or 74 // subsequent input until an alternate window is set via SetCapture, or
75 // ReleaseCapture is called for |window_id|. OnLostCapture is called to notify 75 // ReleaseCapture is called for |window_id|. OnLostCapture is called to notify
76 // of capture ending. 76 // of capture ending.
77 SetCapture(uint32 change_id, uint32 window_id); 77 SetCapture(uint32 change_id, uint32 window_id);
78 78
79 // Releases input event capture for the given |window_id|. This does nothing 79 // Releases input event capture for the given |window_id|. This does nothing
80 // if |window_id| does not currently have capture. 80 // if |window_id| does not currently have capture.
81 ReleaseCapture(uint32 change_id, uint32 window_id); 81 ReleaseCapture(uint32 change_id, uint32 window_id);
82 82
83 // Sets an observer that monitors all events, even if they are not targeted 83 // Starts the pointer watcher that monitors all events (including move events
sky 2016/08/04 20:40:26 'all events' -> 'pointer events' right? Also, expl
riajiang 2016/08/04 21:22:06 Changed to "pointer events". But I thought we wou
sky 2016/08/04 23:08:44 Consider if you did send the exit/enter and the cl
James Cook 2016/08/05 16:26:45 sky@, what do you think about having PointerWatche
riajiang 2016/08/05 17:36:02 Okay I see. Done.
riajiang 2016/08/05 17:36:03 No worries. Changed it to not match enter/exit. Di
84 // at a window in this tree. If an event matchs |matcher| the observer reports 84 // if |want_moves| is true), even if they are not targeted at a window in this
85 // it to the WindowTreeClient via OnWindowInputEvent (if the event target is 85 // tree. If an event matches the pointer watcher the observer reports it to
sky 2016/08/04 20:40:26 'matches the pointer watcher' ? There is no pointe
riajiang 2016/08/05 17:36:03 Done and done.
86 // this window tree) or OnEventObserved (if the target is another tree). The 86 // the WindowTreeClient via OnWindowInputEvent (if the event target is this
87 // window tree) or OnPointerEventObserved (if the target is another tree). The
87 // client must supply a non-zero |observer_id|, which is reported back with 88 // client must supply a non-zero |observer_id|, which is reported back with
88 // observed events. Set the matcher to null to clear the observer. 89 // observed events. The client should prefer |want_moves| to be false, as
90 // there's a system-wide performance/battery penalty for listening to moves.
89 // 91 //
90 // See class description for details on event delivery. 92 // See class description for details on event delivery.
91 SetEventObserver(EventMatcher? matcher, uint32 observer_id); 93 StartPointerWatcher(bool want_moves, uint32 observer_id);
94
95 // Stops the pointer watcher for all events.
96 StopPointerWatcher();
92 97
93 // Sets the specified bounds of the specified window. 98 // Sets the specified bounds of the specified window.
94 SetWindowBounds(uint32 change_id, uint32 window_id, gfx.mojom.Rect bounds); 99 SetWindowBounds(uint32 change_id, uint32 window_id, gfx.mojom.Rect bounds);
95 100
96 // Sets the client area of the specified window. The client area is specified 101 // Sets the client area of the specified window. The client area is specified
97 // by way of insets. Everything outside of the insets, and not in 102 // by way of insets. Everything outside of the insets, and not in
98 // |additional_client_areas| is considered non-client area. 103 // |additional_client_areas| is considered non-client area.
99 // TODO(sky): convert additional_client_areas to a path. 104 // TODO(sky): convert additional_client_areas to a path.
100 SetClientArea(uint32 window_id, 105 SetClientArea(uint32 window_id,
101 gfx.mojom.Insets insets, 106 gfx.mojom.Insets insets,
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 364
360 // Invoked when a window property is changed. If this change is a removal, 365 // Invoked when a window property is changed. If this change is a removal,
361 // |new_data| is null. 366 // |new_data| is null.
362 OnWindowSharedPropertyChanged(uint32 window, 367 OnWindowSharedPropertyChanged(uint32 window,
363 string name, 368 string name,
364 array<uint8>? new_data); 369 array<uint8>? new_data);
365 370
366 // Invoked when an event is targeted at the specified window. The client must 371 // Invoked when an event is targeted at the specified window. The client must
367 // call WindowTree::OnWindowInputEventAck() with the same |event_id| to notify 372 // call WindowTree::OnWindowInputEventAck() with the same |event_id| to notify
368 // that the event has been processed, and with an EventResult value to notify 373 // that the event has been processed, and with an EventResult value to notify
369 // if the event was consumed. |event_observer_id| is non-zero if the event 374 // if the event was consumed. |pointer_watcher_id| is non-zero if the event
370 // also matched the active event observer for this client. The client will not 375 // also matched the active pointer watcher for this client. The client will
sky 2016/08/04 20:40:26 Again, there is no pointer watcher (at least from
riajiang 2016/08/05 17:36:03 Done.
371 // receive farther events until the event is ack'ed. 376 // not receive farther events until the event is ack'ed.
372 OnWindowInputEvent(uint32 event_id, 377 OnWindowInputEvent(uint32 event_id,
373 uint32 window, 378 uint32 window,
374 ui.mojom.Event event, 379 ui.mojom.Event event,
375 uint32 event_observer_id); 380 uint32 pointer_watcher_id);
376 381
377 // Invoked when an |event| is sent via the EventObserver and not targeted at a 382 // Invoked when an |event| is sent via the PointerWatcher and not targeted at
sky 2016/08/04 20:40:26 There is no PointerWatcher in this code. I think y
riajiang 2016/08/05 17:36:03 Done.
378 // specific window. The |event_observer_id| is the one supplied to 383 // a specific window. The |pointer_watcher_id| is the one supplied to
379 // SetEventObserver. The client should not acknowledge these events. 384 // StartPointerWatcher. The client should not acknowledge these events.
380 OnEventObserved(ui.mojom.Event event, uint32 event_observer_id); 385 OnPointerEventObserved(ui.mojom.Event event, uint32 pointer_watcher_id);
381 386
382 // Called in two distinct cases: when a window known to the connection gains 387 // Called in two distinct cases: when a window known to the connection gains
383 // focus, or when focus moves from a window known to the connection to a 388 // focus, or when focus moves from a window known to the connection to a
384 // window not known to the connection. In the later case |focused_window_id| 389 // window not known to the connection. In the later case |focused_window_id|
385 // is 0. As with other functions this is only called if the client did not 390 // is 0. As with other functions this is only called if the client did not
386 // initiate the change. 391 // initiate the change.
387 OnWindowFocused(uint32 focused_window_id); 392 OnWindowFocused(uint32 focused_window_id);
388 393
389 OnWindowPredefinedCursorChanged(uint32 window_id, Cursor cursor_id); 394 OnWindowPredefinedCursorChanged(uint32 window_id, Cursor cursor_id);
390 395
391 // A change initiated from the client has completed. See description of 396 // A change initiated from the client has completed. See description of
392 // change ids for details. 397 // change ids for details.
393 OnChangeCompleted(uint32 change_id, bool success); 398 OnChangeCompleted(uint32 change_id, bool success);
394 399
395 // The WindowManager is requesting the specified window to close. If the 400 // The WindowManager is requesting the specified window to close. If the
396 // client allows the change it should delete the window. 401 // client allows the change it should delete the window.
397 RequestClose(uint32 window_id); 402 RequestClose(uint32 window_id);
398 403
399 // See description of WindowManager for details. 404 // See description of WindowManager for details.
400 GetWindowManager(associated WindowManager& internal); 405 GetWindowManager(associated WindowManager& internal);
401 }; 406 };
402 407
403 // Mus provides this interface as a way for clients to connect and obtain a 408 // Mus provides this interface as a way for clients to connect and obtain a
404 // WindowTree handle with a supplied WindowTreeClient handle. The 409 // WindowTree handle with a supplied WindowTreeClient handle. The
405 // WindowTreeClient has no roots, use NewTopLevelWindow() to create one. 410 // WindowTreeClient has no roots, use NewTopLevelWindow() to create one.
406 interface WindowTreeFactory { 411 interface WindowTreeFactory {
407 CreateWindowTree(WindowTree& tree_request, WindowTreeClient client); 412 CreateWindowTree(WindowTree& tree_request, WindowTreeClient client);
408 }; 413 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698