Fullscreen and Fullscreen YouTube video fixes

This commit is contained in:
2026-05-14 19:52:38 +12:00
parent 6fac7e320b
commit 406d73c10f
6 changed files with 142 additions and 7 deletions
+37 -3
View File
@@ -211,6 +211,12 @@ void NebulaController::OnBrowserClosing(nebula::cef::BrowserRole role, CefRefPtr
menu_popup_browser_ = nullptr;
menu_popup_client_ = nullptr;
} else {
if (content_fullscreen_) {
const auto* active_tab = tabs_.ActiveTab();
if (active_tab && active_tab->browser && active_tab->browser->IsSame(browser)) {
SetContentFullscreen(false);
}
}
tabs_.ClearBrowser(browser);
}
MaybeFinishShutdown();
@@ -308,6 +314,15 @@ void NebulaController::OnContentFaviconChanged(CefRefPtr<CefBrowser> browser, co
tabs_.UpdateFavicon(browser, urls);
}
void NebulaController::OnContentFullscreenChanged(CefRefPtr<CefBrowser> browser, bool fullscreen) {
const auto* active_tab = tabs_.ActiveTab();
if (!active_tab || !active_tab->browser || !active_tab->browser->IsSame(browser)) {
return;
}
SetContentFullscreen(fullscreen);
}
void NebulaController::OnPopupRequested(CefRefPtr<CefBrowser> browser, const std::string& target_url) {
if (!tabs_.OwnsBrowser(browser)) {
return;
@@ -445,7 +460,7 @@ void NebulaController::CreateMenuPopupBrowser() {
}
void NebulaController::PositionMenuPopup() {
if (!window_ || !window_->hwnd() || !menu_popup_browser_) {
if (content_fullscreen_ || !window_ || !window_->hwnd() || !menu_popup_browser_) {
return;
}
@@ -493,19 +508,38 @@ void NebulaController::FreshReload() {
tabs_.LoadURL(WithCacheBuster(tab->url));
}
void NebulaController::SetContentFullscreen(bool fullscreen) {
if (content_fullscreen_ == fullscreen) {
return;
}
content_fullscreen_ = fullscreen;
if (fullscreen) {
CloseMenuPopup();
}
SetBrowserVisible(chrome_browser_, !fullscreen);
if (window_) {
window_->SetFullscreen(fullscreen);
}
ResizeBrowsers();
}
void NebulaController::ResizeBrowsers() {
if (!window_) {
return;
}
const auto layout = window_->CurrentLayout();
const auto layout = window_->CurrentLayout(!content_fullscreen_);
if (chrome_browser_) {
window_->ResizeChild(chrome_browser_->GetHost()->GetWindowHandle(), layout.chrome);
}
if (const auto* tab = tabs_.ActiveTab(); tab && tab->browser) {
window_->ResizeChild(tab->browser->GetHost()->GetWindowHandle(), layout.content);
}
PositionMenuPopup();
if (!content_fullscreen_) {
PositionMenuPopup();
}
}
void NebulaController::SendChromeState(const nebula::browser::NebulaTab& tab) {
+3
View File
@@ -34,6 +34,7 @@ public:
void OnContentLoadingStateChanged(CefRefPtr<CefBrowser> browser, bool is_loading) override;
void OnContentLoadProgressChanged(CefRefPtr<CefBrowser> browser, double progress) override;
void OnContentFaviconChanged(CefRefPtr<CefBrowser> browser, const std::vector<std::string>& urls) override;
void OnContentFullscreenChanged(CefRefPtr<CefBrowser> browser, bool fullscreen) override;
void OnPopupRequested(CefRefPtr<CefBrowser> browser, const std::string& target_url) override;
bool ShouldBypassInsecureWarning(CefRefPtr<CefBrowser> browser, const std::string& target_url) override;
@@ -50,6 +51,7 @@ private:
void ToggleDevTools();
void AdjustZoom(double delta);
void FreshReload();
void SetContentFullscreen(bool fullscreen);
void ResizeBrowsers();
void SendChromeState(const nebula::browser::NebulaTab& tab);
void MaybeFinishShutdown();
@@ -59,6 +61,7 @@ private:
int show_command_ = SW_SHOWDEFAULT;
bool closing_ = false;
bool chrome_ready_ = false;
bool content_fullscreen_ = false;
std::unique_ptr<nebula::window::NebulaWindow> window_;
nebula::browser::TabManager tabs_;