Skip to content

facade: frontend/widgets/OBSBasic_*.cpp: move 33 platform conditionals behind frontend/utility/platform.hpp #873

Closed

Description

@zackees

Part of #847.

Inventory of platform conditionals in frontend/widgets/OBSBasic_*.cpp measured on origin/master. Total: 33.

Conditionals

File Line Macro What the branch does
OBSBasic_Dropfiles.cpp 26 _WIN32 include QSettings
OBSBasic_Dropfiles.cpp 36 _WIN32 add "jxr" to image extensions
OBSBasic_Dropfiles.cpp 76 _WIN32 ReadWindowsURLFile (.url shortcut parser)
OBSBasic_Dropfiles.cpp 138 _WIN32 text source id text_gdiplus (else text_ft2_source)
OBSBasic_Dropfiles.cpp 145 _WIN32 text source read_from_file settings
OBSBasic_Dropfiles.cpp 289 _WIN32 handle dropped .url files
OBSBasic_Hotkeys.cpp 46 _WIN32 hotkey meta string Hotkeys.Windows vs other
OBSBasic_MainControls.cpp 35 __APPLE__ include OBSPermissions.hpp
OBSBasic_MainControls.cpp 40 _WIN32 include AutoUpdateThread.hpp
OBSBasic_MainControls.cpp 44 _WIN32 or WHATSNEW_ENABLED include WhatsNewInfoThread.hpp
OBSBasic_MainControls.cpp 238 __APPLE__ show OBSPermissions dialog
OBSBasic_MainControls.cpp 380 _WIN32 disable CheckForUpdates / Repair actions
OBSBasic_MainControls.cpp 486 !_WIN32 close dialogs before always-on-top toggle
OBSBasic_MainControls.cpp 582 __APPLE__ EnableOSXDockIcon(false)
OBSBasic_MainControls.cpp 596 __APPLE__ EnableOSXDockIcon(true)
OBSBasic_Preview.cpp 537 __linux__ DontUseNativeDialog for colour dialog
OBSBasic_Profiles.cpp 992 !__APPLE__ CheckNVENCInternal helper
OBSBasic_Profiles.cpp 1016 _WIN32 obs-nvenc-test.exe vs obs-nvenc-test
OBSBasic_Profiles.cpp 1159 !__APPLE__ NVENC check branch
OBSBasic_Projectors.cpp 114 __APPLE__ or _WIN32 screen name label vs fallback label
OBSBasic_Recording.cpp 316 __APPLE__ paused tray icon (mac mask)
OBSBasic_Recording.cpp 351 __APPLE__ active tray icon (mac mask)
OBSBasic_SceneItems.cpp 96 __APPLE__ prefer SCK audio capture source id on macOS 13+
OBSBasic_SysTray.cpp 26 __APPLE__ tray icon file (mac mask)
OBSBasic_SysTray.cpp 91 __APPLE__ tray activation reason ignored
OBSBasic_SysTray.cpp 131 __APPLE__ EnableOSXDockIcon(false)
OBSBasic_Updater.cpp 24 _WIN32 include AutoUpdateThread.hpp
OBSBasic_Updater.cpp 31 _WIN32 or WHATSNEW_ENABLED include WhatsNew headers
OBSBasic_Updater.cpp 41 _WIN32 UPDATE_CHECK_INTERVAL 4 days
OBSBasic_Updater.cpp 86 _WIN32 whatsnew platforms.windows filter
OBSBasic_Updater.cpp 90 __APPLE__ (elif) whatsnew platforms.macos filter
OBSBasic_Updater.cpp 185 _WIN32 (elif) last update check logic
OBSBasic_Updater.cpp 205 _WIN32 disable CheckForUpdates / Repair actions

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_tray_icon(TrayState), platform_set_dock_icon_visible(bool), platform_tray_activation_ignored() osx: masks, dock icon; others default (shared with OBSBasic.hpp, see sibling issue)
platform_check_nvenc(missing_encoders), platform_nvenc_test_binary_name() windows: .exe; x11: bare name; osx: unavailable
platform_text_source_id() and platform_text_source_settings(...) windows: text_gdiplus/read_from_file; others text_ft2_source
platform_extra_image_extensions(), platform_resolve_dropped_shortcut(file) windows: jxr, .url parsing (ReadWindowsURLFile moves to platform-windows.cpp)
platform_check_permissions_dialog(parent) osx
platform_updater_enabled(), platform_update_check_interval(), platform_whatsnew_platform_flag(platforms), platform_disable_updater_actions(ui) windows / osx
platform_color_dialog_options(), platform_hotkey_meta_string(), platform_projector_screen_label(screen), platform_prefer_sck_audio_capture() per platform

Likely must stay / caveats

  • Include-only conditionals (35/40/44, 24/31) move into platform impl files with the corresponding function.
  • WHATSNEW_ENABLED is a feature flag and stays.

Test approach

Characterisation tests for platform_nvenc_test_binary_name, platform_update_check_interval, ReadWindowsURLFile (parse a .url fixture; Windows-only test) and the whatsnew platform filter; the rest by 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: #873, one PR per widget file. First is OBSBasic_Dropfiles (5 conditionals, plus the _WIN32 QSettings include in frontend-widgets.pch.hpp). Four new facade calls: IsPlatformImageExtension, GetPlatformTextSourceId, SetPlatformTextFileSettings and ResolvePlatformDroppedFile.

  2. added
    claimed
    on Oct 24, 2026
  3. moved this from In progress to Triage in obs-rust Multiviewon Oct 25, 2026
  4. removed
    claimed
    on Oct 25, 2026
  5. added
    P3
    size:L
    on Oct 25, 2026
  6. zackees commented on Oct 25, 2026

    @zackees
    MemberAuthor

    /ready

    Triage: a complete inventory (33 conditionals with lines and what each one does), one PR per widget file, claimed and started with OBSBasic_Dropfiles. Acceptance: every listed conditional is behind frontend/utility/platform.hpp and ci/platform_ifdef_ratchet.py drops each file from its baseline. P3, size:L (split per file as planned).

  7. added
    ready
    on Oct 25, 2026
  8. zackees commented on Oct 26, 2026

    @zackees
    MemberAuthor

    Done on master. The per-file PRs merged: #2019 (dropped files), #2020, #2025, #2029, #2037 and #2039. No #if on _WIN32, __APPLE__ or __linux__ is left in frontend/widgets/OBSBasic_*. The only files in frontend/widgets/ that still have one are the OS-named obsbasic-windows.hpp, obsbasic-linux.hpp and obsbasic-macos.hpp. ci/platform-ifdef-baseline.json no longer lists any OBSBasic file.

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

    P3readysize:L

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions