Banshee.NowPlaying.FullscreenWindow.OnKeyPressEvent C# (CSharp) Method

OnKeyPressEvent() protected method

protected OnKeyPressEvent ( Gdk evnt ) : bool
evnt Gdk
return bool
        protected override bool OnKeyPressEvent (Gdk.EventKey evnt)
        {
            PlayerEngineService player = ServiceManager.PlayerEngine;

            bool control = (evnt.State & Gdk.ModifierType.ShiftMask) != 0;
            bool shift = (evnt.State & Gdk.ModifierType.ControlMask) != 0;
            bool mod = control || shift;

            uint fixed_seek = 15000; // 15 seconds
            uint fast_seek = player.Length > 0 ? (uint)(player.Length * 0.15) : fixed_seek; // 15% or fixed
            uint slow_seek = player.Length > 0 ? (uint)(player.Length * 0.05) : fixed_seek; // 5% or fixed

            switch (evnt.Key) {
                case Gdk.Key.F11:
                case Gdk.Key.Escape:
                    Hide ();
                    return true;
                case Gdk.Key.C:
                case Gdk.Key.c:
                case Gdk.Key.V:
                case Gdk.Key.v:
                case Gdk.Key.Return:
                case Gdk.Key.KP_Enter:
                case Gdk.Key.Tab:
                    if (controls == null || !controls.Visible) {
                        ShowControls ();
                    } else {
                        HideControls ();
                    }
                    return true;
                case Gdk.Key.Right:
                case Gdk.Key.rightarrow:
                    player.Position += mod ? fast_seek : slow_seek;
                    ShowControls ();
                    break;
                case Gdk.Key.Left:
                case Gdk.Key.leftarrow:
                    player.Position -= mod ? fast_seek : slow_seek;
                    ShowControls ();
                    break;
            }

            return base.OnKeyPressEvent (evnt);
        }