Skip to content

Fix fullscreen configure events sending size 0,0 during state transitions#4695

Closed
Copilot wants to merge 2 commits intomainfrom
copilot/fix-video-fullscreen-chrome
Closed

Fix fullscreen configure events sending size 0,0 during state transitions#4695
Copilot wants to merge 2 commits intomainfrom
copilot/fix-video-fullscreen-chrome

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 18, 2026

Related: pop-os/cosmic-comp#1642, pop-os/cosmic-comp#2099

What's new?

Chrome video fullscreen fails because XdgToplevelStable::send_toplevel_configure() sends size 0,0 when requested_window_size() isn't set. This occurs when state change observers fire before resize observers update the cached size.

Fix: Fall back to scene_surface()->window_size() when requested_window_size() is unavailable. Scene surface is updated synchronously by the window manager, so it reflects correct size even when async observer callbacks haven't run.

// Before: defaults to 0,0 if requested_window_size() not set
geom::Size size = requested_window_size().value_or(geom::Size{0, 0});

// After: uses scene surface's actual window size as fallback
if (auto const requested_size = requested_window_size())
    size = requested_size.value();
else if (auto const surface = scene_surface())
    size = surface.value()->window_size();
else
    size = geom::Size{0, 0};

Applied to both xdg_shell_stable.cpp and xdg_shell_v6.cpp.

How to test

  1. Open Chrome on a non-fullscreen window
  2. Navigate to any video site (YouTube, etc.)
  3. Click fullscreen on the video player
  4. Expected: Video goes fullscreen, not the browser window

Checklist

  • Tests added and pass
  • Adequate documentation added
  • (optional) Added Screenshots or videos
Original prompt

This section details on the original issue you should resolve

<issue_title>Making videos fullscreen in Google Chrome fails if the window isn't already fullscreen</issue_title>
<issue_description>### Version

v2.25.2

Environment

OS: Ubuntu 24.04

What happened? What did you expect to happen?

When you fullscreen a video in Google Chrome it will instead just make the window fullscreen (like using F11). If the window is already fullscreen then the video does become fullscreen. This doesn't occur with Firefox, but it also doesn't occur when using Google Chrome in GNOME.

I think this issue for the Pop OS Cosmic compositor is the same: [BUG] Maximized chromium browsers: clicking video fullscreen makes browser fullscreen instead and their fix is here: fix: window state preservation

Fixes a bunch of issues where the maximized/snapped state of a window was lost in scenarios involving:

  • transitions to full-screen mode,
  • from full-screen mode to snapped state,
  • moving full-screen/snapped window between workspaces.

Exact fixes:

What I tested:

  • Maximize Chrome > Click fullscreen on any video > Single-click fullscreen
  • Maximize Firefox > Click fullscreen on any video > Single-click fullscreen (regression check)
  • Snap Chrome to a corner/side > Click fullscreen on any video > Single-click fullscreen
  • Snap window to a corner/side > Go fullscreen > Exit fullscreen > Window returns to the snap position
  • Maximize window > Move window to the other workspace > Window stays maximized
  • Snap window to a corner/side > Move window to the other workspace > Window stays snapped to the same corner/side

I tried to make the changes as small as possible.

I also wanted to fix the issue with returning the window to the stack from full-screen state in this PR, but it appears to be much more complicated than I initially imagined and has a lot of edge cases.

Reproduction steps

No response

Relevant log output

```</issue_description>

## Comments on the Issue (you are @copilot in this section)

<comments>
<comment_new><author>@Saviq</author><body>
Thanks for the detailed report!</body></comment_new>
<comment_new><author>@AlanGriffiths</author><body>
I'm having trouble reproducing. Testing with Miriway 26.01-mir2.25.2 and Chromium:

With window (on https://www.youtube.com/watch?v=7fGB-hjc2Gc) in a restored state, press "F" or click "Fullscreen" icon: video fullscreens

With window (on https://www.youtube.com/watch?v=7fGB-hjc2Gc) in a fullscreen state, press "F" or click "Fullscreen" icon: video fullscreens

Maybe I have misunderstood the reproduction steps? It seems unlikely Chromium behaves differently to Google Chrome in this respect?</body></comment_new>
<comment_new><author>@AlanGriffiths</author><body>
I'm also starting Miriway from GDM but don't have Nvidia. (That shouldn't make a difference.)

On restarting chromium I could see the problem until I fullscreened the window - after which things worked regardless of the fullscreen/restored window state.

If chromium starts fullscreen, I don't see a problem, nor after it has been fullscreen at least once. (Fullscreen is typically how I use it, which explains why I've not noticed a problem and couldn't reproduce above.)

Could "randomly stop occurring" be after you fullscreen the browser window?</body></comment_new>
<comment_new><author>@AlanGriffiths</author><body>
The Chromium snap just updated to the latest build (3365) and I can no longer reproduce.</body></comment_new>
<comment_new><author>@AlanGriffiths</author><body>
Argh! On my main laptop I can no longer reproduce. On my "testing s...

</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

- Fixes canonical/mir#4688

<!-- START COPILOT CODING AGENT TIPS -->
---

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs.

When a window transitions to fullscreen, the state change callback happens
before the resize callback, causing configure events to be sent with size 0,0.
This confuses Chrome which interprets it as a refusal to go fullscreen.

The fix: when requested_window_size() is not yet set, fall back to the
scene surface's window_size() instead of defaulting to 0,0.

Co-authored-by: AlanGriffiths <9048879+AlanGriffiths@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix fullscreen behavior of videos in Google Chrome Fix fullscreen configure events sending size 0,0 during state transitions Feb 18, 2026
Copilot AI requested a review from AlanGriffiths February 18, 2026 13:12
@Saviq
Copy link
Copy Markdown
Contributor

Saviq commented Feb 24, 2026

Fixed in #4698 instead

@Saviq Saviq closed this Feb 24, 2026
@Saviq Saviq deleted the copilot/fix-video-fullscreen-chrome branch February 24, 2026 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants