Repository navigation
Description
Part of #847.
Inventory of platform conditionals in frontend/widgets/OBSBasic.cpp and OBSBasic.hpp measured on origin/master. Total: 27.
Conditionals
| File | Line | Macro | What the branch does |
|---|---|---|---|
OBSBasic.cpp |
47 | _WIN32 or WHATSNEW_ENABLED |
include WhatsNewInfoThread.hpp |
OBSBasic.cpp |
58 | ENABLE_WAYLAND |
include obs-nix-platform.h |
OBSBasic.cpp |
71 | _WIN32 |
include windows.h |
OBSBasic.cpp |
372 | __APPLE__ |
rename scene/source shortcut is Return |
OBSBasic.cpp |
388 | __linux__ |
Exit shortcut Ctrl+Q |
OBSBasic.cpp |
475 | !__APPLE__ |
connect aboutToQuit to closeWindow |
OBSBasic.cpp |
490 | __APPLE__ |
DEFAULT_CONTAINER "hybrid_mov" vs the non-mac default |
OBSBasic.cpp |
933 | _WIN32 && !_DEBUG |
LoadLibraryW(Qt6Network) |
OBSBasic.cpp |
1063 | _WIN32 |
SetWin32DropStyle |
OBSBasic.cpp |
1073 | ENABLE_WAYLAND |
isWayland detection |
OBSBasic.cpp |
1090 | !_WIN32 |
show() window early unless hidden on start |
OBSBasic.cpp |
1168 | __APPLE__ |
disableColorSpaceConversion(this) |
OBSBasic.cpp |
1184 | (_WIN32 or __APPLE__) && pre-release |
automatically opt in to beta channel |
OBSBasic.cpp |
1212 | !_WIN32 |
delete Repair action |
OBSBasic.cpp |
1215 | !__APPLE__ |
delete crash-log actions (nested) |
OBSBasic.cpp |
1227 | __APPLE__ |
delete Fullscreen Interface action |
OBSBasic.cpp |
1237 | _WIN32 or __APPLE__ |
disable Check-for-Updates if updater disabled |
OBSBasic.cpp |
1240 | _WIN32 |
disable Repair action (nested) |
OBSBasic.cpp |
1304 | !__APPLE__ |
sendPostedEvents DeferredDelete |
OBSBasic.cpp |
1643 | _WIN32 |
nativeEvent MSG handling |
OBSBasic.cpp |
1939 | !__APPLE__ |
deleteLater() in close path |
OBSBasic.cpp |
2069 | _WIN32 |
HWND-based window handling |
OBSBasic.hpp |
166 | _WIN32 |
UpdateProcessPriority() inline |
OBSBasic.hpp |
726 | __APPLE__ |
tray mask icon (active) |
OBSBasic.hpp |
748 | __APPLE__ |
tray icon file (idle) |
OBSBasic.hpp |
758 | __APPLE__ |
tray icon file (paused) |
OBSBasic.hpp |
767 | __APPLE__ |
tray icon file (active) |
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) returning QIcon (mask on macOS) |
osx returns *_macos.svg masks; others default icons. Shared with OBSBasic_SysTray / OBSBasic_Recording (see sibling issue) |
platform_default_recording_container() |
osx: hybrid_mov, others the existing default |
platform_set_main_window_shortcuts(ui) / platform_prune_menu_actions(ui, updater_disabled) |
osx: Return rename, delete fullscreen; windows: Repair; x11: Ctrl+Q |
platform_window_post_create(QMainWindow*) / platform_window_pre_show(...) (drop style, colour-space conversion, Wayland check, Qt6Network preload) |
per platform |
platform_handle_native_event(QByteArray, void*, qintptr*) |
windows: MSG; others false |
platform_close_cleanup(QObject*) (deleteLater vs deferred-delete flush) |
osx differs |
platform_update_process_priority() |
windows; no-op elsewhere |
platform_is_wayland() |
x11 (ENABLE_WAYLAND stays inside platform-x11.cpp) |
Likely must stay / caveats
- Includes at 47, 58, 71 move into the platform impl files;
WHATSNEW_ENABLEDis a feature flag and stays. - OBSBasic.hpp inline functions become non-inline facade calls so no
#ifis left in headers.
Test approach
Characterisation tests for platform_default_recording_container and pure constants; UI behaviour (menus, tray, close) 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.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
zackees commentedon Oct 24, 2026
Claiming: #871 (frontend/widgets/OBSBasic.cpp.hpp, 18 findings, plus OBSBasic.hpp, 5).
Plan, following #865 and #867: self-guarded
frontend/widgets/obsbasic-{windows,macos,linux}.hppheaders in the widgets PCH that define feature macros such asOBS_BASIC_MACOS_MENU,OBS_BASIC_WINDOWS_TASKBARandOBS_BASIC_UPDATER, plus small inline hooks. OBSBasic tests those instead of OS macros._WIN32member and its__APPLE__declarations. This is a frontend-internal header, not public API, so moving them doesn't touch any public C header.First PR expected within a day.
zackees commentedon Oct 24, 2026
Done in #2183. OBSBasic.cpp.hpp and OBSBasic.hpp now test feature macros instead of platforms:
OBS_BASIC_WINDOWSOBS_BASIC_MACOSOBS_BASIC_UPDATEROBS_BASIC_CRASH_LOGSOBS_BASIC_QUIT_SHORTCUTOBS_BASIC_PROCESS_PRIORITYDEFAULT_CONTAINERThe self-guarded
frontend/widgets/obsbasic-{windows,macos,linux}.hppheaders, included from OBSBasic.hpp, define them. All 23 findings have left the ratchet baseline, andtest_frontend_obsbasic_hostpins the Linux feature set.frontend: main window platform behavior behind host feature headers (o…