Managing maximized windows on MacOS

Giovanni johnthejocker at yahoo.it
Wed Nov 20 13:09:32 EST 2019


Hi Paul,
thanks for your reply but unfortunately this workaround cannot suit the need for different reasons:
- the stacks that have a maxHeight lower than the height resolution of the screen will not be triggered by this condition;
- the condition that you suggest can be triggered manually in other conditions without maximizing the window (multiple screens, windows dragged over the top of the screen etc)

As far as I can say there is no way to detect a maximized window with the plus button and I think that should be tracked by LC

> Il giorno 20/nov/2019, alle ore 14:17, Paul Dupuis via use-livecode <use-livecode at lists.runrev.com> ha scritto:
> 
> On 11/20/2019 3:45 AM, Giovanni via use-livecode wrote:
>> Hi everybody,
>> as already said the main problem is that there is no way to intercept the maximization action and to understand if the window is maximized or not.
>> screenrects or windowBoundingRect are not useful in this case mainly when the maximized window has a maxWidth or maxHeight value lower than the maximum width/height of the screenrect.
>> 
>> Moreover due to the bug #21311 (https://quality.livecode.com/show_bug.cgi?id=21311 <https://quality.livecode.com/show_bug.cgi?id=21311>) it’s not possible to prevent the windows maximization for the resizable stacks.
>> 
>> So, any other hint about this topic?
> 
> As this is really an issue mainly on recent versions of macOS where maximize goes to full screen and then really on on the primary monitor as it covers things like the menu bar, I think a work-around in resizeStack is the way to go. in the resizeStack handler see get the rect of the stack - this will be the stacks new rect. If the top in the space normally reserved for the menu bar. It doesn't have to equal the rect of the primary monitor. You just eed to check the top and see if it is less than the height of the macOS menubar (I think 44px?  Can't remember off the top of my head). If top is less than 44px then the stack has been maximized and then you can reset the rect to the effective working rect of the primary screen
> 
> so something like:
> 
> on resizeStack
>   lock screen
>   if the screen of this stack = 1 then -- this stack is on the primary monitor
>    if (the effective top of this stack < (item 2 of the screenRect + 44)) then -- this stack has been maximized as its top is "above" the menubar
>     set the effective rect of this stack to the effective working screenRect
>    end if
>   end if
>   -- do the rest of resizeStack based on the (now) revised stack rect, so don't use the height or width passed as params, but get the height, width, or rect after this line so you have the revised rect.
>   ...
>   unlock screen
> end resizeStack
> 
> I have not tested this - I just wrote it off the top of my head, so check to see if it works.
> 
> _______________________________________________
> 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