Implement `screen_is_kept_on` for macOS.

This commit is contained in:
bruvzg 2022-08-05 13:14:13 +03:00
parent cc35a8723c
commit 944779a132
No known key found for this signature in database
GPG Key ID: 7960FCF39844EC38
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);