One of the checks is near the beginning of UpdateGeometryInfo():
if (wmInfoPtr->flags & WM_FULLSCREEN) {
return;
}
This is presumably intended to prevent the geometry from being set (using wm geometry) at all while fullscreen (the Windows code contains a similar check: tkWinWm.c). Since WM_FULLSCREEN is never set under Aqua, this early exit never occurs.
Consequently, the geometry of a toplevel can change while fullscreen, at least temporarily. The results depend on the contents of the toplevel, and whether Split View is in use (i.e. the toplevel shares the fullscreen space with another "fullscreen" window/app; available since Mac OS X 10.11 El Capitan).
If Split View is not in use, then the requested geometry is temporarily used, until (what I'm assuming is) an event from the window manager prompts the toplevel to revert back to the geometry of the entire fullscreen space as if nothing happened. This can happen immediately, or not until the user performs some window manager operation, such as switching away from and returning to the toplevel's fullscreen space. Demo: https://vimeo.com/397613845
If Split View is in use, then the position of the split may change so that the toplevel has a width as close to the requested width as possible; the height and y-coordinate might also change temporarily, until reverted due to a window manager event, such as adjusting the split or navigating to/away from the fullscreen space. Demo: https://vimeo.com/397613809 (I notice two small black rectangles appear to the left and right of the ttk::label widget where the background color is briefly not drawn, or at least not in the correct location; since I've only observed this after setting geometry while fullscreen, I'm not yet sure it's an issue worth investigating.)
Replacing the early exit check with:
NSWindow *macWindow = wmPtr->Window;
if ([macWindow styleMask] & NSFullScreenWindowMask) {
return;
}
causes requests (by the program) to set the geometry to be ignored while fullscreen: no more temporary toplevel geometry changes, and the width can't be set in Split View.
This check was implemented long before Split View existed, when attempting to change the geometry of a fullscreen toplevel would have made no sense (unless the setting the geometry while fullscreen was supposed to have some other effect; see below). Q1: Rather than updating this check and preventing geometry changes while fullscreen, is it desirable to instead at least allow toplevels to set a preferred/minimum/maximum width in Split View? (I'm not sure this is as simple as removing the early exit and replacing it with a comment saying why it was removed.)
Bug 1: At a minimum, I think the geometry shouldn't be able to change temporarily if a window manager event will inevitably prompt the geometry to revert back. I would probably have to investigate further to see whether this is more due to missing code or existing but broken code.
The other check is in ParseGeometry():
if (wmPtr->flags & WM_FULLSCREEN) {
wmPtr->configX = x;
wmPtr->configY = y;
} else {
wmPtr->x = x;
wmPtr->y = y;
}
WM_FULLSCREEN is never set, so only the else is used, allowing toplevel to (temporarily) change coordinates while fullscreen.
Were this check to be similarly fixed by checking the NSFullScreenWindowMask bit, then setting the coordinates would no longer have an effect while fullscreen (they stay at 0,0; the width/height can still change). But the other codepath which sets configX and configY has no effect, because the Tk Aqua code never reads these values.
Q2: What are configX and configY for? I'm not completely certain what their purpose is based on the comments in the code. Q3: What is the expected behavior of setting wm geometry $toplevel while [wm attributes $toplevel -fullscreen] == 1? I'm not sure this is clearly documented either for wm or by TIP 223. One guess is that setting the geometry of a toplevel while it was fullscreen would instead control the geometry used once the toplevel exited fullscreen; configX and configY would be set (I would guess configWidth and configHeight as well) while fullscreen and then read when exiting fullscreen. This is what the Windows code looks like it might be trying to do (in TkpWmSetFullScreen()). But so far I've only observed this behavior successfully with Tk Aqua 8.5.9 (which doesn't use macOS' native fullscreen), and not in 8.6.9/8.6.10 on various platforms (Windows, Aqua, and X11). I think a discussion might be needed to gather what the intended behavior (for all platforms) is and whether it's a bug for it to not happen.