From 4d4a2b69c28d4ff8a7216bcc4ee59df0128a956c Mon Sep 17 00:00:00 2001 From: speedie Date: Fri, 30 Dec 2022 14:43:57 +0100 Subject: [PATCH] remove rounded corners honestly it's not a very useful feature and the corners don't look that nice. if you want good rounded corners that also works on the bar i might add, use picom and set up some rules. i plan on making a list of classes speedwm uses so that you can apply it to only speedwm if you so wish. --- TODO | 1 - docs/example.Xresources | 2 - options.h | 4 -- speedwm.c | 94 ----------------------------------------- toggle.h | 1 - xresources.h | 4 -- 6 files changed, 106 deletions(-) diff --git a/TODO b/TODO index d3653a0..0156af1 100644 --- a/TODO +++ b/TODO @@ -3,5 +3,4 @@ - Figure out how to get toggletopbar func working - Logo to replace speedwm.png - Click to minimize -- Remove rounded corners - Perhaps introduce padding around text/bar diff --git a/docs/example.Xresources b/docs/example.Xresources index 513a82b..5c886a2 100644 --- a/docs/example.Xresources +++ b/docs/example.Xresources @@ -29,8 +29,6 @@ speedwm.bar.hide.clientindicator: 0 ! Hide the client indicator on the tags speedwm.bar.titleposition: 1 ! Position of the title (0: Left, 1: Center) !! Border options -speedwm.border.roundedcorners: 0 ! Enable rounded corners around the border of windows (0/1) -speedwm.border.cornerradius: 2 ! Corner radius when rounded corners are enabled () speedwm.border.size: 1 ! Size of the border around windows in pixels () !! Client options diff --git a/options.h b/options.h index 017fe4e..eac38e9 100644 --- a/options.h +++ b/options.h @@ -35,10 +35,6 @@ static int fadeinactive = 1; /* Fade inactive windows */ static double activeopacity = 1.0f; /* Window opacity when it's focused (0 <= opacity <= 1) */ static double inactiveopacity = 0.875f; /* Window opacity when it's inactive (0 <= opacity <= 1) */ -/* Rounded corners */ -static int roundedcorners = 0; /* Enable (1) rounded corners or disable (0) rounded corners. */ -static int cornerradius = 2; /* Radius of rounded corners, 10 is the default. */ - /* Tag preview options */ static int tagpreview = 1; /* Enable tag previews */ static int tagpreviewpaddingv = 0; /* Vertical tag padding */ diff --git a/speedwm.c b/speedwm.c index 128ba39..25df2c4 100644 --- a/speedwm.c +++ b/speedwm.c @@ -23,9 +23,6 @@ #if USEXRESOURCES #include #endif -#if USEROUNDCORNERS -#include -#endif #ifdef XINERAMA #include #endif /* XINERAMA */ @@ -502,9 +499,6 @@ static void dragmfact(const Arg *arg); static void drawbaritems(Monitor *m); static void drawbarwin(Bar *bar); static void drawbar(void); -#if USEROUNDCORNERS -static void drawroundedcorners(Client *c); -#endif static void enternotify(XEvent *e); static void expose(XEvent *e); static void focus(Client *c); @@ -1181,14 +1175,6 @@ arrangemon(Monitor *m) if (m->lt[m->sellt]->arrange) { m->lt[m->sellt]->arrange(m); } - - #if USEROUNDCORNERS - if (roundedcorners) { - Client *c; - for (c = nexttiled(m->clients); c; c = nexttiled(c->next)) - drawroundedcorners(c); - } - #endif } void @@ -1212,13 +1198,6 @@ moveresizeaspect(const Arg *arg) { XRaiseWindow(dpy, c->win); resize(c, c->x, c->y, nw, nh, True); - - #if USEROUNDCORNERS - if (roundedcorners) { - XRectangle rect = { .x = 0, .y = 0, .width = c->w, .height = c->h }; - XShapeCombineRectangles(dpy, c->win, ShapeBounding, 0, 0, &rect, 1, ShapeSet, 1); - } - #endif } void @@ -1656,54 +1635,6 @@ configurenotify(XEvent *e) } } -/* draw rounded corners for current client */ -#if USEROUNDCORNERS -void -drawroundedcorners(Client *c) -{ - - Window w = c->win; - XWindowAttributes wa; - XGetWindowAttributes(dpy, w, &wa); - - if(!XGetWindowAttributes(dpy, w, &wa)) - return; - - int width = bordersize * 2 + wa.width; - int height = bordersize * 2 + wa.height; - int rad = cornerradius; - int dia = 2 * rad; - - if(width < dia || height < dia) - return; - - Pixmap mask = XCreatePixmap(dpy, w, width, height, 1); - - if(!mask) - return; - - XGCValues xgcv; - GC shape_gc = XCreateGC(dpy, mask, 0, &xgcv); - if(!shape_gc) { - XFreePixmap(dpy, mask); - return; - } - - XSetForeground(dpy, shape_gc, 0); - XFillRectangle(dpy, mask, shape_gc, 0, 0, width, height); - XSetForeground(dpy, shape_gc, 1); - XFillArc(dpy, mask, shape_gc, 0, 0, dia, dia, 0, 23040); - XFillArc(dpy, mask, shape_gc, width-dia-1, 0, dia, dia, 0, 23040); - XFillArc(dpy, mask, shape_gc, 0, height-dia-1, dia, dia, 0, 23040); - XFillArc(dpy, mask, shape_gc, width-dia-1, height-dia-1, dia, dia, 0, 23040); - XFillRectangle(dpy, mask, shape_gc, rad, 0, width-dia, height); - XFillRectangle(dpy, mask, shape_gc, 0, rad, width, height-dia); - XShapeCombineMask(dpy, w, ShapeBounding, 0-wa.border_width, 0-wa.border_width, mask, ShapeSet); - XFreePixmap(dpy, mask); - XFreeGC(dpy, shape_gc); -} -#endif - void configurerequest(XEvent *e) { @@ -3655,13 +3586,6 @@ moveresize(const Arg *arg) { if ((msx + nmx) > c->x && (msy + nmy) > c->y) XWarpPointer(dpy, None, None, 0, 0, 0, 0, nmx, nmy); } - - #if USEROUNDCORNERS - if (roundedcorners) { - XRectangle rect = { .x = 0, .y = 0, .width = c->w, .height = c->h }; - XShapeCombineRectangles(dpy, c->win, ShapeBounding, 0, 0, &rect, 1, ShapeSet, 1); - } - #endif } #if USESWITCHER @@ -3951,12 +3875,6 @@ moveresizeedge(const Arg *arg) { XWarpPointer(dpy, None, None, 0, 0, 0, 0, nmx, nmy); } - #if USEROUNDCORNERS - if (roundedcorners) { - XRectangle rect = { .x = 0, .y = 0, .width = c->w, .height = c->h }; - XShapeCombineRectangles(dpy, c->win, ShapeBounding, 0, 0, &rect, 1, ShapeSet, 1); - } - #endif } Client * @@ -5016,12 +4934,6 @@ setfullscreen(Client *c, int fullscreen) c->bw = 0; c->isfloating = 1; resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh); - #if USEROUNDCORNERS - if (roundedcorners) { - XRectangle rect = { .x = 0, .y = 0, .width = c->w, .height = c->h }; - XShapeCombineRectangles(dpy, c->win, ShapeBounding, 0, 0, &rect, 1, ShapeSet, 1); - } - #endif XRaiseWindow(dpy, c->win); } else if (!fullscreen && c->isfullscreen){ XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32, @@ -5034,12 +4946,6 @@ setfullscreen(Client *c, int fullscreen) c->w = c->oldw; c->h = c->oldh; resizeclient(c, c->x, c->y, c->w, c->h); - #if USEROUNDCORNERS - if (roundedcorners) { - XRectangle rect = { .x = 0, .y = 0, .width = c->w, .height = c->h }; - XShapeCombineRectangles(dpy, c->win, ShapeBounding, 0, 0, &rect, 1, ShapeSet, 1); - } - #endif arrange(c->mon); } } diff --git a/toggle.h b/toggle.h index e5f59f8..ce9fec8 100644 --- a/toggle.h +++ b/toggle.h @@ -20,7 +20,6 @@ Not compatible with BSDs so for those, set this to 0. */ /* Miscellanious */ #define USESWITCHER 1 /* Whether or not to include the switcher */ #define USESYSTRAY 1 /* Whether or not to include the systray */ -#define USEROUNDCORNERS 1 /* Whether or not to include rounded corners */ #define USEMEDIA 1 /* Whether or not to include media keys */ #define USEMOUSE 1 /* Whether or not to include mouse binds */ #define USEXRESOURCES 1 /* Whether or not to include .Xresources support. */ diff --git a/xresources.h b/xresources.h index a367172..751d684 100644 --- a/xresources.h +++ b/xresources.h @@ -197,10 +197,6 @@ ResourcePref resources[] = { { "client.fade.inactive", INTEGER, &fadeinactive }, { "client.fade.windows", INTEGER, &fadewindows }, #endif - #if USEROUNDCORNERS - { "border.roundedcorners", INTEGER, &roundedcorners }, - { "border.cornerradius", INTEGER, &cornerradius }, - #endif /* Traditional color system support (for example useful for Pywal) */ { "color0", STRING, &col_background },