mirror of
https://github.com/Ylianst/MeshCentralRouter
synced 2025-12-10 05:13:39 +00:00
Added mouse button swap in settings.
This commit is contained in:
@@ -37,6 +37,7 @@ namespace MeshCentralRouter
|
||||
private int compressionlevel = 60; // 60% compression
|
||||
private int scalinglevel = 1024; // 100% scale
|
||||
private int frameRate = 100; // Medium frame rate
|
||||
private bool swamMouseButtons = false;
|
||||
private double scalefactor = 1;
|
||||
public List<string> displays = new List<string>();
|
||||
public ushort currentDisp = 0;
|
||||
@@ -103,6 +104,8 @@ namespace MeshCentralRouter
|
||||
public int CompressionLevel { get { return compressionlevel; } set { compressionlevel = value; SendCompressionLevel(); } }
|
||||
public int ScalingLevel { get { return scalinglevel; } set { scalinglevel = value; SendCompressionLevel(); } }
|
||||
public int FrameRate { get { return frameRate; } set { frameRate = value; SendCompressionLevel(); } }
|
||||
public bool SwamMouseButtons { get { return swamMouseButtons; } set { swamMouseButtons = value; } }
|
||||
|
||||
public double ScaleFactor { get { return scalefactor; } set { scalefactor = value; } }
|
||||
|
||||
public void SetCompressionParams(int level, int scaling, int framerate) { compressionlevel = level; scalinglevel = scaling; frameRate = framerate; SendCompressionLevel(); }
|
||||
@@ -394,10 +397,24 @@ namespace MeshCentralRouter
|
||||
switch (e.Button)
|
||||
{
|
||||
case MouseButtons.Left:
|
||||
if (swamMouseButtons)
|
||||
{
|
||||
buttons |= (byte)KvmMouseButtonCommands.MOUSEEVENTF_RIGHTDOWN;
|
||||
}
|
||||
else
|
||||
{
|
||||
buttons |= (byte)KvmMouseButtonCommands.MOUSEEVENTF_LEFTDOWN;
|
||||
}
|
||||
break;
|
||||
case MouseButtons.Right:
|
||||
if (swamMouseButtons)
|
||||
{
|
||||
buttons |= (byte)KvmMouseButtonCommands.MOUSEEVENTF_LEFTDOWN;
|
||||
}
|
||||
else
|
||||
{
|
||||
buttons |= (byte)KvmMouseButtonCommands.MOUSEEVENTF_RIGHTDOWN;
|
||||
}
|
||||
break;
|
||||
case MouseButtons.Middle:
|
||||
buttons |= (byte)KvmMouseButtonCommands.MOUSEEVENTF_MIDDLEDOWN;
|
||||
@@ -409,10 +426,10 @@ namespace MeshCentralRouter
|
||||
switch (e.Button)
|
||||
{
|
||||
case MouseButtons.Left:
|
||||
buttons |= (byte)KvmMouseButtonCommands.MOUSEEVENTF_LEFTUP;
|
||||
if (swamMouseButtons) { buttons |= (byte)KvmMouseButtonCommands.MOUSEEVENTF_RIGHTUP; } else { buttons |= (byte)KvmMouseButtonCommands.MOUSEEVENTF_LEFTUP; }
|
||||
break;
|
||||
case MouseButtons.Right:
|
||||
buttons |= (byte)KvmMouseButtonCommands.MOUSEEVENTF_RIGHTUP;
|
||||
if (swamMouseButtons) { buttons |= (byte)KvmMouseButtonCommands.MOUSEEVENTF_LEFTUP; } else { buttons |= (byte)KvmMouseButtonCommands.MOUSEEVENTF_RIGHTUP; }
|
||||
break;
|
||||
case MouseButtons.Middle:
|
||||
buttons |= (byte)KvmMouseButtonCommands.MOUSEEVENTF_MIDDLEUP;
|
||||
|
||||
9
KVMSettingsForm.Designer.cs
generated
9
KVMSettingsForm.Designer.cs
generated
@@ -40,6 +40,7 @@
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.swapMouseButtonsCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.groupBox1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
@@ -62,6 +63,7 @@
|
||||
// groupBox1
|
||||
//
|
||||
resources.ApplyResources(this.groupBox1, "groupBox1");
|
||||
this.groupBox1.Controls.Add(this.swapMouseButtonsCheckBox);
|
||||
this.groupBox1.Controls.Add(this.frameRateComboBox);
|
||||
this.groupBox1.Controls.Add(this.label2);
|
||||
this.groupBox1.Controls.Add(this.scalingComboBox);
|
||||
@@ -119,6 +121,12 @@
|
||||
resources.ApplyResources(this.label4, "label4");
|
||||
this.label4.Name = "label4";
|
||||
//
|
||||
// swapMouseButtonsCheckBox
|
||||
//
|
||||
resources.ApplyResources(this.swapMouseButtonsCheckBox, "swapMouseButtonsCheckBox");
|
||||
this.swapMouseButtonsCheckBox.Name = "swapMouseButtonsCheckBox";
|
||||
this.swapMouseButtonsCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// KVMSettingsForm
|
||||
//
|
||||
this.AcceptButton = this.okButton;
|
||||
@@ -155,5 +163,6 @@
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.ComboBox qualityComboBox;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.CheckBox swapMouseButtonsCheckBox;
|
||||
}
|
||||
}
|
||||
@@ -118,6 +118,12 @@ namespace MeshCentralRouter
|
||||
}
|
||||
}
|
||||
|
||||
public bool SwamMouseButtons
|
||||
{
|
||||
get { return swapMouseButtonsCheckBox.Checked; }
|
||||
set { swapMouseButtonsCheckBox.Checked = value; }
|
||||
}
|
||||
|
||||
private void okButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
|
||||
@@ -123,7 +123,7 @@
|
||||
</data>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="cancelButton.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>312, 182</value>
|
||||
<value>312, 207</value>
|
||||
</data>
|
||||
<data name="cancelButton.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>75, 23</value>
|
||||
@@ -151,7 +151,7 @@
|
||||
<value>Bottom, Right</value>
|
||||
</data>
|
||||
<data name="okButton.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>231, 182</value>
|
||||
<value>231, 207</value>
|
||||
</data>
|
||||
<data name="okButton.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>75, 23</value>
|
||||
@@ -177,6 +177,33 @@
|
||||
<data name="groupBox1.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Bottom, Left, Right</value>
|
||||
</data>
|
||||
<data name="swapMouseButtonsCheckBox.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="swapMouseButtonsCheckBox.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>128, 105</value>
|
||||
</data>
|
||||
<data name="swapMouseButtonsCheckBox.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>127, 17</value>
|
||||
</data>
|
||||
<data name="swapMouseButtonsCheckBox.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>10</value>
|
||||
</data>
|
||||
<data name="swapMouseButtonsCheckBox.Text" xml:space="preserve">
|
||||
<value>Swap Mouse Buttons</value>
|
||||
</data>
|
||||
<data name=">>swapMouseButtonsCheckBox.Name" xml:space="preserve">
|
||||
<value>swapMouseButtonsCheckBox</value>
|
||||
</data>
|
||||
<data name=">>swapMouseButtonsCheckBox.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>swapMouseButtonsCheckBox.Parent" xml:space="preserve">
|
||||
<value>groupBox1</value>
|
||||
</data>
|
||||
<data name=">>swapMouseButtonsCheckBox.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="frameRateComboBox.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Left, Right</value>
|
||||
</data>
|
||||
@@ -199,7 +226,7 @@
|
||||
<value>groupBox1</value>
|
||||
</data>
|
||||
<data name=">>frameRateComboBox.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="label2.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
@@ -226,7 +253,7 @@
|
||||
<value>groupBox1</value>
|
||||
</data>
|
||||
<data name=">>label2.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="scalingComboBox.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Left, Right</value>
|
||||
@@ -250,7 +277,7 @@
|
||||
<value>groupBox1</value>
|
||||
</data>
|
||||
<data name=">>scalingComboBox.ZOrder" xml:space="preserve">
|
||||
<value>2</value>
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="label1.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
@@ -277,7 +304,7 @@
|
||||
<value>groupBox1</value>
|
||||
</data>
|
||||
<data name=">>label1.ZOrder" xml:space="preserve">
|
||||
<value>3</value>
|
||||
<value>4</value>
|
||||
</data>
|
||||
<data name="qualityComboBox.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Left, Right</value>
|
||||
@@ -301,7 +328,7 @@
|
||||
<value>groupBox1</value>
|
||||
</data>
|
||||
<data name=">>qualityComboBox.ZOrder" xml:space="preserve">
|
||||
<value>4</value>
|
||||
<value>5</value>
|
||||
</data>
|
||||
<data name="label3.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
@@ -328,19 +355,19 @@
|
||||
<value>groupBox1</value>
|
||||
</data>
|
||||
<data name=">>label3.ZOrder" xml:space="preserve">
|
||||
<value>5</value>
|
||||
<value>6</value>
|
||||
</data>
|
||||
<data name="groupBox1.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>12, 68</value>
|
||||
</data>
|
||||
<data name="groupBox1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>375, 108</value>
|
||||
<value>375, 133</value>
|
||||
</data>
|
||||
<data name="groupBox1.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="groupBox1.Text" xml:space="preserve">
|
||||
<value>Compression Settings</value>
|
||||
<value>Settings</value>
|
||||
</data>
|
||||
<data name=">>groupBox1.Name" xml:space="preserve">
|
||||
<value>groupBox1</value>
|
||||
@@ -412,7 +439,7 @@
|
||||
<value>6, 13</value>
|
||||
</data>
|
||||
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
|
||||
<value>399, 217</value>
|
||||
<value>399, 242</value>
|
||||
</data>
|
||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
|
||||
@@ -315,9 +315,11 @@ namespace MeshCentralRouter
|
||||
form.Compression = kvmControl.CompressionLevel;
|
||||
form.Scaling = kvmControl.ScalingLevel;
|
||||
form.FrameRate = kvmControl.FrameRate;
|
||||
form.SwamMouseButtons = kvmControl.SwamMouseButtons;
|
||||
if (form.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
|
||||
{
|
||||
kvmControl.SetCompressionParams(form.Compression, form.Scaling, form.FrameRate);
|
||||
kvmControl.SwamMouseButtons = form.SwamMouseButtons;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user