On Wed, 04 Aug 2010 16:44:26 +0200, Paolo Ferrario <sko...@tiscali.it> wrote:
> > On Tue, 3 Aug 2010, Michael Jennings wrote: > >> If answering back with a string doesn't break clients requesting a >> UTF8_STRING, I'm inclined to go that route. >> >> I don't have a problem, per se, with answering in UTF-8, but I'm not >> sure if the new UTF-8 Xlib calls are portable to non-Linux/non-Xorg >> platforms (Solaris? HP-UX? AIX?). I'd feel a lot more comfortable >> going down that road if someone who knows those other OS's can >> comment. Does anyone know if XA_UTF8_STRING and XUTF8StringStyle are >> present on any of those platforms? >> >> Paolo, would you mind updating your patch to force XA_STRING if >> XA_UTF8_STRING is not defined, and do the UTF-8 conversion if it is? >> >> Other opinions? >> >> BTW, the UTF-8-enabled Eterm is in the Eterm-0.10 branch in SVN if >> anyone wants to help test. >> >> Thanks for the patch! >> Michael > > > > You are right about the portability.. > > I've seen, in fact, a super-old Xmu/Atoms.h > [ $XConsortium: Atoms.h,v 1.3 89/12/08 12:03:56 rws Exp $ ] > without XA_UTF8_STRING, and it has XA_COMPOUND_TEXT XA_TEXT XA_STRING. > But, in this case, there is not even XmbTextListToTextProperty in > Xutil.h, or elsewhere.. > So, yes, would be good to hear someone about other OS's.. > It's probably good to do the UTF8 conversion. Save a round-trip and seems to play nicer in some cases. I don't think there will be portability issues with this patch unless you somehow get non-matching old Xlib/Xmu versions - not very likely I'd say. If I were in a cleaning mood I'd get rid of Xmu, which as far as I can see only is used for XA_TEXT/COMPOUND_TEXT/XA_UTF8_STRING(Xdisplay), which could easily be replaced with some new props[...]. The availability of XUTF8StringStyle can be tested with X_HAVE_UTF8_STRING. As for systems that don't have XmbTextListToTextProperty ... i.e. pre-X11R5 ~ 1991 ... hmm.. do we care? A few comments... The "else if (rq->target == XA_STRING)" case is redundant - same as final "else" case. I think that in both cases where XmbTextListToTextProperty() is called XFree(xtextp.value) should be added after XChangeProperty(). /Kim > > Here is the updated patch: > > > > --- src/screen.c 2009-10-25 22:07:43.000000000 +0100 > +++ ../../Eterm/src/screen.c 2010-08-04 15:30:28.000000000 +0200 > @@ -3360,8 +3360,28 @@ > } > } > #endif > +#if defined(MULTI_CHARSET) && defined(XA_UTF8_STRING) > + } else if (rq->target == XA_UTF8_STRING(Xdisplay)) { > + XTextProperty xtextp; > + char *l[1]; > + *l = selection.text; > + xtextp.value = NULL; > + xtextp.nitems = 0; > + if (XmbTextListToTextProperty(Xdisplay, l, 1, XUTF8StringStyle, > + &xtextp) == Success) { > + if (xtextp.nitems > 0 && xtextp.value != NULL) { > + XChangeProperty(Xdisplay, rq->requestor, rq->property, > + rq->target, 8, PropModeReplace, xtextp.value, > xtextp.nitems); > + ev.xselection.property = rq->property; > + } > + } > +#endif > } else if (rq->target == XA_STRING) { > XChangeProperty(Xdisplay, rq->requestor, rq->property, > rq->target, 8, > PropModeReplace, selection.text, selection.len); > + ev.xselection.property = rq->property; > + } else { > + XChangeProperty(Xdisplay, rq->requestor, rq->property, > XA_STRING, 8, > + PropModeReplace, selection.text, selection.len); > ev.xselection.property = rq->property; > } > XSendEvent(Xdisplay, rq->requestor, False, 0, &ev); > > > > ------------------------------------------------------------------------------ > The Palm PDK Hot Apps Program offers developers who use the > Plug-In Development Kit to bring their C/C++ apps to Palm for a share > of $1 Million in cash or HP Products. Visit us here for more details: > http://p.sf.net/sfu/dev2dev-palm > _______________________________________________ > enlightenment-devel mailing list > enlightenment-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel > ------------------------------------------------------------------------------ The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel