diff --git a/app/build.gradle b/app/build.gradle index dba8199..d582f4b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,7 +9,7 @@ android { defaultConfig { applicationId "com.gaurav.avnc" - minSdkVersion 21 + minSdkVersion 16 targetSdkVersion 30 versionCode 12 versionName "1.9.0" @@ -108,4 +108,4 @@ dependencies { androidTestImplementation "androidx.test:rules:1.4.0" androidTestImplementation "androidx.test.ext:junit-ktx:1.1.3" androidTestImplementation "io.mockk:mockk-android:1.12.0" -} \ No newline at end of file +} diff --git a/app/src/main/java/com/gaurav/avnc/ui/vnc/TouchHandler.kt b/app/src/main/java/com/gaurav/avnc/ui/vnc/TouchHandler.kt index 06f64e1..a9a1485 100644 --- a/app/src/main/java/com/gaurav/avnc/ui/vnc/TouchHandler.kt +++ b/app/src/main/java/com/gaurav/avnc/ui/vnc/TouchHandler.kt @@ -112,10 +112,12 @@ class TouchHandler(private val viewModel: VncViewModel, private val dispatcher: private val stylusGestureDetector = GestureDetector(viewModel.app, StylusGestureListener()) private fun handleStylusEvent(event: MotionEvent): Boolean { + /* if (event.isFromSource(InputDevice.SOURCE_STYLUS)) { stylusGestureDetector.onTouchEvent(event) return true } + */ return false } @@ -166,7 +168,7 @@ class TouchHandler(private val viewModel: VncViewModel, private val dispatcher: * we use [DragDetector] & [MultiFingerTapDetector] for more gestures. * ****************************************************************************************/ - private val scaleDetector = ScaleGestureDetector(viewModel.app, this).apply { isQuickScaleEnabled = false } + private val scaleDetector = ScaleGestureDetector(viewModel.app, this) //.apply { isQuickScaleEnabled = false } private val gestureDetector = GestureDetector(viewModel.app, this) private val multiFingerTapDetector = MultiFingerTapDetector() private val dragDetector = DragDetector() diff --git a/app/src/main/java/com/gaurav/avnc/ui/vnc/VncActivity.kt b/app/src/main/java/com/gaurav/avnc/ui/vnc/VncActivity.kt index 22096e7..c816a9c 100644 --- a/app/src/main/java/com/gaurav/avnc/ui/vnc/VncActivity.kt +++ b/app/src/main/java/com/gaurav/avnc/ui/vnc/VncActivity.kt @@ -332,6 +332,7 @@ class VncActivity : AppCompatActivity() { //need Mouse right-click events. It is hardcoded to act as back-press, without //giving apps a chance to handle it. For better or worse, they set the 'source' //for such key events to Mouse, enabling the following workarounds. + /* if (keyEvent.keyCode == KeyEvent.KEYCODE_BACK && InputDevice.getDevice(keyEvent.deviceId).supportsSource(InputDevice.SOURCE_MOUSE) && viewModel.pref.input.interceptMouseBack) { @@ -339,6 +340,7 @@ class VncActivity : AppCompatActivity() { touchHandler.onMouseBack() return true } + */ return false } -} \ No newline at end of file +} diff --git a/app/src/main/java/com/gaurav/avnc/ui/vnc/gl/FrameProgram.kt b/app/src/main/java/com/gaurav/avnc/ui/vnc/gl/FrameProgram.kt index b669cbf..bc6841d 100644 --- a/app/src/main/java/com/gaurav/avnc/ui/vnc/gl/FrameProgram.kt +++ b/app/src/main/java/com/gaurav/avnc/ui/vnc/gl/FrameProgram.kt @@ -9,6 +9,7 @@ package com.gaurav.avnc.ui.vnc.gl import android.opengl.GLES20.* +import android.os.SystemClock import android.util.Log /** @@ -34,6 +35,7 @@ class FrameProgram { val uProjectionLocation = glGetUniformLocation(program, U_PROJECTION) val uTexUnitLocation = glGetUniformLocation(program, U_TEXTURE_UNIT) val textureId = createTexture() + var lastValidationTime = 0L fun setUniforms(projectionMatrix: FloatArray) { @@ -58,6 +60,14 @@ class FrameProgram { return texturesObjects[0] } + fun validateProgram() { + val now = SystemClock.uptimeMillis() / 1000 + if (now - lastValidationTime >= 3) { + lastValidationTime = now + ShaderCompiler.validateProgram(program) + } + } + fun useProgram() { glUseProgram(program) } diff --git a/app/src/main/java/com/gaurav/avnc/ui/vnc/gl/Renderer.kt b/app/src/main/java/com/gaurav/avnc/ui/vnc/gl/Renderer.kt index dea87d8..581e8e0 100644 --- a/app/src/main/java/com/gaurav/avnc/ui/vnc/gl/Renderer.kt +++ b/app/src/main/java/com/gaurav/avnc/ui/vnc/gl/Renderer.kt @@ -91,6 +91,8 @@ class Renderer(val viewModel: VncViewModel) : GLSurfaceView.Renderer { frame.updateFbSize(state.fbWidth, state.fbHeight) frame.bind(program) + + program.validateProgram() frame.draw() } } \ No newline at end of file diff --git a/app/src/main/java/com/gaurav/avnc/ui/vnc/gl/ShaderCompiler.kt b/app/src/main/java/com/gaurav/avnc/ui/vnc/gl/ShaderCompiler.kt index 80d88f6..8db6f76 100644 --- a/app/src/main/java/com/gaurav/avnc/ui/vnc/gl/ShaderCompiler.kt +++ b/app/src/main/java/com/gaurav/avnc/ui/vnc/gl/ShaderCompiler.kt @@ -10,7 +10,6 @@ package com.gaurav.avnc.ui.vnc.gl import android.opengl.GLES20.* import android.util.Log -import com.gaurav.avnc.BuildConfig object ShaderCompiler { @@ -77,8 +76,8 @@ object ShaderCompiler { return 0 val programId = linkProgram(vertexShaderId, fragmentShaderId) - if (BuildConfig.DEBUG) - validateProgram(programId) + //if (BuildConfig.DEBUG) + // validateProgram(programId) return programId } } \ No newline at end of file diff --git a/app/src/main/java/com/gaurav/avnc/util/SpinnerEx.kt b/app/src/main/java/com/gaurav/avnc/util/SpinnerEx.kt index 69a6244..aaedff3 100644 --- a/app/src/main/java/com/gaurav/avnc/util/SpinnerEx.kt +++ b/app/src/main/java/com/gaurav/avnc/util/SpinnerEx.kt @@ -44,10 +44,12 @@ class SpinnerEx(context: Context, attrs: AttributeSet? = null) : AppCompatSpinne .compositeOverlayWithThemeSurfaceColorIfNeeded(popupElevation) val background = popupBackground + /* if (background is GradientDrawable) background.setColor(overlay) else background.setTint(overlay) + */ } /** @@ -81,4 +83,4 @@ class SpinnerEx(context: Context, attrs: AttributeSet? = null) : AppCompatSpinne fun setEntries(entries: Map, initialValue: Int, selectionListener: (Int) -> Unit) { setEntries(entries.keys.toTypedArray(), entries.values.toTypedArray(), initialValue, selectionListener) } -} \ No newline at end of file +} diff --git a/app/src/main/java/com/gaurav/avnc/vnc/VncClient.kt b/app/src/main/java/com/gaurav/avnc/vnc/VncClient.kt index a60576f..eec11c4 100644 --- a/app/src/main/java/com/gaurav/avnc/vnc/VncClient.kt +++ b/app/src/main/java/com/gaurav/avnc/vnc/VncClient.kt @@ -182,7 +182,7 @@ class VncClient(private val observer: Observer) { * Sends text to remote desktop's clipboard. */ fun sendCutText(text: String) = executeSend { - nativeSendCutText(nativePtr, text.toByteArray(StandardCharsets.ISO_8859_1)) + //nativeSendCutText(nativePtr, text.toByteArray(StandardCharsets.ISO_8859_1)) } /** @@ -277,4 +277,4 @@ class VncClient(private val observer: Observer) { initLibrary() } } -} \ No newline at end of file +} diff --git a/app/src/main/res/drawable/bg_circular_button.xml b/app/src/main/res/drawable/bg_circular_button.xml index 69aec86..c0034f9 100644 --- a/app/src/main/res/drawable/bg_circular_button.xml +++ b/app/src/main/res/drawable/bg_circular_button.xml @@ -7,19 +7,19 @@ --> - + - + + android:color="#aaaaaa" /> - \ No newline at end of file + diff --git a/app/src/main/res/drawable/bg_round_rect.xml b/app/src/main/res/drawable/bg_round_rect.xml index 48c4348..8ac3594 100644 --- a/app/src/main/res/drawable/bg_round_rect.xml +++ b/app/src/main/res/drawable/bg_round_rect.xml @@ -8,9 +8,9 @@ - + + android:color="#aaaaaa" /> \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_toggle_button.xml b/app/src/main/res/drawable/bg_toggle_button.xml index 145bf64..be923d7 100644 --- a/app/src/main/res/drawable/bg_toggle_button.xml +++ b/app/src/main/res/drawable/bg_toggle_button.xml @@ -8,6 +8,6 @@ - + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_urlbar.xml b/app/src/main/res/drawable/bg_urlbar.xml index f06e506..06bc8fa 100644 --- a/app/src/main/res/drawable/bg_urlbar.xml +++ b/app/src/main/res/drawable/bg_urlbar.xml @@ -7,12 +7,12 @@ --> - + - + - \ No newline at end of file + diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml index 55a7e5d..8ea23f6 100644 --- a/app/src/main/res/drawable/ic_launcher_background.xml +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -29,10 +29,10 @@ android:startY="192.98738" android:type="linear"> diff --git a/app/src/main/res/drawable/indicator.xml b/app/src/main/res/drawable/indicator.xml index a98f60c..07949d0 100644 --- a/app/src/main/res/drawable/indicator.xml +++ b/app/src/main/res/drawable/indicator.xml @@ -11,5 +11,5 @@ - + \ No newline at end of file