Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS: Fix window transparency #10196

Merged
merged 3 commits into from
Feb 3, 2023
Merged

macOS: Fix window transparency #10196

merged 3 commits into from
Feb 3, 2023

Conversation

grokys
Copy link
Member

@grokys grokys commented Feb 3, 2023

What does the pull request do?

Window transparency is broken on macOS, resulting in things like this:

image

Was caused by the default TransparencyLevel in the managed part of the macOS backend being different to that in the unmanaged part, meaning that setting the transparency level to Transparent was considered a no-op by the managed part, and the unmanaged part wasn't informed.

Fixed that and also added some integration tests to try to prevent this in future.

Fixed issues

Fixes #8419

Failing on macOS, passing on win32.
The macOS backend sets up a window with a transparency level of `None` but the managed code thinks it's `Transparent`, meaning that making the window transparent did nothing as it thinks it's already set.

Fixes #8419
@@ -501,7 +501,7 @@ public void SetTransparencyLevelHint(WindowTransparencyLevel transparencyLevel)
}
}

public WindowTransparencyLevel TransparencyLevel { get; private set; } = WindowTransparencyLevel.Transparent;
public WindowTransparencyLevel TransparencyLevel { get; private set; } = WindowTransparencyLevel.None;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the actual fix, the rest of the PR is for the integration test.

