Coder Social home page Coder Social logo

Comments (4)

GasparVardanyan avatar GasparVardanyan commented on August 21, 2024

why dest->pixel = (dest->pixel & 0x00ffffffU) | (0xffU << 24); and not just dest->pixel |= 0xffu << 24;?

from dwm.

mralexmartin avatar mralexmartin commented on August 21, 2024

why dest->pixel = (dest->pixel & 0x00ffffffU) | (0xffU << 24); and not just dest->pixel |= 0xffu << 24;?

I'm unfamiliar with C. That line is a slightly modified line I got from the dwm alpha patch:
https://dwm.suckless.org/patches/alpha/dwm-alpha-20180613-b69c870.diff

The hunk in particular:

@@ -180,21 +183,22 @@ drw_fontset_free(Fnt *font)
 }
 
 void
-drw_clr_create(Drw *drw, Clr *dest, const char *clrname)
+drw_clr_create(Drw *drw, Clr *dest, const char *clrname, unsigned int alpha)
 {
 	if (!drw || !dest || !clrname)
 		return;
 
-	if (!XftColorAllocName(drw->dpy, DefaultVisual(drw->dpy, drw->screen),
-	                       DefaultColormap(drw->dpy, drw->screen),
+	if (!XftColorAllocName(drw->dpy, drw->visual, drw->cmap,
 	                       clrname, dest))
 		die("error, cannot allocate color '%s'", clrname);
+
+	dest->pixel = (dest->pixel & 0x00ffffffU) | (alpha << 24);
 }
 
 /* Wrapper to create color schemes. The caller has to call free(3) on the
  * returned color scheme when done using it. */
 Clr *
-drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount)
+drw_scm_create(Drw *drw, const char *clrnames[], const unsigned int alphas[], size_t clrcount)
 {
 	size_t i;
 	Clr *ret;

Perhaps it's only necessary in the original context. As I say, I'm unfamiliar with C.

from dwm.

GasparVardanyan avatar GasparVardanyan commented on August 21, 2024

From Suckless' mailing lists: szatanjl/dwm@1529909

from dwm.

mralexmartin avatar mralexmartin commented on August 21, 2024

From Suckless' mailing lists: szatanjl/dwm@1529909

How I wish I found this in my searches. I'll close seeing as that fix has been implemented in a recent commit.

from dwm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.