aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Smith <luke@lukesmith.xyz>2021-03-02 09:22:49 -0500
committerGitHub <noreply@github.com>2021-03-02 09:22:49 -0500
commit78925115014bea2f4ead26f0dd7f833ff301ad11 (patch)
tree1762fe6005cb73e5db98653ea1e21d149cbbfec4
parent7101103744dc301ed48eaa1abe30690dc64c45b6 (diff)
parent826e3f1a990efb93f9bbf5d83512e63fc84007fe (diff)
downloaddwmblocks-78925115014bea2f4ead26f0dd7f833ff301ad11.tar.gz
dwmblocks-78925115014bea2f4ead26f0dd7f833ff301ad11.tar.bz2
dwmblocks-78925115014bea2f4ead26f0dd7f833ff301ad11.zip
Merge pull request #66 from LukeSmithxyz/revert-62-fast-scrolling-fix
Revert "Mitigates disappearing blocks on fast mouse interaction"
-rw-r--r--dwmblocks.c27
1 files changed, 6 insertions, 21 deletions
diff --git a/dwmblocks.c b/dwmblocks.c
index 5021af1..18f58fb 100644
--- a/dwmblocks.c
+++ b/dwmblocks.c
@@ -13,7 +13,6 @@ typedef struct {
unsigned int interval;
unsigned int signal;
} Block;
-char** last_updates;
void sighandler(int num);
void buttonhandler(int sig, siginfo_t *si, void *ucontext);
void replace(char *str, char old, char new);
@@ -62,7 +61,7 @@ void remove_all(char *str, char to_remove) {
}
//opens process *cmd and stores output in *output
-void getcmd(const Block *block, char* last_update , char *output)
+void getcmd(const Block *block, char *output)
{
if (block->signal)
{
@@ -78,15 +77,10 @@ void getcmd(const Block *block, char* last_update , char *output)
int i = strlen(block->icon);
fgets(output+i, CMDLENGTH-(strlen(delim)+1), cmdf);
remove_all(output, '\n');
- if(i == strlen(output))
- strcpy(output+i, last_update);
- else
- strcpy(last_update, output+i);
-
i = strlen(output);
- if ((i > 0 && block != &blocks[LENGTH(blocks) - 1]))
- strcat(output, delim);
- i+=strlen(delim);
+ if ((i > 0 && block != &blocks[LENGTH(blocks) - 1]))
+ strcat(output, delim);
+ i+=strlen(delim);
output[i++] = '\0';
pclose(cmdf);
}
@@ -98,7 +92,7 @@ void getcmds(int time)
{
current = blocks + i;
if ((current->interval != 0 && time % current->interval == 0) || time == -1)
- getcmd(current,last_updates[i],statusbar[i]);
+ getcmd(current,statusbar[i]);
}
}
@@ -110,7 +104,7 @@ void getsigcmds(int signal)
{
current = blocks + i;
if (current->signal == signal)
- getcmd(current,last_updates[i],statusbar[i]);
+ getcmd(current,statusbar[i]);
}
}
@@ -182,11 +176,6 @@ void statusloop()
#ifndef __OpenBSD__
setupsignals();
#endif
- last_updates = malloc(sizeof(char*) * LENGTH(blocks));
- for(int i = 0; i < LENGTH(blocks); i++) {
- last_updates[i] = malloc(sizeof(char) * CMDLENGTH);
- strcpy(last_updates[i],"");
- }
int i = 0;
getcmds(-1);
while(statusContinue)
@@ -233,10 +222,6 @@ void buttonhandler(int sig, siginfo_t *si, void *ucontext)
void termhandler(int signum)
{
- for(int i = 0; i < LENGTH(blocks); i++) {
- free(last_updates[i]);
- }
- free(last_updates);
statusContinue = 0;
exit(0);
}