Skip to content

Commit

Permalink
- v4.1.0
Browse files Browse the repository at this point in the history
- Option to disable cursor
- Fixes to cursor shape handling
  • Loading branch information
iiordanov committed Apr 17, 2020
1 parent e0c1633 commit 71e8038
Show file tree
Hide file tree
Showing 28 changed files with 292 additions and 85 deletions.
2 changes: 1 addition & 1 deletion bVNC/AndroidManifest.xml.CustomVnc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
package="com.iiordanov.__CUSTOM_APP_PACKAGE__"
android:installLocation="auto"
android:versionCode="114091" android:versionName="v4.0.9">
android:versionCode="114100" android:versionName="v4.1.0">

<uses-permission tools:node="removeAll"/>
<uses-permission android:name="android.permission.INTERNET"> </uses-permission>
Expand Down
2 changes: 1 addition & 1 deletion bVNC/AndroidManifest.xml.aRDP
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.iiordanov.aRDP" android:installLocation="auto"
android:versionCode="114091" android:versionName="v4.0.9">
android:versionCode="114100" android:versionName="v4.1.0">

<uses-permission tools:node="removeAll"/>
<uses-permission android:name="android.permission.INTERNET"> </uses-permission>
Expand Down
2 changes: 1 addition & 1 deletion bVNC/AndroidManifest.xml.aSPICE
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.iiordanov.aSPICE" android:installLocation="auto"
android:versionCode="114091" android:versionName="v4.0.9">
android:versionCode="114100" android:versionName="v4.1.0">

<uses-permission tools:node="removeAll"/>
<uses-permission android:name="android.permission.INTERNET"> </uses-permission>
Expand Down
2 changes: 1 addition & 1 deletion bVNC/AndroidManifest.xml.bVNC
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.iiordanov.bVNC" android:installLocation="auto"
android:versionCode="114091" android:versionName="v4.0.9">
android:versionCode="114100" android:versionName="v4.1.0">

<uses-permission tools:node="removeAll"/>
<uses-permission android:name="android.permission.INTERNET"> </uses-permission>
Expand Down
2 changes: 1 addition & 1 deletion bVNC/AndroidManifest.xml.freeaRDP
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.iiordanov.freeaRDP" android:installLocation="auto"
android:versionCode="114091" android:versionName="v4.0.9">
android:versionCode="114100" android:versionName="v4.1.0">

<uses-permission tools:node="removeAll"/>
<uses-permission android:name="android.permission.INTERNET"> </uses-permission>
Expand Down
2 changes: 1 addition & 1 deletion bVNC/AndroidManifest.xml.freeaSPICE
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.iiordanov.freeaSPICE" android:installLocation="auto"
android:versionCode="114091" android:versionName="v4.0.9">
android:versionCode="114100" android:versionName="v4.1.0">

<uses-permission tools:node="removeAll"/>
<uses-permission android:name="android.permission.INTERNET"> </uses-permission>
Expand Down
2 changes: 1 addition & 1 deletion bVNC/AndroidManifest.xml.freebVNC
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.iiordanov.freebVNC" android:installLocation="auto"
android:versionCode="114091" android:versionName="v4.0.9">
android:versionCode="114100" android:versionName="v4.1.0">

<uses-permission tools:node="removeAll"/>
<uses-permission android:name="android.permission.INTERNET"> </uses-permission>
Expand Down
3 changes: 3 additions & 0 deletions bVNC/CHANGELOG-aRDP
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v4.1.0
- Option to disable cursor
- Fixes to cursor shape handling
v4.0.9
- Japanese, Korean, Traditional Chinese, and Simplified Chinese localizations
v4.0.8
Expand Down
3 changes: 3 additions & 0 deletions bVNC/CHANGELOG-aSPICE
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v4.1.0
- Option to disable cursor
- Fixes to cursor shape handling
v4.0.9
- Japanese, Korean, Traditional Chinese, and Simplified Chinese localizations
v4.0.8
Expand Down
3 changes: 3 additions & 0 deletions bVNC/CHANGELOG-bVNC
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v4.1.0
- Option to disable cursor
- Fixes to cursor shape handling
v4.0.9
- Japanese, Korean, Traditional Chinese, and Simplified Chinese localizations
v4.0.8
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// This class was generated from com.iiordanov.bVNC.IConnectionBean by a tool
// Do not edit this file directly! PLX THX
// This class used to be generated from com.iiordanov.bVNC.IConnectionBean by an Eclipse plugin
// Since the switch to Android Studio that plugin is no longer operational / in use and this file
// is being edited by hand.
package com.iiordanov.bVNC;

