WebKit / standards-positions

WebKit's positions on emerging web specifications
https://webkit.org/standards-positions/
241 stars 18 forks source link

Captured Mouse Events #233

Open eladalon1983 opened 12 months ago

eladalon1983 commented 12 months ago

WebKittens

@youennf

Title of the spec

Captured Mouse Events

URL to the spec

https://screen-share.github.io/captured-mouse-events/

URL to the spec's repository

https://github.com/screen-share/captured-mouse-events/

Issue Tracker URL

No response

Explainer URL

https://github.com/screen-share/captured-mouse-events/blob/main/README.md

TAG Design Review URL

https://github.com/w3ctag/design-reviews/issues/872

Mozilla standards-positions issue URL

https://github.com/mozilla/standards-positions/issues/850

WebKit Bugzilla URL

No response

Radar URL

No response

Description

Web applications can use getDisplayMedia() to capture any display-surface - tabs, windows or screens. When they do, they can also specify the cursor constraint to control whether the cursor's pixels are captured or not.

But what if the application wishes to programmatically observe the location of the cursor? That can be done by scanning each frame and employing heuristics to detect the cursor. But that's neither simple, nor efficient, nor robust.

To that end, we propose a mechanism for exposing mouse coordinates over a captured surface to a capturing application.

The TL;DR is that we expose an oncapturedmousechange EventHandler on CaptureController. Events are of the general shape {surfaceX: long, surfaceY: long}, exposing the coordinates of the mouse relative to the origin of the captured surface.