ShokoAnime / MyAnime3

Repository for My Anime 3, a MediaPortal plugin.
http://shokoanime.com/mediaportal/
15 stars 10 forks source link

Allow turning off of keyboard hook when entering Anime3_Main (MA3) as an option #11

Closed jmediamanager closed 8 years ago

jmediamanager commented 10 years ago

Reported by windfury000@yahoo.com, Oct 15, 2012

It could be considered a bug since the keyboard hook of MA3 sometimes crashes MediaPortal.

I'm asking it as a feature for now, since I'm using MediaPortal in a dual monitor setup, which is why I take my focus off MediaPortal.

So, the thing is, I'm not using my keyboard when using My Anime 3. However, it steals my keyboard inputs everytime I enter Anime3_Main, It doesn't allow me to get my keyboard back unless I refocus on MediaPortal first.

What steps will reproduce the problem?

  1. Open Notepad (for testing/typing purposes)
  2. Run MediaPortal
  3. Take your focus off MediaPortal, put it somewhere else.
  4. Use a remote to enter Anime3_Main (without focus on MediaPortal), stay there on the first screen while not having focus on MediaPortal.
  5. Try typing somewhere, in this case your Notepad.

Your keyboard will then be hooked to the search function. You can't get it back unless you refocus on MediaPortal first. Sometimes, it also crashes.

error.log

2012-10-16 08:30:20.383372 [ERROR][MPMain(1)]: OnMessage exception:System.NullReferenceException: Object reference not set to an instance of an object.
   at MyAnimePlugin3.MainWindow.OnPageDestroy(Int32 new_windowId) in C:\Projects\SVN\JMM\trunk\animeplugin3\MyAnimePlugin3\Windows\MainWindow.cs:line 557
   at MediaPortal.GUI.Library.GUIWindow.OnMessage(GUIMessage message)

So far, the only way I am able to get by this is to keep the focus on MediaPortal until after I pick a collection group (after the first screen).

Oct 15, 2012 windfury000@yahoo.com

Ohh, or maybe you could just make it so that the keyboard only hooks if the window (MediaPortal) is focused.

Oct 19, 2012 windfury000@yahoo.com

It seems that I was mistaken, I thought that after getting pass Anime3_Main, the keyboard will no longer be hooked by MA3 but then I found out that whenever I finish watching an episode (using an external player: MPC-HC for viewing), after the player exits and goes back to the episode listings, my keyboard is again hooked into MA3.

So I guess having an option to completely turn it off or again only when MediaPortal is focused is the solution here.

RickDB commented 9 years ago

Don't know if this one still applies but what might solve this is to enable the keyboard hook when the video list / facadaview view (Listcontrol) is focused or maybe additional Mediaportal elements in this one, when the hook keyup/down is called it will check and if it's not in focus it will do e.Handled = false; and let it pass thru. Example:

[SkinControlAttribute(50)] protected GUIFacadeControl videoList = null; ... void hook_KeyUp(object sender, KeyEventArgsEx e) { if (videoList.Focus == true && videoList.SelectedListItemIndex >= 0) { e.Handled = true; } else { e.Handled = false; } }

jmediamanager commented 9 years ago

Thanks, will take a look

RickDB commented 8 years ago

Fixed in current master branch as it uses a different method of reading out the keys (native Mediaportal event) which no longer locks out other keyboard input.

ElementalCrisis commented 8 years ago

Fixed in 3.6.0.10.