Generic Keyboard/Remote Input Plugin (2 Viewers)

rsenden

Portal Pro
August 22, 2006
88
108
Rotterdam, NL
Home Country
Netherlands Netherlands
I'm sorry, I uninstalled MediaPortal from "the other" PC. I'll give it a try later.

Now, here we go with my main PC.

I've just tried your the second dll you've attached, and put MediaPortal y Debug mode. Here you have my View attachment 92740 file, but I have to tell you that even if it's less agressive than first dll, the second one still does "nothing" when I push Enter. The actions I do are similar than before, I mean, I go to Videos, Películas, choose one movie, and push enter button until at 5th or 7th time it runs. Then I push Fullscreen button and MediaPortal gets windowed again.

I miss Windows XP hahahah

One main difference between the two DLL versions is that the original version passed keys through to MediaPortal if a mapping was defined for that key, but none of the mapping conditions were met. The new version simply doesn't pass through any keys that have been defined in the mapping, regardless of whether any mapping conditions are met or not.

According to your log, the Enter key is defined in the KeyboardInputPlugin mapping, so with the second DLL this key is never passed through to MediaPortal. I guess this key was passed on to MP in the original plug-in because none of the conditions in this mapping were met.

I could re-introduce the original behavior, but that means (a little bit) more processing code inside the hook, so a (slightly) higher chance that the hook times out. As an alternative, you can add a 'No Condition' -> 'Select Item' action to the Enter key mapping in KeyboardInputPlugin.

I would like to know the opinion of other users on this matter; should the plug-in pass through any keys for which none of the conditions are met, or should the plug-in simply intercept all keys defined in the mapping, irregardless of conditions?
 

enanno

Portal Member
April 6, 2011
29
5
Home Country
Spain Spain
I'm sorry, I uninstalled MediaPortal from "the other" PC. I'll give it a try later.

Now, here we go with my main PC.

I've just tried your the second dll you've attached, and put MediaPortal y Debug mode. Here you have my View attachment 92740 file, but I have to tell you that even if it's less agressive than first dll, the second one still does "nothing" when I push Enter. The actions I do are similar than before, I mean, I go to Videos, Películas, choose one movie, and push enter button until at 5th or 7th time it runs. Then I push Fullscreen button and MediaPortal gets windowed again.

I miss Windows XP hahahah

One main difference between the two DLL versions is that the original version passed keys through to MediaPortal if a mapping was defined for that key, but none of the mapping conditions were met. The new version simply doesn't pass through any keys that have been defined in the mapping, regardless of whether any mapping conditions are met or not.

According to your log, the Enter key is defined in the KeyboardInputPlugin mapping, so with the second DLL this key is never passed through to MediaPortal. I guess this key was passed on to MP in the original plug-in because none of the conditions in this mapping were met.

I could re-introduce the original behavior, but that means (a little bit) more processing code inside the hook, so a (slightly) higher chance that the hook times out. As an alternative, you can add a 'No Condition' -> 'Select Item' action to the Enter key mapping in KeyboardInputPlugin.

I would like to know the opinion of other users on this matter; should the plug-in pass through any keys for which none of the conditions are met, or should the plug-in simply intercept all keys defined in the mapping, irregardless of conditions?

Thank you re-again. I have done what you've said, added a 'No Condition' to my Enter key, and used your second test-DLL, and now the button works perfectly hehe

However... the "bug" is still there... In this View attachment 92744 file I now attach. I push 5 times the Fullscreen button on my remote, being the fifth time when the thing fails. Hope it helps you.
 

rsenden

Portal Pro
August 22, 2006
88
108
Rotterdam, NL
Home Country
Netherlands Netherlands
However... the "bug" is still there... In this View attachment 92744 file I now attach. I push 5 times the Fullscreen button on my remote, being the fifth time when the thing fails. Hope it helps you.

I didn't expect the bug to disappear completely. The question is however, do you think the bug occurs less frequent now?

With the new DLL the keyboard hook has been optimized to use as little time as possible. The main change is that the mapped action is performed asynchronously, outside of the hook.

The hook is still running in the context of the main MediaPortal UI thread however. So, if MP is busy doing something on the main UI thread when you press a key, the main thread first has to finish what it's doing before the hook can be invoked. If the hook cannot be invoked in time, it will still be disabled.

As discussed before, I can try to run the hook on another thread with its own message loop. However, I'm not sure whether I will be able to block key events being sent to the main MP UI thread in that case. If I cannot block the key events, each key press will be handled by both the plug-in and MP.
 

enanno

Portal Member
April 6, 2011
29
5
Home Country
Spain Spain
I didn't expect the bug to disappear completely. The question is however, do you think the bug occurs less frequent now?

With the new DLL the keyboard hook has been optimized to use as little time as possible. The main change is that the mapped action is performed asynchronously, outside of the hook.

The hook is still running in the context of the main MediaPortal UI thread however. So, if MP is busy doing something on the main UI thread when you press a key, the main thread first has to finish what it's doing before the hook can be invoked. If the hook cannot be invoked in time, it will still be disabled.

