Subject: bug#54889: 29.0.50; shift keys can't function when using setxkbmap with custom_symbol in gnome

From: Po Lu <[email-masked]>
Date: Thu, 14 Apr 2022 08:50:06 +0800

[Seriously, please use "Reply All", otherwise the bug tracker cannot
record this conversation.  Thanks]

[email-masked] writes:
> 2. because i am not familier gdb,
>     i need aide :
> a) this is message wnen i enter  gdb /dev/shm/e29/src/emacs -q ,
>
> But that probably won't help, since
> GTK native input is usually the first thing to go awry when you start
> messing with modifier mapping.
>
> Can you attach a debugger to Emacs, add a breakpoint to this part of
> xterm.c:
>
>               xkey.type = KeyPress;
>               xkey.serial = xev->serial;
>               xkey.send_event = xev->send_event;
>               xkey.display = dpyinfo->display;
>               xkey.window = xev->event;
>               xkey.root = xev->root;
>               xkey.subwindow = xev->child;
>               xkey.time = xev->time;
>               xkey.state = ((xev->mods.effective & ~(1 << 13 | 1 << 14))
>                             | (xev->group.effective << 13));
>
> ===>          xkey.x = lrint (xev->event_x);
>               xkey.y = lrint (xev->event_y);
>               xkey.x_root = lrint (xev->root_x);
>               xkey.y_root = lrint (xev->root_y);
>
> press "Shift-A", and then show the value of `xkey.state'?
>
> This should work for you, assuming you're using a fresh copy of Emacs
> from the master branch:
>
>   $ gdb path/to/emacs/binary -Q
>   ...
>   (gdb) break xterm.c:17399
>   ... the breakpoint is hit after pressing the key
>   (gdb) p xkey.state
>
> Also, please show the value of dpyinfo->hyper_mod_mask at that time,
> like this:
>
>   (gdb) p dpyinfo->hyper_mod_mask
>
> If the debugger complains about certain values being optimized out,
> rebuild Emacs without optimizations according to the instructions in
> etc/DEBUG.
>
> Po Lu <[email-masked]> 於 2022年4月13日 週三 上午4:58寫道：
>
>  [email-masked] writes:
>
>  > 1. xmodmap is outputed:
>  >  
>  > xmodmap:  up to 3 keys per modifier, (keycodes in parentheses):
>  >
>  > shift       Shift_L (0x32),  Shift_R (0x3e)
>  > lock      
>  > control     Control_L (0x25),  Control_L (0x42),  Control_R (0x69)
>  > mod1        Alt_L (0x40),  Alt_R (0x6c),  Meta_L (0xcd)
>  > mod2        Num_Lock (0x4d)
>  > mod3        ISO_Last_Group (0x87),  Mode_switch (0xcb)
>  > mod4        Super_L (0x85),  Super_L (0xce),  Hyper_L (0xcf)
>  > mod5        BadKey (0x5c),  ISO_Level3_Shift (0x86)
>  >
>  > 2-1.  i tried these cmd:
>  >        ./configure  --with-xinput2
>  >      then 
>  >        make -j 4
>  >
>  >      after done:
>  >        emacs -q -xrm 'Emacs.useXIM: false'
>  >
>  >      still the same,  if i press Shift+A , minibuffer showed "H-a is undefined" and no capital letter inputed.
>  >
>  > 2-2. could you teach me how to tuen on 'x-gtk-use-native-input' ?
>  >          i have no comprehensive knowlage about linux in now.
>
>     Hi, 
>
>  >> (setq x-gtk-use-native-input t). 
>
>     as you expect, after excute  it still can't input capital letter with shift key.
>
>  >> Can you attach a debugger to Emacs, add a breakpoint to this part of
>  xterm.c:
>
>     unfortunally, in this step, my base knowlage not enough, 
>     here is the result:
>       1.git clone https://github.com/emacs-mirror/emacs  to  /dev/shm/e29/
>       2. after ./configure then build, cd  ./src
>            gdb ./emacs -q
>
>          first, a lot  message occured,
>          i put these text in ~/.config/gdb/gdbinit  , after google:
>               add-auto-load-safe-path /dev/shm/e29/src/
>               set auto-load safe-path /dev/shm/e29/src/
>           hope it is a right way.           
>
>        3. then execute:
>           $  gdb ./emacs -q 
>  Reading symbols from ./emacs...
> SIGINT is used by the debugger.
> Are you sure you want to change it? (y or n) [answered Y; input not from terminal]
> DISPLAY = :0
> TERM = rxvt-unicode-256color
> Breakpoint 1 at 0x4ac18: file emacs.c, line 412.
> Breakpoint 2 at 0x129bc0: file xterm.c, line 19625.
>
> (gdb) break xterm.c:17399
> Breakpoint 3 at 0x13cb23: file xterm.c, line 18393.

You forgot to enter "run" and then press Shift-A here once the input
focus shifts to the Emacs window.  I'm sorry for not mentioning that
earlier.  Thanks.