Skip to content

don't ignore missing non-standard modifiers in _XtMatchUsingDontCareMods

Jann Horn requested to merge jannh/libxt:neofix1 into master

In xterm-360, VTInitTranslations() configures some bindings for keys in a way that requires only the explicitly listed modifiers to be present, but places no constraints on any other modifiers - e.g. insert-selection is bound to Shift <KeyPress> Insert, so if the user e.g. presses Ctrl+Shift+Insert, the action will still fire.

https://www.x.org/releases/X11R7.5/doc/Xt/Xt.html Appendix B, which specifies the Translation Table syntax, says that not only additional modifiers are ignored, but missing modifiers that make up the key are also ignored. As the spec says:

‘‘A’’ and ‘‘a’’ are equivalent

In that example, A is normally composed as Shift+A, but the Shift modifier can be omitted.

On most keyboard layouts, keys such as Insert, Return and KP_Add don't contain modifiers, so everything works fine. However, in the german neo2 layout:

  • Mod5+Ä forms Insert
  • Mod5+Q forms KP_Add

This means that when VTInitTranslations() says that we want to bind to Shift+KP_Add and don't care about any other modifiers (other than Ctrl) being added or removed, the result is that when the user presses Shift+Q (for capital Q), or Shift+Mod3+Q (for ϕ), the terminal's font size will be changed instead.

While libXt is kind of working as documented here, the behavior doesn't really make much sense. Let's tweak _XtMatchUsingDontCareMods such that missing non-standard modifiers are never ignored.

Merge request reports

Loading