mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-29 12:32:52 +00:00
Fix bug pressing warning icon to add palette color when active locale is non-English
It looks like Allegro library was changing the locale to the active one, and it can break things like strtod() (which is used to convert colors from string format in AddColor command). In this case, if we added a HSV color with double floating-point precision, it was added incorrectly because strtod() wasn't taking the decimal part.
This commit is contained in:
parent
f2ba51f1be
commit
27b55030e2
@ -697,9 +697,11 @@ static int x_keyboard_init(void)
|
||||
|
||||
#ifdef ALLEGRO_XWINDOWS_WITH_XIM
|
||||
/* Otherwise we are restricted to ISO-8859-1 characters. */
|
||||
/* [dacap] Don't call setlocale()
|
||||
if (setlocale(LC_ALL, "") == NULL) {
|
||||
TRACE(PREFIX_W "Could not set default locale.\n");
|
||||
}
|
||||
*/
|
||||
|
||||
/* TODO: is this needed?
|
||||
modifiers = XSetLocaleModifiers("@im=none");
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2015 David Capello
|
||||
// Copyright (C) 2001-2016 David Capello
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
@ -22,6 +22,7 @@
|
||||
#include "she/scoped_handle.h"
|
||||
#include "she/system.h"
|
||||
|
||||
#include <clocale>
|
||||
#include <cstdlib>
|
||||
#include <ctime>
|
||||
#include <iostream>
|
||||
@ -48,8 +49,14 @@ namespace {
|
||||
// Aseprite entry point. (Called from she library.)
|
||||
int app_main(int argc, char* argv[])
|
||||
{
|
||||
// Initialize the locale. Aseprite isn't ready to handle numeric
|
||||
// fields with other locales (e.g. we expect strings like "10.32" be
|
||||
// used in std::strtod(), not something like "10,32").
|
||||
std::setlocale(LC_ALL, "en-US");
|
||||
ASSERT(std::strtod("10.32", nullptr) == 10.32);
|
||||
|
||||
// Initialize the random seed.
|
||||
std::srand(static_cast<unsigned int>(std::time(NULL)));
|
||||
std::srand(static_cast<unsigned int>(std::time(nullptr)));
|
||||
|
||||
#ifdef _WIN32
|
||||
::CoInitialize(NULL);
|
||||
|
Loading…
x
Reference in New Issue
Block a user