diff --git a/ChangeLog b/ChangeLog index 8f03399ca..c7f9babb9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-06-10 Chris Lord + + * clutter/clutter-main.c: (pre_parse_hook): + Call setlocale on init + + * clutter/x11/clutter-event-x11.c: (translate_key_event): + Fix typo and use the same buffer size as xev + 2008-06-10 Øyvind Kolås * clutter/clutter-texture.c: improved documentation for diff --git a/clutter/clutter-main.c b/clutter/clutter-main.c index ab5d23d73..dbc8ce6b5 100644 --- a/clutter/clutter-main.c +++ b/clutter/clutter-main.c @@ -35,6 +35,8 @@ #endif #include +#define GETTEXT_PACKAGE "clutter" +#include #include "clutter-event.h" #include "clutter-backend.h" @@ -989,6 +991,10 @@ pre_parse_hook (GOptionContext *context, if (clutter_is_initialized) return TRUE; + + if (setlocale (LC_ALL, "") == NULL) + g_warning ("Locale not supported by C library.\n" + "Using the fallback 'C' locale."); clutter_context = clutter_context_get_default (); diff --git a/clutter/x11/clutter-backend-x11.c b/clutter/x11/clutter-backend-x11.c index 09e6a4893..40eb4c086 100644 --- a/clutter/x11/clutter-backend-x11.c +++ b/clutter/x11/clutter-backend-x11.c @@ -153,7 +153,7 @@ clutter_backend_x11_post_parse (ClutterBackend *backend, if (clutter_synchronise) XSynchronize (backend_x11->xdpy, True); - + XInternAtoms (backend_x11->xdpy, (char **) atom_names, n_atom_names, False, atoms); diff --git a/clutter/x11/clutter-event-x11.c b/clutter/x11/clutter-event-x11.c index fcfdfca46..eaaf6fb6f 100644 --- a/clutter/x11/clutter-event-x11.c +++ b/clutter/x11/clutter-event-x11.c @@ -220,7 +220,7 @@ translate_key_event (ClutterBackend *backend, ClutterEvent *event, XEvent *xevent) { - char buffer[6]; + char buffer[256+1]; int n; CLUTTER_NOTE (EVENT, "Translating key %s event", @@ -239,18 +239,17 @@ translate_key_event (ClutterBackend *backend, 0); /* unicode_value is the printable representation */ - n = XLookupString (&xevent->xkey, buffer, sizeof (buffer), NULL, NULL); - if (n == NoSymbol) - { - event->key.unicode_value = (gunichar)'\0'; - } - else + n = XLookupString (&xevent->xkey, buffer, sizeof (buffer) - 1, NULL, NULL); + + if (n != NoSymbol) { event->key.unicode_value = g_utf8_get_char_validated (buffer, n); - if ((event->key.unicode_value == -1) || - (event->key.unicode_value == -1)) - event->key.unicode_value = (gunichar)'\0'; + if ((event->key.unicode_value != -1) && + (event->key.unicode_value != -2)) + return; } + + event->key.unicode_value = (gunichar)'\0'; } static gboolean