From: Matthias Kruk Date: Sun, 23 May 2021 21:41:46 +0000 (+0900) Subject: workspace: Don't redraw workspace if it doesn't need redrawing X-Git-Url: https://git.corax.cc/?a=commitdiff_plain;h=aace4eca254620491dcdacf362c981c11ca1160c;p=mwm workspace: Don't redraw workspace if it doesn't need redrawing The mwm_redraw() function is called to redraw the clients as well as the status bar and other indicators. The current implementation calls monitor_redraw() and workspace_redraw() on all monitors and workspaces, respectively, so these functions must make sure not to redraw anything if it isn't necessary. This commit changes the workspace_redraw() function so it does not redraw the workspace if it was not explicitly requested. --- diff --git a/workspace.c b/workspace.c index 53172b7..cb38d82 100644 --- a/workspace.c +++ b/workspace.c @@ -228,22 +228,24 @@ int workspace_redraw(struct workspace *workspace) return(-EINVAL); } - first = loop_get_iter(&workspace->clients); + if(workspace->needs_redraw) { + first = loop_get_iter(&workspace->clients); - if(first) { - cur = first; + if(first) { + cur = first; - do { - struct client *client; + do { + struct client *client; - client = (struct client*)loop_iter_get_data(cur); - client_redraw(client); + client = (struct client*)loop_iter_get_data(cur); + client_redraw(client); - cur = loop_iter_get_next(cur); - } while(cur != first); - } + cur = loop_iter_get_next(cur); + } while(cur != first); + } - workspace->needs_redraw = 0; + workspace->needs_redraw = 0; + } return(0); }