macOS: Reduce energy consumption by not rendering occluded windows

This commit is contained in:
Kovid Goyal 2019-02-18 10:10:04 +05:30
parent dcb2d95f9a
commit f3974671f6
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 7 additions and 3 deletions

View File

@ -50,6 +50,8 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
- macOS: Add a number of common macOS keyboard shortcuts - macOS: Add a number of common macOS keyboard shortcuts
- macOS: Reduce energy consumption by not rendering occluded windows
- Fix scrollback pager history not being cleared when clearing the - Fix scrollback pager history not being cleared when clearing the
main scrollback buffer (:iss:`1387`) main scrollback buffer (:iss:`1387`)

View File

@ -869,9 +869,11 @@ mark_os_window_for_close(OSWindow* w, bool yes) {
bool bool
should_os_window_be_rendered(OSWindow* w) { should_os_window_be_rendered(OSWindow* w) {
if (glfwGetWindowAttrib(w->handle, GLFW_ICONIFIED)) return false; return (
if (!glfwGetWindowAttrib(w->handle, GLFW_VISIBLE)) return false; glfwGetWindowAttrib(w->handle, GLFW_ICONIFIED) ||
return true; !glfwGetWindowAttrib(w->handle, GLFW_VISIBLE) ||
glfwGetWindowAttrib(w->handle, GLFW_OCCLUDED)
) ? false : true;
} }
bool bool