Skip to content

Listen to fullscreen change event#75807

Merged
rebornix merged 3 commits intomasterfrom
rebornix/fullscreenlistener
Jun 21, 2019
Merged

Listen to fullscreen change event#75807
rebornix merged 3 commits intomasterfrom
rebornix/fullscreenlistener

Conversation

@rebornix
Copy link
Copy Markdown
Member

On macOS, we can override browsers' ctrl+cmd+f to do our own Toggle Full Screen so our current code works as expected by

  • ctrl+cmd+f
  • WindowService.toggleFullScreen
  • Browser.setFullScreen()

However, on Windows, you can use F11 to Toggle Full Screen with the same experience, but it's a browser feature and we can't override. It means the workspace turns into fullscreen, however as we didn't receive any event, we miss one step

  • Browser.setFullScreen()

Without above step, the workbench is not aware of the window state. This PR introduces an event listener for fullscreenchange. In Chromium on all platforms, the workflow becomes

  • Users press Cmd+Ctrl+F or F11
  • Either we receive the keyboard event, we run requestFullScreen
  • Or we get a fullscreenchange
  • Then we run Browser.setFullScreen()

@rebornix rebornix requested review from bpasero and sbatten June 20, 2019 02:02
if (!(<any>document).webkitIsFullScreen) {
(<any>target).webkitRequestFullscreen(); // it's async, but doesn't return a real promise.
browser.setFullscreen(true);
browser.setFullscreen(true); // we have to set this proactively because Safari doesn't emit fullscreenchange event.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I commented, we can't fully rely on fullscreenchange as Safari doesn't implement it, even though it's Living Standard.

Copy link
Copy Markdown
Member

@sbatten sbatten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

discussed with @rebornix. We think the listener should try to be in a service like window service since it already couples this behavior. Otherwise, the listener is floating in a file and easily forgotten. However, at some point we should really tackle the enormous windowservice.

@rebornix rebornix merged commit 00370ac into master Jun 21, 2019
@rebornix rebornix deleted the rebornix/fullscreenlistener branch June 21, 2019 19:46
@github-actions github-actions bot locked and limited conversation to collaborators Mar 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants