diff options
author | Pierre Ossman <ossman@cendio.se> | 2025-01-09 11:23:14 +0100 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2025-01-09 11:23:14 +0100 |
commit | e622f571df17b292ac3f6e0d313ede98874dec36 (patch) | |
tree | a05ff0a03739f1365a8f375ff8e782950447e221 /java/com/tigervnc/vncviewer/Parameters.java | |
parent | 11798d78e922572e4cea5c44a63308c05cb7d0c5 (diff) | |
parent | 7f44ab96379f837acdfdbd30494653eb516771ad (diff) | |
download | tigervnc-e622f571df17b292ac3f6e0d313ede98874dec36.tar.gz tigervnc-e622f571df17b292ac3f6e0d313ede98874dec36.zip |
Merge branch 'largeCursor' of https://github.com/krystof1119/tigervnc
Diffstat (limited to 'java/com/tigervnc/vncviewer/Parameters.java')
-rw-r--r-- | java/com/tigervnc/vncviewer/Parameters.java | 83 |
1 files changed, 57 insertions, 26 deletions
diff --git a/java/com/tigervnc/vncviewer/Parameters.java b/java/com/tigervnc/vncviewer/Parameters.java index dd2f1c3e..3e14b10e 100644 --- a/java/com/tigervnc/vncviewer/Parameters.java +++ b/java/com/tigervnc/vncviewer/Parameters.java @@ -40,9 +40,19 @@ public class Parameters { public static BoolParameter dotWhenNoCursor = new BoolParameter("DotWhenNoCursor", - "Show the dot cursor when the server sends an invisible cursor", + "[DEPRECATED] Show the dot cursor when the server sends an invisible cursor", false); + public static BoolParameter alwaysCursor + = new BoolParameter("AlwaysCursor", + "Show the local cursor when the server sends an invisible cursor", + false); + + public static StringParameter cursorType + = new StringParameter("CursorType", + "Specify which cursor type the local cursor should be. Should be either Dot or System", + "Dot"); + public static BoolParameter sendLocalUsername = new BoolParameter("SendLocalUsername", "Send the local username for SecurityTypes "+ @@ -282,7 +292,8 @@ public class Parameters { CSecurityTLS.X509CA, CSecurityTLS.X509CRL, SecurityClient.secTypes, - dotWhenNoCursor, + alwaysCursor, + cursorType, autoSelect, fullColor, lowColorLevel, @@ -315,6 +326,10 @@ public class Parameters { sshKeyFile, }; + static VoidParameter[] readOnlyParameterArray = { + dotWhenNoCursor + }; + static LogWriter vlog = new LogWriter("Parameters"); @@ -447,29 +462,35 @@ public class Parameters { invalidParameterName = false; } else { for (int i = 0; i < parameterArray.length; i++) { - if (parameterArray[i] instanceof StringParameter) { - if (line.substring(0,idx).trim().equalsIgnoreCase(parameterArray[i].getName())) { + VoidParameter parameter; + if (i < parameterArray.length) { + parameter = parameterArray[i]; + } else { + parameter = readOnlyParameterArray[i - parameterArray.length]; + } + if (parameter instanceof StringParameter) { + if (line.substring(0,idx).trim().equalsIgnoreCase(parameter.getName())) { if (value.length() > 256) { vlog.error(String.format("Failed to read line %d in file %s: %s", lineNr, filepath, "Invalid format or too large value")); continue; } - ((StringParameter)parameterArray[i]).setParam(value); + ((StringParameter)parameter).setParam(value); invalidParameterName = false; } - } else if (parameterArray[i] instanceof IntParameter) { - if (line.substring(0,idx).trim().equalsIgnoreCase(parameterArray[i].getName())) { - ((IntParameter)parameterArray[i]).setParam(value); + } else if (parameter instanceof IntParameter) { + if (line.substring(0,idx).trim().equalsIgnoreCase(parameter.getName())) { + ((IntParameter)parameter).setParam(value); invalidParameterName = false; } - } else if (parameterArray[i] instanceof BoolParameter) { - if (line.substring(0,idx).trim().equalsIgnoreCase(parameterArray[i].getName())) { - ((BoolParameter)parameterArray[i]).setParam(value); + } else if (parameter instanceof BoolParameter) { + if (line.substring(0,idx).trim().equalsIgnoreCase(parameter.getName())) { + ((BoolParameter)parameter).setParam(value); invalidParameterName = false; } } else { vlog.error(String.format("Unknown parameter type for parameter %s", - parameterArray[i].getName())); + parameter.getName())); } } @@ -517,6 +538,10 @@ public class Parameters { } } + for (int i = 0; i < readOnlyParameterArray.length; i++) { + UserPreferences.delete(hKey, readOnlyParameterArray[i].getName()); + } + UserPreferences.save(hKey); } @@ -528,28 +553,34 @@ public class Parameters { if (servername == null) servername = ""; - for (int i = 0; i < parameterArray.length; i++) { - if (parameterArray[i] instanceof StringParameter) { - if (UserPreferences.get(hKey, parameterArray[i].getName()) != null) { + for (int i = 0; i < parameterArray.length + readOnlyParameterArray.length; i++) { + VoidParameter parameter; + if (i < parameterArray.length) { + parameter = parameterArray[i]; + } else { + parameter = readOnlyParameterArray[i - parameterArray.length]; + } + if (parameter instanceof StringParameter) { + if (UserPreferences.get(hKey, parameter.getName()) != null) { String stringValue = - UserPreferences.get(hKey, parameterArray[i].getName()); - ((StringParameter)parameterArray[i]).setParam(stringValue); + UserPreferences.get(hKey, parameter.getName()); + ((StringParameter)parameter).setParam(stringValue); } - } else if (parameterArray[i] instanceof IntParameter) { - if (UserPreferences.get(hKey, parameterArray[i].getName()) != null) { + } else if (parameter instanceof IntParameter) { + if (UserPreferences.get(hKey, parameter.getName()) != null) { int intValue = - UserPreferences.getInt(hKey, parameterArray[i].getName()); - ((IntParameter)parameterArray[i]).setParam(intValue); + UserPreferences.getInt(hKey, parameter.getName()); + ((IntParameter)parameter).setParam(intValue); } - } else if (parameterArray[i] instanceof BoolParameter) { - if (UserPreferences.get(hKey, parameterArray[i].getName()) != null) { + } else if (parameter instanceof BoolParameter) { + if (UserPreferences.get(hKey, parameter.getName()) != null) { boolean booleanValue = - UserPreferences.getBool(hKey, parameterArray[i].getName()); - ((BoolParameter)parameterArray[i]).setParam(booleanValue); + UserPreferences.getBool(hKey, parameter.getName()); + ((BoolParameter)parameter).setParam(booleanValue); } } else { vlog.error(String.format("Unknown parameter type for parameter %s", - parameterArray[i].getName())); + parameter.getName())); } } |