2018r4 metal windows title bar colour

Since upgrading from 2018r3 to 2018r4, metal window title bars in MacOS are not respecting the background colour in debug or build. The IDE still shows the correct colour.

Dark mode support set to off for the project.

Have you enabled ā€œSupports Dark Modeā€ in the ā€œShared Settingsā€ for your app?

Never mind, I misread your last statement.

Metal windows were deprecated by Apple some time ago.

Probably best to remove the option from Xojo .

Without a metal window, how how to you achieve what Iā€™ve seen called the unified window appearance, like Preview?

Thatā€™s a ā– ā– ā– ā– ā– ā– . Iā€™ve always used them as prefer the title bar matching the window colour. Is there an alternative method for achieving this?

A style of NSBorderlessWindowMask will move all buttons into the window itself. Then you could design the upper 22 or so points completely customized.

@Ulrich Bogun Thanks, but NSBorderlessWindowMask is overkill, it does a lot more than just allow a unified look. The metal window used to be perfect. But as of Xojo 2018R4 there is a slight line beneath the title bar. Itā€™s subtle and doesnā€™t bother me. But a few uses have reported it to me.

BTW, you quoted James Cooksey, not me.

Weird. I just quoted via the quote button, so like now Ā…

Deprecated != removed

I had the same problem after updating to 2018R4 and my bug report was closed with mention: ā€˜is not a bugā€™ā€¦
There are different possibilities to do this, the simplest is maybe to add a toolbox to the window, but that donā€™t help in every case. The example below (to add in the Open event) is another possibility to solve this problem:

[code]// To use with macOS SDK 10.10+
try
Const NSWindowStyleMaskFullSizeContentView = 32768 // Bitwise.ShiftLeft(1,15)

Declare Sub setStyleMask Lib ā€œAppKitā€ Selector ā€œsetStyleMask:ā€ (windowRef As Integer, value As Integer)
Declare Function styleMask Lib ā€œAppKitā€ Selector ā€œstyleMaskā€ (windowRef As Integer) As Integer
setStyleMAsk(Me.Handle, styleMask(Self.Handle) + NSWindowStyleMaskFullSizeContentView)

Declare Sub setTitlebarAppearsTransparent Lib ā€œAppKitā€ Selector ā€œsetTitlebarAppearsTransparent:ā€ (windowRef As Integer, value As Boolean)
Declare Sub setTitleVisibility Lib ā€œAppKitā€ Selector ā€œsetTitleVisibility:ā€ (windowRef As Integer, value As Integer)
setTitlebarAppearsTransparent(Self.Handle, True)
setTitleVisibility(Self.Handle,0) //0=Title visible, 1=Title hidden
end try[/code]

The following link shows an example for these three windows WinOSX.zip

1 Like

[quote=427071:@Alain Clausen]I had the same problem after updating to 2018R4 and my bug report was closed with mention: ā€˜is not a bugā€™ā€¦
There are different possibilities to do this, the simplest is maybe to add a toolbox to the window, but that donā€™t help in every case. The example below (to add in the Open event) is another possibility to solve this problem:

[code]// To use with macOS SDK 10.10+
try
Const NSWindowStyleMaskFullSizeContentView = 32768 // Bitwise.ShiftLeft(1,15)

Declare Sub setStyleMask Lib ā€œAppKitā€ Selector ā€œsetStyleMask:ā€ (windowRef As Integer, value As Integer)
Declare Function styleMask Lib ā€œAppKitā€ Selector ā€œstyleMaskā€ (windowRef As Integer) As Integer
setStyleMAsk(Me.Handle, styleMask(Self.Handle) + NSWindowStyleMaskFullSizeContentView)

Declare Sub setTitlebarAppearsTransparent Lib ā€œAppKitā€ Selector ā€œsetTitlebarAppearsTransparent:ā€ (windowRef As Integer, value As Boolean)
Declare Sub setTitleVisibility Lib ā€œAppKitā€ Selector ā€œsetTitleVisibility:ā€ (windowRef As Integer, value As Integer)
setTitlebarAppearsTransparent(Self.Handle, True)
setTitleVisibility(Self.Handle,0) //0=Title visible, 1=Title hidden
end try[/code]

The following link shows an example for these three windows WinOSX.zip[/quote]
Alain, that is fantastic, thank you. Works a treat.

A really beautiful workaround which actually gives me more possibilities.

It would make sense that if Metal windows are no longer available, that they be removed from the IDE and not work in the IDE (currently they are an option, display correctly in IDE but do not display at runtime).

I hope we gave more info than that, but if we didnĀ’tā€¦

The change that affected this in 2018r4 was the change in macOS SDK that your apps were compiled against. Up until then, we had been using 10.9 which meant that your apps (and ours) were limited to using older drawing engines. This update means that we are more aligned with what Xcode produces and allows your apps to access more recent technologies.

Yes I know that Greg, and itā€™s a very good thing to have updated to SDK 10.14, thanks!

The problem here is more the information. No entry is to find about ā€˜Metal Windowā€™ in the release note, the IDE allows to configure it and the compiler does not complain that this type of window is deprecated but it does not work anymore.
Updating projects using ā€˜Metal Windowā€™ to 2018R4 changes the visual effect of the windows (only on 10.14) and we donā€™t know if itā€™s normal, if itā€™s a Mojave bug or if itā€™s a Xojo bugā€¦ at the end, everyone loses a lot of time to search why and try to find a workaround.

Itā€™s just my comment but I know itā€™s not possible to test everything, especially with such a change.

Please donā€™t remove Metal Window as an option until Apple actually removes it. With it selected and the UI code kindly supplied by Alain Clausen above, I get exactly the look I want, a slightly darker title/toolbar area at the top than one would get if the window was a Document.

Jonathan:
Please consider what happened when Xojo removed the use of g (as Graphics) in Xojo 2018r4, how many people started to complain their code suddenly is no more workingĀ…
(that feature was deprecated many years ago and the people who do not take that into account then were complaining when Xojo 2018r4 was released, in cascadeĀ…).

Yes, life is not easy.

We donā€™t remove things before Apple does :slight_smile:

[quote=427106:@Alain Clausen]Yes I know that Greg, and itā€™s a very good thing to have updated to SDK 10.14, thanks!

The problem here is more the information. No entry is to find about ā€˜Metal Windowā€™ in the release note, the IDE allows to configure it and the compiler does not complain that this type of window is deprecated but it does not work anymore.
Updating projects using ā€˜Metal Windowā€™ to 2018R4 changes the visual effect of the windows (only on 10.14) and we donā€™t know if itā€™s normal, if itā€™s a Mojave bug or if itā€™s a Xojo bugā€¦ at the end, everyone loses a lot of time to search why and try to find a workaround.

Itā€™s just my comment but I know itā€™s not possible to test everything, especially with such a change.[/quote]
The issue is that we are not the ones that deprecated itā€¦ it was Apple. ItĀ’s not really practical for us to include all of their deprecated items for the last 5 years.