mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-22 14:26:00 +00:00
Log session drawer controller routing
This commit is contained in:
1 parent
2853962c10
commit
2b25e9bedd
3 files changed
+15
-2
No files matched your search
@@ -197,7 +197,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
if (drawerOpen) {
|
if (drawerOpen) {
|
||||||
padBridge?.releaseAll()
|
padBridge?.releaseAll()
|
||||||
androidx.compose.runtime.withFrameNanos { }
|
androidx.compose.runtime.withFrameNanos { }
|
||||||
sessionOverlay.requestFocus()
|
val requested = sessionOverlay.requestFocus()
|
||||||
|
Log.i(TAG, "drawer root focus requested=$requested focused=${sessionOverlay.hasFocus()}")
|
||||||
} else {
|
} else {
|
||||||
releaseDrawerDirection()
|
releaseDrawerDirection()
|
||||||
}
|
}
|
||||||
@@ -676,6 +677,9 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
}
|
}
|
||||||
if (drawerOpen) {
|
if (drawerOpen) {
|
||||||
val handled = super.dispatchKeyEvent(event)
|
val handled = super.dispatchKeyEvent(event)
|
||||||
|
if (event.action == KeyEvent.ACTION_DOWN) {
|
||||||
|
Log.i(TAG, "drawer key=${KeyEvent.keyCodeToString(event.keyCode)} handled=$handled viewFocused=${sessionOverlay.hasFocus()}")
|
||||||
|
}
|
||||||
if (event.keyCode == KeyEvent.KEYCODE_BUTTON_B || event.keyCode == KeyEvent.KEYCODE_BACK) {
|
if (event.keyCode == KeyEvent.KEYCODE_BUTTON_B || event.keyCode == KeyEvent.KEYCODE_BACK) {
|
||||||
if (!handled && event.action == KeyEvent.ACTION_DOWN && event.repeatCount == 0) drawerOpen = false
|
if (!handled && event.action == KeyEvent.ACTION_DOWN && event.repeatCount == 0) drawerOpen = false
|
||||||
releaseDrawerDirection()
|
releaseDrawerDirection()
|
||||||
@@ -769,6 +773,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
}
|
}
|
||||||
val now = SystemClock.uptimeMillis()
|
val now = SystemClock.uptimeMillis()
|
||||||
if (keyCode != drawerDirectionKey) {
|
if (keyCode != drawerDirectionKey) {
|
||||||
|
Log.i(TAG, "drawer axis source=${event.source} x=$x y=$y direction=$keyCode")
|
||||||
releaseDrawerDirection()
|
releaseDrawerDirection()
|
||||||
if (keyCode == KeyEvent.KEYCODE_UNKNOWN) return
|
if (keyCode == KeyEvent.KEYCODE_UNKNOWN) return
|
||||||
drawerDirectionKey = keyCode
|
drawerDirectionKey = keyCode
|
||||||
@@ -794,6 +799,9 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
drawerDirectionDownTime, eventTime, action, drawerDirectionKey,
|
drawerDirectionDownTime, eventTime, action, drawerDirectionKey,
|
||||||
repeatCount, 0, drawerDirectionDeviceId, 0, 0, InputDevice.SOURCE_DPAD,
|
repeatCount, 0, drawerDirectionDeviceId, 0, 0, InputDevice.SOURCE_DPAD,
|
||||||
)
|
)
|
||||||
|
if (action == KeyEvent.ACTION_DOWN) {
|
||||||
|
Log.i(TAG, "drawer synthetic key=${KeyEvent.keyCodeToString(drawerDirectionKey)} viewFocused=${sessionOverlay.hasFocus()}")
|
||||||
|
}
|
||||||
super.dispatchKeyEvent(event)
|
super.dispatchKeyEvent(event)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ import androidx.compose.runtime.setValue
|
|||||||
import androidx.compose.ui.draw.clip
|
import androidx.compose.ui.draw.clip
|
||||||
import androidx.compose.ui.focus.FocusRequester
|
import androidx.compose.ui.focus.FocusRequester
|
||||||
import androidx.compose.ui.focus.focusRequester
|
import androidx.compose.ui.focus.focusRequester
|
||||||
|
import androidx.compose.ui.focus.onFocusChanged
|
||||||
import androidx.compose.ui.graphics.Brush
|
import androidx.compose.ui.graphics.Brush
|
||||||
import androidx.compose.ui.graphics.graphicsLayer
|
import androidx.compose.ui.graphics.graphicsLayer
|
||||||
import androidx.compose.ui.input.InputMode
|
import androidx.compose.ui.input.InputMode
|
||||||
@@ -277,7 +278,10 @@ fun SessionDrawer(open: Boolean, a: DrawerActions) {
|
|||||||
onClick = { host.open = null; a.onSteamMenu.invoke() },
|
onClick = { host.open = null; a.onSteamMenu.invoke() },
|
||||||
interactionSource = steamSrc,
|
interactionSource = steamSrc,
|
||||||
modifier = Modifier.weight(1f).height(48.dp).focusRequester(firstFocus)
|
modifier = Modifier.weight(1f).height(48.dp).focusRequester(firstFocus)
|
||||||
.onFocusChanged { firstControlFocused = it.isFocused }.controllerConfirm {
|
.onFocusChanged {
|
||||||
|
firstControlFocused = it.isFocused
|
||||||
|
android.util.Log.i("SessionDrawer", "first control focused=${it.isFocused}")
|
||||||
|
}.controllerConfirm {
|
||||||
host.open = null
|
host.open = null
|
||||||
a.onSteamMenu.invoke()
|
a.onSteamMenu.invoke()
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -122,6 +122,7 @@ fun AnchoredMenu(open: Boolean, onDismiss: () -> Unit, title: String? = null, no
|
|||||||
if (open) {
|
if (open) {
|
||||||
repeat(2) { androidx.compose.runtime.withFrameNanos { } }
|
repeat(2) { androidx.compose.runtime.withFrameNanos { } }
|
||||||
runCatching { firstItemFocus.requestFocus() }
|
runCatching { firstItemFocus.requestFocus() }
|
||||||
|
android.util.Log.i("AnchoredMenu", "requested first option focus")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val gap = with(LocalDensity.current) { 6.dp.roundToPx() }
|
val gap = with(LocalDensity.current) { 6.dp.roundToPx() }
|
||||||
|
|||||||
Reference in new issue
Block a user