]> git.mdlowis.com Git - proto/windowlab.git/commitdiff
removed yet more stuff
authorMichael D. Lowis <mike@mdlowis.com>
Fri, 24 May 2019 00:58:14 +0000 (20:58 -0400)
committerMichael D. Lowis <mike@mdlowis.com>
Fri, 24 May 2019 00:58:14 +0000 (20:58 -0400)
client.c
main.c
misc.c

index fd139664d77dd329815ed559de17474c099a28b9..2b241b8ef963118676cfd9385f58958d5744cdbb 100644 (file)
--- a/client.c
+++ b/client.c
@@ -173,20 +173,11 @@ void remove_client(Client *c, int mode)
 
 void redraw(Client *c)
 {
-    XDrawLine(dsply, c->frame, border_gc, 0, BARHEIGHT() - DEF_BORDERWIDTH + DEF_BORDERWIDTH / 2, c->width, BARHEIGHT() - DEF_BORDERWIDTH + DEF_BORDERWIDTH / 2);
-    // clear text part of bar
-    if (c == focused_client)
-    {
-        XFillRectangle(dsply, c->frame, active_gc, 0, 0, c->width - (BARHEIGHT() - DEF_BORDERWIDTH), BARHEIGHT() - DEF_BORDERWIDTH);
-    }
-    else
-    {
-        XFillRectangle(dsply, c->frame, inactive_gc, 0, 0, c->width - (BARHEIGHT() - DEF_BORDERWIDTH), BARHEIGHT() - DEF_BORDERWIDTH);
-    }
+    int barwidth = BARHEIGHT() - DEF_BORDERWIDTH;
+    XDrawLine(dsply, c->frame, border_gc, 0, barwidth + DEF_BORDERWIDTH/2, c->width, barwidth + DEF_BORDERWIDTH/2);
+    XFillRectangle(dsply, c->frame, active_gc, 0, 0, c->width, barwidth);
     if (!c->trans && c->name != NULL)
-    {
         XftDrawString8(c->xftdraw, &xft_detail, xftfont, SPACE, SPACE + xftfont->ascent, (unsigned char *)c->name, strlen(c->name));
-    }
 }
 
 /* Window gravity is a mess to explain, but we don't need to do much
diff --git a/main.c b/main.c
index dfa2e2e52675e2c474d22305c1befced1e630a25..58c44d3f29b2d9ebe6bfc2bd348acf2416684491 100644 (file)
--- a/main.c
+++ b/main.c
@@ -26,7 +26,6 @@
 Display *dsply = NULL;
 Window root;
 int screen;
-XFontStruct *font = NULL;
 XftFont *xftfont = NULL;
 XftColor xft_detail;
 GC string_gc, border_gc, text_gc, active_gc, depressed_gc, inactive_gc, selected_gc, empty_gc;
@@ -51,14 +50,6 @@ static void setup_display(void);
 
 int main(int argc, char **argv)
 {
-    struct sigaction act;
-    act.sa_handler = sig_handler;
-    act.sa_flags = 0;
-    sigaction(SIGTERM, &act, NULL);
-    sigaction(SIGINT, &act, NULL);
-    sigaction(SIGHUP, &act, NULL);
-    sigaction(SIGCHLD, &act, NULL);
-
     setup_display();
     scan_wins();
     do_event_loop();
diff --git a/misc.c b/misc.c
index 1d57feebba3eb95f819c7415700cc4e04d32dca0..f0bbf79b1ae71d69b0bea4398eff845bfc1d2393 100644 (file)
--- a/misc.c
+++ b/misc.c
 #include <sys/wait.h>
 #include "windowlab.h"
 
-static void quit_nicely(void);
-
 void err(const char *fmt, ...)
 {
     va_list argp;
-
     fprintf(stderr, "windowlab: ");
     va_start(argp, fmt);
     vfprintf(stderr, fmt, argp);
@@ -38,67 +35,6 @@ void err(const char *fmt, ...)
     fprintf(stderr, "\n");
 }
 
-void fork_exec(char *cmd)
-{
-    char *envshell, *envshellname;
-    pid_t pid = fork();
-
-    switch (pid)
-    {
-        case 0:
-            setsid();
-            envshell = getenv("SHELL");
-            if (envshell == NULL)
-            {
-                envshell = "/bin/sh";
-            }
-            envshellname = strrchr(envshell, '/');
-            if (envshellname == NULL)
-            {
-                envshellname = envshell;
-            }
-            else
-            {
-                /* move to the character after the slash */
-                envshellname++;
-            }
-            execlp(envshell, envshellname, "-c", cmd, NULL);
-            err("exec failed, cleaning up child");
-            exit(1);
-            break;
-        case -1:
-            err("can't fork");
-            break;
-    }
-}
-
-void sig_handler(int signal)
-{
-    pid_t pid;
-    int status;
-
-    switch (signal)
-    {
-        case SIGINT:
-        case SIGTERM:
-            quit_nicely();
-            break;
-        case SIGCHLD:
-            while ((pid = waitpid(-1, &status, WNOHANG)) != 0)
-            {
-                if ((pid == -1) && (errno != EINTR))
-                {
-                    break;
-                }
-                else
-                {
-                    continue;
-                }
-            }
-            break;
-    }
-}
-
 int handle_xerror(Display *dsply, XErrorEvent *e)
 {
     Client *c = find_client(e->resourceid, WINDOW);
@@ -241,41 +177,3 @@ void copy_dims(Rect *sourcedims, Rect *destdims)
     destdims->height = sourcedims->height;
 }
 
-/* We use XQueryTree here to preserve the window stacking order,
- * since the order in our linked list is different. */
-
-static void quit_nicely(void)
-{
-    unsigned int nwins, i;
-    Window dummyw1, dummyw2, *wins;
-    Client *c;
-
-    XQueryTree(dsply, root, &dummyw1, &dummyw2, &wins, &nwins);
-    for (i = 0; i < nwins; i++)
-    {
-        c = find_client(wins[i], FRAME);
-        if (c != NULL)
-        {
-            remove_client(c, REMAP);
-        }
-    }
-    XFree(wins);
-
-    if (font)
-    {
-        XFreeFont(dsply, font);
-    }
-    if (xftfont)
-    {
-        XftFontClose(dsply, xftfont);
-    }
-    XFreeCursor(dsply, resize_curs);
-    XFreeGC(dsply, border_gc);
-    XFreeGC(dsply, text_gc);
-
-    XInstallColormap(dsply, DefaultColormap(dsply, screen));
-    XSetInputFocus(dsply, PointerRoot, RevertToNone, CurrentTime);
-
-    XCloseDisplay(dsply);
-    exit(0);
-}