From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Robin Hu Newsgroups: gmane.emacs.devel Subject: Re: Emacs failes to communicate with other X clients Date: Mon, 26 May 2003 02:56:54 +0000 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: References: <3405-Fri23May2003202207+0300-eliz@elta.co.il> <7458-Sat24May2003203851+0300-eliz@elta.co.il> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: main.gmane.org 1053917757 2958 80.91.224.249 (26 May 2003 02:55:57 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 26 May 2003 02:55:57 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Mon May 26 04:55:55 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19K89M-0000lR-00 for ; Mon, 26 May 2003 04:55:48 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 19K8MM-0005uD-00 for ; Mon, 26 May 2003 05:09:15 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19K8Ak-0007Lc-Iy for emacs-devel@quimby.gnus.org; Sun, 25 May 2003 22:57:14 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.20) id 19K8AK-0007L7-9d for emacs-devel@gnu.org; Sun, 25 May 2003 22:56:48 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20) id 19K8AI-0007KU-Oa for emacs-devel@gnu.org; Sun, 25 May 2003 22:56:47 -0400 Original-Received: from [210.77.38.126] (helo=ns.turbolinux.com.cn) by monty-python.gnu.org with esmtp (Exim 4.20) id 19K8AH-0007CA-4E for emacs-devel@gnu.org; Sun, 25 May 2003 22:56:45 -0400 Original-Received: from LOADLIN (gateway.cn.tlan [210.74.191.34]) (authenticated bits=0) by ns.turbolinux.com.cn (8.12.5/8.12.5) with ESMTP id h4Q30m8q024337; Mon, 26 May 2003 11:00:55 +0800 Original-To: "Eli Zaretskii" In-Reply-To: <7458-Sat24May2003203851+0300-eliz@elta.co.il> (Eli Zaretskii's message of "Sat, 24 May 2003 20:38:51 +0300") User-Agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3.50 (windows-nt) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:14264 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:14264 --=-=-= >>>>> "Eli" == Eli Zaretskii writes: >> From: Robin Hu Date: Sat, 24 May 2003 >> 11:10:06 +0000 >> Eli> Sounds like a bug. Unfortunately, I don't know enough about Eli> gbk to guess what might be wrong, and don't have time to debug Eli> compound-text-with-extensions myself. I'll try to clearify myself, and attachment is a dirty patch to xselect.c, I also hope this can be any help out of my buggy english ;-( My point is that compound-text decoding should be left to X itself, rather then by emacs itself. It should be better be transparent to emacs, for better portable and better extensible. My patch implements this idea, it use XmbTextPropertyToTextList to decode compound-text, then delegate the result to selection_data_to_lisp_data, who will call decode_region with chinese-gbk to translate gbk coding characters to emacs-mule. It works fine for me these days. But there is still some problems I am not so sure. First is that I dont know whether this change of behavior will impact any other packages exists. Second is that I still wonder if there are any better places for this change. Eli> Keyboard input is nowhere as transparent as you seem to think. Eli> Emacs decodes keyboard input similarly to what it does with X Eli> selections. I mean decoding X selections should be seperated into 2 stages, then compound text is transparent to emacs. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=xselect.c.patch Content-Description: patch to Xselect.c --- xselect.c 2003-04-07 04:35:06.000000000 +0800 +++ /home/huxw/tmp_src/emacs/src/xselect.c 2003-05-26 10:29:46.641097720 +0800 @@ -1496,6 +1496,11 @@ Lisp_Object target_type; /* for error messages only */ Atom selection_atom; /* for error messages only */ { + // by huxw start here + XTextProperty text_prop; + char** local_list; + int local_number; + // by huxw end here Atom actual_type; int actual_format; unsigned long actual_size; @@ -1554,12 +1559,50 @@ /* It's been read. Now convert it to a lisp object in some semi-rational manner. */ + //by huxw start here + if (XSupportsLocale()) { + int local_status; + + text_prop.value = (char*)data; + text_prop.encoding = actual_type; + text_prop.format = actual_format; + text_prop.nitems = actual_size; + + local_status = XmbTextPropertyToTextList(display, &text_prop, &local_list, &local_number); + if (local_status < Success || !local_number || !*local_list ) { + printf("failed due to XmbTextPropertyToTextList\n"); + printf("XNoMemory is %d, XLocaleNotSupported is %d, XConverterNotFound is %d\n", XNoMemory, XLocaleNotSupported, XConverterNotFound); + printf("status is %d, number is %d, \n", local_status, local_number ); + } else { + printf("XmbTextPropertyToTextList successfullly\n"); + xfree((char*)data); + printf("xfree data successfully\n"); + data = strdup(*local_list); + printf("strdup data successfully, data is %s\n", (char*)data); + XFreeStringList(local_list); + printf("XFreeStringList successfully\n"); + } + } else { + printf("no support this locale\n"); + } + //by huxw end here + +#if 0 val = selection_data_to_lisp_data (display, data, bytes, actual_type, actual_format); +#else + val = selection_data_to_lisp_data (display, data, strlen(data), actual_type, actual_format); +#endif /* Use xfree, not XFree, because x_get_window_property calls xmalloc itself. */ - xfree ((char *) data); + + // by huxw start here +// xfree ((char *) data); + printf("selection_data_to_lisp_data successfully\n"); + free(data); + printf("free data successfully\n"); + // by huxw end here return val; } --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://mail.gnu.org/mailman/listinfo/emacs-devel --=-=-=--