@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 11.0.999-cibuild0029530-beta. (feed url: https://pkgs.dev.azure.com/AvaloniaUI/AvaloniaUI/_packaging/avalonia-all/nuget/v3/index.json) [PRBUILDID]

@maxkatz6 maxkatz6 merged commit 74b9d9d into master Feb 3, 2023
@maxkatz6 maxkatz6 deleted the fixes/macos-transparency branch February 3, 2023 20:55
@grokys
Copy link
Member Author

grokys commented Feb 3, 2023

Probably shouldn't have merged this with the mac integration tests failing. I'll try to fix and open a new PR.

grokys pushed a commit that referenced this pull request Feb 16, 2023
donandren added a commit to donandren/Avalonia that referenced this pull request Mar 24, 2023
commit 45c009e
Author: Steven Kirk <grokys@users.noreply.github.com>
Date:   Thu Mar 23 15:21:13 2023 +0100

    Bump version

commit 02752e0
Author: Steven Kirk <grokys@gmail.com>
Date:   Thu Mar 23 12:13:35 2023 +0100

    Update ShowWindowTest from master.

    This branch had gone out-of-sync due to repeated cherry picks.

commit c9c1eb8
Author: Dan Walmsley <dan@avaloniaui.net>
Date:   Thu Mar 16 21:48:06 2023 +0000

    Merge pull request AvaloniaUI#10677 from AvaloniaUI/fixes/10650-extend-client-area-decorations

    macOS: Fix interaction between ExtendClientAreaToDecorationsHint and SystemDecorations

commit 9bebc76
Author: Dan Walmsley <dan@avaloniaui.net>
Date:   Tue Mar 7 22:24:50 2023 +0000

    Merge pull request AvaloniaUI#10575 from AvaloniaUI/fixes/macos-no-resize-zoom

    macOS: Don't allow window zoom when CanResize=false.

commit a674362
Author: Max Katz <maxkatz6@outlook.com>
Date:   Wed Mar 8 15:52:19 2023 +0000

    Merge pull request AvaloniaUI#10600 from AvaloniaUI/fixes/x11window-nre

    Add nullable reference checking to X11Window.

commit afd25c8
Author: Steven Kirk <grokys@gmail.com>
Date:   Fri Feb 24 10:31:42 2023 +0100

    Set openssl-legacy-provider on all platforms.

    Linux is failing now with the same error.

commit 136a0ab
Author: Steven Kirk <grokys@users.noreply.github.com>
Date:   Wed Feb 22 14:34:34 2023 +0100

    Merge pull request AvaloniaUI#10431 from AvaloniaUI/fixes/osx-menu-reparenting-crash

    if the window is closed, we cannot become the key window.

commit 8096b59
Author: Dan Walmsley <dan@walms.co.uk>
Date:   Wed Feb 22 22:26:24 2023 +0000

    Merge pull request AvaloniaUI#10427 from AvaloniaUI/fixes/macos-close-window-zorder

    macOS: Fix window order breaking when closing modal dialog

commit a5f20fb
Author: Steven Kirk <grokys@gmail.com>
Date:   Thu Feb 16 11:34:42 2023 +0100

    Only set openssl-legacy-provider on Windows.

commit cea9d20
Author: Steven Kirk <grokys@gmail.com>
Date:   Thu Feb 16 11:20:22 2023 +0100

    Try to fix CI build error.

    `error:0308010C:digital envelope routines::unsupported`

commit a082601
Author: Max Katz <maxkatz6@outlook.com>
Date:   Sat Feb 4 08:22:00 2023 -0500

    Merge pull request AvaloniaUI#10204 from AvaloniaUI/update-angle-version

    Update Angle to 2.1.0.2023020321

commit 8d0f449
Author: Steven Kirk <grokys@users.noreply.github.com>
Date:   Tue Feb 14 20:04:44 2023 +0100

    Merge pull request AvaloniaUI#10265 from AvaloniaUI/fixes/macos-noresize-fullscreen

    Various macOS and win32 fixes

commit ac49092
Author: Max Katz <maxkatz6@outlook.com>
Date:   Fri Feb 3 15:55:45 2023 -0500

    Merge pull request AvaloniaUI#10196 from AvaloniaUI/fixes/macos-transparency

    macOS: Fix window transparency

commit 730e08d
Author: Max Katz <maxkatz6@outlook.com>
Date:   Tue Dec 13 12:56:33 2022 -0500

    Merge pull request AvaloniaUI#9699 from AvaloniaUI/fixes/7974-selectionmodel-eventargs-indexer

    Fix SelectionModelSelectionChangedEventArgs.SelectedItems indexer.

commit f3acb6e
Author: Steven Kirk <grokys@users.noreply.github.com>
Date:   Wed Feb 1 16:31:57 2023 +0100

    Merge pull request AvaloniaUI#10153 from AvaloniaUI/fixes/macos-windowstate-crash

    macOS: Sync actual window state after window show, and fix integration tests on macOS 13.1

commit 7d09e7c
Author: Max Katz <maxkatz6@outlook.com>
Date:   Mon Jan 16 22:12:39 2023 -0500

    Merge pull request AvaloniaUI#9716 from AvaloniaUI/fixes/macos-child-window-key-handling

    macos: Fix child window key handling

commit fb67190
Author: Steven Kirk <grokys@gmail.com>
Date:   Thu Jan 12 15:47:56 2023 +0100

    Revert "Merge pull request AvaloniaUI#9947 from AvaloniaUI/stable/nswindow-setappearance"

    This reverts commit c273732, reversing
    changes made to d926650.

commit c273732
Merge: d926650 561b04a
Author: Dan Walmsley <dan@walms.co.uk>
Date:   Tue Jan 10 12:40:08 2023 +0000

    Merge pull request AvaloniaUI#9947 from AvaloniaUI/stable/nswindow-setappearance

    [stable] macOS: Set Window appearance to fix missing white border

commit 561b04a
Author: Dan Walmsley <dan@walms.co.uk>
Date:   Wed Dec 14 22:58:28 2022 +0000

    set appearance on osx window.

commit d926650
Author: Dan Walmsley <dan@walms.co.uk>
Date:   Tue Dec 6 15:05:40 2022 +0000

    fix integration test app.

commit 96465de
Author: Dan Walmsley <dan@walms.co.uk>
Date:   Tue Dec 6 15:01:04 2022 +0000

    Revert "remove integration test app."

    This reverts commit 46ea187.

commit 46ea187
Author: Dan Walmsley <dan@walms.co.uk>
Date:   Tue Dec 6 14:38:36 2022 +0000

    remove integration test app.

commit f549f1e
Author: Dan Walmsley <dan@walms.co.uk>
Date:   Tue Dec 6 14:26:09 2022 +0000

    fix build

commit 92687ad
Author: Max Katz <maxkatz6@outlook.com>
Date:   Thu Sep 8 14:32:09 2022 +0200

    Merge pull request AvaloniaUI#8880 from AvaloniaUI/fixes/8878-mac-window-order

    macOS: Fix child window order with multiple child windows
    # Conflicts:
    #	tests/Avalonia.IntegrationTests.Appium/WindowTests_MacOS.cs

commit cb56351
Author: Max Katz <maxkatz6@outlook.com>
Date:   Wed Nov 2 14:15:41 2022 -0400

    Merge pull request AvaloniaUI#9326 from AvaloniaUI/fixes/osx-child-windows-cant-minimise

    OSX: fix minimise button being disabled when either a parent or a dialog.

commit 0af2a96
Author: Max Katz <maxkatz6@outlook.com>
Date:   Wed Nov 16 16:45:16 2022 -0800

    Merge pull request AvaloniaUI#9451 from AvaloniaUI/fixes/osx-native-menu-memory-leak

    [OSX] Fixed NativeMenu memory leak
    # Conflicts:
    #	src/Avalonia.MicroCom/CallbackBase.cs

commit fdb32b7
Author: Dan Walmsley <dan@avaloniaui.net>
Date:   Sat Nov 19 14:47:02 2022 +0000

    Merge pull request AvaloniaUI#9469 from AvaloniaUI/fixes/window-border-for-opaque-windows

    [OSX] Use non-opaque window background for non-transparent windows
    # Conflicts:
    #	src/Avalonia.Native/avn.idl

commit 1dacc90
Author: Max Katz <maxkatz6@outlook.com>
Date:   Tue Dec 6 03:19:45 2022 -0800

    Merge pull request AvaloniaUI#9566 from AvaloniaUI/fixes/9565-mac-fullscreen-children

    MacOS: Only bring windows to front if they're on the active space.

commit d3723c6
Author: Max Katz <maxkatz6@outlook.com>
Date:   Thu Jul 21 14:16:29 2022 -0400

    Merge pull request AvaloniaUI#8514 from pr8x/move-first-last-skip-disabled

    Skip disabled controls when moving to first/last item

commit 3e43d6f
Merge: 719d89f 8ee727f
Author: Dan Walmsley <dan@walms.co.uk>
Date:   Wed Nov 30 13:46:37 2022 +0000

    Merge branch 'stable/0.10.x-outsys' into stable/0.10.x

commit 8ee727f
Author: Dan Walmsley <dan@walms.co.uk>
Date:   Wed Nov 30 13:45:47 2022 +0000

    Revert "Fix AvaloniaUI#9565"

    This reverts commit 5fa4da3.

commit 8546725
Merge: ea71071 133abac
Author: Dan Walmsley <dan@walms.co.uk>
Date:   Wed Nov 30 12:50:23 2022 +0000

    Merge pull request AvaloniaUI#9573 from AvaloniaUI/fixes/update-nuke

    Fix Stable Branch Builds

commit 133abac
Author: Dan Walmsley <dan@walms.co.uk>
Date:   Wed Nov 30 12:35:09 2022 +0000

    fix create nuget packages.

commit ead8be7
Author: Dan Walmsley <dan@walms.co.uk>
Date:   Wed Nov 30 11:00:53 2022 +0000

    use custom ilrepack.

commit 3432d2b
Author: Dan Walmsley <dan@walms.co.uk>
Date:   Tue Nov 29 14:33:46 2022 +0000

    update nuke.

commit 6990327
Author: Dan Walmsley <dan@walms.co.uk>
Date:   Tue Nov 29 14:26:20 2022 +0000

    update nukebuild.

commit ea71071
Author: Dan Walmsley <dan@walms.co.uk>
Date:   Tue Nov 29 13:47:05 2022 +0000

    use 6.0.200

commit 16ce88c
Author: Steven Kirk <grokys@gmail.com>
Date:   Tue Nov 29 13:35:30 2022 +0100

    Pin SDK.

commit 5fa4da3
Author: Steven Kirk <grokys@gmail.com>
Date:   Tue Nov 29 12:40:02 2022 +0100

    Fix AvaloniaUI#9565

    - Only bring window to front if it's on the currently active space
    - Ensure correct order of child windows after fullscreen transition

commit 719d89f
Merge: ffe74ce 734e165
Author: Max Katz <maxkatz6@outlook.com>
Date:   Fri Nov 25 15:45:58 2022 -0500

    Merge pull request AvaloniaUI#9538 from timunie/backport/GH_9528

    Backport AvaloniaUI#9528

commit 734e165
Author: Tim <tim.uniewski@gmail.com>
Date:   Fri Nov 25 10:53:23 2022 +0100

    Backport AvaloniaUI#9528

commit ffe74ce
Author: Max Katz <maxkatz6@outlook.com>
Date:   Thu Nov 17 19:54:14 2022 -0500

    Merge pull request AvaloniaUI#9221 from AvaloniaUI/fixes/8869-show-windowstate

    Fix setting WindowState before showing Window.

commit a64fcdd
Merge: a35520c 80288aa
Author: Max Katz <maxkatz6@outlook.com>
Date:   Sun Oct 30 00:01:09 2022 -0400

    Merge pull request AvaloniaUI#9300 from AvaloniaUI/fixes/osx-menu-reentrancy-crash

    OSX: fix menu re-entrancy crash

commit 80288aa
Author: Dan Walmsley <dan@walms.co.uk>
Date:   Fri Oct 28 11:48:27 2022 +0100

    use didResignKey notification instead of override resignKey

commit a35520c
Author: Dan Walmsley <dan@walms.co.uk>
Date:   Thu Oct 27 15:03:55 2022 +0100

    Revert "Merge branch 'disableSetProcessName-feature' into tmp8"

    This reverts commit d8ee76d.

commit d8ee76d
Author: Dan Walmsley <dan@walms.co.uk>
Date:   Mon Oct 3 17:03:56 2022 +0100

    Merge branch 'disableSetProcessName-feature' into tmp8

commit 62a5ee1
Author: Max Katz <maxkatz6@outlook.com>
Date:   Sat Aug 13 03:34:22 2022 -0400

    Merge pull request AvaloniaUI#8739 from AvaloniaUI/update-skia

    Update SkiaSharp
    # Conflicts:
    #	build/HarfBuzzSharp.props

commit 0ac982f
Merge: 9f50abd 96187d7
Author: Dan Walmsley <dan@avaloniaui.net>
Date:   Mon Aug 15 13:39:20 2022 +0100

    Merge pull request AvaloniaUI#8753 from AvaloniaUI/fix-listBoxTests-stable

    Fix ListBoxTests on stable

commit 96187d7
Author: Takoooooo <tako0qq@gmail.com>
Date:   Mon Aug 15 15:20:34 2022 +0300

    Fix ListBoxTests.

commit 9f50abd
Author: Dan Walmsley <dan@walms.co.uk>
Date:   Mon Mar 7 16:54:24 2022 +0000

    Merge pull request AvaloniaUI#7755 from AvaloniaUI/fixes/win32-can-resize

    Fixes/win32 can resize

commit ff86693
Author: Max Katz <maxkatz6@outlook.com>
Date:   Thu Aug 11 19:30:58 2022 -0400

    Merge pull request AvaloniaUI#8728 from jp2masa/gl-control-render-rect

    Fixed OpenGlControlBase render rect

commit 7627db1
Author: Max Katz <maxkatz6@outlook.com>
Date:   Sat Aug 6 05:28:31 2022 -0400

    Merge pull request AvaloniaUI#8683 from AvaloniaUI/stop-transition-if-it-was-cancelled

    Stop TransitioningContentControl if it was cancelled

commit 7eb0a48
Author: Max Katz <maxkatz6@outlook.com>
Date:   Sun Aug 7 02:52:50 2022 -0400

    Merge pull request AvaloniaUI#8569 from hez2010/visual-fixes

    Avoid crashing when fail to create OpenGL context

commit 5f9c852
Author: Dan Walmsley <dan@walms.co.uk>
Date:   Tue Aug 9 18:38:40 2022 +0100

    Merge pull request AvaloniaUI#8574 from AvaloniaUI/fixes/win32-consistent-minimize-restore-window-size

    Win32: Retain window position and size when docked and then minimized and restored.
    # Conflicts:
    #	tests/Avalonia.IntegrationTests.Appium/WindowTests.cs

commit 46d83d1
Author: Dan Walmsley <dan@walms.co.uk>
Date:   Tue Aug 9 17:09:06 2022 +0100

    Merge pull request AvaloniaUI#8618 from AvaloniaUI/fixes/macos-dont-reopen-hidden-window

    macos: Don't reopen hidden window when parent clicked.
    # Conflicts:
    #	tests/Avalonia.IntegrationTests.Appium/WindowTests_MacOS.cs

commit d758481
Merge: 765c4d7 7b33526
Author: Max Katz <maxkatz6@outlook.com>
Date:   Tue Aug 9 01:29:08 2022 -0400

    Merge pull request AvaloniaUI#8699 from timunie/fix/backport_GH_7778

    Backport PR 7778

commit 7b33526
Author: Tim <tim.uniewski@gmail.com>
Date:   Mon Aug 8 11:24:12 2022 +0200

    Backport PR 7778

commit 765c4d7
Author: Tako <53405089+Takoooooo@users.noreply.github.com>
Date:   Wed Aug 3 18:44:47 2022 +0300

    Merge pull request AvaloniaUI#8655 from AvaloniaUI/use-correct-toggleModifier-for-treeView-on-macOS-with-multiselection

    Use correct ToggleModifier in TreeView multiselection on MacOS

commit fb607cc
Author: Steven Kirk <grokys@users.noreply.github.com>
Date:   Wed Aug 3 17:05:21 2022 +0200

    Merge pull request AvaloniaUI#8637 from AvaloniaUI/use-correct-toggleModifier-for-listBox-on-macOS-with-multiselection

    Use correct ToggleModifier in ListBox multiselection on MacOS.

commit fcada17
Author: Steven Kirk <grokys@gmail.com>
Date:   Wed Aug 3 18:24:46 2022 +0200

    Added AvaloniaLocator.GetRequiredService.

commit 50f02de
Author: Max Katz <maxkatz6@outlook.com>
Date:   Tue Jul 26 23:06:08 2022 -0400

    Merge pull request AvaloniaUI#8604 from AvaloniaUI/feature/tray-icon-non-mandatory

    Don't throw exceptions for missing windowing platform since it's actually not mandatory for TrayIcon

commit dfabf4d
Author: Max Katz <maxkatz6@outlook.com>
Date:   Sat Jul 30 13:56:36 2022 -0400

    Merge pull request AvaloniaUI#8599 from jinek/fixes/scene-hittest-exclusive

    Scene hittest now uses exclusive `Rect.Contains`. Fixes https://githu…

commit 1628b20
Author: Nikita Tsukanov <keks9n@gmail.com>
Date:   Tue Jul 26 13:52:23 2022 +0300

    Merge pull request AvaloniaUI#8597 from AvaloniaUI/feature/x11-wmclass-spec

    Set WM_CLASS property according to ICCCM spec

commit d2f8fe6
Author: Jumar Macato <16554748+jmacato@users.noreply.github.com>
Date:   Fri Jul 15 21:04:07 2022 +0800

    Merge pull request AvaloniaUI#8520 from timunie/fix/DataGrid_LastColumnIsClipped

    fix: RowDesiredWidth was missing the RowHeaderWidth

commit 2d2cd97
Author: Max Katz <maxkatz6@outlook.com>
Date:   Thu Jul 28 12:04:17 2022 -0400

    Backport proper exception handling in win32 system dialogs

commit 7fb8c01
Author: Nikita Tsukanov <keks9n@gmail.com>
Date:   Tue Jul 26 16:41:15 2022 +0300

    Merge pull request AvaloniaUI#8601 from AvaloniaUI/fixes/7773-skia-stream-workaround

    Workaround for SkiaSharp broken image decoding.

commit e975100
Author: Dan Walmsley <dan@walms.co.uk>
Date:   Mon Jul 18 15:38:27 2022 +0100

    Merge pull request AvaloniaUI#8538 from AvaloniaUI/feature/expose-gtk-thread-invoke

    Introduced GtkInteropHelper.RunOnGlibThread, fixed demos
    # Conflicts:
    #	samples/ControlCatalog.NetCore/NativeControls/Gtk/EmbedSample.Gtk.cs
    #	samples/ControlCatalog.NetCore/NativeControls/Gtk/GtkHelper.cs

# Conflicts:
#	build/SharedVersion.props
#	nukebuild/Build.cs
#	samples/IntegrationTestApp/ShowWindowTest.axaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Window transparency on MacOS in version 0.10.15
3 participants