revert corners

This commit is contained in:
WanderingPenwing 2024-07-30 18:03:56 +02:00
parent 54f7bca6e3
commit bdfccdbfd7
3 changed files with 0 additions and 59 deletions

View file

@ -3,7 +3,6 @@
/* appearance */ /* appearance */
static const unsigned int borderpx = 6; /* border pixel of windows */ static const unsigned int borderpx = 6; /* border pixel of windows */
static const unsigned int gappx = 6; static const unsigned int gappx = 6;
static const unsigned int cornerrad = 20;
static const unsigned int snap = 32; /* snap pixel */ static const unsigned int snap = 32; /* snap pixel */
static const int showbar = 1; /* 0 means no bar */ static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */ static const int topbar = 1; /* 0 means bottom bar */

58
dwm.c
View file

@ -39,7 +39,6 @@
#ifdef XINERAMA #ifdef XINERAMA
#include <X11/extensions/Xinerama.h> #include <X11/extensions/Xinerama.h>
#endif /* XINERAMA */ #endif /* XINERAMA */
#include <X11/extensions/shape.h>
#include <X11/Xft/Xft.h> #include <X11/Xft/Xft.h>
#include "drw.h" #include "drw.h"
@ -242,7 +241,6 @@ static int xerrordummy(Display *dpy, XErrorEvent *ee);
static int xerrorstart(Display *dpy, XErrorEvent *ee); static int xerrorstart(Display *dpy, XErrorEvent *ee);
static void xinitvisual(); static void xinitvisual();
static void zoom(const Arg *arg); static void zoom(const Arg *arg);
static void drawroundedcorners(Client *c);
/* variables */ /* variables */
static const char broken[] = "broken"; static const char broken[] = "broken";
@ -1096,9 +1094,6 @@ manage(Window w, XWindowAttributes *wa)
unfocus(selmon->sel, 0); unfocus(selmon->sel, 0);
c->mon->sel = c; c->mon->sel = c;
arrange(c->mon); arrange(c->mon);
drawroundedcorners(c);
XMapWindow(dpy, c->win); XMapWindow(dpy, c->win);
focus(NULL); focus(NULL);
} }
@ -1309,55 +1304,6 @@ resizeclient(Client *c, int x, int y, int w, int h)
XSync(dpy, False); XSync(dpy, False);
} }
void drawroundedcorners(Client *c) {
// if set to zero in config.h, do not attempt to round
if(cornerrad < 0) return;
// NOTE: this is extremely hacky and surely could be optimized.
// Any X wizards out there reading this, please pull request.
if (cornerrad > 0 && c && !c->isfullscreen) {
Window win;
win = c->win;
if(!win) return;
XWindowAttributes win_attr;
if(!XGetWindowAttributes(dpy, win, &win_attr)) return;
// set in config.h:
int dia = 2 * cornerrad;
int w = c->w;
int h = c->h;
if(w < dia || h < dia) return;
Pixmap mask;
mask = XCreatePixmap(dpy, win, w, h, 1);
if(!mask) return;
XGCValues xgcv;
GC shape_gc;
shape_gc = XCreateGC(dpy, mask, 0, &xgcv);
if(!shape_gc) {
XFreePixmap(dpy, mask);
free(shape_gc);
return;
}
XSetForeground(dpy, shape_gc, 0);
XFillRectangle(dpy, mask, shape_gc, 0, 0, w, h);
XSetForeground(dpy, shape_gc, 1);
XFillArc(dpy, mask, shape_gc, 0, 0, dia, dia, 0, 23040);
XFillArc(dpy, mask, shape_gc, w-dia-1, 0, dia, dia, 0, 23040);
XFillArc(dpy, mask, shape_gc, 0, h-dia-1, dia, dia, 0, 23040);
XFillArc(dpy, mask, shape_gc, w-dia-1, h-dia-1, dia, dia, 0, 23040);
XFillRectangle(dpy, mask, shape_gc, cornerrad, 0, w-dia, h);
XFillRectangle(dpy, mask, shape_gc, 0, cornerrad, w, h-dia);
XShapeCombineMask(dpy, win, ShapeBounding, 0, 0, mask, ShapeSet);
XFreePixmap(dpy, mask);
XFreeGC(dpy, shape_gc);
}
}
void void
resizemouse(const Arg *arg) resizemouse(const Arg *arg)
{ {
@ -1402,9 +1348,6 @@ resizemouse(const Arg *arg)
} }
if (!selmon->lt[selmon->sellt]->arrange || c->isfloating) if (!selmon->lt[selmon->sellt]->arrange || c->isfloating)
resize(c, c->x, c->y, nw, nh, 1); resize(c, c->x, c->y, nw, nh, 1);
drawroundedcorners(c);
break; break;
} }
} while (ev.type != ButtonRelease); } while (ev.type != ButtonRelease);
@ -1416,7 +1359,6 @@ resizemouse(const Arg *arg)
selmon = m; selmon = m;
focus(NULL); focus(NULL);
} }
drawroundedcorners(c);
} }
void void

BIN
dwm.o

Binary file not shown.