Shorcut keystrokes tests

Hi Jules,

I saw in the forum that improvements had been made on the timeless problem of shortcut keystrokes with TextEditors on plugins, so I update my Juce library that was one year old.

I tested all plugin formats (excepted VST3) on all DAW I had and here are my results:

Mac (10.9):

       VST (Cubase/Live)           OK
       VST (Reaper)                    Spacebar key not caught by the text editor.
       AU (Logic/Live)                OK
       AU (Reaper)                     Spacebar key not caught by the text editor.
       RTAS (PT 10)                    OK
       AAX  (PT 10/11)               OK

The spacebar problem was not present in the last version of the Juce Library I had (from August 2013).

 

PC (Windows 7): 

       VST   (Reaper/Cubase/Live)  OK
       AAX  (PT 10/11)                    OK
       RTAS (PT 10)                         Enter and escape keys not caught by the plugin.


For the RTAS problem, here is a fix I wrote in the RTASWrapper.cpp to send the key code to the focused component.

#if JUCE_WINDOWS

    Boolean HandleKeystroke(EventRecord *theEvent)
    {
        JUCE_NAMESPACE::Component* const modalComponent = JUCE_NAMESPACE::Component::getCurrentlyModalComponent();

        if (modalComponent != nullptr)
        {
            switch(theEvent->message)
            {
            case 9229:     // return key
            case 13315:    // numeric pad return key
                modalComponent->getCurrentlyFocusedComponent()->keyPressed(KeyPress(KeyPress::returnKey));
                break;
            case 13595: // escape key
                modalComponent->getCurrentlyFocusedComponent()->keyPressed(KeyPress(KeyPress::escapeKey));
                break;
            default:
                break;
            }

            return true;
        }
        else
            return false;
    };
#endif

 

What do you think of it?
Any idea about why space bars are not caught anymore on Reaper?

Thanks for the info. In your suggested Windows fix, where did you get the magic numbers from?

I simply did a printf of the 'theEvent->message' values as unsigned int to get these numbers.

There must be constants to use instead, but I didn't find them.

 

How about this?

   #if JUCE_WINDOWS
    Boolean HandleKeystroke (EventRecord* e) override
    {
        if (juce::Component* modalComp = juce::Component::getCurrentlyModalComponent())
        {
            if (juce::Component* focused = modalComp->getCurrentlyFocusedComponent())
            {
                switch (e->message & charCodeMask)
                {
                    case kReturnCharCode:
                    case kEnterCharCode:    focused->keyPressed (KeyPress (KeyPress::returnKey)); break;
                    case kEscapeCharCode:   focused->keyPressed (KeyPress (KeyPress::escapeKey)); break;
                    default: break;
                }
                return true;
            }
        }
        return false;
    }
   #endif