Comment 17 for bug 167290

Revision history for this message
JiHO (jiho) wrote :

To restart discussion on this very annoying bug, I have an approximative workaround. It has been tested with Leopard and X11 2.4.0.

# Background

Using xev, I find that the mapping of control keys from left to right on a US keyboard is:
        control = keycode 67 = Control_L
        option = 66 = Mode_switch
        command = 63 = Meta_L
        space
        command = 71 = Meta_R
        option = 69 = Mode_switch (with the additional message XKeysymToKeycode returns keycode: 66)

And xmodmap gives
        $ xmodmap
        xmodmap: up to 2 keys per modifier, (keycodes in parentheses):

        shift Shift_L (0x40), Shift_R (0x44)
        lock Caps_Lock (0x41)
        control Control_L (0x43), Control_R (0x46)
        mod1 Mode_switch (0x42), Mode_switch (0x45)
        mod2 Meta_L (0x3f), Meta_R (0x47)
        mod3
        mod4
        mod5

In this configuration, with X11 options "Follow system keyboard layout" and do NOT "Enable key equivalent under X11", Inkscape's behaviour is:
        control works as control
        option can be used to type accents
        option+letter does not activate menus, option+D does not clone (i.e. option does not work as alt)
        command does not do anything except switching to drawing selection mode (the red path) so in that case, and in that case only, it works as alt

# Workaround:

Use ~/.Xmodmap to remap keys under X11:

! Switch meta and control
keycode 67 = Meta_L
keycode 63 = Control_L
keycode 71 = Control_R
clear mod2
clear control
add mod2 = Meta_L
add control = Control_L Control_R

! Switch the left alt key to be alt
! and leave the other as Mode_switch, for accents
keycode 66 = Alt_L

In that configuration, xmodmap gives:
        $ xmodmap
        xmodmap: up to 3 keys per modifier, (keycodes in parentheses):

        shift Shift_L (0x40), Shift_R (0x44)
        lock Caps_Lock (0x41)
        control Control_L (0x3f), Control_R (0x46), Control_R (0x47)
        mod1 Alt_L (0x42), Mode_switch (0x45)
        mod2 Meta_L (0x43)
        mod3
        mod4
        mod5
which is not completely clean but at least, keys work in a sensible way. In Inkscape:
        control is meta (hence has little use, except to switch modes in the tweak tool for example)
        left-option works as alt: it opens menus, clones, etc.
        left-command works as control: copy, paste, ... many other shortcuts.
        right-command works the same
        right-option retains the old behaviour (Mode_switch) and allows to type special characters such as œéāß etc.

Now I don't really know where we should be going with this.
Include this "fix" as a part of the installation of Inkscape will disrupt the behaviour of all other X11 apps. A soft change for Inkscape only, if possible, should detect whether Xmodmap is already used. Anyhow, the fix is here at least.