From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Cecilio Pardo Newsgroups: gmane.emacs.bugs Subject: bug#74423: Low level key events Date: Sat, 23 Nov 2024 13:08:24 +0100 Message-ID: References: <31bdc55d-8c13-4de0-9cef-bd6cc4fb033f@imayhem.com> <87ttc4hzmb.fsf@yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30335"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: 74423@debbugs.gnu.org To: Po Lu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Nov 23 13:09:14 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tEows-0007kc-Aj for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 23 Nov 2024 13:09:14 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tEowj-00082j-J5; Sat, 23 Nov 2024 07:09:05 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tEowh-00081m-Ed for bug-gnu-emacs@gnu.org; Sat, 23 Nov 2024 07:09:03 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tEowh-0003vy-5s for bug-gnu-emacs@gnu.org; Sat, 23 Nov 2024 07:09:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=In-Reply-To:From:References:MIME-Version:Date:To:Subject; bh=I53rI78TzOsehMsP7a6o9GdMBtSsTbeUWaRgfXpIXPc=; b=PFgCNnjJdJq4c3a1umMLJV01lv2yvijW6y+yW3FtwIs8X8jYRSqGfDuFrh9QdfnJBWXd1YdwoM39FNPG2qe9hxcXjoYIVh5uOuYLdhq2ugKZ+Rt7wxwxoDVzFXadtltB81IaZutc/nJvnp5IqlO4OXcKvL7z/wNFK/M2Uj4eK/9Xd7ajb7sndNEZK1CPdmoy8tV8d1FpENPSF0jNk+kt3FPFIo2n6DvzZ8n5Nij9ocOOhENvuwQjtpDmQ9qDb+ph/MXA5k5vLYo+jHhYegDb6SiUTvvem8AU82v1XIv9f6enpk0l5QQJDIwUrm9hSKFeqpY3EjfnGOiWLZiafQdntw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tEowg-00038a-JT for bug-gnu-emacs@gnu.org; Sat, 23 Nov 2024 07:09:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Cecilio Pardo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 23 Nov 2024 12:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74423 X-GNU-PR-Package: emacs Original-Received: via spool by 74423-submit@debbugs.gnu.org id=B74423.173236371712021 (code B ref 74423); Sat, 23 Nov 2024 12:09:02 +0000 Original-Received: (at 74423) by debbugs.gnu.org; 23 Nov 2024 12:08:37 +0000 Original-Received: from localhost ([127.0.0.1]:56923 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tEowH-00037p-1v for submit@debbugs.gnu.org; Sat, 23 Nov 2024 07:08:37 -0500 Original-Received: from mail.imayhem.com ([82.223.54.191]:38121 helo=zealous-pike.82-223-54-191.plesk.page) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tEowD-00037Y-U8 for 74423@debbugs.gnu.org; Sat, 23 Nov 2024 07:08:35 -0500 Original-Received: from [192.168.68.104] (111.red-88-21-7.staticip.rima-tde.net [88.21.7.111]) by zealous-pike.82-223-54-191.plesk.page (Postfix) with ESMTPSA id 90F8080127; Sat, 23 Nov 2024 12:08:25 +0000 (UTC) Authentication-Results: zealous-pike.82-223-54-191.plesk.page; spf=pass (sender IP is 88.21.7.111) smtp.mailfrom=cpardo@imayhem.com smtp.helo=[192.168.68.104] Received-SPF: pass (zealous-pike.82-223-54-191.plesk.page: connection is authenticated) Content-Language: es-ES In-Reply-To: <87ttc4hzmb.fsf@yahoo.com> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:295813 Archived-At: On 19/11/2024 0:49, Po Lu wrote: > You are computing the modifier event to be generated incorrectly. You > should search the modifier map (dpyinfo->modmap) for columns containing > received keysyms, and compare modifier bits derived from the rows where > they appear against meta_mod_mask, shift_lock_mask, alt_mod_mask, > super_mod_mask, and hyper_mod_mask in the display structure, or CtrlMask > and ShiftMask. Thanks for the guidance. Does this look ok? Lisp_Object x_get_modifier_for_keycode (struct x_display_info *dpyinfo, int keycode) { #ifdef HAVE_XKB if (dpyinfo->xkb_desc) for (int mod = 0; mod < XkbNumModifiers; mod++) { int mask = (1 << mod); if (dpyinfo->xkb_desc->map->modmap[keycode] & mask) { if (mask == ShiftMask) return Qshift; if (mask == ControlMask) return Qctrl; if (mask == dpyinfo->meta_mod_mask) return Qmeta; if (mask == dpyinfo->alt_mod_mask) return Qalt; if (mask == dpyinfo->super_mod_mask) return Qsuper; if (mask == dpyinfo->hyper_mod_mask) return Qhyper; } } #endif XModifierKeymap *map = dpyinfo->modmap; if (map) for (int mod = 0; mod < 8; mod++) { int mask = (1 << mod); for (int key = 0; key < map->max_keypermod; key++) if (map->modifiermap[mod * map->max_keypermod + key] == keycode) { if (mask == ShiftMask) return Qshift; if (mask == ControlMask) return Qctrl; if (mask == dpyinfo->meta_mod_mask) return Qmeta; if (mask == dpyinfo->alt_mod_mask) return Qalt; if (mask == dpyinfo->super_mod_mask) return Qsuper; if (mask == dpyinfo->hyper_mod_mask) return Qhyper; } } return Qnil; }