MIDI2LR icon indicating copy to clipboard operation
MIDI2LR copied to clipboard

Shortcut keys in OS X

Open tryba2000 opened this issue 10 years ago • 16 comments

I can not run the function "paste from the previous". I program the cc: 90 KPPasteFromPrevious but nothing happens when I press the button. The "reset all" button works ok.

•Operating system Windows 10 •MIDI2LR version: 0.9.10 •Lightroom version: 6.0 •Lightroom language: PL •Keyboard language: PL •MIDI controller: Behringer BCF2000 •Plugin installation directory: E:\Programy\programy foto\MIDI2LR •Profiles save directory: E:\Programy\programy foto\MIDI2LR\AlexArtPhoto_BehringerBCF2000_MIDI2LR

tryba2000 avatar Apr 02 '16 20:04 tryba2000

Try the latest hotfix: https://github.com/rsjaffe/MIDI2LR/releases/tag/%60v0.9.10.1 This should fix that issue. (I hope).

rsjaffe avatar Apr 02 '16 22:04 rsjaffe

This still isn't working for me on the X-Touch Mini, even after applying the hotfix, unless I'm doing something stupid. I've tried using the KPPasteFromPrevious and also assigning the Cmd+Option+v shortcut using the new key mapping options (thanks for those), but I just get an audible OSX "nope" type of sound, and nothing happens.

Has anyone else got this working in the latest version? OSX 10.11.3, LR CC, UK language LR & keyboard.

EDIT: Just spotted issue #234 - is this likely to be related?

bozwellox avatar Apr 05 '16 20:04 bozwellox

No, not related to #234. Do any of the shortcuts work for you? I've never received any confirmation from Mac users that they work, and so that code is considered "experimental" for Macs. Also, is Lightroom the active application? Unlike with the PC, the key messages won't go to Lightroom unless it is the foreground application.

rsjaffe avatar Apr 06 '16 13:04 rsjaffe

@rsjaffe I'll give it a proper test and get back to you. Just in the middle of a mega edit.

bozwellox avatar Apr 06 '16 22:04 bozwellox

I've tested the shortcuts on my Mac. Result is that only Cmd key does not work for me. That sucks because most of the key-combinations in lightroom includes Cmd. However Alt/Opt key works well, Shift works well, letters work well. Eg. (Before-after toggle) Alt/Opt+Y works just like Shift+Y. Keystore R for Crop tool works too. But any other keycombination with Cmd or Cmd+Opt, or Cmd+Shift or Cmd+Opt+Shift does not work. Eg Copy/Paste, Paste from Previous and so on.

  • MIDI2LR 1.0.0
  • OSX El Capitan latest
  • English lang op-system and english Lightroom
  • Hungarian keyboard (but when I switch to English keyboard, everything remain the same)

emkorec avatar Apr 11 '16 11:04 emkorec

That's very odd. I'll check the code.

rsjaffe avatar Apr 11 '16 15:04 rsjaffe

Very odd. The following is a piece of the code used for OS X. The keys set by the user are: 'key' (the key to press), 'Control' (the command key), 'Alt' (the options key) and 'Shift'. Does anyone see an issue here?

        const std::wstring utf16str{ utf8_to_utf16(key) };
        const UniChar keychar = utf16str[0];
        d = CGEventCreateKeyboardEvent(source, 0, true);
        u = CGEventCreateKeyboardEvent(source, 0, false);
        CGEventKeyboardSetUnicodeString(d, 1, &keychar);
        CGEventKeyboardSetUnicodeString(u, 1, &keychar);
        flags = CGEventGetFlags(d); //in case KeyCode has associated flag
        if (Control) flags |= kCGEventFlagMaskCommand;
        if (Alt) flags |= kCGEventFlagMaskAlternate;
        if (Shift) flags |= kCGEventFlagMaskShift;
        if (flags != UINT64_C(0))
        {
            CGEventSetFlags(d, static_cast<CGEventFlags>(flags));
            CGEventSetFlags(u, static_cast<CGEventFlags>(flags));
        }

rsjaffe avatar Apr 11 '16 15:04 rsjaffe

Beware that Control is not the same as Command. Mac keyboard has both Ctrl and Cmd keys, but Ctrl is rarely used. All commands made with Ctrl on Windows are made with Cmd (command or apple key) on Mac. Ctrl (control) key does some totally different thing that Windows does not even have a key for (and once again it is rarely used on Macs).

