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

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: pointer enter/exit; has_pointer_watcher etc 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 pointer events (monitor pointer
sky 2016/08/05 18:06:50 How about changing the () to: (up/down events if |
riajiang 2016/08/05 19:23:59 Done.
84 // at a window in this tree. If an event matchs |matcher| the observer reports 84 // up/down events if |want_moves| is false and monitor pointer up/down/move
85 // it to the WindowTreeClient via OnWindowInputEvent (if the event target is 85 // events if |want_moves| is true), even if they are not targeted at a window
86 // this window tree) or OnEventObserved (if the target is another tree). The 86 // in this tree. For pointer events that would normally be sent to the
87 // client must supply a non-zero |observer_id|, which is reported back with 87 // requesting client (if the event target is this window tree)
88 // observed events. Set the matcher to null to clear the observer. 88 // OnWindowInputEvent() is called, all other matching pointer events (if the
89 // target is another tree) result in OnPointerEventObserved(). The client must
90 // supply a non-zero |pointer_watcher_id|, which is reported back with matched
91 // events. There is only ever one pointer watcher active at a given time. The
92 // client should prefer |want_moves| to be false, as there's a system-wide
93 // performance/battery penalty for listening to moves.
89 // 94 //
90 // See class description for details on event delivery. 95 // See class description for details on event delivery.
91 SetEventObserver(EventMatcher? matcher, uint32 observer_id); 96 StartPointerWatcher(bool want_moves, uint32 pointer_watcher_id);
97
98 // Stops the pointer watcher for all events.
99 StopPointerWatcher();
92 100
93 // Sets the specified bounds of the specified window. 101 // Sets the specified bounds of the specified window.
94 SetWindowBounds(uint32 change_id, uint32 window_id, gfx.mojom.Rect bounds); 102 SetWindowBounds(uint32 change_id, uint32 window_id, gfx.mojom.Rect bounds);
95 103
96 // Sets the client area of the specified window. The client area is specified 104 // 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 105 // by way of insets. Everything outside of the insets, and not in
98 // |additional_client_areas| is considered non-client area. 106 // |additional_client_areas| is considered non-client area.
99 // TODO(sky): convert additional_client_areas to a path. 107 // TODO(sky): convert additional_client_areas to a path.
100 SetClientArea(uint32 window_id, 108 SetClientArea(uint32 window_id,
101 gfx.mojom.Insets insets, 109 gfx.mojom.Insets insets,
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 367
360 // Invoked when a window property is changed. If this change is a removal, 368 // Invoked when a window property is changed. If this change is a removal,
361 // |new_data| is null. 369 // |new_data| is null.
362 OnWindowSharedPropertyChanged(uint32 window, 370 OnWindowSharedPropertyChanged(uint32 window,
363 string name, 371 string name,
364 array<uint8>? new_data); 372 array<uint8>? new_data);
365 373
366 // Invoked when an event is targeted at the specified window. The client must 374 // Invoked when an event is targeted at the specified window. The client must
367 // call WindowTree::OnWindowInputEventAck() with the same |event_id| to notify 375 // call WindowTree::OnWindowInputEventAck() with the same |event_id| to notify
368 // that the event has been processed, and with an EventResult value to notify 376 // 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 377 // if the event was consumed. |pointer_watcher_id| is the id supplied to
370 // also matched the active event observer for this client. The client will not 378 // StartPointerWatcher() if the event is a pointer event and the client called
371 // receive farther events until the event is ack'ed. 379 // StartPointerWatcher(). The client will not receive farther events until the
380 // event is ack'ed.
372 OnWindowInputEvent(uint32 event_id, 381 OnWindowInputEvent(uint32 event_id,
373 uint32 window, 382 uint32 window,
374 ui.mojom.Event event, 383 ui.mojom.Event event,
375 uint32 event_observer_id); 384 uint32 pointer_watcher_id);
376 385
377 // Invoked when an |event| is sent via the EventObserver and not targeted at a 386 // Called when a pointer event that would not normally be targeted at this
378 // specific window. The |event_observer_id| is the one supplied to 387 // client is encountered and the client called StartPointerWatcher(). The
379 // SetEventObserver. The client should not acknowledge these events. 388 // |pointer_watcher_id| is the one supplied to StartPointerWatcher(). See
380 OnEventObserved(ui.mojom.Event event, uint32 event_observer_id); 389 // StartPointerWatcher() for details.The client should not acknowledge these
390 // events.
391 OnPointerEventObserved(ui.mojom.Event event, uint32 pointer_watcher_id);
381 392
382 // Called in two distinct cases: when a window known to the connection gains 393 // 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 394 // 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| 395 // 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 396 // is 0. As with other functions this is only called if the client did not
386 // initiate the change. 397 // initiate the change.
387 OnWindowFocused(uint32 focused_window_id); 398 OnWindowFocused(uint32 focused_window_id);
388 399
389 OnWindowPredefinedCursorChanged(uint32 window_id, Cursor cursor_id); 400 OnWindowPredefinedCursorChanged(uint32 window_id, Cursor cursor_id);
390 401
391 // A change initiated from the client has completed. See description of 402 // A change initiated from the client has completed. See description of
392 // change ids for details. 403 // change ids for details.
393 OnChangeCompleted(uint32 change_id, bool success); 404 OnChangeCompleted(uint32 change_id, bool success);
394 405
395 // The WindowManager is requesting the specified window to close. If the 406 // The WindowManager is requesting the specified window to close. If the
396 // client allows the change it should delete the window. 407 // client allows the change it should delete the window.
397 RequestClose(uint32 window_id); 408 RequestClose(uint32 window_id);
398 409
399 // See description of WindowManager for details. 410 // See description of WindowManager for details.
400 GetWindowManager(associated WindowManager& internal); 411 GetWindowManager(associated WindowManager& internal);
401 }; 412 };
402 413
403 // Mus provides this interface as a way for clients to connect and obtain a 414 // Mus provides this interface as a way for clients to connect and obtain a
404 // WindowTree handle with a supplied WindowTreeClient handle. The 415 // WindowTree handle with a supplied WindowTreeClient handle. The
405 // WindowTreeClient has no roots, use NewTopLevelWindow() to create one. 416 // WindowTreeClient has no roots, use NewTopLevelWindow() to create one.
406 interface WindowTreeFactory { 417 interface WindowTreeFactory {
407 CreateWindowTree(WindowTree& tree_request, WindowTreeClient client); 418 CreateWindowTree(WindowTree& tree_request, WindowTreeClient client);
408 }; 419 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698