From 926ae379ba2639322948b4c9f21b9b9eeadf72df Mon Sep 17 00:00:00 2001 From: Richard Grenville Date: Sun, 15 Sep 2013 08:56:53 +0800 Subject: [PATCH] Bug fix #143: GLSL shader error on European locales Set LC_NUMERIC=C when generating GLSL shader strings to avoid decimal point issues on European locales. Thanks to hiciu for reporting. --- src/opengl.c | 9 +++++++++ src/opengl.h | 1 + 2 files changed, 10 insertions(+) diff --git a/src/opengl.c b/src/opengl.c index a26a286..33a2fc7 100644 --- a/src/opengl.c +++ b/src/opengl.c @@ -225,6 +225,11 @@ glx_init_blur(session_t *ps) { #ifdef CONFIG_VSYNC_OPENGL_GLSL { + char *lc_numeric_old = mstrcpy(setlocale(LC_NUMERIC, NULL)); + // Enforce LC_NUMERIC locale "C" here to make sure decimal point is sane + // Thanks to hiciu for reporting. + setlocale(LC_NUMERIC, "C"); + static const char *FRAG_SHADER_BLUR_PREFIX = "#version 110\n" "%s" @@ -331,6 +336,10 @@ glx_init_blur(session_t *ps) { #undef P_GET_UNIFM_LOC } free(extension); + + // Restore LC_NUMERIC + setlocale(LC_NUMERIC, lc_numeric_old); + free(lc_numeric_old); } diff --git a/src/opengl.h b/src/opengl.h index eae8bcf..564b7e2 100644 --- a/src/opengl.h +++ b/src/opengl.h @@ -11,6 +11,7 @@ #include "common.h" #include +#include #ifdef DEBUG_GLX_ERR