Skip to content

facade: frontend/settings/OBSBasicSettings.cpp: move 29 platform conditionals behind frontend/utility/platform.hpp #867

Closed

Description

@zackees

Part of #847.

Inventory of platform conditionals in frontend/settings/OBSBasicSettings.cpp measured on origin/master. Total: 29.

Conditionals

Line Macro What the branch does
594 _WIN32 connect disableAudioDucking widget signals
597 _WIN32 or __APPLE__ or __linux__ connect browserHWAccel widget signals
635 !_WIN32 && !ENABLE_SPARKLE_UPDATER delete the Updates group box
656 _WIN32 hide "hide OBS from capture" if SetDisplayAffinitySupported() is false
678 __APPLE__ && __aarch64__ delete adapter combo on Apple Silicon
700 !__APPLE__ && !__linux__ delete browser HW accel / sources group
711 !__APPLE__ && !__linux__ null the same widget pointers
718 !__APPLE__ delete disableOSXVSync / resetOSXVSync widgets
1255 _WIN32 or ENABLE_SPARKLE_UPDATER TranslateBranchInfo helper
1272 _WIN32 or ENABLE_SPARKLE_UPDATER load update branch list into combo
1324 _WIN32 or ENABLE_SPARKLE_UPDATER load EnableAutoUpdates
1333 _WIN32 load HideOBSWindowsFromCapture
1475 _WIN32 or (__APPLE__ && __aarch64__) populate renderer combo
1477 _WIN32 add Direct3D 11 renderer item
2708 __APPLE__ load DisableOSXVSync / ResetOSXVSyncOnExit
2714 _WIN32 (elif) load DisableAudioDucking
2732 _WIN32 or __APPLE__ or __linux__ load BrowserHWAccel
3171 _WIN32 or ENABLE_SPARKLE_UPDATER save EnableAutoUpdates / update branch
3184 _WIN32 save HideOBSWindowsFromCapture
3267 _WIN32 or __APPLE__ save projector monitor option (else ResetProjectors)
3397 _WIN32 or (__APPLE__ && __aarch64__) save renderer
3404 _WIN32 save process priority
3414 _WIN32 or __APPLE__ or __linux__ save BrowserHWAccel
3424 __APPLE__ save DisableOSXVSync
3445 _WIN32 save DisableAudioDucking
4372 __APPLE__ filename illegal-character regex (mac)
4374 _WIN32 (elif) filename illegal-character regex (windows)
5753 __APPLE__ enable/disable the OSX VSync reset checkbox
5941 _WIN32 show/hide process priority and related rows

Proposed facade operations

Declared in frontend/utility/platform.hpp; implemented in frontend/utility/platform-windows.cpp, platform-osx.mm, platform-x11.cpp (Linux/BSD). Names are proposals; one facade function per logical operation, moves kept small and mechanical so upstream merges stay manageable.

Facade function Implementation
platform_settings_capabilities() returning a struct {has_audio_ducking, has_browser_hw_accel, has_hide_from_capture, has_vsync_toggle, has_renderer_choice, has_process_priority, has_projector_monitor, has_updates_ui} each platform file fills its own; shared code branches at runtime on the fields, removing macros from the setup/load/save code
platform_load_advanced_settings(config, ui) / platform_save_advanced_settings(...) windows: ducking, hide-from-capture, process priority, D3D11 renderer; osx: VSync, Apple Silicon renderer; x11: browser HW accel
platform_filename_forbidden_chars() returning the regex string per platform
platform_update_channel_supported() windows / osx

Likely must stay / caveats

  • ENABLE_SPARKLE_UPDATER is a build feature macro (macOS updater), not a platform macro; it stays but should be expressed through has_updates_ui.
  • __aarch64__ combined with __APPLE__ (678, 1475, 3397) is an arch check that moves into the capability struct.

Test approach

Characterisation tests for platform_filename_forbidden_chars and the capabilities struct (pure data); UI load/save paths are covered by native builds (ci-full).

RED first (failing characterisation test or facade stub), then GREEN, per docs/rust-port/testing-policy.md. Add the ci-full label since this touches shared frontend code built natively on all platforms.

Done when the listed files have no platform conditionals other than the documented exceptions, and the ratchet baseline (#848) is lowered accordingly.

Activity

  1. zackees commented on Oct 24, 2026

    @zackees
    MemberAuthor

    Claiming: #867 (frontend/settings/OBSBasicSettings.cpp.hpp, 29 baseline findings).

    Plan, one PR per slice, following the self-guarded host headers from #865 (settings-{windows,macos,linux}.hpp included from the settings PCH, each defining feature macros or inline hooks that OBSBasicSettings tests instead of OS macros):

    1. General page: updater, hotkey focus, Apple Silicon, theme and taskbar options (~560-690, 1221-1300, 3179-3200).
    2. Audio/advanced pages: monitoring devices, renderer, process priority, browser hardware acceleration, low-latency network (1441-1450, 2716-2740, 3275-3460, 4370, 5751, 5939).

    First PR expected within a day.

  2. added
    claimed
    on Oct 24, 2026
  3. zackees commented on Oct 24, 2026

    @zackees
    MemberAuthor

    Done in #2180. OBSBasicSettings.cpp.hpp now tests feature macros instead of platforms:

    • OBS_SETTINGS_WINDOWS
    • OBS_SETTINGS_RENDERER
    • OBS_SETTINGS_MACOS_VSYNC
    • OBS_SETTINGS_BROWSER_HWACCEL
    • OBS_SETTINGS_PROJECTOR_ON_TOP
    • OBS_SETTINGS_FILENAME_UNSAFE
    • the existing OBS_PLATFORM_HAS_UPDATE_BRANCHES

    The self-guarded frontend/settings/settings-{windows,macos,linux}.hpp headers in the settings PCH define them. The file's 29 findings have left the ratchet baseline, and test_frontend_settings_host pins the Linux feature set. Nothing is left for this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    claimed

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions