mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-06 04:55:44 +00:00
fix(input): count the deck surface and check Steam Touch by visibility for tap suppression
This commit is contained in:
1 parent
9cb876e1e4
commit
8c3d6cfaad
4 files changed
+61
-14
No files matched your search
@@ -4081,11 +4081,11 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
}
|
||||
|
||||
private fun onScreenMouseButtonShown(): Boolean {
|
||||
if (steamTouchInUse) return false
|
||||
return listOfNotNull(unfoldedPanel, bottomInputControls, onScreenControls).any {
|
||||
it.visibility == View.VISIBLE && !it.isButtonsOnly &&
|
||||
inputProfile.hasMouseButton(InputRole.PRIMARY, it.shownElements())
|
||||
}
|
||||
if (steamTouchControls?.visibility == View.VISIBLE) return false
|
||||
val controls = listOfNotNull(unfoldedPanel, bottomInputControls, onScreenControls)
|
||||
.filter { it.visibility == View.VISIBLE && !it.isButtonsOnly }.map { it.shownElements() }
|
||||
val deck = listOfNotNull(unfoldedDeckSurface?.takeIf { it.visibility == View.VISIBLE }?.shownElements())
|
||||
return (controls + deck).any { inputProfile.hasMouseButton(InputRole.PRIMARY, it) }
|
||||
}
|
||||
|
||||
private val directTouchSink = object : DirectTouchHold.Touch {
|
||||
|
||||
@@ -80,19 +80,15 @@ class OnScreenControls(context: Context, pad: PadBridge?, val dock: OnScreenLayo
|
||||
}
|
||||
}
|
||||
|
||||
private fun requestedElements(): List<InputSurfaceElement> {
|
||||
fun shownElements() = surface.shownElements()
|
||||
|
||||
private fun render() {
|
||||
val elements = placed()
|
||||
return when {
|
||||
surface.updateCustomLayout(when {
|
||||
isPinnedOnly -> elements.filter { it.alwaysShown }
|
||||
isQuickHidden -> elements.filter { it.id == "builtin:keyboard" || it.alwaysShown }
|
||||
else -> elements
|
||||
}
|
||||
}
|
||||
|
||||
fun shownElements() = (layout?.style ?: InputSurfaceStyle()).shown(requestedElements())
|
||||
|
||||
private fun render() {
|
||||
surface.updateCustomLayout(requestedElements())
|
||||
})
|
||||
val style = layout?.style ?: InputSurfaceStyle()
|
||||
surface.updateStyle(style)
|
||||
quickToggle.tint = style.tint
|
||||
|
||||
@@ -158,6 +158,8 @@ class InputSurfaceView(
|
||||
}
|
||||
}
|
||||
|
||||
fun shownElements() = customLayout
|
||||
|
||||
fun releaseInputs() {
|
||||
val now = android.os.SystemClock.uptimeMillis()
|
||||
val cancel = MotionEvent.obtain(now, now, MotionEvent.ACTION_CANCEL, 0f, 0f, 0)
|
||||
|
||||
Reference in new issue
Block a user