home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
MediaPortal 1 Plugins
Generic Keyboard/Remote Input Plugin
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="rsenden" data-source="post: 644125" data-attributes="member: 24295"><p>I've released a new beta version of KeyboardInputPlugin 2.4.0.0. The MediaPortal Extension Installer version can be downloaded at <a href="https://mp-plugins.svn.sourceforge.net/svnroot/mp-plugins/trunk/plugins/KeyboardInputPlugin/MPE/KeyboardInputPlugin.mpe1" target="_blank">https://mp-plugins.svn.sourceforge.net/svnroot/mp-plugins/trunk/plugins/KeyboardInputPlugin/MPE/KeyboardInputPlugin.mpe1</a>. If you've previously installed the KeyboardInputPlugin MPE package, you may need to uninstall it and clear the MPE installation cache. </p><p></p><p>You can also download the full package containing sources and release as a GNU tarball from <a href="http://mp-plugins.svn.sourceforge.net/viewvc/mp-plugins/trunk/plugins/KeyboardInputPlugin/?view=tar" target="_blank">http://mp-plugins.svn.sourceforge.net/viewvc/mp-plugins/trunk/plugins/KeyboardInputPlugin/?view=tar</a> for manual installation. Please note that the HISTORY.HTML and README.HTML files may not be completely up to date yet.</p><p></p><p>Changes in this version are as follows:</p><ul> <li data-xf-list-type="ul">Extensive code clean-up.</li> <li data-xf-list-type="ul">Simplified key processing.</li> <li data-xf-list-type="ul">Win-keys can be used as modifiers again.</li> <li data-xf-list-type="ul">Looks like the plug-in can intercept almost all keystrokes, at least in the test program; from simple keystrokes like 'A' to key combinations like Ctrl-Alt-Shift-Win-A. Within MediaPortal it looks like you can even override system keys like Win+E.</li> <li data-xf-list-type="ul">Keys handled by the plug-in will not be passed on to MediaPortal, so no need to remove the MediaPortal keymap.xml file.</li> <li data-xf-list-type="ul">Keys not handled by the plug-in will be passed on to MediaPortal, other plug-ins and/or Windows. So Keyboard.xml and keymap.xml supplement each other, and keys like Win+E will have their usual behavior even when the plug-in is active (unless the key combination has been redefined in KeyboardInputPlugin).</li> </ul><p></p><p>By looking at the code (don't have my MediaPortal installation at hand right now) I think we still need to look at the following:</p><ul> <li data-xf-list-type="ul"><span style="color: Gray">I think the plug-in will intercept keystrokes even when MediaPortal is running in the background; if possible we should probably check if MP has focus (for example in KeyboardInputPluginMain.KeyboardHandler_IsActiveIndicator method). </span><span style="color: Green">This is already handled by KeyboardInputPluginMain.form_Activated/form_Deactivate.</span></li> <li data-xf-list-type="ul">It looks like other keyboard hooks will not be invoked if a key combination is handled by the plug-in; I'm not sure whether we should want this or not. Changing this would require copying MP's Hook.cs into our project and modifying the InternalHookDelegate method to always invoke CallNextHookEx (and at the end return 1 if e.Handled==true, otherwise return result of CallNextHookEx).</li> <li data-xf-list-type="ul"><span style="color: Gray">We simply ignore (pass through) modifier key presses, and only check for currently pressed modifier keys whenever any other key is pressed. In theory this could cause an application to see for example just an Alt keypress if the user presses Alt+X (if Alt+X is handled by the plug-in), which could cause strange behavior. I haven't seen any strange behavior during testing, but we should double check this.</span> <span style="color: Green">Double checked, seems to work correctly</span></li> <li data-xf-list-type="ul"><span style="color: Gray">We still need to fix the keyboard hook de-activation problem on Windows 7. Some possible solutions:</span><br /> <ul style="margin-left: 20px"> <li data-xf-list-type="ul"><span style="color: Gray">Fix using registry hack:</span> <span style="color: Green">Not needed; fixed at code level</span><br /> <ul style="margin-left: 20px"> <li data-xf-list-type="ul"><span style="color: Silver">Automatic installation of registry hack during MPE install. This poses a problem; the registry entry is under HKCU, but the installer is run as Administrator I think. So we would need to find out the user that is used to run MediaPortal and update the registry key under HKU\<user></span>.</li> <li data-xf-list-type="ul"><span style="color: Silver">Manual installation of registry hack by installing a .reg-file that users can manually run (as the MediaPortal user).</span></li> <li data-xf-list-type="ul"><span style="color: Silver">Detection and auto-install of the registry hack from the plug-in. However, the registry hack requires a restart.</span></li> </ul> </li> <li data-xf-list-type="ul">Fix at code level:<br /> <ul style="margin-left: 20px"> <li data-xf-list-type="ul"><span style="color: Gray">Maybe running the keyboard hook in a separate high-priority thread can help solve the problem; we're currently probably running as part of the MP UI thread, and due to that may have to wait until MP has processed a message before the keyboard hook can be invoked by Windows.</span> <span style="color: Green">Probably fix below is enough; if not we could still implement this in addition.</span></li> <li data-xf-list-type="ul"><span style="color: Gray">Automatically detect when the keyboard hook becomes inactive and re-enable it. For example, set lastHookKeyDownTime to the current time on hook invocation, and implement IPluginReceiver.WndProc, setting lastWndProcKeyDownTime to the current time on WM_KEYDOWN/WM_SYSKEYDOWN messages. Compare these times, and if necessary (lastHookKeyDownTime<lastWndProcKeyDownTime, before updating lastWndProcKeyDownTime to current time) restart the keyboard hook. WndProc may not see all key presses that are usually handled by the plug-in (and has some other problems that prevent us from using it instead of a keyboard hook) so the plug-in may skip a few key presses, but at least you won't have to restart MediaPortal. </span><span style="color: Green">Implemented in new version (to be released in a few days)</span></li> </ul> </li> </ul> </li> </ul><p></p><p>Please test this version on your system and give us your feedback on how it works. Have fun!</p></blockquote><p></p>
[QUOTE="rsenden, post: 644125, member: 24295"] I've released a new beta version of KeyboardInputPlugin 2.4.0.0. The MediaPortal Extension Installer version can be downloaded at [URL="https://mp-plugins.svn.sourceforge.net/svnroot/mp-plugins/trunk/plugins/KeyboardInputPlugin/MPE/KeyboardInputPlugin.mpe1"]https://mp-plugins.svn.sourceforge.net/svnroot/mp-plugins/trunk/plugins/KeyboardInputPlugin/MPE/KeyboardInputPlugin.mpe1[/URL]. If you've previously installed the KeyboardInputPlugin MPE package, you may need to uninstall it and clear the MPE installation cache. You can also download the full package containing sources and release as a GNU tarball from [URL="http://mp-plugins.svn.sourceforge.net/viewvc/mp-plugins/trunk/plugins/KeyboardInputPlugin/?view=tar"]http://mp-plugins.svn.sourceforge.net/viewvc/mp-plugins/trunk/plugins/KeyboardInputPlugin/?view=tar[/URL] for manual installation. Please note that the HISTORY.HTML and README.HTML files may not be completely up to date yet. Changes in this version are as follows: [LIST] [*]Extensive code clean-up. [*]Simplified key processing. [*]Win-keys can be used as modifiers again. [*]Looks like the plug-in can intercept almost all keystrokes, at least in the test program; from simple keystrokes like 'A' to key combinations like Ctrl-Alt-Shift-Win-A. Within MediaPortal it looks like you can even override system keys like Win+E. [*]Keys handled by the plug-in will not be passed on to MediaPortal, so no need to remove the MediaPortal keymap.xml file. [*]Keys not handled by the plug-in will be passed on to MediaPortal, other plug-ins and/or Windows. So Keyboard.xml and keymap.xml supplement each other, and keys like Win+E will have their usual behavior even when the plug-in is active (unless the key combination has been redefined in KeyboardInputPlugin). [/LIST] By looking at the code (don't have my MediaPortal installation at hand right now) I think we still need to look at the following: [LIST] [*][COLOR="Gray"]I think the plug-in will intercept keystrokes even when MediaPortal is running in the background; if possible we should probably check if MP has focus (for example in KeyboardInputPluginMain.KeyboardHandler_IsActiveIndicator method). [/COLOR][COLOR="Green"]This is already handled by KeyboardInputPluginMain.form_Activated/form_Deactivate.[/COLOR] [*]It looks like other keyboard hooks will not be invoked if a key combination is handled by the plug-in; I'm not sure whether we should want this or not. Changing this would require copying MP's Hook.cs into our project and modifying the InternalHookDelegate method to always invoke CallNextHookEx (and at the end return 1 if e.Handled==true, otherwise return result of CallNextHookEx). [*][COLOR="Gray"]We simply ignore (pass through) modifier key presses, and only check for currently pressed modifier keys whenever any other key is pressed. In theory this could cause an application to see for example just an Alt keypress if the user presses Alt+X (if Alt+X is handled by the plug-in), which could cause strange behavior. I haven't seen any strange behavior during testing, but we should double check this.[/COLOR] [COLOR="Green"]Double checked, seems to work correctly[/COLOR] [*][COLOR="Gray"]We still need to fix the keyboard hook de-activation problem on Windows 7. Some possible solutions:[/COLOR] [INDENT][LIST] [*][COLOR="Gray"]Fix using registry hack:[/COLOR] [COLOR="Green"]Not needed; fixed at code level[/COLOR] [INDENT][LIST] [*][COLOR="Silver"]Automatic installation of registry hack during MPE install. This poses a problem; the registry entry is under HKCU, but the installer is run as Administrator I think. So we would need to find out the user that is used to run MediaPortal and update the registry key under HKU\<user>[/COLOR]. [*][COLOR="Silver"]Manual installation of registry hack by installing a .reg-file that users can manually run (as the MediaPortal user).[/COLOR] [*][COLOR="Silver"]Detection and auto-install of the registry hack from the plug-in. However, the registry hack requires a restart.[/COLOR] [/LIST][/INDENT] [*]Fix at code level: [INDENT][LIST] [*][COLOR="Gray"]Maybe running the keyboard hook in a separate high-priority thread can help solve the problem; we're currently probably running as part of the MP UI thread, and due to that may have to wait until MP has processed a message before the keyboard hook can be invoked by Windows.[/COLOR] [COLOR="Green"]Probably fix below is enough; if not we could still implement this in addition.[/COLOR] [*][COLOR="Gray"]Automatically detect when the keyboard hook becomes inactive and re-enable it. For example, set lastHookKeyDownTime to the current time on hook invocation, and implement IPluginReceiver.WndProc, setting lastWndProcKeyDownTime to the current time on WM_KEYDOWN/WM_SYSKEYDOWN messages. Compare these times, and if necessary (lastHookKeyDownTime<lastWndProcKeyDownTime, before updating lastWndProcKeyDownTime to current time) restart the keyboard hook. WndProc may not see all key presses that are usually handled by the plug-in (and has some other problems that prevent us from using it instead of a keyboard hook) so the plug-in may skip a few key presses, but at least you won't have to restart MediaPortal. [/COLOR][COLOR="Green"]Implemented in new version (to be released in a few days)[/COLOR] [/LIST][/INDENT] [/LIST][/INDENT] [/LIST] Please test this version on your system and give us your feedback on how it works. Have fun! [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
MediaPortal 1 Plugins
Generic Keyboard/Remote Input Plugin
Contact us
RSS
Top
Bottom