Subject: change set-kbd option default to 1 on mac osx clients

From: [email-masked]
Date: Thu, 7 Jan 2016 20:46:45 +0100

Package: x2goclient
Version: 4.0.5.0
  
  This bug affects mac clients only.
    
    Systems:
    OSX 10.6.8 + XQuartz 2.7.5 from macports
    OSX 10.10.5 + XQuartz 2.7.5 from macports

Hi,

Problem:
The keyboard works fine in x2goclient session (if xmodmap  is found at
hardcoded path "/opt/X11/bin/xmodmap")(see Bugs #487 and #977)
only using virtualbox gives a completely garbled keyboard.

Explanation for the virtualbox part:
virtualbox on a linux host has to find a mapping from X11 keycodes to
scancodes that are to be sent to the guest system.
It uses three methods to guess this mapping: "byXKB", "byType" and
"byLayout". All three methods look at the keycode to keyname 
mapping of X11, if method "byXKB" gives a result that matches one of
several known keyboard layouts, this result is used. Failing this, 
the results of the other two methods are checked. 
This works quite well for 
- linux local access
- native X11 remote access from linux client systems
- x2goclient access from windows clients
- x2goclient access from linux clients
but it does not work for x2goclient access from mac clients, because the
x2goserver provides bogus keynames for the XkbGetKeyboard() call. 

This could be fixed using the x2goclient command line parameter
--set-kbd=1 because then x2goserver uses some other way to set up
XKB key mappings. This method results in virtualbox getting a good
keyname to keycode mapping with XkbGetKeyboard().

I have not seen any problems with other X11 clients using the
--set-kbd=1 parameter. 

Unfortunately  the parameter value for "--set-kbd" is silently
overridden for max osx client in onmainwindow.cpp to 0 .
I spent some hours of testing and looking at the source code of
virtualbox, x2goserver, the nx part of x2goserver and at last
found this code in onmainwindow.cpp:

#ifdef Q_OS_DARWIN  
  usekbd=0;
  type="query";
#endif 

in two places. I changed it to "usekbd=1" and virtualbox found a
perfect keycode to scancode mapping.

As I did not find any problems using this setting, I suggest to use    
 
   usekbd=1;
   type="query";

as default for x2goclient on OSX. 

Joerg