From 77aec74483f4140b5cbce40507e6615ce2732ba8 Mon Sep 17 00:00:00 2001 From: Matt Mascarenhas Date: Tue, 30 Jan 2024 15:41:30 +0000 Subject: [PATCH] cinera_player_post.js: Fix fullscreen handling It is possible to bring our player out of fullscreen mode without using the provided views menu or keyboard shortcut, e.g. by pressing Escape. Doing so leaves our state in the SUPERTHEATRE view, which omits SUPERtheatre mode itself from the views menu. This commit fixes this by switching our state to the THEATRE view. Thanks to Aske Bisgaard Vammen for the report. --- cinera/cinera.c | 2 +- cinera/cinera_player_post.js | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/cinera/cinera.c b/cinera/cinera.c index a4dbd6a..9d81bee 100644 --- a/cinera/cinera.c +++ b/cinera/cinera.c @@ -23,7 +23,7 @@ typedef struct version CINERA_APP_VERSION = { .Major = 0, .Minor = 10, - .Patch = 27 + .Patch = 28 }; #define __USE_XOPEN2K8 // NOTE(matt): O_NOFOLLOW diff --git a/cinera/cinera_player_post.js b/cinera/cinera_player_post.js index 9cbc389..59567c0 100644 --- a/cinera/cinera_player_post.js +++ b/cinera/cinera_player_post.js @@ -65,3 +65,12 @@ document.addEventListener("keydown", function(ev) { ev.preventDefault(); } }); + +document.addEventListener("fullscreenchange", function() { + if(!document.fullscreenElement && CineraProps.V == views.SUPERTHEATRE) + { + CineraProps.V = views.THEATRE; + localStorage.setItem(player.cineraViewStorageItem, views.THEATRE); + player.updateSize(); + } +});