beeware / toga

A Python native, OS native GUI toolkit.
https://toga.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
4.3k stars 668 forks source link

Window size setting requests not being ignored while in full screen #2862

Open hyuri opened 4 days ago

hyuri commented 4 days ago

Describe the bug

My app has multiple pages. Two of them set a specific window size. When I go into full screen, go to another page and come back, Toga still applies the size requested by the page, drawing it small from screen lower-left over a black background.

Shouldn't Toga ignore the size setting if the app/window is in full screen?

Edit: If I switch to another app (Command + Tab) and back, the issue is no longer present — meaning: the page fills the full screen again.

Proof-of-concept app capturing the issue: FullScreenResizeIssue - Hyuri.zip

Possibly Related:

When I enter full screen using the green window button (macOS) and check app.is_full_screen and window.full_screen, both report False. If I enter full screen by setting window.full_screen = True, window.full_screen does report True, while app.is_full_screen still reports False.

Steps to reproduce

  1. Have a page that sets a window size
  2. Go into full screen, using the green window button
  3. Go to another page
  4. Come back to the page that sets a window size
  5. See issue

Expected behavior

Toga should ignore window size setting when app/window is in full screen.

Screenshots

image

Screen recording showing the issue: video

__

Environment

Logs

No response

Additional context

Related to the lower-left alignment aspect:

Is macOS using a flipped coordinate system? Seems to be the case considering the error above shows the page apparently being drawn from a lower-left origin, so maybe why #2855 is happening?

freakboy3742 commented 4 days ago

I'm not able to reproduce the problem you're describing - but I'm not sure if that's because I'm misunderstanding your description of the problem. In particular, there's a difference between "full screen" (maximized) on a window, and "full screen" presentation mode on the app; I haven't been able to reproduce the behaviour your describe with either - but app-level presentation mode, I also don't have the ability to switch to a different workspace.

It's always a lot more helpful to have a proof-of-concept app, rather than a word description of a problem; that makes it a lot easier to triage a problem, as we can start with a "not working" case, rather than trying to work out how to manufacture one. If you can provide a worked example of this behavior, I can take another look and see what is going on.

Regarding the specific question about macOS coordinate systems - yes, macOS's default coordinate system puts 0,0 at the bottom left of the screen; however, that's unlikely to be the cause of what is going on here. It definitely impacts how the window is displayed, but it shouldn't be altering the resize behavior.

hyuri commented 3 days ago

Here you go: FullScreenResizeIssue - Hyuri.zip

I've also add it to the original report.

Also: I forgot to mention that when I switch to another app and switch back, the issue is resolved — the window now fills the full screen again. I've updated the description to include that info.

hyuri commented 3 days ago

I've attached a screen recording, showing the issue, to the original report.

freakboy3742 commented 2 days ago

Ok - I can confirm I can reproduce the problem with the provided code. Some more debugging is required to determine why the "non maximized" window size is being applied when the window isn't maximised.