Skip to content

Commit

Permalink
blank-screens: snap alpha if close to min/max
Browse files Browse the repository at this point in the history
  • Loading branch information
XPhyro committed Mar 28, 2024
1 parent 600c955 commit 3f51184
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/cpp/util/core/blank-screens.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,14 @@ struct Options {

void set_window_alpha(Window window, double alpha)
{
unsigned long opacity = 0xFFFFFFFFul * alpha;
unsigned long opacity;
if (alpha > 0.99)
opacity = 0xFFFFFFFFul;
else if (alpha < 0.01)
opacity = 0x00000000ul;
else
opacity = 0xFFFFFFFFul * alpha;

auto opacity_atom = XInternAtom(display, "_NET_WM_WINDOW_OPACITY", False);
XChangeProperty(display,
window,
Expand Down

0 comments on commit 3f51184

Please sign in to comment.