2024-05-16 07:24:42 +00:00
|
|
|
// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
|
2024-09-01 12:08:31 +00:00
|
|
|
// SPDX-License-Identifier: PolyForm-Strict-1.0.0
|
2022-12-04 11:03:45 +00:00
|
|
|
|
2023-08-23 12:06:48 +00:00
|
|
|
#include "window_info.h"
|
|
|
|
|
|
|
|
#include <optional>
|
|
|
|
|
2024-05-25 13:49:14 +00:00
|
|
|
class Error;
|
|
|
|
|
2023-08-23 12:06:48 +00:00
|
|
|
namespace PlatformMisc {
|
2024-05-25 13:49:14 +00:00
|
|
|
bool InitializeSocketSupport(Error* error);
|
2022-11-18 08:14:39 +00:00
|
|
|
void SuspendScreensaver();
|
2022-09-21 12:44:52 +00:00
|
|
|
void ResumeScreensaver();
|
|
|
|
|
2024-05-16 07:24:42 +00:00
|
|
|
/// Returns the size of pages for the current host.
|
|
|
|
size_t GetRuntimePageSize();
|
|
|
|
|
2022-09-21 12:44:52 +00:00
|
|
|
/// Abstracts platform-specific code for asynchronously playing a sound.
|
|
|
|
/// On Windows, this will use PlaySound(). On Linux, it will shell out to aplay. On MacOS, it uses NSSound.
|
|
|
|
bool PlaySoundAsync(const char* path);
|
2023-08-23 12:06:48 +00:00
|
|
|
} // namespace PlatformMisc
|
2023-02-05 05:00:51 +00:00
|
|
|
|
2023-08-23 12:06:48 +00:00
|
|
|
namespace Host {
|
|
|
|
/// Return the current window handle. Needed for DInput.
|
|
|
|
std::optional<WindowInfo> GetTopLevelWindowInfo();
|
2024-05-23 15:59:35 +00:00
|
|
|
} // namespace Host
|
|
|
|
|
|
|
|
// TODO: Move all the other Cocoa stuff in here.
|
|
|
|
namespace CocoaTools {
|
|
|
|
/// Returns the refresh rate of the display the window is placed on.
|
|
|
|
std::optional<float> GetViewRefreshRate(const WindowInfo& wi);
|
|
|
|
}
|