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

UI: Inline macOS 13 check #11146

Merged
merged 1 commit into from
Aug 24, 2024
Merged

UI: Inline macOS 13 check #11146

merged 1 commit into from
Aug 24, 2024

Conversation

gxalpha
Copy link
Member

@gxalpha gxalpha commented Aug 18, 2024

Description

Inlines the macOS 13 check for the default device.

Motivation and Context

When I closed #11127 I noticed that there is potential to clean this up.

How Has This Been Tested?

macOS 15
New OBS Settings folder, new device does not get created.

Types of changes

  • Code cleanup (non-breaking change which makes code smaller or more readable)

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

@gxalpha gxalpha added Code Cleanup Non-breaking change which makes code smaller or more readable macOS Affects macOS labels Aug 18, 2024
@gxalpha gxalpha requested a review from PatTheMav August 18, 2024 00:24
@jcm93
Copy link
Contributor

jcm93 commented Aug 18, 2024

Part of my original PR's goal was trying to make the meaning of why we were disabling the source on macOS 13 clear (or at least somewhat clear) just from reading the code, and I think this might lose some of that, but overall it's very minor anyway, so no real complaints.

@gxalpha
Copy link
Member Author

gxalpha commented Aug 18, 2024

Yeah imo that’s a bit overkill, if anything that should just be a comment imo. I can add that.

Copy link
Member

@PatTheMav PatTheMav left a comment

Choose a reason for hiding this comment

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

Overall I'm fine with the changes themselves, my only gripe would be that the reason this function was put into platform-osx.mm was that it's very much a platform-specific check.

The idea being that shouldCreateDefaultAudioSource being a function part of internal API independent(!) of platform and that it happens to return always false on macOS 13 (and vice versa maybe always return true on Windows or Linux).

The reason we have the platform header (and the platform specific TUs) is to put platform-specific code into that source file and not litter the rest of the code with platform-specific conditionals.

@gxalpha
Copy link
Member Author

gxalpha commented Aug 18, 2024

The reason we have the platform header (and the platform specific TUs) is to put platform-specific code into that source file and not litter the rest of the code with platform-specific conditionals.

I think platform.hpp in the UI and util/platform.h are used very differently.
While this is true for the libobs functions, functions in the UI's header often only have implementations for the operating system where they are used, and calls to them are generally ifdefd (see functions like EnableOSXVSync or EnableOSXDockIcon, but also SetWin32DropStyle,SetProcessPriority for Windows, etc.).

@PatTheMav
Copy link
Member

The reason we have the platform header (and the platform specific TUs) is to put platform-specific code into that source file and not litter the rest of the code with platform-specific conditionals.

I think platform.hpp in the UI and util/platform.h are used very differently. While this is true for the libobs functions, functions in the UI's header often only have implementations for the operating system where they are used, and calls to them are generally ifdefd (see functions like EnableOSXVSync or EnableOSXDockIcon, but also SetWin32DropStyle,SetProcessPriority for Windows, etc.).

Yeah as I said, I'm fine with the change but wanted to point out that the whole reason to have platform-specific implementations under a unified header is to avoid using preprocessor conditionals in source code, but we ended up doing both.

UI/window-basic-main.cpp Outdated Show resolved Hide resolved
Copy link
Member

@RytoEX RytoEX left a comment

Choose a reason for hiding this comment

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

LGTM

@RytoEX RytoEX merged commit ec5f499 into obsproject:master Aug 24, 2024
14 checks passed
@RytoEX RytoEX added this to the OBS Studio 31 milestone Aug 24, 2024
@gxalpha gxalpha deleted the macos-13-check branch August 24, 2024 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Cleanup Non-breaking change which makes code smaller or more readable macOS Affects macOS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants