Workaround compiling with -ffast-math
And add a compiler warning. Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
45e9530bcb
commit
be09a9a835
|
@ -4016,7 +4016,7 @@ get_cfg(session_t *ps, int argc, char *const *argv, bool first_pass) {
|
|||
ps->o.wintype_shadow[WINTYPE_DND] = false;
|
||||
if (fading_enable)
|
||||
wintype_arr_enable(ps->o.wintype_fade);
|
||||
if (!isnan(cfgtmp.menu_opacity)) {
|
||||
if (!safe_isnan(cfgtmp.menu_opacity)) {
|
||||
ps->o.wintype_opacity[WINTYPE_DROPDOWN_MENU] = cfgtmp.menu_opacity;
|
||||
ps->o.wintype_opacity[WINTYPE_POPUP_MENU] = cfgtmp.menu_opacity;
|
||||
}
|
||||
|
|
11
src/utils.h
11
src/utils.h
|
@ -4,6 +4,17 @@
|
|||
#include <ctype.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
#ifdef __FAST_MATH__
|
||||
#warning Use of -ffast-math can cause rendering error or artifacts, \
|
||||
therefore it is not recommended.
|
||||
#endif
|
||||
|
||||
__attribute__((optimize("-fno-fast-math")))
|
||||
static inline bool safe_isnan(double a) {
|
||||
return isnan(a);
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalize an int value to a specific range.
|
||||
|
|
|
@ -324,7 +324,7 @@ void win_calc_opacity(session_t *ps, win *w) {
|
|||
// Try obeying opacity property and window type opacity firstly
|
||||
if (w->has_opacity_prop)
|
||||
opacity = w->opacity_prop;
|
||||
else if (!isnan(ps->o.wintype_opacity[w->window_type]))
|
||||
else if (!safe_isnan(ps->o.wintype_opacity[w->window_type]))
|
||||
opacity = ps->o.wintype_opacity[w->window_type] * OPAQUE;
|
||||
else {
|
||||
// Respect active_opacity only when the window is physically focused
|
||||
|
|
Loading…
Reference in New Issue