Repository: wezterm/wezterm (language: rust)

Issue:
A transparent title bar appears with `window_decorations = "RESIZE|MACOS_FORCE_DISABLE_SHADOW"`
### What Operating System(s) are you seeing this problem on?

macOS

### Which Wayland compositor or X11 Window manager(s) are you using?

\-

### WezTerm version

20230320-124340-559cb7b0

### Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?

Yes, and I updated the version box above to show the version of the nightly that I tried

### Describe the bug

By adding `MACOS_FORCE_DISABLE_SHADOW` to `RESIZE` for `window_decorations` config, I have a transparent window bar.

With `window_decorations = "RESIZE|MACOS_FORCE_DISABLE_SHADOW"`:

<img width="499" alt="Screenshot 2023-03-21 at 18 06 29" src="https://user-images.githubusercontent.com/37739/226687543-362d919a-efa9-4bf8-b1c7-a29182a2fc9b.png">

With `window_decorations = "RESIZE"`:

<img width="445" alt="Screenshot 2023-03-21 at 18 06 11" src="https://user-images.githubusercontent.com/37739/226687580-ddf25e0a-5a8f-495d-8c78-74e9e3fdfa68.png">

Issue linked to this issue: https://github.com/wez/wezterm/issues/2669

### To Reproduce

Set the config `window_decorations = "RESIZE|MACOS_FORCE_DISABLE_SHADOW"` (on macOS)

### Configuration

```
local wezterm = require 'wezterm'
local mux = wezterm.mux

wezterm.on('gui-startup', function(cmd)
  local _, _, window = mux.spawn_window(cmd or {})
  window:gui_window():maximize()
end)

return {
  font = wezterm.font "IosevkaTerm Nerd Font Mono",
  font_size = 15,
  color_scheme = 'Dracula (Official)',
  window_decorations = "RESIZE|MACOS_FORCE_DISABLE_SHADOW",
  enable_tab_bar = false,
  initial_rows = 50,
  initial_cols = 200,
  audible_bell="Disabled",
  send_composed_key_when_left_alt_is_pressed=true,
}
```

### Expected Behavior

Not having a transparent window bar (like with the config `window_decorations = "RESIZE"`)

### Logs

_No response_

### Anything else?

_No response_


Discussion / hints:
I can't explain this behavior, but this should be equivalent and doesn't cause the titlebar to appear:

```lua
  window_decorations = "RESIZE",
  window_background_opacity = 0.999,
```

@wez Thank you for the workaround. Could it be linked to this condition? https://github.com/wez/wezterm/blob/3eede5c248e022ef30b604dcc254d13c632bf5d0/window/src/os/macos/window.rs#L1237 I can try to fix it and make a PR if you want?
Ah, possibly: seems like the top of that function should remove those new bits so that the rest of the function works as originally intended, something like this:

```rust
fn decoration_to_mask(decorations: WindowDecorations) -> NSWindowStyleMask {
   let decorations = decorations.difference(WindowDecorations::MACOS_FORCE_DISABLE_SHADOW | WindowDecorations::MACOS_FORCE_ENABLE_SHADOW);
```

I'm not going to be near my mac for for most of the day, so if you have time to try that out and want to send a PR, that would be great!


Fix patch:
diff --git a/window/src/os/macos/window.rs b/window/src/os/macos/window.rs
index b6f26a58b51..922f4cf2ef1 100644
--- a/window/src/os/macos/window.rs
+++ b/window/src/os/macos/window.rs
@@ -1229,6 +1229,10 @@ fn apply_decorations_to_window(window: &StrongPtr, decorations: WindowDecoration
 }
 
 fn decoration_to_mask(decorations: WindowDecorations) -> NSWindowStyleMask {
+    let decorations = decorations.difference(
+        WindowDecorations::MACOS_FORCE_DISABLE_SHADOW
+            | WindowDecorations::MACOS_FORCE_ENABLE_SHADOW,
+    );
     if decorations == WindowDecorations::TITLE | WindowDecorations::RESIZE {
         NSWindowStyleMask::NSTitledWindowMask
             | NSWindowStyleMask::NSClosableWindowMask


Test patch: