diff options
author | Andrew Tropin <andrew@trop.in> | 2022-09-16 15:53:53 +0300 |
---|---|---|
committer | Andrew Tropin <andrew@trop.in> | 2022-09-16 20:28:34 +0300 |
commit | 77e768ac4e57d5fd443c7d69a7cc0c8339d0c238 (patch) | |
tree | dee75cf1c29691e79adc3723f6e3ab9d968e55ea | |
parent | 888dfc8eb6f08672de716dc66a15a74fee302eb7 (diff) | |
download | guix-77e768ac4e57d5fd443c7d69a7cc0c8339d0c238.tar.gz |
gnu: emacs-next-pgtk: Fix super key problem.
Recent version of emacs 29 with pgtk flag has a problem with handling super key modifier, due to gtk bug: https://gitlab.gnome.org/GNOME/gtk/-/issues/4913 This commit workarounds it. * gnu/packages/patches/emacs-pgtk-super-key-fix.patch: New file. * gnu/packages/emacs.scm (emacs-next-pgtk): Use it here. * gnu/local.mk (dist_patch_DATA): Register it here.
-rw-r--r-- | gnu/local.mk | 1 | ||||
-rw-r--r-- | gnu/packages/emacs.scm | 4 | ||||
-rw-r--r-- | gnu/packages/patches/emacs-pgtk-super-key-fix.patch | 49 |
3 files changed, 54 insertions, 0 deletions
diff --git a/gnu/local.mk b/gnu/local.mk index ebfc7fd803..de460c2017 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1052,6 +1052,7 @@ dist_patch_DATA = \ %D%/packages/patches/emacs-wordnut-require-adaptive-wrap.patch \ %D%/packages/patches/emacs-yasnippet-fix-tests.patch \ %D%/packages/patches/emacs-kv-fix-tests.patch \ + %D%/packages/patches/emacs-pgtk-super-key-fix.patch \ %D%/packages/patches/enjarify-setup-py.patch \ %D%/packages/patches/enlightenment-fix-setuid-path.patch \ %D%/packages/patches/erlang-man-path.patch \ diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm index ef6e9ae1f1..fc93852880 100644 --- a/gnu/packages/emacs.scm +++ b/gnu/packages/emacs.scm @@ -409,6 +409,10 @@ languages.") (package (inherit emacs-next) (name "emacs-next-pgtk") + (source + (origin + (inherit (package-source emacs-next)) + (patches (search-patches "emacs-pgtk-super-key-fix.patch")))) (arguments (substitute-keyword-arguments (package-arguments emacs-next) ((#:configure-flags flags #~'()) 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 0000000000..a58c448af9 --- /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 |