Hendrik Tews <hendrik.t...@fireeye.com> writes:

> I found the culprit: It's the Debian deprecated.patch, which I
> attach below, in case you are interested.

I analyzed the problem a bit further. The patch deprecated.patch
replaces various occurrences of XKeycodeToKeysym with
XkbKeycodeToKeysym, apparently following various resources
suggesting XkbKeycodeToKeysym should be used instead of the
deprecated XKeycodeToKeysym. The problem is that these
suggestions are wrong wrt. applications running inside X servers
without the XKEYBOARD extension and vnc4server _does not_ have
the XKEYBOARD extension.

The XKEYBOARD doc clearly say, no Xkb function should be called
if the server does not provide XKEYBOARD. And indeed, inside
vnc4server, XkbKeycodeToKeysym does always return 0. (I attach a
small test program that shows this behavior.) Inside the loop in
AddBinding (file libs/Binding.c) this causes all key bindings to
be dropped.

For the behavior of XkbKeycodeToKeysym it is not relevant whether
the XKEYBOARD extension is properly initialized or not (indeed,
the patch uses XkbKeycodeToKeysym without calling
XkbQueryExtension as the documentation requests).

Therefore, I strongly believe that as long as Debian distributes
X servers without the XKEYBOARD extension, such as vnc4server for
example, fvwm should use the deprecated XKeycodeToKeysym instead
of XkbKeycodeToKeysym. As a consequence, the patch
deprecated.patch should be removed.

As conclusion, there are the following solutions to this problem:

- downgrade to Debian fvwm 2.5.30 (as suggested by Claude)
  because this uses XKeycodeToKeysym

- use a vnc server with XKEYBOARD, such as tigervnc

- compile fvwm without the offending patch, for instance the
  upstream version (the Debian package lists debhelper (>=
  9.0.0), autotools-dev, dh-autoreconf, file, fontconfig,
  gettext, libfontconfig1-dev | libfontconfig-dev,
  libfreetype6-dev, libfribidi-dev (>= 0.10.7), libncurses5-dev,
  libreadline-dev | libreadline6-dev | libreadline5-dev,
  libpng12-dev | libpng-dev, librplay3-dev, librsvg2-dev (>=
  2.13.92), libsm-dev, libstroke0-dev, libx11-dev,
  libxcursor-dev, libxext-dev, libxft-dev, libxi-dev,
  libxinerama-dev, libxpm-dev, libxrandr-dev, libxrender-dev,
  libxt-dev, sharutils, xsltproc as build dependencies).

Bye,

Hendrik


This email and any attachments thereto may contain private, confidential, 
and/or privileged material for the sole use of the intended recipient. Any 
review, copying, or distribution of this email (or any attachments thereto) by 
others is strictly prohibited. If you are not the intended recipient, please 
contact the sender immediately and permanently delete the original and any 
copies of this email and any attachments thereto.
#include <stdio.h>
#include <stdlib.h>
#include <X11/Xlib.h>
#include <X11/XKBlib.h>

int main(int argc, char **argv)
{
  char *display_name = NULL;
  Display * dpy;
  int xkb_major = XkbMajorVersion;
  int xkb_minor = XkbMinorVersion;
  int xkb_opcode, xkb_event_base, xkb_error_base, xkb_open_reason;

  dpy = XOpenDisplay(display_name);
  if (!dpy) {
    fprintf(stderr, "xkbtest: unable to open display '%s'\n",
  	    XDisplayName (display_name));
    exit(2);
  }
  
  printf("Connected\n");
  
  if(XkbLibraryVersion(&xkb_major, &xkb_minor)) {
    printf("linked with compatible XKB lib %d.%d\n", xkb_major, xkb_minor);
  } else {
    fprintf(stderr, "xkbtest: dynamic XKB library incompatible\n");
    exit(2);
  }
  
  xkb_major = XkbMajorVersion;
  xkb_minor = XkbMinorVersion;
  if(XkbQueryExtension(dpy, &xkb_opcode, &xkb_event_base, &xkb_error_base,
  		       &xkb_major, &xkb_minor)) {
    printf("compatible XKB on server present version %d.%d\n"
  	   "opcode %d ev base %d error base %d\n",
  	   xkb_major, xkb_minor, xkb_opcode, xkb_event_base, xkb_error_base);
  } else {
    printf("no compatible XKB on server\n");
  }

  printf("key 0x48 index 0 to keysym std: %lX\n",
	 XKeycodeToKeysym(dpy, 0x48, 0));

  printf("key 0x48 group 0 index 0 to keysym XKB: %lX\n",
	 XkbKeycodeToKeysym(dpy, 0x48, 0, 0));
  
  return 0;
}


/*** 
Local Variables:
compile-command: "gcc -Wall -o xkbtest -lX11 xkbtest.c"
End:
***/

Reply via email to