1 Description: Enable locale support
2 Enable locale support in nxagent.
4 Originally contributed by FreeNX Team (dimbor).
6 Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
7 Last-Update: 2011-12-31
8 --- a/nx-X11/programs/Xserver/hw/nxagent/Init.c
9 +++ b/nx-X11/programs/Xserver/hw/nxagent/Init.c
15 +#include <X11/Xlocale.h>
18 * Set here the required log level.
26 + char *locale = setlocale(LC_ALL, "");
28 + fprintf(stderr, "InitOutput: failed to set locale, reverting to \"C\"\n");
31 + if (!XSupportsLocale())
32 + fprintf(stderr, "InitOutput: Locale %s not supported by X\n",locale);
34 + fprintf(stderr, "InitOutput: Set %s locale\n",locale);
36 + if (!XSetLocaleModifiers(""))
37 + fprintf(stderr,"InitOutput: cannot set locale modifiers.\n");
40 void InitInput(argc, argv)
41 --- a/nx-X11/programs/Xserver/hw/nxagent/Rootless.c
42 +++ b/nx-X11/programs/Xserver/hw/nxagent/Rootless.c
49 +#include <X11/Xlocale.h>
52 * Set here the required log level.
59 +char *textToUTF8String(char *text, int nitems)
61 + XTextProperty t_prop;
63 + t_prop.value=((unsigned char *)text);
64 + t_prop.nitems=nitems;
68 + t_prop.encoding=XInternAtom(nxagentDisplay, "COMPOUND_TEXT", 0);
71 + int r = Xutf8TextPropertyToTextList(nxagentDisplay, &t_prop,&list, &num);
72 + if ((r == Success || r > 0) && num > 0 && *list)
74 + ret=(char *)strdup (*list);
75 + XFreeStringList(list);
80 int nxagentExportAllProperty(pWin)
85 if (strncmp(propertyS, "WM_", 3) != 0 &&
86 strncmp(propertyS, "_NET_", 5) != 0 &&
87 + strncmp(propertyS, "_MOTIF_", 7) != 0 &&
88 strcmp(propertyS, "_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR") != 0)
94 else if (strcmp(typeS, "STRING") == 0 ||
95 + strcmp(typeS, "_MOTIF_WM_HINTS") == 0 ||
97 strcmp(typeS, "CARDINAL") == 0 ||
98 strcmp(typeS, "WM_SIZE_HINTS") == 0 ||
103 + /* add by dimbor, modified by Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
104 + else if (strcmp(typeS, "COMPOUND_TEXT") == 0)
106 + output = textToUTF8String(value, nUnits);
107 + if ( output != NULL ) {
108 + type = MakeAtom("UTF8_STRING", strlen("UTF8_STRING"), True);
112 + nUnits = strlen((char *) output);
117 else if (strcmp(typeS, "CARDINAL") == 0 || strcmp(typeS, "WM_SIZE_HINTS") == 0)