Skip to content

Commit

Permalink
1) We can now specify to CompactBitmapData whether it should operate …
Browse files Browse the repository at this point in the history
…in True Color mode.

2) Workaround for buggy IME's that cannot handle Views that do accept only InputType.TYPE_NULL input.
  • Loading branch information
iiordanov committed Dec 8, 2013
1 parent 4f3e994 commit 423cefc
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 7 deletions.
2 changes: 1 addition & 1 deletion eclipse_projects/bVNC/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.iiordanov.bVNC" android:installLocation="auto"
android:versionCode="3390" android:versionName="v3.3.9">
android:versionCode="3400" android:versionName="v3.4.0">

<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8"></uses-sdk>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void draw(Canvas canvas) {
}
}

CompactBitmapData(RfbConnectable rfb, RemoteCanvas c)
CompactBitmapData(RfbConnectable rfb, RemoteCanvas c, boolean trueColor)
{
super(rfb,c);
bitmapwidth=framebufferwidth;
Expand All @@ -63,8 +63,7 @@ public void draw(Canvas canvas) {
if (bitmapwidth == 0) bitmapwidth = 1;
if (bitmapheight == 0) bitmapheight = 1;

isSpice = c.getContext().getPackageName().contains("SPICE");
if (isSpice)
if (trueColor)
cfg = Bitmap.Config.ARGB_8888;

mbitmap = Bitmap.createBitmap(bitmapwidth, bitmapheight, cfg);
Expand Down
29 changes: 26 additions & 3 deletions eclipse_projects/bVNC/src/com/iiordanov/bVNC/RemoteCanvas.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,16 @@
import android.os.Message;
import android.os.SystemClock;
import android.text.ClipboardManager;
import android.text.InputType;
import android.util.AttributeSet;
import android.util.Base64;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Display;
import android.view.KeyEvent;
import android.view.inputmethod.BaseInputConnection;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
import android.widget.ImageView;
import android.widget.Toast;
import android.graphics.BitmapFactory;
Expand Down Expand Up @@ -620,7 +624,7 @@ void initializeBitmap (int dx, int dy) throws IOException {
bitmapData=new FullBufferBitmapData(rfbconn, this, capacity);
android.util.Log.i(TAG, "Using FullBufferBitmapData.");
} else {
bitmapData=new CompactBitmapData(rfbconn, this);
bitmapData=new CompactBitmapData(rfbconn, this, isSpice);
android.util.Log.i(TAG, "Using CompactBufferBitmapData.");
}
} catch (Throwable e) { // If despite our efforts we fail to allocate memory, use LBBM.
Expand Down Expand Up @@ -1072,7 +1076,7 @@ public void invalidateMousePosition() {
}
}


/**
* Moves soft cursor into a particular location.
* @param x
Expand All @@ -1096,6 +1100,7 @@ synchronized void softCursorMove(int x, int y) {
}
}


/**
* Initializes the data structure which holds the remote pointer data.
*/
Expand All @@ -1112,6 +1117,24 @@ void initializeSoftCursor () {
bm.recycle();
}


@Override
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
android.util.Log.d(TAG, "onCreateInputConnection called");

BaseInputConnection bic = new BaseInputConnection(this, false);
outAttrs.actionLabel = null;
int version = android.os.Build.VERSION.SDK_INT;
// Workaround for IME's that don't support InputType.TYPE_NULL.
if (version >= 11) {
outAttrs.inputType = InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS;
outAttrs.imeOptions |= EditorInfo.IME_FLAG_NO_FULLSCREEN;
} else {
outAttrs.inputType = InputType.TYPE_NULL;
}
return bic;
}

public RemotePointer getPointer() {
return pointer;
}
Expand Down Expand Up @@ -1251,7 +1274,7 @@ public void OnSettingsChanged(int width, int height, int bpp) {
disposeDrawable ();
try {
// TODO: Use frameBufferSizeChanged instead.
bitmapData = new CompactBitmapData(rfbconn, this);
bitmapData = new CompactBitmapData(rfbconn, this, isSpice);
} catch (Throwable e) {
showFatalMessageAndQuit (getContext().getString(R.string.error_out_of_memory));
return;
Expand Down

0 comments on commit 423cefc

Please sign in to comment.