AW: Re: macOS window maximization weirdness

Mark Waddingham mark at livecode.com
Mon Feb 12 11:36:35 EST 2024


On 2024-02-10 21:16, Paul Dupuis via use-livecode wrote:
> 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.

As far as I can see, the engine only ever sends resizeStack with all 
parameters - so if your stack is getting a resizeStack with only two 
arguments - that's being sent from your code or a library you are using 
I think.

> 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?

So the engine hooks into the notification from the OS for a change in 
screen parameters... The engine then checks the new ones against the old 
and sends desktopChanged if there are any differences.

In the case of maximization on macOS - using (what is now!) the 
fullscreen gadget on the titlebar of windows causes the OS furniture to 
ebb away - i.e. the *working* screenRect changes - and thus the engine 
sends the desktopChanged notification.*

(You can test this by creating a stack and 'answer the screenRect & 
return & the working screenRect' - click before and after the fullscreen 
gadget on the title bar, and there will be a difference.)

Warmest Regards,

Mark.

P.S. The message is also sent when the dock is adjusted in size too - so 
presumably you would see the same problem then (assuming your handling 
of the desktopChanged message is causing the errant resizeStack with 
only two arguments to be sent from script somehow).

-- 
Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things



More information about the use-livecode mailing list