public abstract class AbstractConnectionBean extends com.antlersoft.android.dbimpl.IdImplementationBase implements IConnectionBean {
Expand Down Expand Up @@ -288,7 +289,7 @@ public abstract class AbstractConnectionBean extends com.antlersoft.android.dbim
private boolean gen_useDpadAsArrows;
private boolean gen_rotateDpad;
private boolean gen_usePortrait;
private boolean gen_useLocalCursor;
private int gen_useLocalCursor;
private boolean gen_keepPassword;
private boolean gen_followMouse;
private boolean gen_useRepeater;
Expand Down Expand Up @@ -415,8 +416,8 @@ public abstract class AbstractConnectionBean extends com.antlersoft.android.dbim
public void setRotateDpad(boolean arg_rotateDpad) { gen_rotateDpad = arg_rotateDpad; }
public boolean getUsePortrait() { return gen_usePortrait; }
public void setUsePortrait(boolean arg_usePortrait) { gen_usePortrait = arg_usePortrait; }
public boolean getUseLocalCursor() { return gen_useLocalCursor; }
public void setUseLocalCursor(boolean arg_useLocalCursor) { gen_useLocalCursor = arg_useLocalCursor; }
public int getUseLocalCursor() { return gen_useLocalCursor; }
public void setUseLocalCursor(int arg_useLocalCursor) { gen_useLocalCursor = arg_useLocalCursor; }
public boolean getKeepPassword() { return gen_keepPassword; }
public void setKeepPassword(boolean arg_keepPassword) { gen_keepPassword = arg_keepPassword; }
public boolean getFollowMouse() { return gen_followMouse; }
Expand Down Expand Up @@ -524,7 +525,7 @@ public android.content.ContentValues Gen_getValues() {
values.put(GEN_FIELD_USEDPADASARROWS,(this.gen_useDpadAsArrows ? "1" : "0"));
values.put(GEN_FIELD_ROTATEDPAD,(this.gen_rotateDpad ? "1" : "0"));
values.put(GEN_FIELD_USEPORTRAIT,(this.gen_usePortrait ? "1" : "0"));
values.put(GEN_FIELD_USELOCALCURSOR,(this.gen_useLocalCursor ? "1" : "0"));
values.put(GEN_FIELD_USELOCALCURSOR,(Integer.toString(this.gen_useLocalCursor)));
values.put(GEN_FIELD_KEEPPASSWORD,(this.gen_keepPassword ? "1" : "0"));
values.put(GEN_FIELD_FOLLOWMOUSE,(this.gen_followMouse ? "1" : "0"));
values.put(GEN_FIELD_USEREPEATER,(this.gen_useRepeater ? "1" : "0"));
Expand Down Expand Up @@ -790,7 +791,7 @@ public void Gen_populate(android.database.Cursor cursor,int[] columnIndices) {
gen_usePortrait = (cursor.getInt(columnIndices[GEN_ID_USEPORTRAIT]) != 0);
}
if ( columnIndices[GEN_ID_USELOCALCURSOR] >= 0 && ! cursor.isNull(columnIndices[GEN_ID_USELOCALCURSOR])) {
gen_useLocalCursor = (cursor.getInt(columnIndices[GEN_ID_USELOCALCURSOR]) != 0);
gen_useLocalCursor = (int)cursor.getInt(columnIndices[GEN_ID_USELOCALCURSOR]);
}
if ( columnIndices[GEN_ID_KEEPPASSWORD] >= 0 && ! cursor.isNull(columnIndices[GEN_ID_KEEPPASSWORD])) {
gen_keepPassword = (cursor.getInt(columnIndices[GEN_ID_KEEPPASSWORD]) != 0);
Expand Down Expand Up @@ -931,7 +932,7 @@ public void Gen_populate(android.content.ContentValues values) {
gen_useDpadAsArrows = (values.getAsInteger(GEN_FIELD_USEDPADASARROWS) != 0);
gen_rotateDpad = (values.getAsInteger(GEN_FIELD_ROTATEDPAD) != 0);
gen_usePortrait = (values.getAsInteger(GEN_FIELD_USEPORTRAIT) != 0);
gen_useLocalCursor = (values.getAsInteger(GEN_FIELD_USELOCALCURSOR) != 0);
gen_useLocalCursor = (int)values.getAsInteger(GEN_FIELD_USELOCALCURSOR);
gen_keepPassword = (values.getAsInteger(GEN_FIELD_KEEPPASSWORD) != 0);
gen_followMouse = (values.getAsInteger(GEN_FIELD_FOLLOWMOUSE) != 0);
gen_useRepeater = (values.getAsInteger(GEN_FIELD_USEREPEATER) != 0);
Expand Down
2 changes: 1 addition & 1 deletion bVNC/src2/main/java/com/iiordanov/bVNC/ConnectionBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public class ConnectionBean extends AbstractConnectionBean implements Comparable
setUseDpadAsArrows(true);
setRotateDpad(false);
setUsePortrait(false);
setUseLocalCursor(false);
setUseLocalCursor(Constants.CURSOR_AUTO);
setRepeaterId("");
setExtraKeysToggleType(1);
setMetaListId(1);
Expand Down
4 changes: 4 additions & 0 deletions bVNC/src2/main/java/com/iiordanov/bVNC/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -277,4 +277,8 @@ public static String getCommandString (int command, String opts) {
}
return "";
}

public static final int CURSOR_AUTO = 0;
public static final int CURSOR_FORCE_LOCAL = 1;
public static final int CURSOR_FORCE_DISABLE = 2;
}
22 changes: 13 additions & 9 deletions bVNC/src2/main/java/com/iiordanov/bVNC/Decoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,10 @@ public class Decoder {

private AbstractBitmapData bitmapData;
private RemoteCanvas vncCanvas;
private boolean discardCursorShapeUpdates;


public Decoder (RemoteCanvas v) {
public Decoder (RemoteCanvas v, boolean discardCursorShapeUpdates) {
this.discardCursorShapeUpdates = discardCursorShapeUpdates;
handleRREPaint.setStyle(Style.FILL);
handleTightRectPaint.setStyle(Style.FILL);
bitmapopts.inPurgeable = false;
Expand Down Expand Up @@ -1061,16 +1062,19 @@ void decodeGradientData (int x, int y, int w, int h, byte[] buf) {
}
return;
}*/
int[] cursorShape = decodeCursorShape(rfb, encodingType, w, h);

// Set cursor rectangle.
bitmapData.setCursorRect(x, y, w, h, hotX, hotY);
if (!discardCursorShapeUpdates) {
// Set cursor rectangle.
bitmapData.setCursorRect(x, y, w, h, hotX, hotY);

// Decode cursor pixel data, and set pixel data into bitmap drawable.
bitmapData.setSoftCursor (decodeCursorShape(rfb, encodingType, w, h));
// Decode cursor pixel data, and set pixel data into bitmap drawable.
bitmapData.setSoftCursor(cursorShape);

// Show the cursor.
RectF r = bitmapData.getCursorRect();
vncCanvas.reDraw(r.left, r.top, r.width(), r.height());
// Show the cursor.
RectF r = bitmapData.getCursorRect();
vncCanvas.reDraw(r.left, r.top, r.width(), r.height());
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ interface IConnectionBean {
@FieldAccessor
boolean getUsePortrait();
@FieldAccessor
boolean getUseLocalCursor();
int getUseLocalCursor();
@FieldAccessor
boolean getKeepPassword();
@FieldAccessor
Expand Down
23 changes: 23 additions & 0 deletions bVNC/src2/main/java/com/iiordanov/bVNC/MainConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioGroup;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
Expand Down Expand Up @@ -67,10 +68,31 @@ public abstract class MainConfiguration extends FragmentActivity implements GetT
private Button buttonGeneratePubkey;
private TextView versionAndCode;
protected PermissionsManager permissionsManager;
private RadioGroup radioCursor;

protected abstract void updateViewFromSelected();
protected abstract void updateSelectedFromView();

public void commonUpdateViewFromSelected() {
if (selected.getUseLocalCursor() == Constants.CURSOR_AUTO) {
radioCursor.check(R.id.radioCursorAuto);
} else if (selected.getUseLocalCursor() == Constants.CURSOR_FORCE_LOCAL) {
radioCursor.check(R.id.radioCursorForceLocal);
} else if (selected.getUseLocalCursor() == Constants.CURSOR_FORCE_DISABLE) {
radioCursor.check(R.id.radioCursorForceDisable);
}
}

public void commonUpdateSelectedFromView() {
if (radioCursor.getCheckedRadioButtonId() == R.id.radioCursorAuto) {
selected.setUseLocalCursor(Constants.CURSOR_AUTO);
} else if (radioCursor.getCheckedRadioButtonId() == R.id.radioCursorForceLocal) {
selected.setUseLocalCursor(Constants.CURSOR_FORCE_LOCAL);
} else if (radioCursor.getCheckedRadioButtonId() == R.id.radioCursorForceDisable) {
selected.setUseLocalCursor(Constants.CURSOR_FORCE_DISABLE);
}
}

@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
Expand Down Expand Up @@ -144,6 +166,7 @@ public void onClick(View v) {
});

permissionsManager.requestPermissions(MainConfiguration.this);
radioCursor = findViewById(R.id.radioCursor);
}

@Override
Expand Down
15 changes: 7 additions & 8 deletions bVNC/src2/main/java/com/iiordanov/bVNC/RemoteCanvas.java
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,6 @@ public RemoteCanvas(final Context context, AttributeSet attrs) {
isVnc = getContext().getPackageName().toUpperCase().contains("VNC");
isRdp = getContext().getPackageName().toUpperCase().contains("RDP");
isSpice = getContext().getPackageName().toUpperCase().contains("SPICE");
if (isVnc) {
decoder = new Decoder(this);
}

final Display display = ((Activity) context).getWindow().getWindowManager().getDefaultDisplay();
displayWidth = display.getWidth();
Expand Down Expand Up @@ -445,9 +442,9 @@ private void startRdpConnection() throws Exception {
private void initializeVncConnection() throws Exception {
Log.i(TAG, "Initializing connection to: " + connection.getAddress() + ", port: " + connection.getPort());
boolean sslTunneled = connection.getConnectionType() == Constants.CONN_TYPE_STUNNEL;
decoder = new Decoder(this, connection.getUseLocalCursor() == Constants.CURSOR_FORCE_LOCAL);
rfb = new RfbProto(decoder, this, connection.getPrefEncoding(), connection.getViewOnly(),
connection.getUseLocalCursor(), sslTunneled, connection.getIdHashAlgorithm(),
connection.getIdHash(), connection.getSshHostKey());
sslTunneled, connection.getIdHashAlgorithm(), connection.getIdHash(), connection.getSshHostKey());

rfbconn = rfb;
pointer = new RemoteVncPointer(rfbconn, RemoteCanvas.this, handler);
Expand Down Expand Up @@ -501,7 +498,7 @@ public void run() {
});

sendUnixAuth();
if (connection.getUseLocalCursor())
if (isRdp || connection.getUseLocalCursor() == Constants.CURSOR_FORCE_LOCAL)
initializeSoftCursor();

handler.post(drawableSetter);
Expand Down Expand Up @@ -748,7 +745,9 @@ public void reallocateDrawable(int dx, int dy) {
}

try {
initializeSoftCursor();
if (isRdp || connection.getUseLocalCursor() == Constants.CURSOR_FORCE_LOCAL) {
initializeSoftCursor();
}
handler.post(drawableSetter);
handler.post(setModes);
myDrawable.syncScroll();
Expand Down Expand Up @@ -1261,7 +1260,7 @@ public void mouseMode(boolean relative) {
* @param y
*/
synchronized void softCursorMove(int x, int y) {
if (myDrawable.isNotInitSoftCursor()) {
if (myDrawable.isNotInitSoftCursor() && connection.getUseLocalCursor() != Constants.CURSOR_FORCE_DISABLE) {
initializeSoftCursor();
}

Expand Down
13 changes: 4 additions & 9 deletions bVNC/src2/main/java/com/iiordanov/bVNC/RfbProto.java
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,6 @@ class RfbProto implements RfbConnectable {
// The remote canvas
RemoteCanvas canvas;

// Whether to only use a local cursor.
private boolean useLocalCursor = false;

// ExtendedDesktopSize Variables
// ScreenId
private int screenId;
Expand All @@ -313,14 +310,13 @@ class RfbProto implements RfbConnectable {
// Constructor
//
RfbProto(Decoder decoder, RemoteCanvas canvas, int preferredEncoding,
boolean viewOnly, boolean useLocalCursor, boolean sslTunneled, int hashAlgorithm,
boolean viewOnly, boolean sslTunneled, int hashAlgorithm,
String hash, String cert) {
this.sslTunneled = sslTunneled;
this.decoder = decoder;
this.viewOnly = viewOnly;
this.canvas = canvas;
this.preferredEncoding = preferredEncoding;
this.useLocalCursor = useLocalCursor;
this.hashAlgorithm = hashAlgorithm;
this.hash = hash;
this.cert = cert;
Expand Down Expand Up @@ -1846,10 +1842,8 @@ private void setEncodings() {
encodings[nEncodings++] = RfbProto.EncodingCompressLevel0 + compressLevel;
encodings[nEncodings++] = RfbProto.EncodingQualityLevel0 + jpegQuality;

if (!useLocalCursor) {
encodings[nEncodings++] = RfbProto.EncodingXCursor;
encodings[nEncodings++] = RfbProto.EncodingRichCursor;
}
encodings[nEncodings++] = RfbProto.EncodingXCursor;
encodings[nEncodings++] = RfbProto.EncodingRichCursor;

encodings[nEncodings++] = RfbProto.EncodingPointerPos;
encodings[nEncodings++] = RfbProto.EncodingLastRect;
Expand Down Expand Up @@ -1926,6 +1920,7 @@ public void processProtocol() throws Exception {
case RfbProto.EncodingRichCursor:
decoder.handleCursorShapeUpdate(this, updateRectEncoding, updateRectX, updateRectY,
updateRectW, updateRectH);
canvas.softCursorMove(updateRectX, updateRectY);
break;
case RfbProto.EncodingLastRect:
exitforloop = true;
Expand Down
Loading

0 comments on commit 71e8038

Please sign in to comment.