Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Pre-Release Discussion

Reply
 
Thread Tools Display Modes
Old 05-21-2015, 03:06 AM   #1
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 7,239
Default Docked scripts Keyboard Pass Through to Main Window?

When you have a docked script and you click on it, then it steals the keyboard shortcuts. You have to click again in the arrange area for example, to have shortcuts working again.

Is there a way to Pass through to Main window all keyboard shortcuts?

(I post here in pre-release since docking scripts is new to 5.0)
heda is offline   Reply With Quote
Old 05-21-2015, 08:49 AM   #2
helgoboss
Human being with feelings
 
helgoboss's Avatar
 
Join Date: Aug 2010
Location: Germany
Posts: 2,184
Default

Don't know how it works for scripts. I had that issue with Playtime (C++) and solved it by registering an accelerator_register_t. That makes REAPER call a function of your choice whenever the user presses a key (even if a docked window has focus). That function then calls kbd_translateAccelerator which forwards the key to REAPER main window:

Code:
  int forwardKeyToReaper(MSG* msg, accelerator_register_t* ctx) {
    if (msg->message == WM_KEYDOWN) {
      // Actually don't know if this is necessary in your case
      HWND reaperMainWindow = reaper::GetMainHwnd();
      msg->hwnd = reaperMainWindow;
      
      KbdSectionInfo* mainInfo = reaper::SectionFromUniqueID(0);
      reaper::kbd_translateAccelerator(reaperMainWindow, msg, mainInfo);
    }
    else {
      return 0;
    }
  }
  
  // Register accelerator register in order to get place in keyboard processing queue
  accelerator_register_t* acceleratorRegister = new accelerator_register_t();
  acceleratorRegister->isLocal = true;
  acceleratorRegister->translateAccel = forwardKeyToReaper;
  reaper::plugin_register("accelerator", (void*)acceleratorRegister);
Does anybody know an easier way to achieve that?
helgoboss is offline   Reply With Quote
Old 03-11-2018, 04:23 PM   #3
tack
Human being with feelings
 
tack's Avatar
 
Join Date: Jan 2014
Location: Ontario, Canada
Posts: 1,618
Default

Quote:
Originally Posted by heda View Post
Is there a way to Pass through to Main window all keyboard shortcuts?
Sorry for the thread necromancy, but did you ever figure this out, heda?
tack is offline   Reply With Quote
Old 03-11-2018, 08:38 PM   #4
mpl
Human being with feelings
 
mpl's Avatar
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 3,960
Default

AFAIK heda calls SWS/BR: Focus arrange on mouse release in Track inspector. It was suggested to me also for Interactive Toolbar.
In my case it is probably working wrong there, because I need to add a condition to focus MIDI Editor if there is opened MIDI Editor.
mpl is offline   Reply With Quote
Old 03-12-2018, 06:37 AM   #5
tack
Human being with feelings
 
tack's Avatar
 
Join Date: Jan 2014
Location: Ontario, Canada
Posts: 1,618
Default

Quote:
Originally Posted by mpl View Post
AFAIK heda calls SWS/BR: Focus arrange on mouse release in Track inspector. It was suggested to me also for Interactive Toolbar.
Yeah, I can refocus things easily enough. I was hoping for an API where I could pass through unhandled keystrokes to the main window. Similar to the capability that exists with the MIDI editor.

Quote:
Originally Posted by mpl View Post
In my case it is probably working wrong there, because I need to add a condition to focus MIDI Editor if there is opened MIDI Editor.
You probably already know this, but SN_FocusMIDIEditor() exists in relatively recent versions of SWS.
tack is offline   Reply With Quote
Old 03-12-2018, 07:54 AM   #6
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 7,239
Default

Yes I use what mpl said. But it would be nice to have control to pass any unused key. But not a priority. I didn't remember this thread. It should be moved from prerelease forum now.

Also, I don't seem to be able to detect combination keys(Ctrl, alt, shift) if the script is docked and not focused. But that's another problem.
heda is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 09:10 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.