Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Bug Reports

Reply
 
Thread Tools Display Modes
Old 04-25-2019, 01:51 PM   #1
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default "accelerator" should be ahead of MIDI editor in keyboard processing queue (FIXED)

The "accelerator" function gets an extension a place in the keyboard processing queue:

(Quoting from reaper_plugin.h)
Code:
/*
** accelerator_register_t allows you to register ("accelerator") a record which lets you get a place in the 
** keyboard processing queue.
*/

typedef struct accelerator_register_t
{
  // translateAccel returns:
  // 0 if not our window, 
  // 1 to eat the keystroke, 
  // -1 to pass it on to the window, 
  // -666 to force it to the main window's accel table (with the exception of ESC)
  int (*translateAccel)(MSG *msg, accelerator_register_t *ctx); 
  bool isLocal; // must be TRUE, now (false is no longer supported, heh)
  void *user;
} accelerator_register_t;
This ability to eat keystrokes would be very useful for deferred scripts:

* The script can detect a keystroke and terminate itself, thereby skipping the strange "ReaScript task control" dialog that confuses new users.

* Alternatively, instead of starting and stopping the script by two separate keystrokes, the script can run while the shortcut key is held down, and terminate when the key is released. Many users find this more natural, and more similar to REAPER's native mouse modifier actions.

* The script can be controlled by keystrokes, without triggering action shortcuts. For example, ESC can terminate the script, instead of closing the MIDI editor.


Unfortunately, the MIDI editor and inline editor appear to jump the queue when they are focused, inserting themselves ahead of the extension's accelerator in the keyboard processing queue. The accelerator can therefore not eat keystrokes that go to the these windows, and deferred scripts cannot take advantage of the above-mentioned applications.

Last edited by juliansader; 04-25-2019 at 02:33 PM.
juliansader is offline   Reply With Quote
Old 04-25-2019, 08:41 PM   #2
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 16,117
Default

If you add the accelerator via "<accelerator" rather than "accelerator" it will place it at the front of the queue.
Justin is offline   Reply With Quote
Old 05-07-2019, 02:36 PM   #3
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Thanks!

"<accelerator" works well for the main MIDI editor and all dialog boxes that I tested.

However, the plucky little inline MIDI editor is still ahead in the queue and is unaffected by "<accelerator".
juliansader is offline   Reply With Quote
Old 05-09-2019, 08:32 AM   #4
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 16,117
Default

Quote:
Originally Posted by juliansader View Post
Thanks!

"<accelerator" works well for the main MIDI editor and all dialog boxes that I tested.

However, the plucky little inline MIDI editor is still ahead in the queue and is unaffected by "<accelerator".
Hmm yeah. I might be able to fix that (unsure what it will break...).

Last edited by Justin; 05-09-2019 at 08:37 AM.
Justin 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 11:07 AM.


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