diff options
author | rafa_99 <rafa99@protonmail.com> | 2020-02-02 12:35:37 +0000 |
---|---|---|
committer | rafa_99 <rafa99@protonmail.com> | 2020-02-02 12:35:37 +0000 |
commit | a2feba1c66487f3d6ec70c036868e59801d8eee1 (patch) | |
tree | 57da6c85d23d2723d87af2b2489f6a0137d7ec3f | |
parent | 0d7d790a54b3aae23f2b68e9ea134309f3f776fc (diff) |
Revert "Rounded Corners Patch"
This reverts commit 0d7d790a54b3aae23f2b68e9ea134309f3f776fc.
-rw-r--r-- | config.def.h | 2 | ||||
-rw-r--r-- | config.h | 3 | ||||
-rw-r--r-- | config.mk | 8 | ||||
-rw-r--r-- | dwm.c | 103 |
4 files changed, 3 insertions, 113 deletions
diff --git a/config.def.h b/config.def.h index 5c91489..44ff26e 100644 --- a/config.def.h +++ b/config.def.h @@ -10,8 +10,6 @@ static const unsigned int gappov = 10; /* vert outer gap between window static const int smartgaps = 0; /* 1 means no outer gap when there is only one window */ static const int showbar = 1; /* 0 means no bar */ static const int topbar = 1; /* 0 means bottom bar */ -static int corner_radius = 0; /* window corners radius */ -static int round_windows = 0; /* 0 == round only floating windows, 1 == round only fullscreen windows, 2 == round all windows */ static const int vertpad = 10; /* vertical padding of bar */ static const int sidepad = 10; /* horizontal padding of bar */ static const char *fonts[] = { "monospace:size=10" }; @@ -10,8 +10,6 @@ static const unsigned int gappov = 15; /* vert outer gap between window static const int smartgaps = 0; /* 1 means no outer gap when there is only one window */ static const int showbar = 1; /* 0 means no bar */ static const int topbar = 1; /* 0 means bottom bar */ -static int corner_radius = 5; /* window corners radius */ -static int round_windows = 2; /* 0 == round only floating windows, 1 == round only fullscreen windows, 2 == round all windows */ static const int vertpad = 10; /* vertical padding of bar */ static const int sidepad = 10; /* horizontal padding of bar */ static const char *fonts[] = { "UbuntuMono Nerd Font:size=11" }; @@ -210,3 +208,4 @@ static Button buttons[] = { { ClkTagBar, MODKEY, Button1, tag, {0} }, { ClkTagBar, MODKEY, Button3, toggletag, {0} }, }; + @@ -14,10 +14,6 @@ X11LIB = /usr/X11R6/lib XINERAMALIBS = -lXinerama XINERAMAFLAGS = -DXINERAMA -# Shape extension flags -XSHAPELIBS = -lXext -XSHAPEFLAGS= -DSHAPE - # freetype FREETYPELIBS = -lfontconfig -lXft FREETYPEINC = /usr/include/freetype2 @@ -26,10 +22,10 @@ FREETYPEINC = /usr/include/freetype2 # includes and libs INCS = -I${X11INC} -I${FREETYPEINC} -LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${XSHAPELIBS} ${FREETYPELIBS} -lXrender +LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} # flags -CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=2 -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} ${XSHAPEFLAGS} +CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=2 -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} #CFLAGS = -g -std=c99 -pedantic -Wall -O0 ${INCS} ${CPPFLAGS} CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os ${INCS} ${CPPFLAGS} LDFLAGS = ${LIBS} @@ -39,9 +39,6 @@ #ifdef XINERAMA #include <X11/extensions/Xinerama.h> #endif /* XINERAMA */ -#ifdef SHAPE -#include "X11/extensions/shape.h" -#endif /* SHAPE */ #include <X11/Xft/Xft.h> #include "drw.h" @@ -266,10 +263,6 @@ static void zoom(const Arg *arg); static void centeredmaster(Monitor *m); static void centeredfloatingmaster(Monitor *m); -/* rounded corners */ -unsigned int have_to_round_corners(Client *c); -void shape_window_round_corners(Client *c); - /* variables */ static const char broken[] = "broken"; static char stext[256]; @@ -1192,10 +1185,6 @@ manage(Window w, XWindowAttributes *wa) (unsigned char *) &(c->win), 1); XMoveResizeWindow(dpy, c->win, c->x + 2 * sw, c->y, c->w, c->h); /* some windows require this */ setclientstate(c, NormalState); - - if (have_to_round_corners(c)) - shape_window_round_corners(c); - if (c->mon == selmon) unfocus(selmon->sel, 0); c->mon->sel = c; @@ -1429,8 +1418,6 @@ resizeclient(Client *c, int x, int y, int w, int h) wc.border_width = c->bw; XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc); configure(c); - if (have_to_round_corners(c)) - shape_window_round_corners(c); XSync(dpy, False); } @@ -1487,9 +1474,6 @@ resizemouse(const Arg *arg) selmon = m; focus(NULL); } - if (have_to_round_corners(c)) - shape_window_round_corners(c); - } void @@ -2596,90 +2580,3 @@ centeredfloatingmaster(Monitor *m) tx += WIDTH(c); } } - -// determines round window corners mode -unsigned int have_to_round_corners(Client *c) { - // 2 means round all windows - if (round_windows == 2) return 1; - - // 0 and window is floating - if (c->isfloating && round_windows == 0) return 1; - - // 1 and window is fullscreen - if (c->isfullscreen && round_windows == 1) return 1; - - // any other combination means no rounded corners - return 0; -} - -// use X11 shape extension to draw windows with round corners -void shape_window_round_corners(Client *c) { - if (!c) return; - Window win = c->win; - unsigned long white_pixel = 0, black_pixel = 0; - unsigned int diameter = 0; - int event_base, error_base; - - // Get correct white and black pixel values from the current screen - white_pixel = WhitePixel(dpy, DefaultScreen(dpy)); - black_pixel = BlackPixel(dpy, DefaultScreen(dpy)); - - // check whether the SHAPE extension is supported - if (! XShapeQueryExtension(dpy, &event_base, &error_base)) { - printf("X SHAPE extension is not supported. Won't render corners on windows."); - return; - } - - // do we have to round corners? - if (!(corner_radius > 0)) { - return; - } else { - diameter = corner_radius << 1; - } - - // allocate arc and rectangle resources - XArc window_corners[] = { - {0, 0, diameter, diameter, 0, 360*64}, // top left - {c->w - diameter - 1, 0, diameter, diameter, 0, 360*64}, // top right - {0, c->h - diameter - 1, diameter, diameter, 0, 360*64}, // bottom left - {c->w - diameter - 1, c->h - diameter - 1, diameter, diameter, 0, 360*64}, // bottom right - }; - - XRectangle mask_rectangles[] = { - {corner_radius, 0, c->w - diameter, c->h}, - {0, corner_radius, c->w, c->h - diameter}, - }; - - // allocate a pixmap for the draw mask - Pixmap mask = XCreatePixmap(dpy, win, c->w, c->h, 1); - if (!mask) return; - - // create a graphic context to draw on - XGCValues valuemask; - GC graphic_context; - graphic_context = XCreateGC(dpy, mask, 0, &valuemask); - // failed to allocate graphic context. - // clean up mask drawable and return - if (!graphic_context) { - XFreePixmap(dpy, mask); - return; - } - - // 1- fill mask rectangle - XSetForeground(dpy, graphic_context, black_pixel); - XFillRectangle(dpy, mask, graphic_context, 0, 0, c->w, c->h); - - // 2- draw corner arcs - XSetForeground(dpy, graphic_context, white_pixel); - XFillArcs(dpy, mask, graphic_context, window_corners, 4); - XFillRectangles(dpy, mask, graphic_context, mask_rectangles, 2); - - // 3- combine masks - XShapeCombineMask(dpy, win, ShapeBounding, 0, 0, mask, ShapeSet); - - // free mask drawable - XFreePixmap(dpy, mask); - // clear and deallocate graphic context - XFreeGC(dpy, graphic_context); -} - |