fix(runtime-wry): reapply custom traffic light position on macOS#15628
fix(runtime-wry): reapply custom traffic light position on macOS#15628tenderdeve wants to merge 2 commits into
Conversation
FabianLars
left a comment
There was a problem hiding this comment.
this pr also contains #15604 - i think that will resolve itself when the other one is merged but just blocking the merge on that to not do an oopsie
|
In general i am not sure if this should be fixed in tauri. For similar cases i added the workarounds into tao and wry directly and hoped we could do the same here. |
macOS drops a window's custom traffic light inset when the title changes or when it exits fullscreen from a maximized state, reverting the buttons to the system default until the window is resized. Store the configured position on the window and reapply it after a title change and on resize (the only event tao emits for a green-button fullscreen exit). Fixes tauri-apps#15451, fixes tauri-apps#13044
64df305 to
35e1267
Compare
|
@FabianLars rebased onto On whether it belongs in tauri vs tao/wry: fair point. The reapply itself is just Happy to move it upstream instead — close this and open a tao PR making the inset sticky across those events. Your call on which layer you'd prefer; if you'd rather keep the fix tauri-side for now I'll leave it as is. |
This isn't the case actually, we store it in an objc Ivar as well https://github.com/tauri-apps/tao/blob/14a6dec20897904c9041c52cb92111b81db20e13/src/platform_impl/macos/view.rs#L343-L349 But i just remembered i had a tao branch related to one of the 2 github issues https://github.com/tauri-apps/tao/tree/refresh-lights (that's a bad way to do it i think - and its not using the ivar state as well) Let me go through things, i'll get back to you. |
|
@FabianLars opened the tao-side version: tauri-apps/tao#1254. It reapplies the inset from the existing Happy to close this PR (#15628) once #1254 lands and the tao bump flows through, or keep this one as the interim runtime-wry fix if you would rather not wait on a tao release — your call. |
Closes #15451
Closes #13044
macOS resets a window's custom traffic light inset back to the system default in two cases, and it stays wrong until the window is resized:
Both come down to the same thing — AppKit re-lays-out the title bar buttons and tao doesn't reapply our inset. @FabianLars flagged these should be fixed together.
Fix: keep the configured position on the window and reapply it right after a title change, and on resize — a resize is the only event tao emits for a green-button fullscreen exit, and it matches the existing
resize the window and it comes backworkaround.set_traffic_light_positionalso updates the stored value so later reapplies use the latest.All of it is macOS-gated. Raw windows (
CreateRawWindow) don't carry the config so there's nothing to reapply for them.