mirror of https://github.com/quasar/Quasar.git
Key Handling Improvements
This commit is contained in:
parent
439777ca43
commit
e19b39ea3a
|
@ -1,6 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using System.Collections.Generic;
|
||||||
using xServer.Core.Helper;
|
using xServer.Core.Helper;
|
||||||
using xServer.Core.Networking;
|
using xServer.Core.Networking;
|
||||||
using xServer.Core.Utilities;
|
using xServer.Core.Utilities;
|
||||||
|
@ -9,7 +10,7 @@ using xServer.Enums;
|
||||||
|
|
||||||
namespace xServer.Forms
|
namespace xServer.Forms
|
||||||
{
|
{
|
||||||
//TODO: Register Hotkeys for WIN - and ALT-key combinations
|
//TODO: Fix Alt + Tab
|
||||||
public partial class FrmRemoteDesktop : Form
|
public partial class FrmRemoteDesktop : Form
|
||||||
{
|
{
|
||||||
public bool IsStarted { get; private set; }
|
public bool IsStarted { get; private set; }
|
||||||
|
@ -17,6 +18,7 @@ namespace xServer.Forms
|
||||||
private bool _enableMouseInput;
|
private bool _enableMouseInput;
|
||||||
private bool _enableKeyboardInput;
|
private bool _enableKeyboardInput;
|
||||||
private IKeyboardMouseEvents _mEvents;
|
private IKeyboardMouseEvents _mEvents;
|
||||||
|
private List<Keys> _keysPressed;
|
||||||
|
|
||||||
public FrmRemoteDesktop(Client c)
|
public FrmRemoteDesktop(Client c)
|
||||||
{
|
{
|
||||||
|
@ -38,6 +40,7 @@ namespace xServer.Forms
|
||||||
btnShow.Left = (this.Width / 2) - (btnShow.Width / 2);
|
btnShow.Left = (this.Width / 2) - (btnShow.Width / 2);
|
||||||
|
|
||||||
_enableKeyboardInput = false;
|
_enableKeyboardInput = false;
|
||||||
|
_keysPressed = new List<Keys>();
|
||||||
|
|
||||||
if (_connectClient.Value != null)
|
if (_connectClient.Value != null)
|
||||||
new Core.Packets.ServerPackets.GetMonitors().Execute(_connectClient);
|
new Core.Packets.ServerPackets.GetMonitors().Execute(_connectClient);
|
||||||
|
@ -303,6 +306,13 @@ namespace xServer.Forms
|
||||||
{
|
{
|
||||||
if (picDesktop.Image != null && _enableKeyboardInput && IsStarted && this.ContainsFocus)
|
if (picDesktop.Image != null && _enableKeyboardInput && IsStarted && this.ContainsFocus)
|
||||||
{
|
{
|
||||||
|
e.Handled = true;
|
||||||
|
|
||||||
|
if (_keysPressed.Contains(e.KeyCode))
|
||||||
|
return;
|
||||||
|
|
||||||
|
_keysPressed.Add(e.KeyCode);
|
||||||
|
|
||||||
if (_connectClient != null)
|
if (_connectClient != null)
|
||||||
new Core.Packets.ServerPackets.DoKeyboardEvent((byte)e.KeyCode, true).Execute(_connectClient);
|
new Core.Packets.ServerPackets.DoKeyboardEvent((byte)e.KeyCode, true).Execute(_connectClient);
|
||||||
}
|
}
|
||||||
|
@ -312,6 +322,10 @@ namespace xServer.Forms
|
||||||
{
|
{
|
||||||
if (picDesktop.Image != null && _enableKeyboardInput && IsStarted && this.ContainsFocus)
|
if (picDesktop.Image != null && _enableKeyboardInput && IsStarted && this.ContainsFocus)
|
||||||
{
|
{
|
||||||
|
e.Handled = true;
|
||||||
|
|
||||||
|
_keysPressed.Remove(e.KeyCode);
|
||||||
|
|
||||||
if (_connectClient != null)
|
if (_connectClient != null)
|
||||||
new Core.Packets.ServerPackets.DoKeyboardEvent((byte)e.KeyCode, false).Execute(_connectClient);
|
new Core.Packets.ServerPackets.DoKeyboardEvent((byte)e.KeyCode, false).Execute(_connectClient);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue