Window layering

Mark Waddingham mark at livecode.com
Wed Jul 19 13:43:07 EDT 2017


On 2017-07-19 18:59, Mark Waddingham via use-livecode wrote:
> On 2017-07-19 18:32, Richard Gaskin via use-livecode wrote:
>> All this talk about the background has me wondering:  would it be
>> useful to anyone here if we had a way to:
>> 
>> - set the layer of a stack below all other LC stacks (opposite
>>   of palette)
>> 
>> - set the layer ouf a stack below all other windows (opposite
>>   of systemWindow)
> 
> It might be useful - although probably not implementable (judging by
> how hard it is to get the backdrop to work reliably on all platforms).

Okay and then my memory of how things work kicked in...

The backdrop is actually a window (of course) so it could potentially be 
generalized to an arbitrary stack - so you could definitely have one 
(which would work as well as the backdrop feature does now).

More than one we could probably get to work on Mac, and probably 
Windows. Linux is a little trickier.

Actually the fundamental problem here is ensuring stacking order of 
Windows within an application - this isn't the easiest thing to do.

Carbon used to allow you to do it in a very flexible way - Cocoa, less 
so. In the latter we actually have to restack the window list back to 
front in the 'preclick' event which windows get - which works reasonably 
well, but not as well as it did in Carbon; on Win32 we have to intercept 
a message that window's sends (WM_SETWINDOWPOS) and fettle quite 
considerably.

On Linux, it is a case of set some window manager hints and hope they 
are obeyed in the way you intend.

Now, if we could make a window stacking routine which follows the rules 
set by script work reliably on all platforms then it becomes more than 
possible (I'm currently wondering whether the Mac approach *might* work 
on Linux actually, GDK certainly seems to suggest it tries its hardest 
to do what the application wants; rather than what the Window Manager 
wants and Monte made some headway on getting the backdrop to work better 
on Linux today).

This is one of those things that sound like it should be straightforward 
to do - after all, an application should be able to control the layering 
of its windows, right? However, you start to fight against the UI 
consistency rules which have been embedded in the platform APIs with 
things like this, and applications generally always lose such fights if 
not in one OS version, but a subsequent one.

That being said, if anyone knows of any open source (particularly Linux 
and Windows) applications which do stuff like this - specifically, have 
normal windows which do keep a strict stacking order regardless of how 
you try and change it then please let us know as we could look at the 
source to see how they do it.

Warmest Regards,

Mark.

-- 
Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps




More information about the use-livecode mailing list