Skip to content

Commit

Permalink
Revert "WinIcon Patch"
Browse files Browse the repository at this point in the history
This reverts commit 48d827b.

Changes to be committed:
    modified:   config.def.h
    modified:   config.def.h.orig
    modified:   config.h
    modified:   config.mk
    deleted:    config.mk.orig
    modified:   drw.c
    modified:   drw.c.orig
    modified:   drw.h
    deleted:    drw.h.orig
    modified:   dwm.c
    modified:   dwm.c.orig
    deleted:    patches/dwm-winicon-6.3-v2.1.diff
  • Loading branch information
xAlpharax committed Aug 18, 2023
1 parent f44745c commit 496351c
Show file tree
Hide file tree
Showing 12 changed files with 5 additions and 662 deletions.
2 changes: 0 additions & 2 deletions config.def.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ static const unsigned int gappx = 6; /* gaps between windows */
static const unsigned int snap = 32; /* snap pixel */
static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */
#define ICONSIZE 16 /* icon size */
#define ICONSPACING 5 /* space between icon and title */
static const char *fonts[] = { "monospace:size=10" };
static const char dmenufont[] = "monospace:size=10";
static const char col_gray1[] = "#222222";
Expand Down
1 change: 0 additions & 1 deletion config.def.h.orig
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ static const char *colors[][3] = {

/* tagging */
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
static const char *alttags[] = { "<01>", "<02>", "<03>", "<04>", "<05>" };

static const Rule rules[] = {
/* xprop(1):
Expand Down
5 changes: 0 additions & 5 deletions config.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ static const unsigned int gappx = 4; /* tiling spacing */
static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */

#define ICONSIZE 17 /* icon size in pixels */
#define ICONSPACING 6 /* space between icon and title */
//#define ICONSIZE bh /* make icon size equals to bar height */
//#define ICONSIZE (bh - 4) /* or adaptively preserve 2 pixels each side */

static const char *fonts[] = { "inconsolata:pixelsize=17" };
static const char dmenufont[] = "inconsolata:pixelsize=17";

Expand Down
2 changes: 1 addition & 1 deletion config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ FREETYPEINC = /usr/include/freetype2

# includes and libs
INCS = -I${X11INC} -I${FREETYPEINC}
LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} -lXrender -lImlib2
LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS}

# flags
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
Expand Down
39 changes: 0 additions & 39 deletions config.mk.orig

This file was deleted.

75 changes: 0 additions & 75 deletions drw.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include <string.h>
#include <X11/Xlib.h>
#include <X11/Xft/Xft.h>
#include <Imlib2.h>

#include "drw.h"
#include "util.h"
Expand Down Expand Up @@ -72,7 +71,6 @@ drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h
drw->w = w;
drw->h = h;
drw->drawable = XCreatePixmap(dpy, root, w, h, DefaultDepth(dpy, screen));
drw->picture = XRenderCreatePicture(dpy, drw->drawable, XRenderFindVisualFormat(dpy, DefaultVisual(dpy, screen)), 0, NULL);
drw->gc = XCreateGC(dpy, root, 0, NULL);
XSetLineAttributes(dpy, drw->gc, 1, LineSolid, CapButt, JoinMiter);

Expand All @@ -87,18 +85,14 @@ drw_resize(Drw *drw, unsigned int w, unsigned int h)

drw->w = w;
drw->h = h;
if (drw->picture)
XRenderFreePicture(drw->dpy, drw->picture);
if (drw->drawable)
XFreePixmap(drw->dpy, drw->drawable);
drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, DefaultDepth(drw->dpy, drw->screen));
drw->picture = XRenderCreatePicture(drw->dpy, drw->drawable, XRenderFindVisualFormat(drw->dpy, DefaultVisual(drw->dpy, drw->screen)), 0, NULL);
}

void
drw_free(Drw *drw)
{
XRenderFreePicture(drw->dpy, drw->picture);
XFreePixmap(drw->dpy, drw->drawable);
XFreeGC(drw->dpy, drw->gc);
drw_fontset_free(drw->fonts);
Expand Down Expand Up @@ -231,67 +225,6 @@ drw_setscheme(Drw *drw, Clr *scm)
drw->scheme = scm;
}

