GNU bug report logs - #55660
29.0.50; PGTK degrades to terminal-compatible keyboard events

Previous Next

Package: emacs;

Reported by: Derek Upham <derek_upham <at> mailfence.com>

Date: Thu, 26 May 2022 14:44:01 UTC

Severity: normal

Tags: moreinfo

Merged with 49211, 51002, 53200, 55362, 56653

Found in versions 28.0.50, 29.0.50

Done: Po Lu <luangruo <at> yahoo.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 55660 in the body.
You can then email your comments to 55660 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#55660; Package emacs. (Thu, 26 May 2022 14:44:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Derek Upham <derek_upham <at> mailfence.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 26 May 2022 14:44:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Derek Upham <derek_upham <at> mailfence.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.50; PGTK degrades to terminal-compatible keyboard events
Date: Thu, 26 May 2022 07:43:37 -0700
Meaningful control keys in ASCII are @, A-Z, [ \ ] ^ and _ (0x40 through
0x5f).  VT100 terminals use the Control key to zero-out the top two bits
of seven, leaving us with 2^5=32 characters.  The above control keys
happen to be a bank of 32 that are all graphical and easy to reach.)  I
have old notes to myself that say that VT100 terminals do a little extra
mapping: Control and `?' (0x3f) sends the DEL keycode (0xff); Emacs
itself seems to map Control and `/' (0x2f) to the same keycode as
Control and `_' (0x1f)).

Window system interfaces like GTK track individual keypresses, and Emacs
supports binding other keys with Control:

  (global-set-key [(control ?<)] 'my-left-command)
  (global-set-key [(control ?>)] 'my-right-command)

Some terminals even send special character sequences to Emacs that
encode the Control modifier alongside the ">" character.  Xterm is one
of those, if you use the "xterm" terminal type.

I was experimenting with Emacs configurations (in a weekly snapshot) and
discovered that the PGTK interface does not support arbitrary Control
modifiers.  I can send any of the ASCII control keys listed above, but
for all others PGTK ignores the Control modifier.  Control-> turns into
a plain ">", for example.

These configuration options have the bug:

  --with-x-toolkit=gtk3
  --with-xwidgets=yes
  --with-pgtk=yes

These configuration options understand Control-> correctly.

  --with-x-toolkit=gtk3
  --with-xwidgets=yes
  --with-pgtk=no

I'm aware that PGTK is under active development and unreliable, and the
immediate workaround is "stop using PGTK".

Derek

-- 
Derek Upham
derek_upham <at> mailfence.com




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55660; Package emacs. (Fri, 27 May 2022 00:21:02 GMT) Full text and rfc822 format available.

Message #8 received at 55660 <at> debbugs.gnu.org (full text, mbox):

From: Po Lu <luangruo <at> yahoo.com>
To: Derek Upham <derek_upham <at> mailfence.com>
Cc: 55660 <at> debbugs.gnu.org
Subject: Re: bug#55660: 29.0.50; PGTK degrades to terminal-compatible
 keyboard events
Date: Fri, 27 May 2022 08:19:51 +0800
Derek Upham <derek_upham <at> mailfence.com> writes:

> Meaningful control keys in ASCII are @, A-Z, [ \ ] ^ and _ (0x40 through
> 0x5f).  VT100 terminals use the Control key to zero-out the top two bits
> of seven, leaving us with 2^5=32 characters.  The above control keys
> happen to be a bank of 32 that are all graphical and easy to reach.)  I
> have old notes to myself that say that VT100 terminals do a little extra
> mapping: Control and `?' (0x3f) sends the DEL keycode (0xff); Emacs
> itself seems to map Control and `/' (0x2f) to the same keycode as
> Control and `_' (0x1f)).
>
> Window system interfaces like GTK track individual keypresses, and Emacs
> supports binding other keys with Control:
>
>   (global-set-key [(control ?<)] 'my-left-command)
>   (global-set-key [(control ?>)] 'my-right-command)
>
> Some terminals even send special character sequences to Emacs that
> encode the Control modifier alongside the ">" character.  Xterm is one
> of those, if you use the "xterm" terminal type.
>
> I was experimenting with Emacs configurations (in a weekly snapshot) and
> discovered that the PGTK interface does not support arbitrary Control
> modifiers.  I can send any of the ASCII control keys listed above, but
> for all others PGTK ignores the Control modifier.  Control-> turns into
> a plain ">", for example.
>
> These configuration options have the bug:
>
>   --with-x-toolkit=gtk3
>   --with-xwidgets=yes
>   --with-pgtk=yes
>
> These configuration options understand Control-> correctly.
>
>   --with-x-toolkit=gtk3
>   --with-xwidgets=yes
>   --with-pgtk=no
>
> I'm aware that PGTK is under active development and unreliable, and the
> immediate workaround is "stop using PGTK".
>
> Derek

What happens if you turn off input method support, by evaluating
(pgtk-use-im-context nil)?  In general, these problems are not with
Emacs, but with GTK input method modules, and should be reported to
their developers instead.

Emacs never "degrades" to "terminal-compatible" input events when using
a window system.  We directly use whatever it reports.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55660; Package emacs. (Fri, 27 May 2022 01:14:02 GMT) Full text and rfc822 format available.

Message #11 received at 55660 <at> debbugs.gnu.org (full text, mbox):

From: Derek Upham <derek_upham <at> mailfence.com>
To: Po Lu <luangruo <at> yahoo.com>
Cc: 55660 <at> debbugs.gnu.org
Subject: Re: bug#55660: 29.0.50; PGTK degrades to terminal-compatible
 keyboard events
Date: Thu, 26 May 2022 18:13:41 -0700
Po Lu <luangruo <at> yahoo.com> writes:

> What happens if you turn off input method support, by evaluating
> (pgtk-use-im-context nil)?  In general, these problems are not 
> with
> Emacs, but with GTK input method modules, and should be reported 
> to
> their developers instead.
>
> Emacs never "degrades" to "terminal-compatible" input events 
> when using
> a window system.  We directly use whatever it reports.

Calling that function restores normal rich events.

I’m using Ubuntu 20.04.  The distro installs ibus-gtk3 as part of 
the normal desktop experience, but I haven’t configured it. 
“im-config” reports that it’s using the default en_US locale.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55660; Package emacs. (Fri, 27 May 2022 02:01:01 GMT) Full text and rfc822 format available.

Message #14 received at 55660 <at> debbugs.gnu.org (full text, mbox):

From: Po Lu <luangruo <at> yahoo.com>
To: Derek Upham <derek_upham <at> mailfence.com>
Cc: 55660 <at> debbugs.gnu.org
Subject: Re: bug#55660: 29.0.50; PGTK degrades to terminal-compatible
 keyboard events
Date: Fri, 27 May 2022 09:59:43 +0800
Derek Upham <derek_upham <at> mailfence.com> writes:

> Calling that function restores normal rich events.
>
> I’m using Ubuntu 20.04.  The distro installs ibus-gtk3 as part of the
> normal desktop experience, but I haven’t configured it. “im-config”
> reports that it’s using the default en_US locale.

Then this is a duplicate of bug#53200 (and many other similar issues).
Would someone please merge the two?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55660; Package emacs. (Fri, 27 May 2022 05:55:02 GMT) Full text and rfc822 format available.

Message #17 received at 55660 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Po Lu <luangruo <at> yahoo.com>
Cc: 55660 <at> debbugs.gnu.org, derek_upham <at> mailfence.com
Subject: Re: bug#55660: 29.0.50;
 PGTK degrades to terminal-compatible keyboard events
Date: Fri, 27 May 2022 08:53:57 +0300
merge 55660 53200
thanks

> Cc: 55660 <at> debbugs.gnu.org
> Date: Fri, 27 May 2022 09:59:43 +0800
> From:  Po Lu via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> Derek Upham <derek_upham <at> mailfence.com> writes:
> 
> > Calling that function restores normal rich events.
> >
> > I’m using Ubuntu 20.04.  The distro installs ibus-gtk3 as part of the
> > normal desktop experience, but I haven’t configured it. “im-config”
> > reports that it’s using the default en_US locale.
> 
> Then this is a duplicate of bug#53200 (and many other similar issues).
> Would someone please merge the two?

Done (and anyone can easily do that).

Should this issue be in PROBLEMS?




Merged 49211 53200 55362 55660. Request was from Eli Zaretskii <eliz <at> gnu.org> to control <at> debbugs.gnu.org. (Fri, 27 May 2022 05:55:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55660; Package emacs. (Fri, 27 May 2022 06:07:01 GMT) Full text and rfc822 format available.

Message #22 received at 55660 <at> debbugs.gnu.org (full text, mbox):

From: Po Lu <luangruo <at> yahoo.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 55660 <at> debbugs.gnu.org, derek_upham <at> mailfence.com
Subject: Re: bug#55660: 29.0.50; PGTK degrades to terminal-compatible
 keyboard events
Date: Fri, 27 May 2022 14:06:34 +0800
Eli Zaretskii <eliz <at> gnu.org> writes:

> Done (and anyone can easily do that).

Thanks for showing the procedure.

> Should this issue be in PROBLEMS?

I guess so, I will probably write an entry in a while.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55660; Package emacs. (Fri, 27 May 2022 07:08:01 GMT) Full text and rfc822 format available.

Message #25 received at 55660 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Po Lu <luangruo <at> yahoo.com>
Cc: 55660 <at> debbugs.gnu.org, derek_upham <at> mailfence.com
Subject: Re: bug#55660: 29.0.50; PGTK degrades to terminal-compatible
 keyboard events
Date: Fri, 27 May 2022 10:07:18 +0300
> From: Po Lu <luangruo <at> yahoo.com>
> Cc: derek_upham <at> mailfence.com,  55660 <at> debbugs.gnu.org
> Date: Fri, 27 May 2022 14:06:34 +0800
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> > Should this issue be in PROBLEMS?
> 
> I guess so, I will probably write an entry in a while.

Thanks, but shouldn't the heading line of the entry you added be
qualified with "in PGTK builds"? or maybe "in GTK and PGTK builds"?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55660; Package emacs. (Fri, 27 May 2022 08:01:02 GMT) Full text and rfc822 format available.

Message #28 received at 55660 <at> debbugs.gnu.org (full text, mbox):

From: Po Lu <luangruo <at> yahoo.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 55660 <at> debbugs.gnu.org, derek_upham <at> mailfence.com
Subject: Re: bug#55660: 29.0.50; PGTK degrades to terminal-compatible
 keyboard events
Date: Fri, 27 May 2022 16:00:18 +0800
Eli Zaretskii <eliz <at> gnu.org> writes:

> Thanks, but shouldn't the heading line of the entry you added be
> qualified with "in PGTK builds"? or maybe "in GTK and PGTK builds"?

It's already under "Runtime problems specific to PGTK".




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55660; Package emacs. (Fri, 27 May 2022 15:54:01 GMT) Full text and rfc822 format available.

Message #31 received at 55660 <at> debbugs.gnu.org (full text, mbox):

From: Derek Upham <derek_upham <at> mailfence.com>
To: Po Lu <luangruo <at> yahoo.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 55660 <at> debbugs.gnu.org
Subject: Re: bug#55660: 29.0.50; PGTK degrades to terminal-compatible
 keyboard events
Date: Fri, 27 May 2022 08:53:35 -0700
Po Lu <luangruo <at> yahoo.com> writes:

> Eli Zaretskii <eliz <at> gnu.org> writes:
>
>> Thanks, but shouldn't the heading line of the entry you added 
>> be
>> qualified with "in PGTK builds"? or maybe "in GTK and PGTK 
>> builds"?
>
> It's already under "Runtime problems specific to PGTK".

How about this?

** Keyboard behavior depends on your GTK input method

The GTK3 libraries may interpret and process keypresses as part of 
the
current GTK input method, before passing them as input events to 
Emacs.
GTK applications like PGTK Emacs configure their input method
automatically based on environment variables, particularly LANG 
and
GTK_IM_MODULE.

If you notice differences in keyboard behavior depending on how 
you
start PGTK Emacs, compare your environments using 
`process-environment'.
For example, you may see behavior differences when running Emacs 
out of
a systemd unit file, compared to running Emacs from the command 
line.
Input methods may also cause the keyboard behavior to change if 
you
switch from a GTK-based build to a PGTK-based build.

Emacs may reveal bugs that are in the input method libraries. 
Those
libraries are out of Emacs's control, but you can tell PGTK Emacs 
to
bypass input methods entirely using an Emacs Lisp function:

 M-: (pgtk-use-im-context nil)





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55660; Package emacs. (Sat, 28 May 2022 00:43:02 GMT) Full text and rfc822 format available.

Message #34 received at 55660 <at> debbugs.gnu.org (full text, mbox):

From: Po Lu <luangruo <at> yahoo.com>
To: Derek Upham <derek_upham <at> mailfence.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 55660 <at> debbugs.gnu.org
Subject: Re: bug#55660: 29.0.50; PGTK degrades to terminal-compatible
 keyboard events
Date: Sat, 28 May 2022 08:41:51 +0800
Derek Upham <derek_upham <at> mailfence.com> writes:

> How about this?
>
> ** Keyboard behavior depends on your GTK input method
>
> The GTK3 libraries may interpret and process keypresses as part of the
> current GTK input method, before passing them as input events to
> Emacs.
> GTK applications like PGTK Emacs configure their input method
> automatically based on environment variables, particularly LANG and
> GTK_IM_MODULE.
>
> If you notice differences in keyboard behavior depending on how you
> start PGTK Emacs, compare your environments using
> `process-environment'.
> For example, you may see behavior differences when running Emacs out
> of
> a systemd unit file, compared to running Emacs from the command line.
> Input methods may also cause the keyboard behavior to change if you
> switch from a GTK-based build to a PGTK-based build.
>
> Emacs may reveal bugs that are in the input method libraries. Those
> libraries are out of Emacs's control, but you can tell PGTK Emacs to
> bypass input methods entirely using an Emacs Lisp function:
>
>  M-: (pgtk-use-im-context nil)

No, that doesn't describe the problem very well.  `process-environment'
is certainly completely unrelated, and the description is much more
vague, with no examples of what can go wrong with faulty input methods.

The first half of the entry also describes a different problem, which
has already been in PROBLEMS for a while.




Forcibly Merged 49211 53200 55362 55660 56653. Request was from Po Lu <luangruo <at> yahoo.com> to control <at> debbugs.gnu.org. (Wed, 20 Jul 2022 11:16:02 GMT) Full text and rfc822 format available.

Forcibly Merged 49211 51002 53200 55362 55660 56653. Request was from Po Lu <luangruo <at> yahoo.com> to control <at> debbugs.gnu.org. (Tue, 13 Sep 2022 02:32:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 07 Nov 2022 12:24:04 GMT) Full text and rfc822 format available.

bug unarchived. Request was from Daan Ro <daanturo <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 24 Nov 2022 08:33:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 23 Dec 2022 12:24:04 GMT) Full text and rfc822 format available.

bug unarchived. Request was from Daan Ro <daanturo <at> gmail.com> to control <at> debbugs.gnu.org. (Sun, 25 Dec 2022 08:59:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 22 Jan 2023 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 148 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.