Browse Source

removed setstatus() && simplified main()

master
Ali H. Fardan 8 years ago
parent
commit
b650c438f0
1 changed files with 2 additions and 16 deletions
  1. +2
    -16
      slstatus.c

+ 2
- 16
slstatus.c View File

@@ -33,7 +33,6 @@ struct arg {
const char *args; const char *args;
}; };


static void setstatus(const char *);
static char *smprintf(const char *, ...); static char *smprintf(const char *, ...);
static char *battery_perc(const char *); static char *battery_perc(const char *);
static char *cpu_perc(void); static char *cpu_perc(void);
@@ -64,14 +63,6 @@ static Display *dpy;


#include "config.h" #include "config.h"


static void
setstatus(const char *str)
{
/* set WM_NAME via X11 */
XStoreName(dpy, DefaultRootWindow(dpy), str);
XSync(dpy, False);
}

static char * static char *
smprintf(const char *fmt, ...) smprintf(const char *fmt, ...)
{ {
@@ -625,10 +616,6 @@ main(void)
struct arg argument; struct arg argument;


dpy = XOpenDisplay(0x0); dpy = XOpenDisplay(0x0);
if (!dpy) {
fprintf(stderr, "Cannot open display!\n");
exit(1);
}


for (;;) { for (;;) {
memset(status_string, 0, sizeof(status_string)); memset(status_string, 0, sizeof(status_string));
@@ -648,7 +635,8 @@ main(void)
free(element); free(element);
} }


setstatus(status_string);
XStoreName(dpy, DefaultRootWindow(dpy), status_string);
XSync(dpy, False);
sleep(UPDATE_INTERVAL -1); sleep(UPDATE_INTERVAL -1);
} }


@@ -657,8 +645,6 @@ main(void)
* TODO: find out a way to exit successfully * TODO: find out a way to exit successfully
* to prevent memory leaks * to prevent memory leaks
*/ */
/*
XCloseDisplay(dpy); XCloseDisplay(dpy);
return 0; return 0;
*/
} }

Loading…
Cancel
Save