Picture
drw_picture_create_resized(Drw *drw, char *src, unsigned int srcw, unsigned int srch, unsigned int dstw, unsigned int dsth) {
Pixmap pm;
Picture pic;
GC gc;

if (srcw <= (dstw << 1u) && srch <= (dsth << 1u)) {
XImage img = {
srcw, srch, 0, ZPixmap, src,
ImageByteOrder(drw->dpy), BitmapUnit(drw->dpy), BitmapBitOrder(drw->dpy), 32,
32, 0, 32,
0, 0, 0
};
XInitImage(&img);

pm = XCreatePixmap(drw->dpy, drw->root, srcw, srch, 32);
gc = XCreateGC(drw->dpy, pm, 0, NULL);
XPutImage(drw->dpy, pm, gc, &img, 0, 0, 0, 0, srcw, srch);
XFreeGC(drw->dpy, gc);

pic = XRenderCreatePicture(drw->dpy, pm, XRenderFindStandardFormat(drw->dpy, PictStandardARGB32), 0, NULL);
XFreePixmap(drw->dpy, pm);

XRenderSetPictureFilter(drw->dpy, pic, FilterBilinear, NULL, 0);
XTransform xf;
xf.matrix[0][0] = (srcw << 16u) / dstw; xf.matrix[0][1] = 0; xf.matrix[0][2] = 0;
xf.matrix[1][0] = 0; xf.matrix[1][1] = (srch << 16u) / dsth; xf.matrix[1][2] = 0;
xf.matrix[2][0] = 0; xf.matrix[2][1] = 0; xf.matrix[2][2] = 65536;
XRenderSetPictureTransform(drw->dpy, pic, &xf);
} else {
Imlib_Image origin = imlib_create_image_using_data(srcw, srch, (DATA32 *)src);
if (!origin) return None;
imlib_context_set_image(origin);
imlib_image_set_has_alpha(1);
Imlib_Image scaled = imlib_create_cropped_scaled_image(0, 0, srcw, srch, dstw, dsth);
imlib_free_image_and_decache();
if (!scaled) return None;
imlib_context_set_image(scaled);
imlib_image_set_has_alpha(1);

XImage img = {
dstw, dsth, 0, ZPixmap, (char *)imlib_image_get_data_for_reading_only(),
ImageByteOrder(drw->dpy), BitmapUnit(drw->dpy), BitmapBitOrder(drw->dpy), 32,
32, 0, 32,
0, 0, 0
};
XInitImage(&img);

pm = XCreatePixmap(drw->dpy, drw->root, dstw, dsth, 32);
gc = XCreateGC(drw->dpy, pm, 0, NULL);
XPutImage(drw->dpy, pm, gc, &img, 0, 0, 0, 0, dstw, dsth);
imlib_free_image_and_decache();
XFreeGC(drw->dpy, gc);

pic = XRenderCreatePicture(drw->dpy, pm, XRenderFindStandardFormat(drw->dpy, PictStandardARGB32), 0, NULL);
XFreePixmap(drw->dpy, pm);
}

return pic;
}

void
drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert)
{
Expand Down Expand Up @@ -453,14 +386,6 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
return x + (render ? w : 0);
}

void
drw_pic(Drw *drw, int x, int y, unsigned int w, unsigned int h, Picture pic)
{
if (!drw)
return;
XRenderComposite(drw->dpy, PictOpOver, pic, None, drw->picture, 0, 0, 0, 0, x, y, w, h);
}

void
drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h)
{
Expand Down
2 changes: 0 additions & 2 deletions drw.c.orig
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,6 @@ drw_clr_create(Drw *drw, Clr *dest, const char *clrname)
DefaultColormap(drw->dpy, drw->screen),
clrname, dest))
die("error, cannot allocate color '%s'", clrname);

dest->pixel |= 0xff << 24;
}

/* Wrapper to create color schemes. The caller has to call free(3) on the
Expand Down
4 changes: 0 additions & 4 deletions drw.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ typedef struct {
int screen;
Window root;
Drawable drawable;
Picture picture;
GC gc;
Clr *scheme;
Fnt *fonts;
Expand Down Expand Up @@ -51,12 +50,9 @@ void drw_cur_free(Drw *drw, Cur *cursor);
void drw_setfontset(Drw *drw, Fnt *set);
void drw_setscheme(Drw *drw, Clr *scm);

Picture drw_picture_create_resized(Drw *drw, char *src, unsigned int src_w, unsigned int src_h, unsigned int dst_w, unsigned int dst_h);

/* Drawing functions */
void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert);
int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert);
void drw_pic(Drw *drw, int x, int y, unsigned int w, unsigned int h, Picture pic);

/* Map functions */
void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h);
58 changes: 0 additions & 58 deletions drw.h.orig

This file was deleted.

Loading

0 comments on commit 496351c

Please sign in to comment.