NSWindow - Floating

macOS internals are confusing… I can create a nice NSWindow, but I’m trying t make one of them a floating window

I create TWO windows with a mask of
let mask : NSWindow.StyleMask = [.titled,.resizable,.closable,.miniaturizable]
I then show them like this

window_01.level = .normal

window_02.level = .floating

but clicking in either window sends the other one to the back
where window_02 should always remain on top (at least per all the documents I’ve read)

Not sure why… and I’m not sure this is the “right way” but this looks like it works

window_01.level = .normal

/// not this - window_02.level = .floating
// had to use these two lines instead
window_02.level = NSWindow.Level(rawValue: 99)

sigh… now it seems that ANY window in my application remains on over any window from other applications… If I click in another app, it gets the focus, but it stays under my app windows… and even if I remove all the stuff above

yeah I do recall there being some screwiness around how this was all supposed to be set up

just not details

another case of “Apple Documentation SUCKS”

1 Like

Ok… i got part of it working… but my “floating window” is a GLOBAL floating window, which isn’t what I want

Uh… Thanks Sam… but not sure how that applies. I know how to deactivate a window… the issue is a “floating” window, but not a “global floating” window. The same behaviour as the same Xojo window types.

According to the overview, it hides the window on application deactivation, which I understand it to mean switching to a different app.

Not used it myself, but I noticed it some time ago and somehow remembered it. Unlike Mandarin which is actually more useful in my daily life.

To be honest… I did not realize the a floating window actually vanished when the app lost focus… I just tried it with an Xojo app, and I’ll be darned… it does… So this may be the right solution after all… I’ll try it tommrow and see how it goes… Thanks

1 Like

added this one line to my window master subclass

if type == .floating { self.hidesOnDeactivate = true }