Skip to content

Commit

Permalink
Revert "Merge pull request LukeSmithxyz#62 from Federico-Ciuffardi/fa…
Browse files Browse the repository at this point in the history
…st-scrolling-fix"

This reverts commit 7101103, reversing
changes made to 141e5f4.

 Cambios a ser confirmados:
	modificado:     dwmblocks.c
  • Loading branch information
AlexSyssoyev committed Feb 25, 2021
1 parent 4138f3b commit 2c21414
Showing 1 changed file with 6 additions and 21 deletions.
27 changes: 6 additions & 21 deletions dwmblocks.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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)
{
Expand All @@ -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);
}
Expand All @@ -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]);
}
}

Expand All @@ -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]);
}
}

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 2c21414

Please sign in to comment.