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 2
Plugin Development
Inputdevice Manager for MP2
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="osre" data-source="post: 1179125" data-attributes="member: 150866"><p>Found the reason why LMenu and Enter keys were not visible to the InputmanagerPlugin.</p><p>As soon as LWin is down, LMenu (Alt) and Enter do not raise the KEY_DOWN, but the SYSTEMKEY_DOWN message (I think this is always true for Alt)</p><p>Since this message was ignored it did not work.</p><p>Fixed this as well now.</p><p></p><p>[USER=48495]@morpheus_xx[/USER] :</p><p>I made a hack in InputMapper class to prevent window switching when HAMA Start button is pressed:</p><p>Since I'm working on FreekyJ's fork, and it is a bit hakky, I would not push it without confirmation:</p><p>[code=csharp]public static class InputMapper</p><p> {</p><p> public static Key MapSpecialKey(KeyEventArgs args)</p><p> {</p><p> return MapSpecialKey(args.KeyCode, args.Alt, args.Shift, args.Control);</p><p> }</p><p></p><p> private static class Keyboard</p><p> {</p><p> [Flags]</p><p> private enum KeyStates</p><p> {</p><p> None = 0,</p><p> Down = 1,</p><p> Toggled = 2</p><p> }</p><p></p><p> [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]</p><p> private static extern short GetKeyState(int keyCode);</p><p></p><p> private static KeyStates GetKeyState(Keys key)</p><p> {</p><p> KeyStates state = KeyStates.None;</p><p></p><p> short retVal = GetKeyState((int)key);</p><p></p><p> //If the high-order bit is 1, the key is down</p><p> //otherwise, it is up.</p><p> if ((retVal & 0x8000) == 0x8000)</p><p> state |= KeyStates.Down;</p><p></p><p> //If the low-order bit is 1, the key is toggled.</p><p> if ((retVal & 1) == 1)</p><p> state |= KeyStates.Toggled;</p><p></p><p> return state;</p><p> }</p><p></p><p> public static bool IsKeyDown(Keys key)</p><p> {</p><p> return KeyStates.Down == (GetKeyState(key) & KeyStates.Down);</p><p> }</p><p></p><p> public static bool IsKeyToggled(Keys key)</p><p> {</p><p> return KeyStates.Toggled == (GetKeyState(key) & KeyStates.Toggled);</p><p> }</p><p> }</p><p></p><p> public static Key MapSpecialKey(Keys keycode, bool alt, bool shift, bool control)</p><p> {</p><p> switch (keycode)</p><p> {</p><p> case Keys.Add:</p><p> if (alt)</p><p> return Key.VolumeUp;</p><p> break;</p><p> case Keys.Subtract:</p><p> if (alt)</p><p> return Key.VolumeDown;</p><p> break;</p><p> case Keys.Cancel:</p><p> return Key.Escape;</p><p> case Keys.Clear:</p><p> return Key.Clear;</p><p> case Keys.Delete:</p><p> return Key.Delete;</p><p> case Keys.Insert:</p><p> return Key.Insert;</p><p> case Keys.Enter:</p><p> if (!Keyboard.IsKeyDown(Keys.LWin))</p><p> {</p><p> if (alt)</p><p> return Key.Fullscreen;</p><p> return Key.Ok;</p><p> }</p><p> break;</p><p> case Keys.Back:</p><p> return Key.BackSpace;</p><p> case Keys.Escape:</p><p> return Key.Escape;</p><p></p><p> case Keys.MediaNextTrack:</p><p> return Key.Next;</p><p> case Keys.MediaPlayPause:</p><p> return Key.PlayPause;</p><p> case Keys.MediaPreviousTrack:</p><p> return Key.Previous;</p><p> case Keys.MediaStop:</p><p> return Key.Stop;</p><p> case Keys.Pause:</p><p> return Key.Pause;</p><p> case Keys.Play:</p><p> return Key.Play;</p><p></p><p> case Keys.VolumeMute:</p><p> return Key.Mute;</p><p> case Keys.VolumeDown:</p><p> return Key.VolumeDown;</p><p> case Keys.VolumeUp:</p><p> return Key.VolumeUp;</p><p></p><p> case Keys.Up:</p><p> return Key.Up;</p><p> case Keys.Down:</p><p> return Key.Down;</p><p> case Keys.Left:</p><p> return Key.Left;</p><p> case Keys.Right:</p><p> return Key.Right;</p><p></p><p> case Keys.PageUp:</p><p> return Key.PageUp;</p><p> case Keys.PageDown:</p><p> return Key.PageDown;</p><p></p><p> case Keys.Home:</p><p> return Key.Home;</p><p> case Keys.End:</p><p> return Key.End;</p><p></p><p> case Keys.Apps:</p><p> return Key.ContextMenu;</p><p> case Keys.Zoom:</p><p> return Key.ZoomMode;</p><p></p><p> case Keys.Sleep:</p><p> return Key.Power;</p><p></p><p> case Keys.F1:</p><p> return Key.F1;</p><p> case Keys.F2:</p><p> return Key.F2;</p><p> case Keys.F3:</p><p> return Key.F3;</p><p> case Keys.F4:</p><p> if (alt)</p><p> return Key.Close;</p><p> return Key.F4;</p><p> case Keys.F5:</p><p> return Key.F5;</p><p> case Keys.F6:</p><p> return Key.F6;</p><p> case Keys.F7:</p><p> return Key.F7;</p><p> case Keys.F8:</p><p> return Key.F8;</p><p> case Keys.F9:</p><p> return Key.F9;</p><p> case Keys.F10:</p><p> return Key.F10;</p><p> case Keys.F11:</p><p> return Key.F11;</p><p> case Keys.F12:</p><p> return Key.F12;</p><p> case Keys.F13:</p><p> return Key.F13;</p><p> case Keys.F14:</p><p> return Key.F14;</p><p> case Keys.F15:</p><p> return Key.F15;</p><p> case Keys.F16:</p><p> return Key.F16;</p><p> case Keys.F17:</p><p> return Key.F17;</p><p> case Keys.F18:</p><p> return Key.F18;</p><p> case Keys.F19:</p><p> return Key.F19;</p><p> case Keys.F20:</p><p> return Key.F20;</p><p> case Keys.F21:</p><p> return Key.F21;</p><p> case Keys.F22:</p><p> return Key.F22;</p><p> case Keys.F23:</p><p> return Key.F23;</p><p> case Keys.F24:</p><p> return Key.F24;</p><p></p><p> case Keys.X:</p><p> if (control)</p><p> return Key.Cut;</p><p> break;</p><p> case Keys.C:</p><p> if (control)</p><p> return Key.Copy;</p><p> break;</p><p> case Keys.V:</p><p> if (control)</p><p> return Key.Paste;</p><p> break;</p><p> }</p><p> return Key.None;</p><p> }</p><p></p><p> public static Key MapPrintableKeys(char keyChar)</p><p> {</p><p> if (keyChar >= (char)32)</p><p> return new Key(keyChar);</p><p> return Key.None;</p><p> }</p><p> }[/Code]</p><p></p><p>But it is working.</p><p>Actual Change is in line 70 of the Code above.</p></blockquote><p></p>
[QUOTE="osre, post: 1179125, member: 150866"] Found the reason why LMenu and Enter keys were not visible to the InputmanagerPlugin. As soon as LWin is down, LMenu (Alt) and Enter do not raise the KEY_DOWN, but the SYSTEMKEY_DOWN message (I think this is always true for Alt) Since this message was ignored it did not work. Fixed this as well now. [USER=48495]@morpheus_xx[/USER] : I made a hack in InputMapper class to prevent window switching when HAMA Start button is pressed: Since I'm working on FreekyJ's fork, and it is a bit hakky, I would not push it without confirmation: [code=csharp]public static class InputMapper { public static Key MapSpecialKey(KeyEventArgs args) { return MapSpecialKey(args.KeyCode, args.Alt, args.Shift, args.Control); } private static class Keyboard { [Flags] private enum KeyStates { None = 0, Down = 1, Toggled = 2 } [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)] private static extern short GetKeyState(int keyCode); private static KeyStates GetKeyState(Keys key) { KeyStates state = KeyStates.None; short retVal = GetKeyState((int)key); //If the high-order bit is 1, the key is down //otherwise, it is up. if ((retVal & 0x8000) == 0x8000) state |= KeyStates.Down; //If the low-order bit is 1, the key is toggled. if ((retVal & 1) == 1) state |= KeyStates.Toggled; return state; } public static bool IsKeyDown(Keys key) { return KeyStates.Down == (GetKeyState(key) & KeyStates.Down); } public static bool IsKeyToggled(Keys key) { return KeyStates.Toggled == (GetKeyState(key) & KeyStates.Toggled); } } public static Key MapSpecialKey(Keys keycode, bool alt, bool shift, bool control) { switch (keycode) { case Keys.Add: if (alt) return Key.VolumeUp; break; case Keys.Subtract: if (alt) return Key.VolumeDown; break; case Keys.Cancel: return Key.Escape; case Keys.Clear: return Key.Clear; case Keys.Delete: return Key.Delete; case Keys.Insert: return Key.Insert; case Keys.Enter: if (!Keyboard.IsKeyDown(Keys.LWin)) { if (alt) return Key.Fullscreen; return Key.Ok; } break; case Keys.Back: return Key.BackSpace; case Keys.Escape: return Key.Escape; case Keys.MediaNextTrack: return Key.Next; case Keys.MediaPlayPause: return Key.PlayPause; case Keys.MediaPreviousTrack: return Key.Previous; case Keys.MediaStop: return Key.Stop; case Keys.Pause: return Key.Pause; case Keys.Play: return Key.Play; case Keys.VolumeMute: return Key.Mute; case Keys.VolumeDown: return Key.VolumeDown; case Keys.VolumeUp: return Key.VolumeUp; case Keys.Up: return Key.Up; case Keys.Down: return Key.Down; case Keys.Left: return Key.Left; case Keys.Right: return Key.Right; case Keys.PageUp: return Key.PageUp; case Keys.PageDown: return Key.PageDown; case Keys.Home: return Key.Home; case Keys.End: return Key.End; case Keys.Apps: return Key.ContextMenu; case Keys.Zoom: return Key.ZoomMode; case Keys.Sleep: return Key.Power; case Keys.F1: return Key.F1; case Keys.F2: return Key.F2; case Keys.F3: return Key.F3; case Keys.F4: if (alt) return Key.Close; return Key.F4; case Keys.F5: return Key.F5; case Keys.F6: return Key.F6; case Keys.F7: return Key.F7; case Keys.F8: return Key.F8; case Keys.F9: return Key.F9; case Keys.F10: return Key.F10; case Keys.F11: return Key.F11; case Keys.F12: return Key.F12; case Keys.F13: return Key.F13; case Keys.F14: return Key.F14; case Keys.F15: return Key.F15; case Keys.F16: return Key.F16; case Keys.F17: return Key.F17; case Keys.F18: return Key.F18; case Keys.F19: return Key.F19; case Keys.F20: return Key.F20; case Keys.F21: return Key.F21; case Keys.F22: return Key.F22; case Keys.F23: return Key.F23; case Keys.F24: return Key.F24; case Keys.X: if (control) return Key.Cut; break; case Keys.C: if (control) return Key.Copy; break; case Keys.V: if (control) return Key.Paste; break; } return Key.None; } public static Key MapPrintableKeys(char keyChar) { if (keyChar >= (char)32) return new Key(keyChar); return Key.None; } }[/Code] But it is working. Actual Change is in line 70 of the Code above. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 2
Plugin Development
Inputdevice Manager for MP2
Contact us
RSS
Top
Bottom