diff options
Diffstat (limited to 'WebCore/platform/gtk')
-rw-r--r-- | WebCore/platform/gtk/KeyEventGtk.cpp | 2 | ||||
-rw-r--r-- | WebCore/platform/gtk/Language.cpp | 23 |
2 files changed, 23 insertions, 2 deletions
diff --git a/WebCore/platform/gtk/KeyEventGtk.cpp b/WebCore/platform/gtk/KeyEventGtk.cpp index 4186c2f..3931eff 100644 --- a/WebCore/platform/gtk/KeyEventGtk.cpp +++ b/WebCore/platform/gtk/KeyEventGtk.cpp @@ -200,6 +200,7 @@ static int windowsKeyCodeForKeyEvent(unsigned int keycode) case GDK_Control_R: return VK_CONTROL; // (11) CTRL key case GDK_Menu: + return VK_APPS; // (5D) Applications key (Natural keyboard) case GDK_Alt_L: case GDK_Alt_R: return VK_MENU; // (12) ALT key @@ -370,7 +371,6 @@ static int windowsKeyCodeForKeyEvent(unsigned int keycode) return VK_LWIN; // (5B) Left Windows key (Microsoft Natural keyboard) case GDK_Meta_R: return VK_RWIN; // (5C) Right Windows key (Natural keyboard) - // VK_APPS (5D) Applications key (Natural keyboard) // VK_SLEEP (5F) Computer Sleep key // VK_SEPARATOR (6C) Separator key // VK_SUBTRACT (6D) Subtract key diff --git a/WebCore/platform/gtk/Language.cpp b/WebCore/platform/gtk/Language.cpp index 171cd84..fea2df6 100644 --- a/WebCore/platform/gtk/Language.cpp +++ b/WebCore/platform/gtk/Language.cpp @@ -21,16 +21,37 @@ #include "Language.h" #include "CString.h" +#include "GOwnPtr.h" #include "PlatformString.h" #include <gtk/gtk.h> +#include <locale.h> #include <pango/pango.h> namespace WebCore { +// Using pango_language_get_default() here is not an option, because +// it doesn't support changing the locale in runtime, so it returns +// always the same value. String defaultLanguage() { - return pango_language_to_string(gtk_get_default_language()); + char* localeDefault = setlocale(LC_CTYPE, NULL); + + if (!localeDefault) + return String("c"); + + GOwnPtr<gchar> normalizedDefault(g_ascii_strdown(localeDefault, -1)); + char* ptr = strchr(normalizedDefault.get(), '_'); + + if(ptr) + *ptr = '-'; + + ptr = strchr(normalizedDefault.get(), '.'); + + if(ptr) + *ptr = '\0'; + + return String(normalizedDefault.get()); } } |