MouseWithoutBordersProperties.cs
1 // Copyright (c) Microsoft Corporation 2 // The Microsoft Corporation licenses this file to you under the MIT license. 3 // See the LICENSE file in the project root for more information. 4 5 using System; 6 using System.Collections.Generic; 7 using System.Linq; 8 using System.Text.Json.Serialization; 9 10 using Settings.UI.Library.Attributes; 11 12 namespace Microsoft.PowerToys.Settings.UI.Library 13 { 14 #pragma warning disable SA1649 // File name should match first type name 15 public struct ConnectionRequest 16 #pragma warning restore SA1649 // File name should match first type name 17 { 18 public string PCName { get; set; } 19 20 public string SecurityKey { get; set; } 21 } 22 23 public struct NewKeyGenerationRequest 24 { 25 } 26 27 public class MouseWithoutBordersProperties : ICloneable 28 { 29 [CmdConfigureIgnore] 30 public static HotkeySettings DefaultHotKeySwitch2AllPC => new HotkeySettings(); 31 32 [CmdConfigureIgnore] 33 public static HotkeySettings DefaultHotKeyLockMachine => new HotkeySettings(true, true, true, false, 0x4C); 34 35 [CmdConfigureIgnore] 36 public static HotkeySettings DefaultHotKeyReconnect => new HotkeySettings(true, true, true, false, 0x52); 37 38 [CmdConfigureIgnore] 39 public static HotkeySettings DefaultHotKeyToggleEasyMouse => new HotkeySettings(true, true, true, false, 0x45); 40 41 [CmdConfigureIgnore] 42 public StringProperty SecurityKey { get; set; } 43 44 [CmdConfigureIgnore] 45 [JsonConverter(typeof(BoolPropertyJsonConverter))] 46 public bool UseService { get; set; } 47 48 [JsonConverter(typeof(BoolPropertyJsonConverter))] 49 public bool ShowOriginalUI { get; set; } 50 51 [JsonConverter(typeof(BoolPropertyJsonConverter))] 52 public bool WrapMouse { get; set; } 53 54 [JsonConverter(typeof(BoolPropertyJsonConverter))] 55 public bool ShareClipboard { get; set; } 56 57 [JsonConverter(typeof(BoolPropertyJsonConverter))] 58 public bool TransferFile { get; set; } 59 60 [JsonConverter(typeof(BoolPropertyJsonConverter))] 61 public bool HideMouseAtScreenEdge { get; set; } 62 63 [JsonConverter(typeof(BoolPropertyJsonConverter))] 64 public bool DrawMouseCursor { get; set; } 65 66 [JsonConverter(typeof(BoolPropertyJsonConverter))] 67 public bool ValidateRemoteMachineIP { get; set; } 68 69 [JsonConverter(typeof(BoolPropertyJsonConverter))] 70 public bool SameSubnetOnly { get; set; } 71 72 [JsonConverter(typeof(BoolPropertyJsonConverter))] 73 public bool BlockScreenSaverOnOtherMachines { get; set; } 74 75 [JsonConverter(typeof(BoolPropertyJsonConverter))] 76 public bool MoveMouseRelatively { get; set; } 77 78 [JsonConverter(typeof(BoolPropertyJsonConverter))] 79 public bool BlockMouseAtScreenCorners { get; set; } 80 81 [JsonConverter(typeof(BoolPropertyJsonConverter))] 82 public bool ShowClipboardAndNetworkStatusMessages { get; set; } 83 84 [CmdConfigureIgnoreAttribute] 85 public List<string> MachineMatrixString { get; set; } 86 87 [CmdConfigureIgnoreAttribute] 88 public StringProperty MachinePool { get; set; } 89 90 [JsonConverter(typeof(BoolPropertyJsonConverter))] 91 [CmdConfigureIgnoreAttribute] 92 public bool MatrixOneRow { get; set; } 93 94 public IntProperty EasyMouse { get; set; } 95 96 [JsonConverter(typeof(BoolPropertyJsonConverter))] 97 public bool DisableEasyMouseWhenForegroundWindowIsFullscreen { get; set; } 98 99 // Apps that are to be excluded when using DisableEasyMouseWhenForegroundWindowIsFullscreen 100 // meaning that it is possible to switch screen when these apps are running in fullscreen. 101 [CmdConfigureIgnore] 102 public GenericProperty<HashSet<string>> EasyMouseFullscreenSwitchBlockExcludedApps { get; set; } 103 104 [CmdConfigureIgnore] 105 public IntProperty MachineID { get; set; } 106 107 [CmdConfigureIgnoreAttribute] 108 public IntProperty LastX { get; set; } 109 110 [CmdConfigureIgnoreAttribute] 111 public IntProperty LastY { get; set; } 112 113 [CmdConfigureIgnoreAttribute] 114 public IntProperty PackageID { get; set; } 115 116 [JsonConverter(typeof(BoolPropertyJsonConverter))] 117 [CmdConfigureIgnoreAttribute] 118 public bool FirstRun { get; set; } 119 120 public IntProperty HotKeySwitchMachine { get; set; } 121 122 [ObsoleteAttribute("Use ToggleEasyMouseShortcut instead", false)] 123 [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] 124 [CmdConfigureIgnoreAttribute] 125 public IntProperty HotKeyToggleEasyMouse { get; set; } 126 127 [ObsoleteAttribute("Use LockMachineShortcut instead", false)] 128 [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] 129 [CmdConfigureIgnoreAttribute] 130 public IntProperty HotKeyLockMachine { get; set; } 131 132 [ObsoleteAttribute("Use ReconnectShortcut instead", false)] 133 [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] 134 [CmdConfigureIgnoreAttribute] 135 public IntProperty HotKeyReconnect { get; set; } 136 137 [ObsoleteAttribute("Use Switch2AllPCShortcut instead", false)] 138 [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] 139 [CmdConfigureIgnoreAttribute] 140 public IntProperty HotKeySwitch2AllPC { get; set; } 141 142 public HotkeySettings ToggleEasyMouseShortcut { get; set; } 143 144 public HotkeySettings LockMachineShortcut { get; set; } 145 146 public HotkeySettings ReconnectShortcut { get; set; } 147 148 public HotkeySettings Switch2AllPCShortcut { get; set; } 149 150 [CmdConfigureIgnoreAttribute] 151 public IntProperty TCPPort { get; set; } 152 153 [JsonConverter(typeof(BoolPropertyJsonConverter))] 154 public bool DrawMouseEx { get; set; } 155 156 public StringProperty Name2IP { get; set; } 157 158 [JsonConverter(typeof(BoolPropertyJsonConverter))] 159 [CmdConfigureIgnoreAttribute] 160 public bool FirstCtrlShiftS { get; set; } 161 162 [CmdConfigureIgnoreAttribute] 163 public StringProperty DeviceID { get; set; } 164 165 public MouseWithoutBordersProperties() 166 { 167 SecurityKey = new StringProperty(string.Empty); 168 WrapMouse = true; 169 ShareClipboard = true; 170 TransferFile = true; 171 HideMouseAtScreenEdge = true; 172 DrawMouseCursor = true; 173 ValidateRemoteMachineIP = false; 174 SameSubnetOnly = false; 175 BlockScreenSaverOnOtherMachines = true; 176 MoveMouseRelatively = false; 177 BlockMouseAtScreenCorners = false; 178 ShowClipboardAndNetworkStatusMessages = false; 179 EasyMouse = new IntProperty(1); 180 MachineMatrixString = new List<string>(); 181 DeviceID = new StringProperty(string.Empty); 182 ShowOriginalUI = false; 183 UseService = false; 184 185 DisableEasyMouseWhenForegroundWindowIsFullscreen = true; 186 EasyMouseFullscreenSwitchBlockExcludedApps = new GenericProperty<HashSet<string>>(new HashSet<string>(StringComparer.OrdinalIgnoreCase)); 187 188 HotKeySwitchMachine = new IntProperty(0x70); // VK.F1 189 ToggleEasyMouseShortcut = DefaultHotKeyToggleEasyMouse; 190 LockMachineShortcut = DefaultHotKeyLockMachine; 191 ReconnectShortcut = DefaultHotKeyReconnect; 192 Switch2AllPCShortcut = DefaultHotKeySwitch2AllPC; 193 194 // These are internal, i.e. cannot be edited directly from UI 195 MachinePool = ":,:,:,:"; 196 MatrixOneRow = true; 197 MachineID = new IntProperty(0); 198 LastX = new IntProperty(0); 199 LastY = new IntProperty(0); 200 PackageID = new IntProperty(0); 201 FirstRun = false; 202 TCPPort = new IntProperty(15100); 203 DrawMouseEx = true; 204 Name2IP = new StringProperty(string.Empty); 205 FirstCtrlShiftS = false; 206 } 207 208 public object Clone() 209 { 210 var clone = new MouseWithoutBordersProperties(); 211 clone = this; 212 return clone; 213 } 214 } 215 }