AW: Re: macOS window maximization weirdness

Paul Dupuis paul at researchware.com
Sat Feb 10 16:16:59 EST 2024


So, I finally tracked this maximization weirdness down.

This only occurs on macOS when a window is maximized using the titlebar 
maximization icon (which cause teh window to go to fullscreen, hiding 
the window titlebar and macOS menubar. The menubar and titlebar 
re-appear if your roll the mouse over where they are hidden, allowing 
the user to click on titlebar maximization icon to restore the window to 
normal size.

The issue also only occurs if the resizeStack handler for the window 
uses the passed parameters to determine position of objects within the 
window. i.e. if you do:
Example 1)
on resizeStack pNewWidth, pNewHeight
   set the bottomRight of btn "X" to (pNewWidth-5),(pNewHeight-5)
end resizeStack

There can be a problem under the specific circumstances below. Where as:
Example 2)
on resizeStack
   put the width of this stack into pNewWidth
   put the height of this stack into pNewHeight
   set the bottomRight of btn "X" to (pNewWidth-5),(pNewHeight-5)
end resizeStack

Will work under the specific circumstances below.

When a window is mazimized on macOS, that window is sent a resizeStack 
message with the correct parameters, so either code block above works.

However, on macOS ONLY (not Windows) when a window is maximized, after 
the resizeStack message is sent, a desktopChanged message is also sent

My problem was that I also have a on desktopChanged handler in my app. I 
had expected desktopChanged to only be sent when a monitor is added or 
removed or the resolution of a monitor is changed (increased or 
decreased), not if a window is maximized.

My desktopChanged handler, at one point, executes either a:

   set the effective width of window tWindow to tMontiorWidth
OR a
   set the effective height of window tWindow to tMonitorHeight

Either of which sends a resizeStack message to the stack/window. 
However, when it is sent this 2nd time as a result of the window 
maximization (which does a successful resizeStack, then desktopChanged, 
which sets teh effecting width/height, that causes a resizeStack) the 
resizeStack parameters, pNewWidth and pNewHeight are EMPTY, so any 
placement of controls based on the parameters use empty, which gets 
treated as zero.

The work-around is the do Example 2 for resizeStack, but I think is 
might be considered an ENGINE BUG that on macOS, not Windows, 
maximization sends a resizeStack and then a desktopChanged message. No 
monitor has been added or removed, nor has the resolution of any monitor 
been changed, therefore I don't think a desktopChanged message SHOULD be 
sent on macOS window maximization. I think this is a bug?

Does anyone have a valid reason why macOS should receive a 
desktopChanged message on window maximization when Windows does not?

Paul Dupuis
Researchware

On 1/15/2024 6:16 PM, Paul Dupuis via use-livecode wrote:
> I have a standalone, built with Livecode 9.6.11 STABLE, where for some 
> windows (stacks) on certain macOS versions, maximizing the window 
> results in no controls being drawn or most controls being drawn 
> incorrectly.
>
> It is not every resizable window (stack) in my app, just some. It is 
> not every version of macOS, just some. For example, on macOS Sonoma, 
> the offending windows (again, a subset of all my app's resizable 
> windows) work fine. On Mojave, they do not.
>
> On Windows, they all work fine when maximized (meaning they are all 
> rendered as expected). On macOS and Windows, they all RESIZE (i.e. 
> user window resizing) correctly. It is only certain windows AND only 
> on certain versions of macOS, and only when maximized (using the 
> titlebar green maximize circular icon). In fact. you can RESIZE the 
> window manually on macOS Sonoma or Mojave up to the working area of 
> the screen (all so the full screen except the menubar) and they all 
> render correctly. It is just the "full screen" maximize Apple now does 
> where it hides the window's titlebar until you hover over where it 
> would be that have a problem and, again, just for certain windows on 
> certain versions of macOS.
>
> I'm baffled as the resizeStack handlers are the same across platforms 
> (macOS and Windows). There is NOT platform specific code in the 
> resizeStack handlers and, I believe, that when a window is maximized, 
> Livecode just sends a resizeStack message.
>
> Has anyone seen or heard of any weirdness like this?
>
> I do not have a whole set of macOS version to test on. Sonoma and 
> Mojave are about it. I can compare the resizeStack handlers for the 
> stacks that maximize correctly with those that don't to see if there 
> is some issue, but they all work correctly on Windows and work 
> correctly when manually resized.
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your 
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list