]> git.corax.cc Git - mwm/commitdiff
workspace: Don't redraw workspace if it doesn't need redrawing
authorMatthias Kruk <m@m10k.eu>
Sun, 23 May 2021 21:41:46 +0000 (06:41 +0900)
committerMatthias Kruk <m@m10k.eu>
Sun, 23 May 2021 21:41:46 +0000 (06:41 +0900)
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.

workspace.c

index 53172b780f0f0a1e046742e75f11c147122b99a4..cb38d82ae8f2abcfcccfc079a4e4966b0d8ae4b8 100644 (file)
@@ -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);
 }