Managing maximized windows on MacOS

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Managing maximized windows on MacOS

Mark Wieder via use-livecode
Hi guys,
from MacOS Mojave and on when you maximize a window (clicking on “+” button on windows main bar) the system maximize the window on the entire screen hiding all the system bars and moving the window on a different “virtual” space.

Is there a way using LC to manage this window status?
It’s possible to detect the window maximization (I.E. in a message) and manage the actions to activate when the window goes to this status or go back to the normal status?

Thank you in advance for your tips!

Regards
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Managing maximized windows on MacOS

Mark Wieder via use-livecode
I'd like to know this too. I'd love to see a way to better control
maximizing a window. the windowBoundingRect is a little out of date.

1) It only applies to the primary monitor (any platform) and I am
finding a lot more of our customers have multiple monitors these days
(usually a laptop with a larger desktop monitor). However, with Catalina
allowing iPads to be extra monitors for a macOS system, we're only
likely to have more situations where desktop apps need to be multiple
monitor aware

2) I am not sure it works any more on the latest versions of macOS




On 11/4/2019 1:58 PM, Giovanni via use-livecode wrote:

> Hi guys,
> from MacOS Mojave and on when you maximize a window (clicking on “+” button on windows main bar) the system maximize the window on the entire screen hiding all the system bars and moving the window on a different “virtual” space.
>
> Is there a way using LC to manage this window status?
> It’s possible to detect the window maximization (I.E. in a message) and manage the actions to activate when the window goes to this status or go back to the normal status?
>
> Thank you in advance for your tips!
>
> Regards
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Managing maximized windows on MacOS

Mark Wieder via use-livecode
In reply to this post by Mark Wieder via use-livecode
Did you already see the new
https://support.apple.com/en-ie/guide/mac-help/mchlp2469/mac

Such "features" override LC settings (on MacOS 10.14/10.15).

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Managing maximized windows on MacOS

Mark Wieder via use-livecode
Thanks for that link hh... I had researched this a while back and actually
looked at the source code.  I knew about the modifier key, but didn't know
about the double click.

So, you can hold the option key down when hovering over the green dot to
get the maximize "+" action.  You can also double click the title bar to
maximize the window.  If you just click the green dot, you get the full
screen mode.

I would go one step further... this is the way the OS works now and other
apps work that way too.  Trying to make your LC app work like a previous
version of the OS may not be the best course of action.

On Mon, Nov 4, 2019 at 9:10 PM hh via use-livecode <
[hidden email]> wrote:

> Did you already see the new
> https://support.apple.com/en-ie/guide/mac-help/mchlp2469/mac
>
> Such "features" override LC settings (on MacOS 10.14/10.15).
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Managing maximized windows on MacOS

Mark Wieder via use-livecode
In reply to this post by Mark Wieder via use-livecode
I ran into this myself recently. LiveCode sends a resizeStack message when
you click the maximize "zoom box" button which you can intercept, but
there's no way to verify that it was the fullscreen zoom button that
generated the message. It would be nice if LC had the opposite of it's
iconifyStack
/ uniconifyStack messages for maximize, maybe "fullscreenify" or something
like that. It would also be nice if it played nice with LiveCode's
non-native fullScreen modes, as it is now the stack automatically gets
resized to the current screen's sized putting all the contents to the upper
left (0,0) origin point.
I have played around a bit with a separate LiveCode builder implementation
macOS native fullscreen that seems to behave a bit differently, if you lock
the resizable attributes it centers your stack on the screen without the
resizing. It's part of this LCB library here:
https://github.com/PaulMcClernan/LiveCode-LCB-macOSTools

On Mon, Nov 4, 2019 at 1:59 PM Giovanni via use-livecode <
[hidden email]> wrote:

> Hi guys,
> from MacOS Mojave and on when you maximize a window (clicking on “+”
> button on windows main bar) the system maximize the window on the entire
> screen hiding all the system bars and moving the window on a different
> “virtual” space.
>
> Is there a way using LC to manage this window status?
> It’s possible to detect the window maximization (I.E. in a message) and
> manage the actions to activate when the window goes to this status or go
> back to the normal status?
>
> Thank you in advance for your tips!
>
> Regards
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Managing maximized windows on MacOS

Mark Wieder via use-livecode
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?


> Il giorno 12/nov/2019, alle ore 02:52, Paul McClernan via use-livecode <[hidden email]> ha scritto:
>
> I ran into this myself recently. LiveCode sends a resizeStack message when
> you click the maximize "zoom box" button which you can intercept, but
> there's no way to verify that it was the fullscreen zoom button that
> generated the message. It would be nice if LC had the opposite of it's
> iconifyStack
> / uniconifyStack messages for maximize, maybe "fullscreenify" or something
> like that. It would also be nice if it played nice with LiveCode's
> non-native fullScreen modes, as it is now the stack automatically gets
> resized to the current screen's sized putting all the contents to the upper
> left (0,0) origin point.
> I have played around a bit with a separate LiveCode builder implementation
> macOS native fullscreen that seems to behave a bit differently, if you lock
> the resizable attributes it centers your stack on the screen without the
> resizing. It's part of this LCB library here:
> https://github.com/PaulMcClernan/LiveCode-LCB-macOSTools
>
> On Mon, Nov 4, 2019 at 1:59 PM Giovanni via use-livecode <
> [hidden email]> wrote:
>
>> Hi guys,
>> from MacOS Mojave and on when you maximize a window (clicking on “+”
>> button on windows main bar) the system maximize the window on the entire
>> screen hiding all the system bars and moving the window on a different
>> “virtual” space.
>>
>> Is there a way using LC to manage this window status?
>> It’s possible to detect the window maximization (I.E. in a message) and
>> manage the actions to activate when the window goes to this status or go
>> back to the normal status?
>>
>> Thank you in advance for your tips!
>>
>> Regards
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Managing maximized windows on MacOS

Mark Wieder via use-livecode
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
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Managing maximized windows on MacOS

Mark Wieder via use-livecode
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 <[hidden email]> 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
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode