From f3974671f6a1eaf91d2b00b34f481d49b295002d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 18 Feb 2019 10:10:04 +0530 Subject: [PATCH] macOS: Reduce energy consumption by not rendering occluded windows --- docs/changelog.rst | 2 ++ kitty/glfw.c | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index ce9aa4bf0..0b51c5dda 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -50,6 +50,8 @@ To update |kitty|, :doc:`follow the instructions `. - 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 main scrollback buffer (:iss:`1387`) diff --git a/kitty/glfw.c b/kitty/glfw.c index f5c87c908..eda64acbd 100644 --- a/kitty/glfw.c +++ b/kitty/glfw.c @@ -869,9 +869,11 @@ mark_os_window_for_close(OSWindow* w, bool yes) { bool should_os_window_be_rendered(OSWindow* w) { - if (glfwGetWindowAttrib(w->handle, GLFW_ICONIFIED)) return false; - if (!glfwGetWindowAttrib(w->handle, GLFW_VISIBLE)) return false; - return true; + return ( + glfwGetWindowAttrib(w->handle, GLFW_ICONIFIED) || + !glfwGetWindowAttrib(w->handle, GLFW_VISIBLE) || + glfwGetWindowAttrib(w->handle, GLFW_OCCLUDED) + ) ? false : true; } bool