emkorec avatar Apr 11 '16 15:04 emkorec

Here you can see: http://dailypillar.com/wp-content/uploads/2015/06/mac-keyboard.png or here: http://mac.sillydog.org/archives/pic/keyboard_changes_01.jpg Ctrl = Control (used rarely) Alt = Option Cmd = Command or on older Macs it was the "Apple" key If windows version is ctrl+C than the mac version is Cmd+C.

Maybe you already knew these I just write it because I see the word "Control" in the code besides Alt and Shift. I do not have any programming knowledge though...

emkorec avatar Apr 11 '16 15:04 emkorec

Yes--I use the variable Control for Control in windows, Command in OS X, and mapped it tok CGEventFlagMaskCommand . The whole set is

enum _CGEventFlags {
   kCGEventFlagMaskAlphaShift =    NX_ALPHASHIFTMASK,
   kCGEventFlagMaskShift =         NX_SHIFTMASK,
   kCGEventFlagMaskControl =       NX_CONTROLMASK,
   kCGEventFlagMaskAlternate =     NX_ALTERNATEMASK,
   kCGEventFlagMaskCommand =       NX_COMMANDMASK,
   kCGEventFlagMaskHelp =          NX_HELPMASK,
   kCGEventFlagMaskSecondaryFn =   NX_SECONDARYFNMASK,
   kCGEventFlagMaskNumericPad =    NX_NUMERICPADMASK,
   kCGEventFlagMaskNonCoalesced =  NX_NONCOALSESCEDMASK 
};
typedef uint64_t CGEventFlags;

One thing I might try is to send the modifier keys in sequence--currently the modifiers and character key are sent as a single event, which might confuse LR.

rsjaffe avatar Apr 12 '16 00:04 rsjaffe

Could you try replacing MIDI2LR.app (located in the plugin directory) with the attached app (unzip it first)?

Thanks

MIDI2LR.app.zip

Or, if you have to replace the whole plugin, the following contains the entire plugin with the updated app.:

MIDI2LR.zip

rsjaffe avatar Apr 12 '16 02:04 rsjaffe

Just tried using the version posted directly above - paste previous isn't working still (set to Command + Option + v in the plugin settings).

bozwellox avatar Apr 12 '16 09:04 bozwellox

Sorry I am not at home at the moment. You should try something else with command key maybe?

emkorec avatar Apr 12 '16 09:04 emkorec

OK so I've done some further testing and it does indeed seem like it is the command key that isn't playing nicely. The following things don't work for me:

Copy (Shift + CMD + C) Paste (Shift + CMD+ V) Paste previous (Option + CMD + V) Targeted adjustments for Hue, Saturation, Luminance, Tone Curve & B&W Mix (all involving the Alt + Shift + CMD keys)

The following things work perfectly and none of them use the CMD key:

Lights out (Shift + L) Hide panels (Shift + TAB)

It definitely seems like the CMD key is causing the problems for Mac users. Hope this helps - let me know if I can be of any assistance with debugging and wotnot.

bozwellox avatar Apr 12 '16 17:04 bozwellox

I'm traveling now, can't do any compiling. I've revised SendKeys.cpp again. I had it sequentially pressing any applicable modifier keys, now just the command key. If you are able to compile for OS X, could you run it and test based on the current develop branch? Thanks. Otherwise, this will have to wait a week.

rsjaffe avatar Apr 12 '16 22:04 rsjaffe

I'd happily do that, if I had the faintest clue what you're talking about. My role here is mainly to assign pushy buttons on my slidey box to the clever things you've spent hours mapping to Lightroom functions, then moan about it when I can't get them to work, like an annoying child.

I actually feel like a total bastard for just commenting on what doesn't work, given all the things that now work perfectly. Version 1 has pretty much delivered everything I wanted, with the exception of these issues, which seem to be a Mac "lost in translation" thing. So massive thanks for all the work you've put in on this - Midi2LR is shaping up to be pretty much perfect. Bravo!

If someone can explain to me in very, very simple terms how to do what Rory is requesting I'd happily give it a go (I feel like I should give something back given the amount of requests I put in) but it's probably better at this point if a grown-up/someone who knows what words like "compile" and "develop branch" means takes over

Enjoy your travels dude. I'll buy you a steak dinner via the medium of PayPal once these things are sorted.

bozwellox avatar Apr 12 '16 22:04 bozwellox