aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Tari <robert@tari.in>2024-05-15 14:56:48 +0200
committerRobert Tari <robert@tari.in>2024-05-15 14:56:48 +0200
commit9a605aa2479f99a088fa079ba12a9e86da165166 (patch)
treee402271504868897ab67c109aaac48ac2031661b /src
parentcd7ad7e27544e0073d817624bc40438a19ae9c33 (diff)
parent89ca869f6cf3cb10871d8fd8c54b5bd2a870a8da (diff)
downloadayatana-indicator-display-9a605aa2479f99a088fa079ba12a9e86da165166.tar.gz
ayatana-indicator-display-9a605aa2479f99a088fa079ba12a9e86da165166.tar.bz2
ayatana-indicator-display-9a605aa2479f99a088fa079ba12a9e86da165166.zip
Merge branch 'sunweaver-pr/xsct-brightness-slider-blackscreen-with-de-locale'
Attributes GH PR #97: https://github.com/AyatanaIndicators/ayatana-indicator-display/pull/97
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp14
1 files changed, 14 insertions, 0 deletions
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);