Re: Alt and Command keys in the quartz backend

On Sep 6, 2011, at 1:13 PM, Michael Natterer wrote:

> On Tue, 2011-09-06 at 21:51 +0200, Kristian Rietveld wrote:
>> On Sep 6, 2011, at 6:58 PM, Paul Davis wrote:
>>> this seems to be about two different things, neither of which are in
>>> conflict (and i think john actually agrees with this).
>>> 1) whether or not the Alt key should generate MOD1 as a modifier
>>> 2) whether or not code that wants to be cross-platform can assume that
>>> they can use MOD1 with its own chosen semantics
>> I have typically avoided the debate on modifiers/etc. since I am not very familiar with the X11 background of them either.
>> The two things you set out indeed seem to make much sense to me. The big question to me is around (2), if MOD1 is passed by GDK, should  GTK+ or an application still include cross-platform handling or should the cross-platform handling already been taken care of?  I get the impression that given that keybindings still need cross-platform porting at the GTK+ level, the former is perhaps not a strange assumption.  For the former, having modifiers bound to keys with similar labels is, I *think*, helpful for implementing the cross-platform handling in GTK+ and/or applications. 
> I agree, and I would argue like this about ALT/MOD1:
> - on GTK+, ALT/MOD1 are used for mnemonics, which are typically
>  translatable, which means unforeseeable, so cannot really be used
>  for apps.
> - on the Mac, ALT/Option is used for generating special chars, which
>  are different per keyboard layout, which means unforeseeable, so
> cannot
>  really be used for apps.
> So there is no conflict here, see below.
>>> if (2) was fixed so that GTK was not an example of code that assumes
>>> that MOD1 is free for any interpretation on any platform, then (1) is
>>> moot, and it really doesn't matter what the Alt key generates on OS X
>>> (hence, it could be MOD1).
>>> but as long as (2) remains an issue within GTK itself, its hard to
>>> argue that a key that has clearly different purposes for a large body
>>> of platform users of OS X should be handled by GTK as if it had some
>>> different meaning based on another platform.
>> My impression is that GTK+ has to be fixed first here before we can consider binding the key labeled with Alt to MOD1 like is done on other platforms.
> IMHO for the ALT/MOD1 mapping to work nicely, we simply need to
> hardcode gtk-enable-mnemonics to FALSE and we're done. Apps are
> used to have Alt-foo being taken by the system in an unpredictable
> way, and Alt-mouse interaction will just start working on the Mac
> too, so will keybindings that use Alt. Note that key bindings
> don't have above "being taken" problem, since they will typically
> modify a widget's key binding to do exactly what the respective
> Mac control does, so there should be no conflict.
> Did I miss anything here?

Uh, won't hard coding gtk-enable-mnemonics=FALSE (I suppose you mean the GtkSettings property, and that you propose to do it inside of some sort of a runtime check for the quartz backend) mean that all keybindings, regardless of what modifier keys they use, *don't* work?

Have you actually tried any of these things? On a Mac? With the deadkeys patch [1]? No? Why don't you, and when you get it working post your patch on Bug 607115 [2]? You might find the test program I posted there [3] helpful in understanding how the Apple keyboard differs from the Microsoft one. It should compile in a gtk-osx or macports-quartz environment with 'gcc -o keytest keytest.c `pkg-config --cflags --libs gtk+-3.0`'

John Ralls


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]