/** * @file src/display_helper_integration.h * @brief Cross-platform wrapper for display helper integration. On Windows, routes to the IPC helper; on other platforms, no-ops. */ #pragma once #include "src/config.h" #include "src/display_helper_builder.h" #include "src/rtsp.h" #include #include #ifdef _WIN32 // Bring in the Windows implementation in the correct namespace #include "src/platform/windows/display_helper_integration.h" namespace display_helper_integration { // On Windows, we exclusively use the helper and suppress in-process fallback. inline bool suppress_fallback() { return true; } // Enumerate display devices as a JSON string suitable for API responses. // Implemented in the Windows backend. std::string enumerate_devices_json(display_device::DeviceEnumerationDetail detail); } // namespace display_helper_integration #elif defined(__linux__) #include "src/platform/linux/display_backend.h" namespace display_helper_integration { inline bool apply(const DisplayApplyRequest &request) { if (request.action == DisplayApplyAction::Revert) { return platf::linux_display::backend().revert(); } if (!request.session) { return request.action == DisplayApplyAction::Skip; } // Linux applies and verifies synchronously, then publishes the verified // HDR/readiness state back into the live launch session. return request.mutable_session && platf::linux_display::backend().apply_session(*request.mutable_session); } inline bool revert(bool = false) { return platf::linux_display::backend().revert(); } inline bool export_golden_restore() { return false; } inline bool reset_persistence() { return platf::linux_display::backend().reset_persistence(); } inline bool suppress_fallback() { return true; } inline std::string enumerate_devices_json( display_device::DeviceEnumerationDetail detail = display_device::DeviceEnumerationDetail::Minimal ) { return platf::linux_display::backend().enumerate_devices_json(detail); } inline std::optional enumerate_devices( display_device::DeviceEnumerationDetail detail = display_device::DeviceEnumerationDetail::Minimal ) { return platf::linux_display::backend().enumerate_devices(detail); } } // namespace display_helper_integration #else namespace display_helper_integration { // Non-Windows: No-op implementations that allow callers to fallback to in-process logic inline bool apply(const DisplayApplyRequest &) { return false; } inline bool revert(bool = false) { return false; } inline bool export_golden_restore() { return false; } inline bool reset_persistence() { return false; } inline bool suppress_fallback() { return false; } inline std::string enumerate_devices_json( [[maybe_unused]] display_device::DeviceEnumerationDetail detail = display_device::DeviceEnumerationDetail::Minimal ) { return "[]"; } inline std::optional enumerate_devices( [[maybe_unused]] display_device::DeviceEnumerationDetail detail = display_device::DeviceEnumerationDetail::Minimal ) { return std::nullopt; } } // namespace display_helper_integration #endif