As discussed before, I can try to run the hook on another thread with its own message loop. However, I'm not sure whether I will be able to block key events being sent to the main MP UI thread in that case. If I cannot block the key events, each key press will be handled by both the plug-in and MP.

Of course, man. It works better now, and I thank you.
You have all my support with this wonderful plugin. Without it, MediaPortal would be incomplete at all. I think it should be integrated in it!
 

rsenden

Portal Pro
August 22, 2006
88
108
Rotterdam, NL
Home Country
Netherlands Netherlands
I didn't expect the bug to disappear completely. The question is however, do you think the bug occurs less frequent now?
Of course, man. It works better now, and I thank you.

I have created yet another version of the DLL. Together with the earlier changes, the keyboard hook now runs in its own thread. As such, if MediaPortal is busy doing something on the main UI thread, the hook will still be called in time. Of course, if your system is under a really high load and/or paging a lot, a time-out may still occur.

<Edit: text removed>

Can you please test this DLL and let me know the result? Logs are now less useful for me, as I can't see whether a time-out has occurred (due to disabled recovery mechanism). Just do the same tests as before and check whether you can still get Alt+Enter to trigger full-screen/windowed mode instead of aspect ratio.

Edit: Updated DLL; please re-download if you downloaded the attached DLL before 2011-11-19 8:40. The new DLL executes the MapAction method on the main MP UI thread by using GUIGraphicsContext.form.Invoke().

Edit: Updated DLL; please re-download if you downloaded the attached DLL before 2011-11-21 16:00. The new DLL should have all possible threading issues fixed, code has been cleaned up, etc. The handler time-out recovery mechanism is still disabled as I think it is not needed anymore now that the keyboard hook is running in its own thread.

Edit: Added beta-version of MPE Installer package containing the above DLL for easy installation.

Request to everyone using this plugin; if you have the time please test the beta version of the MPE Installer package and let me know whether it works correctly for you. If results are positive I will release a new stable version of the plugin.

Edit: Removed attachments; the updated DLL is now released as a regular MPE installation package; see first post.
 

enanno

Portal Member
April 6, 2011
29
5
Home Country
Spain Spain
I didn't expect the bug to disappear completely. The question is however, do you think the bug occurs less frequent now?
Of course, man. It works better now, and I thank you.

I have created yet another version of the DLL. Together with the earlier changes, the keyboard hook now runs in its own thread. As such, if MediaPortal is busy doing something on the main UI thread, the hook will still be called in time. Of course, if your system is under a really high load and/or paging a lot, a time-out may still occur.

<Edit: text removed>

Can you please test this DLL and let me know the result? Logs are now less useful for me, as I can't see whether a time-out has occurred (due to disabled recovery mechanism). Just do the same tests as before and check whether you can still get Alt+Enter to trigger full-screen/windowed mode instead of aspect ratio.

Edit: Updated DLL; please re-download if you downloaded the attached DLL before 2011-11-19 8:40. The new DLL executes the MapAction method on the main MP UI thread by using GUIGraphicsContext.form.Invoke().

Edit: Updated DLL; please re-download if you downloaded the attached DLL before 2011-11-21 16:00. The new DLL should have all possible threading issues fixed, code has been cleaned up, etc. The handler time-out recovery mechanism is still disabled as I think it is not needed anymore now that the keyboard hook is running in its own thread.

Request to everyone using this plugin; if you have the time please test this DLL and let me know whether it works correctly for you. If results are positive I will incorporate the changes in a new MPE-installable version of the plug-in.

WOOOOOW!!!! YOU GOT IT!
Your beautiful plugin is now PERFECT.


I can confirm it, I push near 200 times my "Fullscreen" button and MediaPortal doesn't get windowed:D
And now I also can perfectly zap between my tv channels without getting some random "Group Change" (it was another issue in my system because of RePag/AdPag buttons), and can see all the times the Reboot/Shutdown/Hybernate dialog with my "Close" button, which has Alt+F4 mapped and which sometimes closed MediaPortal without letting me choose what I wanted to do.

Thank you very much for all, and I hope you release it as an official version soon.
Greetings.
 

enanno

Portal Member
April 6, 2011
29
5
Home Country
Spain Spain
Congratulations for the brand new version, man ;)

By the way, I have a little issue with my own remote, and I'd like to know if somebody can guess how to solve it. Unfortunately, my "Back" button in the remote is "Backspace", so when I take my keyboard to write some text in a text box in MediaPortal, if I have a mistake and want to delete by pushing the "Backspace" key in the keyboard, the text box is closed.

I've thought to assign the "Back" function to another button in my remote, but... I really like this key for it.
I suppose it has something to do with telling the plugin I am on a text box... but I don't know how. An ideal situation would be that if I push "Backspace" key while there are letters in the text box, they can be deleted, but if there is no letters, then the text box can be closed.

Any idea?
:D
 

Users who are viewing this thread

Top Bottom