
On 12/3/10 02:35, Krzysztof Kosiński wrote:
I have never used OSX, but I know there are issues with modifier keys on it. Correct me if I'm wrong.
- Control is called Command, and is used for shortcuts
Command (labeled 'cmd') exists and is used for shortcuts
- There is a different key called Control, which is used to emulate a
right click and is rarely used for shortcuts
Control (labeled 'ctrl') exists, it can be used (and is used by default settings) for shortcuts (shortcuts are user definable per System Preferences)
- Left Alt is called Option and is used for shortcuts
- Right Alt (AltGr) is called Alt and is used for inputting diacritics
(third level chooser)
Both Alt keys (left and - if available, depending on keyboard model - right) are labeled ⌥/alt and both can be used for shortcuts as well as to input special characters. AFAIK OS X does not differentiate between Alt_L and Alt_R
- Shift is called Shift
Yes
I would like to know the following things, to create an initial solution for Inkscape, with the goal of including it in GTK.
- How are those keys reported to GDK, e.g. which bits in the state
field are set when they are pressed? GDK knows about Shift, Control, Mod1 (aka Alt), Super (aka Windows key), Hyper and Meta. Which of them correspond to which Mac keys?
AFAIU X11-based applications running under X11/Xquartz get the key press events from X11, not from OS X itself. This means that remapping and swapping of keysyms can and currently is recommended to be done with xmodmap and not per application (see Inkscape FAQ). It also means whatever default keysyms are seen by GDK and applications like GIMP or Inkscape can change with new X11 releases (AFAIK this happened with the 'Option' key which was mapped to 'Alt_L' in earlier X11 versions and currently defaults to 'Mode_switch' for both right and left option/alt key).
- Does the above differ in the Quartz version of GTK? I know there are
some X server preferences that can be used to alter the mapping.
X11: See attached screenshot for available X server input preferences.
Quartz: I guess it differs because there's no intermediary X11 between OS X and GTK+ but I have no knowledge about implementation and differences between the GTK+/X11 and GTK+/Quartz modules.
There are GTK+/Quartz bug reports about shortcuts (see some listed in Inkscape bug #438603) but I don't know if there are plans to change defaults in the GTK+/Quartz module (e.g. swapping Ctrl/Cmd)
- Is it OK to shorten "Option" as "Opt" in the UI? I know that Command
is shortened as Cmd.
Idk
My plan is as follows:
- Define some constants in ui/tool/event-utils.h that define
cross-platform masks for the "state" field of GDK events, so that e.g. INK_STATE_ALT maps to Alt on Linux / Windows and to Option on Macs, and INK_STATE_CONTROL accordingly maps to Control or Command.
- Define macros for names of the keys indicated by the above masks.
For example INK_KEYNAME_CTRL would expand to "Ctrl" or "Cmd". This name would also be marked for translation.
- Adjust all messages that contain modifier names.
- Look into modifying GTK so that menu items created from actions have
the correct modifier names. Alternatively, derive from Gtk::Action and override the widget creation functions.
I am not sure about swapping Ctrl/Cmd on application level. At the moment the same default shortcuts can be used in all X11 based applications (e.g. 'Ctrl-C/Ctrl-V' copies/pastes in Inkscape as well as in GIMP). If the user wants to change this with xmodmap this will affect all applications under X11 and avoid even more confusion (Cmd-C in Inkscape, but Ctrl-C in GIMP for the same basic operation?).
But for me Ctrl/Cmd is not the main issue on osx - getting the 'Alt' modifier right (e.g. when used in hard-coded keyboard shortcuts) seems far more critical because with default settings users on osx miss basic functionality in Inkscape (e.g. no 'select-under' with 'Alt-click', no line/letter spacing, no rotate ...), besides failing keyboard shortcuts (like 'Paste in Place' with 'Alt+Ctrl+V', clones with 'Alt+D'...) which however could be remapped in keys/default.xml.
PS is there any way to run OSX in a virtual machine? If not, then maybe people who do have access to OSX machines could help.
I think you need physical access to a mac with a default apple keyboard attached to work on this.
~suv