Subject: bug#52795: 29.0.50; pgtk: issues with key bindings

From: Kévin Le Gouguec <[email-masked]>
Date: Tue, 28 Dec 2021 09:31:28 +0100

Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text
editors" <[email-masked]> writes:

>            I think that the bug report should remain open though, in
> case some person wiser than I am has a solution.

FWIW, I goofed around a bit in pgtkim.c:

diff --git a/src/pgtkim.c b/src/pgtkim.c
index c0104ebc0a..6e4c763b08 100644
--- a/src/pgtkim.c
+++ b/src/pgtkim.c
@@ -18,6 +18,8 @@ Copyright (C) 1989, 1993-1994, 2005-2006, 2008-2020 Free Software
 You should have received a copy of the GNU General Public License
 along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.  */
 
+#include <stdio.h>
+
 /* This should be the first include, as it may set up #defines affecting
    interpretation of even the system includes. */
 #include <config.h>
@@ -201,6 +203,12 @@ pgtk_im_focus_out (struct frame *f)
 bool
 pgtk_im_filter_keypress (struct frame *f, GdkEventKey * ev)
 {
+  if (ev->state & GDK_SHIFT_MASK)
+    fprintf(stderr, "S-");
+  if (ev->state & GDK_CONTROL_MASK)
+    fprintf(stderr, "C-");
+  fprintf(stderr, "%s\n", gdk_keyval_name(ev->keyval));
+
   struct pgtk_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
   if (dpyinfo->im.context != NULL)
     {

AFAICT Emacs receives enough information to see S-SPC?

Hitting SPC and S-SPC 3 times each from emacs -Q (so without calling
(pgtk-use-im-context nil), and with dead keys fully functioning):

> space
> space
> space
> Shift_L
> S-space
> S-space
> S-space

No idea how easy it would be to pass on that information to the rest of
Emacs.