glxwindow.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Sets the transparency of the toplevel window. | |
* An alpha value of 1 draws the window opaque a value of 0 makes | |
* it totally translucent. | |
* If alpha is set to a value outside of [0..1] EINVAL is returned. */ | |
staticintsettransparency_helper(Display*display, Windowwin, doublealpha) | |
{ | |
interr ; | |
if ( alpha<0 | |
||alpha>1) { | |
LOG_DOUBLE(alpha) ; | |
err=EINVAL ; | |
goto ABBRUCH ; | |
} | |
uint32_tcardinal_alpha= (uint32_t) (alpha* (uint32_t)-1) ; | |
if (cardinal_alpha== (uint32_t)-1) { | |
XDeleteProperty( display, win, XInternAtom( display, "_NET_WM_WINDOW_OPACITY", 0)) ; | |
} else { | |
XChangeProperty( display, win, XInternAtom( display, "_NET_WM_WINDOW_OPACITY", 0), | |
XA_CARDINAL, 32, PropModeReplace, (uint8_t*) &cardinal_alpha, 1) ; | |
} | |
return0 ; | |
ABBRUCH: | |
LOG_ABORT(err) ; | |
returnerr ; | |
} |