Merge pull request from bruvzg/mac_keep_on_read

Implement `screen_is_kept_on` for macOS.
This commit is contained in:
Rémi Verschelde 2022-08-05 23:46:56 +02:00 committed by GitHub
commit 91f14c40ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View file

@ -303,6 +303,7 @@ public:
virtual Rect2i screen_get_usable_rect(int p_screen = SCREEN_OF_MAIN_WINDOW) const override;
virtual float screen_get_refresh_rate(int p_screen = SCREEN_OF_MAIN_WINDOW) const override;
virtual void screen_set_keep_on(bool p_enable) override;
virtual bool screen_is_kept_on() const override;
virtual Vector<int> get_window_list() const override;

View file

@ -1892,6 +1892,10 @@ float DisplayServerMacOS::screen_get_refresh_rate(int p_screen) const {
return SCREEN_REFRESH_RATE_FALLBACK;
}
bool DisplayServerMacOS::screen_is_kept_on() const {
return (screen_keep_on_assertion);
}
void DisplayServerMacOS::screen_set_keep_on(bool p_enable) {
if (screen_keep_on_assertion) {
IOPMAssertionRelease(screen_keep_on_assertion);