From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Jan D." Newsgroups: gmane.emacs.devel Subject: Re: [mega@hotpop.com: Re: x-backspace-delete-keys-p] Date: Thu, 03 Feb 2005 21:28:21 +0100 Message-ID: <42028965.2060902@swipnet.se> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1107462640 25703 80.91.229.2 (3 Feb 2005 20:30:40 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 3 Feb 2005 20:30:40 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Feb 03 21:30:39 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1CwncR-0006PA-CF for ged-emacs-devel@m.gmane.org; Thu, 03 Feb 2005 21:30:27 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Cwnpo-0000AZ-Vd for ged-emacs-devel@m.gmane.org; Thu, 03 Feb 2005 15:44:16 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1CwnpM-0008V5-Uq for emacs-devel@gnu.org; Thu, 03 Feb 2005 15:43:49 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1CwnpE-0008Q6-Px for emacs-devel@gnu.org; Thu, 03 Feb 2005 15:43:41 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1CwnpE-0008Pi-It for emacs-devel@gnu.org; Thu, 03 Feb 2005 15:43:40 -0500 Original-Received: from [195.54.107.73] (helo=mxfep02.bredband.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CwnbH-0002oo-4A; Thu, 03 Feb 2005 15:29:15 -0500 Original-Received: from coolsville.localdomain ([83.226.180.210] [83.226.180.210]) by mxfep02.bredband.com with ESMTP id <20050203202913.LROK24781.mxfep02.bredband.com@coolsville.localdomain>; Thu, 3 Feb 2005 21:29:13 +0100 User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en Original-To: rms@gnu.org In-Reply-To: X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org X-MailScanner-To: ged-emacs-devel@m.gmane.org Xref: main.gmane.org gmane.emacs.devel:32841 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:32841 Richard Stallman wrote: >Could people please study this, and try it, and see if it causes >any problems? > > If you have (like I usually have) Backspace and Delete on the same key (Shift-Backspace generates a Delete) and no other delete key, XKeysymToKeycode will return the same key for XK_Backspace and XK_Delete. The code suggested will then incorrectly assume there are two keys. The code could be modified to check for different keysyms for delete and backspace, but I'm not sure what problem it is trying to solve. Doesn't the current code work? Jan D. >------- Start of forwarded message ------- >From: Gabor Melis >To: rms@gnu.org >Subject: Re: x-backspace-delete-keys-p >Date: Wed, 2 Feb 2005 11:25:06 +0100 >In-Reply-To: >X-Spam-Status: No, hits=-2.5 required=5.0 > tests=EMAIL_ATTRIBUTION,IN_REP_TO,PATCH_UNIFIED_DIFF, > QUOTED_EMAIL_TEXT,RCVD_IN_ORBS,REFERENCES, > REPLY_WITH_QUOTES,USER_AGENT_KMAIL > version=2.55 >X-Spam-Level: >X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp) > >- --Boundary-00=_CqKACLDpv2J5AY6 >Content-Type: text/plain; > charset="iso-8859-1" >Content-Transfer-Encoding: 7bit >Content-Disposition: inline > >On Wednesday 02 February 2005 08:29, Richard Stallman wrote: > > >> I don't know much about other keyboards but checking only >> whether XK_Delete/XK_Backspace is mapped to a keycode that belongs >>to _any_ >> key in the current keyboard sounds enough. >> >>Maybe you are right, but I don't know how to do this, or if there >>is a way to do this. Do you want to find out? >> >> > >This patch (against 21.3) does what I described. It could probably be improved >by checking for the the geometry in case the keycode belongs to a key, but >that key is not present on the physical keyboard. I tested it with my lisp >machine, us and us-without-a-backspace-key layouts and it seems to work >returning t, t an nil respectively. > >- --Boundary-00=_CqKACLDpv2J5AY6 >Content-Type: text/x-diff; > charset="iso-8859-1"; > name="x-backspace-delete-keys-p.patch" >Content-Transfer-Encoding: 7bit >Content-Disposition: attachment; > filename="x-backspace-delete-keys-p.patch" > >- --- xfns.c.orig 2005-02-02 11:15:23.000000000 +0100 >+++ xfns.c 2005-02-02 11:07:46.000000000 +0100 >@@ -11350,6 +11350,16 @@ > #include > #endif > >+#ifdef HAVE_XKBGETKEYBOARD >+static int >+is_keycode_mapped (XkbDescPtr kb, int keycode) >+{ >+ /* We could also check if the key is physically present in the >+ geometry component, but that is more trouble than it is worth. */ >+ return (kb->min_key_code <= keycode) && (keycode <= kb->max_key_code); >+} >+#endif >+ > DEFUN ("x-backspace-delete-keys-p", Fx_backspace_delete_keys_p, > Sx_backspace_delete_keys_p, 0, 1, 0, > "Check if both Backspace and Delete keys are on the keyboard of FRAME.\n\ >@@ -11390,34 +11400,19 @@ > kb = XkbGetMap (dpy, XkbAllMapComponentsMask, XkbUseCoreKbd); > if (kb) > { >- - int delete_keycode = 0, backspace_keycode = 0, i; >+ int delete_keycode = XKeysymToKeycode (dpy, XK_Delete); >+ int backspace_keycode = XKeysymToKeycode (dpy, XK_BackSpace); > > if (XkbGetNames (dpy, XkbAllNamesMask, kb) == Success) > { >- - for (i = kb->min_key_code; >- - (i < kb->max_key_code >- - && (delete_keycode == 0 || backspace_keycode == 0)); >- - ++i) >- - { >- - /* The XKB symbolic key names can be seen most easily in >- - the PS file generated by `xkbprint -label name >- - $DISPLAY'. */ >- - if (bcmp ("DELE", kb->names->keys[i].name, 4) == 0) >- - delete_keycode = i; >- - else if (bcmp ("BKSP", kb->names->keys[i].name, 4) == 0) >- - backspace_keycode = i; >- - } >+ if (is_keycode_mapped (kb, delete_keycode) && >+ is_keycode_mapped (kb, backspace_keycode)) >+ have_keys = Qt; > > XkbFreeNames (kb, 0, True); > } > > XkbFreeClientMap (kb, 0, True); >- - >- - if (delete_keycode >- - && backspace_keycode >- - && XKeysymToKeycode (dpy, XK_Delete) == delete_keycode >- - && XKeysymToKeycode (dpy, XK_BackSpace) == backspace_keycode) >- - have_keys = Qt; > } > UNBLOCK_INPUT; > return have_keys; > >- --Boundary-00=_CqKACLDpv2J5AY6-- >------- End of forwarded message ------- > > >_______________________________________________ >Emacs-devel mailing list >Emacs-devel@gnu.org >http://lists.gnu.org/mailman/listinfo/emacs-devel > >