Reply to thread

Hi Enanno,


Did you reboot after the registry change? If not, please do so and retry.


I can see that the plugin captures the first Alt+Enter; on the second Alt+Enter it detects that the keyboard handler is disabled and as such could not capture it. I guess if you would press Alt+Enter multiple times after that, it will again sometimes be handled by the plugin, sometimes by MediaPortal itself. Currently the only known work-around is the registry hack unfortunately.


I think the plug-in could be improved to prevent the keyboard hook time-out. Currently all processing (looking up the key mapping and actually executing the related action) is done on the same thread as the keyboard hook itself. In order to improve this, the following steps should be taken:


  • Add functionality to InputHandler to store all mapped keycodes in a simple HashSet for quick lookup, and add a method IsMapped(keycode). For performance reasons, we could ignore conditions (e.g. once a key is defined in the mapping, the plugin will always 'eat' it independent of whether it is actually mapped under the current conditions).
  • KeyboardInputPluginMain.KeyboardHandler_KeyPressHandler currently calls _inputHandler.MapAction, which will both look up whether there is a mapping for the given key/button code, and if so, execute the corresponding action. This should be changed such that actually executing the action is performed on a separate thread. So, the relevant code in KeyboardHandler_KeyPressHandler could for example look something like this: [code]
    bool isMapped = InputHandler.IsMapped(keycode);
    if ( isMapped) { postToActionThread(keycode); }
    return isMapped;[/code]


Unfortunately, I lack the C#/.NET experience needed to quickly implement the threading mechanism (and I don't have time to delve into this). Anyone willing to help implement this? The source code can be found in the MP-Plugins SVN at https://mp-plugins.svn.sourceforge.net/svnroot/mp-plugins/trunk/plugins/KeyboardInputPlugin/ (see https://forum.team-mediaportal.com/mediaportal-plugins-47/plugin-development-svn-15863/ for information on getting write access).


Top Bottom