From 89ca869f6cf3cb10871d8fd8c54b5bd2a870a8da Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Tue, 14 May 2024 17:06:55 +0200 Subject: src/main.cpp: Initialize LC_NUMERIC with 'POSIX'. This assures that float number conversions (from float to string via e.g. g_strdup_sprintf()) always use a dot in decimal numbers. This resolves blackening of the screen if users with e.g. de_DE.UTF-8 use the brightness slider and hand over a komma-decimal to the xsct executable (which only understands dot-decimals). As we don't use numbers / number conversions anywhere else in the display indicator, this global setting of LC_NUMERIC seems to be the easiest approach. --- src/main.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index a422610..c03a5ec 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -48,6 +48,20 @@ main(int /*argc*/, char** /*argv*/) // boilerplate i18n setlocale(LC_ALL, ""); + + // Initialize LC_NUMERIC with 'POSIX'. This assures that float number + // conversions (from float to string via e.g. g_strdup_sprintf()) always + // use a dot in decimal numbers. + // + // This resolves blackening of the screen if users with e.g. de_DE.UTF-8 + // use the brightness slider and hand over a komma-decimal to the xsct + // executable (which only understands dot-decimals). + // + // As we don't use numbers / number conversions anywhere else in the + // display indicator, this global setting of LC_NUMERIC seems to be the + // easiest approach. + setlocale(LC_NUMERIC, "POSIX"); + bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR); textdomain(GETTEXT_PACKAGE); -- cgit v1.2.3