Compare commits

...
Author SHA1 Message Date
maxjivi05 257efdaf3d fix: moving a mouse no longer recomposes the whole session overlay
The session overlay read the cursor position while composing, so every mouse
move rebuilt the overlay (HUD, glasses hints and the rest) on the UI thread.
The cursor now reads its position while drawing, so a move only redraws the
cursor.

Part of #1247
2026-10-21 06:19:54 -04:00
2 changed files with 3 additions and 2 deletions

No files matched your search

@@ -636,7 +636,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
}
} else {
com.droiddeck.launcher.ui.FocusGlideHost(androidx.compose.ui.Modifier.fillMaxSize()) {
CursorOverlay(cursorPos, cursorVisible, resources.displayMetrics.density,
CursorOverlay({ cursorPos }, cursorVisible, resources.displayMetrics.density,
cursorImage, cursorHotX, cursorHotY, cursorImageScale)
if (hud.text.isNotEmpty()) HudText(hud.text)
if (glassesOutputActive && !loading.visible) com.droiddeck.launcher.ui.GlassesPlayingHint(glasses.model)
@@ -13,11 +13,12 @@ import androidx.compose.ui.graphics.drawscope.Stroke
@Composable
fun CursorOverlay(
position: Offset, visible: Boolean, scale: Float,
positionOf: () -> Offset, visible: Boolean, scale: Float,
image: ImageBitmap? = null, hotX: Int = 0, hotY: Int = 0, imageScale: Float = 1f,
) {
if (!visible) return
Canvas(modifier = Modifier.fillMaxSize()) {
val position = positionOf()
if (image != null) {
val w = (image.width * imageScale).toInt().coerceAtLeast(1)
val h = (image.height * imageScale).toInt().coerceAtLeast(1)