From: Andrew Tropin <andrew@trop.in>
To: Po Lu <luangruo@yahoo.com>, Lars Ingebrigtsen <larsi@gnus.org>
Cc: masmer4@yahoo.co.jp, 57825@debbugs.gnu.org
Subject: bug#57825: 29.0.50; Superkey handling regression in pgtk
Date: Mon, 19 Sep 2022 11:15:12 +0300 [thread overview]
Message-ID: <87sfknhjan.fsf@trop.in> (raw)
In-Reply-To: <8735cnsuad.fsf@yahoo.com>
[-- Attachment #1: Type: text/plain, Size: 3260 bytes --]
On 2022-09-19 15:22, Po Lu wrote:
> Lars Ingebrigtsen <larsi@gnus.org> writes:
>
>> Andrew Tropin <andrew@trop.in> writes:
>>
>>> and applied this workaround:
>>> https://git.savannah.gnu.org/cgit/guix.git/commit/?id=77e768ac4e57d5fd443c7d69a7cc0c8339d0c238
>>>
>>> the logic in the code is not completely correct, but should work for
>>> most users and use cases, we will remove it, once the problem is fixed
>>> in GTK and gtk package is updated.
>>
>> For future reference, I've included the patch below.
>>
>> Perhaps we should apply something like this to Emacs?
>>
>> diff --git a/gnu/packages/patches/emacs-pgtk-super-key-fix.patch b/gnu/packages/patches/emacs-pgtk-super-key-fix.patch
>> new file mode 100644
>> index 0000000..a58c448
>> --- /dev/null
>> +++ b/gnu/packages/patches/emacs-pgtk-super-key-fix.patch
>> @@ -0,0 +1,49 @@
>> +From a897516fc5ec380938115ad42023f279d128fc1e Mon Sep 17 00:00:00 2001
>> +From: Andrew Tropin <andrew@trop.in>
>> +Date: Fri, 16 Sep 2022 15:24:19 +0300
>> +Subject: [PATCH] Workaround gtk bug for superkey handling
>> +
>> +https://gitlab.gnome.org/GNOME/gtk/-/issues/4913
>> +https://debbugs.gnu.org/cgi/bugreport.cgi?bug=55362
>> +Patch based on Thomas Jost's suggestion.
>> +
>> +---
>> + src/pgtkterm.c | 9 +++++----
>> + 1 file changed, 5 insertions(+), 4 deletions(-)
>> +
>> +diff --git a/src/pgtkterm.c b/src/pgtkterm.c
>> +index 491ba33882..d5a9970693 100644
>> +--- a/src/pgtkterm.c
>> ++++ b/src/pgtkterm.c
>> +@@ -5051,7 +5051,7 @@ pgtk_gtk_to_emacs_modifiers (struct pgtk_display_info *dpyinfo, int state)
>> + mod |= mod_ctrl;
>> + if (state & GDK_META_MASK || state & GDK_MOD1_MASK)
>> + mod |= mod_meta;
>> +- if (state & GDK_SUPER_MASK)
>> ++ if (state & GDK_SUPER_MASK || state & GDK_MOD4_MASK)
>> + mod |= mod_super;
>> + if (state & GDK_HYPER_MASK)
>> + mod |= mod_hyper;
>> +@@ -5184,7 +5184,7 @@ key_press_event (GtkWidget *widget, GdkEvent *event, gpointer *user_data)
>> + /* While super is pressed, the input method will always always
>> + resend the key events ignoring super. As a workaround, don't
>> + filter key events with super or hyper pressed. */
>> +- if (!(event->key.state & (GDK_SUPER_MASK | GDK_HYPER_MASK)))
>> ++ if (!(event->key.state & (GDK_SUPER_MASK | GDK_MOD4_MASK | GDK_HYPER_MASK)))
>> + {
>> + if (pgtk_im_filter_keypress (f, &event->key))
>> + return TRUE;
>> +@@ -5199,8 +5199,9 @@ key_press_event (GtkWidget *widget, GdkEvent *event, gpointer *user_data)
>> + /* make_lispy_event turns chars into control chars.
>> + Don't do it here because XLookupString is too eager. */
>> + state &= ~GDK_CONTROL_MASK;
>> +- state &= ~(GDK_META_MASK
>> +- | GDK_SUPER_MASK | GDK_HYPER_MASK | GDK_MOD1_MASK);
>> ++ state &= ~(GDK_META_MASK | GDK_MOD1_MASK
>> ++ | GDK_SUPER_MASK | GDK_MOD4_MASK
>> ++ | GDK_HYPER_MASK);
>> +
>> + nbytes = event->key.length;
>> + if (nbytes > copy_bufsiz)
>> +--
>> +2.37.3
>
> No, because this will break on other Wayland compositors, including one
> that I am writing.
Can you share a link to it, please? Just curious.
--
Best regards,
Andrew Tropin
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
prev parent reply other threads:[~2022-09-19 8:15 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-15 8:53 bug#57825: 29.0.50; Superkey handling regression in pgtk Andrew Tropin
2022-09-15 11:07 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-16 4:25 ` Andrew Tropin
2022-09-16 5:49 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-19 5:02 ` Andrew Tropin
2022-09-19 5:19 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-19 8:09 ` Andrew Tropin
2022-09-19 7:11 ` Lars Ingebrigtsen
2022-09-19 7:22 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-19 7:44 ` Lars Ingebrigtsen
2022-09-19 7:57 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-19 8:15 ` Andrew Tropin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87sfknhjan.fsf@trop.in \
--to=andrew@trop.in \
--cc=57825@debbugs.gnu.org \
--cc=larsi@gnus.org \
--cc=luangruo@yahoo.com \
--cc=masmer4@yahoo.co.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.