discuss-gnustep
[Top][All Lists]
Advanced

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

ALT as a click modifier


From: Riccardo Mottola
Subject: ALT as a click modifier
Date: Thu, 11 Jul 2013 14:21:19 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0 SeaMonkey/2.19

Hi,

after William's advice, I changed Graphos mouse-event key-modifier for certain operations to Alternate, to be more similar to other applications.

Graphos handles three different modifiers: shift, control, alt (method below).

Originally "alt" was mapped to NSCommandKeyMask. This would usually work fine on GNUstep with the standard setup, but on Mac you needed "command", as it is obvious. Now I set it to Alternate and it works like a charm on Mac, but not on GNUstep: there is no key combination that returns Alt. I fear this is a similar problem as the one with alt as key-modifier for Emacs that Fred had.

I tried to remap keys using SystemPreferences, so that "command" becomes the WindowKey, thus I could map Alternate to Meta. That way, it works on GNUstep too, essentially it behaves like on Mac. However, The windows key is not always available, people usually run with the standard setup.

What options do I have?

1) #ifdef in the code for GNUstep and Mac. Horrible, but quick and works
2) Introduce preferences in graphos where the behaviour is customizable. This would be an advanced version of 1) 3) interpret both Command and Alternate as altClick. Looks dirty to me and probably would not work if on GS command gets mapped to control 4) change GS's gehaviour to issue "alt" if alt gets clicked and in case command is alt, both alt and command are returned as modifier (is this even possible?)
5) ...? what other option



Riccardo

---
    if([theEvent type] == NSLeftMouseDown
       || [theEvent type] == NSLeftMouseDragged)
    {
        if([theEvent modifierFlags] & NSShiftKeyMask)
            shiftclick = YES;
        else
            shiftclick = NO;
        if([theEvent modifierFlags] & NSAlternateKeyMask)
            altclick = YES;
        else
            altclick = NO;
        if([theEvent modifierFlags] & NSControlKeyMask)
            ctrlclick = YES;
        else
            ctrlclick = NO;
    }

    else if([theEvent type] == NSLeftMouseUp)
    {
        if(!([theEvent modifierFlags] & NSShiftKeyMask))
            shiftclick = NO;
        if(!([theEvent modifierFlags] & NSAlternateKeyMask))
            altclick = NO;
        if(!([theEvent modifierFlags] & NSControlKeyMask))
            ctrlclick = NO;
    }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]