mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-20 05:16:01 +00:00
Feat/gpu drivers redesign (#858)
This commit is contained in:
1 parent
7c90879b39
commit
23479d15f5
47 files changed
+556
-139
No files matched your search
@@ -21,7 +21,12 @@ import com.droiddeck.launcher.gpu.TurnipReleases
|
||||
import com.droiddeck.launcher.session.SessionService
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import com.droiddeck.launcher.session.QuestExperimental
|
||||
import com.droiddeck.launcher.session.SessionState
|
||||
import com.droiddeck.launcher.ui.DriverRow
|
||||
import com.droiddeck.launcher.ui.DriverSlot
|
||||
import com.droiddeck.launcher.ui.GPU_MODE_AUTO
|
||||
import com.droiddeck.launcher.ui.GPU_MODE_MIX
|
||||
import com.droiddeck.launcher.ui.GPU_MODE_PAIR
|
||||
import com.droiddeck.launcher.ui.GpuDriversState
|
||||
import com.droiddeck.launcher.ui.PairRow
|
||||
import com.droiddeck.launcher.wayland.CompositorHost
|
||||
@@ -43,6 +48,17 @@ internal class DriverMenus(private val activity: Activity, private val ui: Handl
|
||||
var autoStatus by mutableStateOf("")
|
||||
var activeBundle by mutableStateOf<String?>(null)
|
||||
private var autoCheckedThisProcess = false
|
||||
private var pairModeOpen by mutableStateOf(false)
|
||||
var restartPending by mutableStateOf(false)
|
||||
private set
|
||||
private var runtimePending by mutableStateOf(false)
|
||||
private var sessionRunning by mutableStateOf(false)
|
||||
|
||||
val uiMode: String get() = when (mode) {
|
||||
SessionPrefs.GPU_DRIVERS_AUTO -> GPU_MODE_AUTO
|
||||
SessionPrefs.GPU_DRIVERS_MIX -> GPU_MODE_MIX
|
||||
else -> if (pairModeOpen || pairRows.any { it.active }) GPU_MODE_PAIR else GPU_MODE_MIX
|
||||
}
|
||||
|
||||
fun state() = GpuDriversState(
|
||||
gpuName = gpu.displayName(activity), gpuFamily = gpu.family.label(activity), soc = gpu.soc, supportText = gpu.supportText(activity),
|
||||
@@ -52,7 +68,56 @@ internal class DriverMenus(private val activity: Activity, private val ui: Handl
|
||||
linuxRows = linuxRows, linuxSelected = linuxSelected, androidRows = androidRows, androidSelected = androidSelected,
|
||||
linuxDownloads = linuxDownloads, androidDownloads = androidDownloads, canRestoreBundled = canRestoreBundled,
|
||||
activeBundle = activeBundle,
|
||||
mode = uiMode, display = displaySlot(), runtime = runtimeSlot(),
|
||||
canRestart = !sessionRunning,
|
||||
checkedAt = TurnipReleases.cached(activity)?.checkedAt ?: 0L,
|
||||
)
|
||||
|
||||
private fun slotSource(chosenDefault: Boolean, defaultLabel: Int): String = activity.getString(when {
|
||||
uiMode == GPU_MODE_AUTO -> R.string.gpu_src_auto
|
||||
uiMode == GPU_MODE_PAIR && pairRows.any { it.active } -> R.string.gpu_src_pair
|
||||
activeBundle != null -> R.string.gpu_src_bundle
|
||||
chosenDefault -> defaultLabel
|
||||
else -> R.string.gpu_src_chosen
|
||||
})
|
||||
|
||||
private fun displaySlot(): DriverSlot {
|
||||
val row = androidRows.firstOrNull { it.id == androidSelected }
|
||||
val live = androidRows.firstOrNull { it.id == CompositorHost.displayChoice }?.name
|
||||
return DriverSlot(
|
||||
name = row?.name ?: activity.getString(R.string.gpu_auto_by_gpu),
|
||||
source = slotSource(androidSelected == TurnipDriver.AUTO, R.string.gpu_src_by_gpu),
|
||||
pending = restartPending,
|
||||
status = when {
|
||||
restartPending -> activity.getString(R.string.gpu_display_pending, live ?: activity.getString(R.string.gpu_previous_driver))
|
||||
CompositorHost.isStarted -> activity.getString(R.string.gpu_display_live)
|
||||
else -> activity.getString(R.string.gpu_display_next)
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
private fun runtimeSlot(): DriverSlot {
|
||||
val row = linuxRows.firstOrNull { it.id == linuxSelected }
|
||||
val live = SessionState.runtimeDriver?.let { id -> linuxRows.firstOrNull { it.id == id }?.name }
|
||||
return DriverSlot(
|
||||
name = row?.name ?: activity.getString(R.string.gpu_runtime_default),
|
||||
source = slotSource(linuxSelected.isEmpty(), R.string.gpu_src_default),
|
||||
pending = runtimePending,
|
||||
status = when {
|
||||
runtimePending -> activity.getString(R.string.gpu_runtime_pending, live ?: activity.getString(R.string.gpu_previous_driver))
|
||||
sessionRunning -> activity.getString(R.string.gpu_runtime_live)
|
||||
else -> activity.getString(R.string.gpu_runtime_hint)
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
fun restartApp() {
|
||||
if (SessionState.running) return
|
||||
val launch = activity.packageManager.getLaunchIntentForPackage(activity.packageName) ?: return
|
||||
activity.startActivity(android.content.Intent.makeRestartActivityTask(launch.component)
|
||||
.putExtra(com.droiddeck.launcher.stores.download.StoreDownloadService.EXTRA_NAV, "components"))
|
||||
Runtime.getRuntime().exit(0)
|
||||
}
|
||||
var androidRows by mutableStateOf<List<DriverRow>>(emptyList())
|
||||
var androidSelected by mutableStateOf("")
|
||||
|
||||
@@ -90,14 +155,23 @@ internal class DriverMenus(private val activity: Activity, private val ui: Handl
|
||||
canRestoreBundled = td.hiddenBundled().isNotEmpty()
|
||||
androidSelected = SessionPrefs.androidDriver(activity)
|
||||
activeBundle = DriverBundle.active(activity)?.label
|
||||
restartPending = CompositorHost.isStarted && CompositorHost.displayChoice.let { it != null && it != androidSelected }
|
||||
sessionRunning = SessionState.running
|
||||
runtimePending = sessionRunning && SessionState.runtimeDriver.let { it != null && it != linuxSelected }
|
||||
refreshReleaseRows()
|
||||
refreshPairs()
|
||||
}
|
||||
|
||||
fun summary(): String {
|
||||
val active = pairRows.firstOrNull { it.active }?.name ?: activeBundle
|
||||
val label = activity.getString(if (mode == SessionPrefs.GPU_DRIVERS_AUTO) R.string.common_auto else R.string.drivers_manual)
|
||||
return active?.let { activity.getString(R.string.drivers_summary, label, it) } ?: label
|
||||
val display = displaySlot().name
|
||||
val base = when {
|
||||
uiMode == GPU_MODE_AUTO -> activity.getString(R.string.drivers_summary, activity.getString(R.string.common_auto), active ?: display)
|
||||
uiMode == GPU_MODE_PAIR && active != null -> activity.getString(R.string.drivers_summary, activity.getString(R.string.gpu_mode_pair_short), active)
|
||||
else -> activity.getString(R.string.drivers_summary, activity.getString(R.string.gpu_mode_mix_short),
|
||||
runtimeSlot().name.let { if (it == display) it else activity.getString(R.string.gpu_summary_mix, display, it) })
|
||||
}
|
||||
return if (restartPending) activity.getString(R.string.gpu_summary_restart, base) else base
|
||||
}
|
||||
|
||||
fun refreshPairs() {
|
||||
@@ -121,8 +195,17 @@ internal class DriverMenus(private val activity: Activity, private val ui: Handl
|
||||
}.sortedByDescending { it.recommended }
|
||||
}
|
||||
|
||||
fun setMode(auto: Boolean) {
|
||||
mode = if (auto) SessionPrefs.GPU_DRIVERS_AUTO else SessionPrefs.GPU_DRIVERS_MANUAL
|
||||
fun chooseMode(next: String) {
|
||||
pairModeOpen = next == GPU_MODE_PAIR
|
||||
setMode(auto = next == GPU_MODE_AUTO, mix = next == GPU_MODE_MIX)
|
||||
}
|
||||
|
||||
fun setMode(auto: Boolean, mix: Boolean = false) {
|
||||
mode = when {
|
||||
auto -> SessionPrefs.GPU_DRIVERS_AUTO
|
||||
mix -> SessionPrefs.GPU_DRIVERS_MIX
|
||||
else -> SessionPrefs.GPU_DRIVERS_MANUAL
|
||||
}
|
||||
SessionPrefs.setGpuDriverMode(activity, mode)
|
||||
autoStatus = ""
|
||||
if (auto) ensureAuto(force = false)
|
||||
@@ -174,6 +257,8 @@ internal class DriverMenus(private val activity: Activity, private val ui: Handl
|
||||
fun selectPair(key: String) {
|
||||
if (pairBusy != null) return
|
||||
val pair = DriverPairs.from(TurnipReleases.cached(activity)).firstOrNull { it.key == key && it.complete } ?: return
|
||||
pairModeOpen = true
|
||||
if (mode != SessionPrefs.GPU_DRIVERS_MANUAL) setMode(auto = false)
|
||||
installPair(pair, auto = false)
|
||||
}
|
||||
|
||||
@@ -304,14 +389,15 @@ internal class DriverMenus(private val activity: Activity, private val ui: Handl
|
||||
linux -> SessionPrefs.setLinuxDriver(activity, id)
|
||||
else -> SessionPrefs.setAndroidDriver(activity, id)
|
||||
}
|
||||
setMode(false)
|
||||
pairModeOpen = false
|
||||
setMode(auto = false, mix = true)
|
||||
refreshDrivers()
|
||||
}
|
||||
|
||||
private fun useBundle(bundle: DriverBundle.Bundle): String {
|
||||
val displayChanged = SessionPrefs.androidDriver(activity) != bundle.androidId
|
||||
DriverBundle.select(activity, bundle)
|
||||
if (mode == SessionPrefs.GPU_DRIVERS_AUTO) setMode(false)
|
||||
if (mode == SessionPrefs.GPU_DRIVERS_AUTO) setMode(auto = false, mix = true)
|
||||
return activity.getString(
|
||||
if (displayChanged && CompositorHost.isStarted) R.string.drivers_using_bundle_restart else R.string.drivers_using_bundle,
|
||||
bundle.label,
|
||||
|
||||
@@ -1209,6 +1209,8 @@ class MainActivity : ComponentActivity() {
|
||||
onImportAndroid = { pickAndroidDriver.launch(InAppFilePicker.buildIntent(this, ZIP_EXT, getString(R.string.drivers_pick_android))) },
|
||||
onImportZip = { pickAnyDriver.launch(InAppFilePicker.buildIntent(this, ZIP_EXT, getString(R.string.drivers_pick_any))) },
|
||||
onRestoreBundled = { TurnipDriver(this).restoreBundled(); drivers.refreshDrivers() },
|
||||
onMode = { m -> drivers.chooseMode(m) },
|
||||
onRestart = { drivers.restartApp() },
|
||||
),
|
||||
protons = com.droiddeck.launcher.ui.ProtonsState(
|
||||
rows = protons.protonRows, busyId = protons.protonBusyId, stage = protons.protonStage, percent = protons.protonPercent,
|
||||
@@ -1592,6 +1594,7 @@ class MainActivity : ComponentActivity() {
|
||||
|
||||
private fun refresh() {
|
||||
if (!busy && LinuxRuntimeInstaller.isBusy()) followRuntimeOperation { LinuxRuntimeInstaller.attach(it) }
|
||||
if (showComponents) drivers.refreshDrivers()
|
||||
addedGamesArt = SessionPrefs.addedGamesArt(this)
|
||||
desktopInstalled = DesktopCatalog.desktopInstalled(this)
|
||||
desktopPresent = DesktopCatalog.desktopPresent(this)
|
||||
|
||||
@@ -239,6 +239,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
private var leaving by mutableStateOf(false)
|
||||
private var closeAtOnce = false
|
||||
private var drawerComponents by mutableStateOf<ComponentsManager.Snapshot?>(null)
|
||||
private var drawerDefaultProton by mutableStateOf<String?>(null)
|
||||
private val drawerComponentMenu by lazy { ComponentsMenu(this, uiHandler) }
|
||||
private var drawerGameProfileId by mutableStateOf<Long?>(null)
|
||||
private val drawerGameInventory = GameProfileInventoryCache<Library.SteamGame>()
|
||||
@@ -740,6 +741,9 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
onGameNoSteam = ::setDrawerGameNoSteam,
|
||||
onComponentSwap = { pid, comp, value -> swapDrawerComponent(pid, comp, value) },
|
||||
onGameComponent = ::setDrawerGameComponent,
|
||||
defaultProtonId = drawerDefaultProton,
|
||||
onDefaultProton = ::chooseDrawerDefaultProton,
|
||||
onGameProton = ::setDrawerGameProton,
|
||||
))
|
||||
LaunchedEffect(achievementsOpen) {
|
||||
if (achievementsOpen) {
|
||||
@@ -859,8 +863,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
Thread({
|
||||
val applied = runCatching { ComponentsManager.applyQueued(this) }.getOrDefault(emptyList())
|
||||
val snap = runCatching { ComponentsManager.snapshot(this) }.getOrNull()
|
||||
val chosen = snap?.let { s -> runCatching { ProtonDefault.selectedId(this, s.protons.map { it.proton }) }.getOrNull() }
|
||||
uiHandler.post {
|
||||
drawerComponents = snap
|
||||
drawerDefaultProton = chosen
|
||||
if (applied.isNotEmpty()) android.widget.Toast.makeText(this, getString(R.string.main_applied, applied.joinToString(", ")), android.widget.Toast.LENGTH_LONG).show()
|
||||
}
|
||||
}, "drawer-components").start()
|
||||
@@ -1004,6 +1010,46 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
}, "drawer-game-component").start()
|
||||
}
|
||||
|
||||
private fun chooseDrawerDefaultProton(protonId: String) {
|
||||
val proton = drawerComponents?.protons?.firstOrNull { it.proton.id == protonId }?.proton ?: return
|
||||
drawerDefaultProton = protonId
|
||||
Thread({
|
||||
val message = runCatching {
|
||||
when (ProtonDefault.request(this, proton)) {
|
||||
ProtonDefault.Outcome.LIVE -> getString(R.string.comp_default_live, proton.name)
|
||||
ProtonDefault.Outcome.NEXT_START -> getString(R.string.comp_default_next, proton.name)
|
||||
ProtonDefault.Outcome.NOT_RUNNABLE -> getString(R.string.comp_default_not_runnable, proton.name)
|
||||
}
|
||||
}.getOrElse { e -> getString(R.string.comp_default_failed, e.message ?: e.javaClass.simpleName) }
|
||||
uiHandler.post {
|
||||
Toast.makeText(this, message, Toast.LENGTH_LONG).show()
|
||||
refreshDrawerComponents()
|
||||
refreshDrawerGameProfile()
|
||||
}
|
||||
}, "drawer-default-proton").start()
|
||||
}
|
||||
|
||||
private fun setDrawerGameProton(appId: Long, protonId: String?) {
|
||||
val name = drawerGameProfileRefresh.data?.profiles?.firstOrNull { it.first == appId }?.second ?: appId.toString()
|
||||
val proton = protonId?.let { id -> drawerComponents?.protons?.firstOrNull { it.proton.id == id }?.proton ?: return }
|
||||
Thread({
|
||||
val message = runCatching {
|
||||
getString(
|
||||
when (ProtonDefault.requestGame(this, appId.toString(), proton)) {
|
||||
ProtonDefault.Outcome.LIVE -> R.string.comp_game_proton_live
|
||||
ProtonDefault.Outcome.NEXT_START -> R.string.comp_game_proton_next
|
||||
ProtonDefault.Outcome.NOT_RUNNABLE -> R.string.comp_game_proton_not_runnable
|
||||
},
|
||||
name,
|
||||
)
|
||||
}.getOrElse { e -> getString(R.string.session_profile_save_failed, e.message ?: e.javaClass.simpleName) }
|
||||
uiHandler.post {
|
||||
Toast.makeText(this, message, Toast.LENGTH_LONG).show()
|
||||
refreshDrawerGameProfile()
|
||||
}
|
||||
}, "drawer-game-proton").start()
|
||||
}
|
||||
|
||||
private fun setDrawerGameFexPreset(appId: Long, preset: String?) {
|
||||
if (drawerGameFexPresetSaving) return
|
||||
drawerGameFexPresetSaving = true
|
||||
@@ -1251,6 +1297,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
|
||||
val turnip = TurnipDriver(this)
|
||||
com.droiddeck.launcher.gpu.DriverSetupLog.write(this, "surface.driver-setup")
|
||||
if (!CompositorHost.isStarted) CompositorHost.displayChoice = SessionPrefs.androidDriver(this)
|
||||
val driverId = if (CompositorHost.isStarted) null else turnip.install()
|
||||
|
||||
val previous = SessionState.outputSize
|
||||
|
||||
@@ -201,6 +201,7 @@ object SessionPrefs {
|
||||
|
||||
const val GPU_DRIVERS_AUTO = "auto"
|
||||
const val GPU_DRIVERS_MANUAL = "manual"
|
||||
const val GPU_DRIVERS_MIX = "mix"
|
||||
|
||||
fun gpuDriverMode(context: Context): String =
|
||||
prefs(context).getString("gpuDriverMode", GPU_DRIVERS_AUTO) ?: GPU_DRIVERS_AUTO
|
||||
|
||||
@@ -538,6 +538,7 @@ class SessionService : Service() {
|
||||
guest.add("LIBGL_KOPPER_DRI2=true")
|
||||
LinuxRuntime.vulkanIcd(this)?.let { guest.add("VK_ICD_FILENAMES=" + it.path) }
|
||||
val linuxDriverId = SessionPrefs.linuxDriver(this)
|
||||
SessionState.runtimeDriver = linuxDriverId
|
||||
LinuxVulkanDriver.resolveIcdPath(this, linuxDriverId)
|
||||
?.let { guest.add(LinuxVulkanDriver.ENV + "=" + it) }
|
||||
tuDebug(linuxDriverId)?.let { guest.add("TU_DEBUG=$it") }
|
||||
|
||||
@@ -41,6 +41,8 @@ object SessionState {
|
||||
|
||||
@Volatile
|
||||
var running = false
|
||||
@Volatile
|
||||
var runtimeDriver: String? = null
|
||||
var suspended by mutableStateOf(false)
|
||||
@Volatile var pipActive = false
|
||||
@Volatile
|
||||
|
||||
@@ -56,6 +56,7 @@ import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.focus.FocusRequester
|
||||
import androidx.compose.ui.focus.focusProperties
|
||||
import androidx.compose.ui.focus.focusRequester
|
||||
import androidx.compose.ui.focus.onFocusChanged
|
||||
import androidx.compose.ui.geometry.Offset
|
||||
@@ -101,7 +102,7 @@ const val GPU_TAB = "gpu"
|
||||
|
||||
const val PROTON_TAB = "proton"
|
||||
|
||||
internal val LAYERS = listOf(PROTON_TAB, "dxvk", "vkd3d", "fex", GPU_TAB)
|
||||
internal val LAYERS = listOf(GPU_TAB, PROTON_TAB, "dxvk", "vkd3d", "fex")
|
||||
|
||||
internal fun layerStep(current: String, by: Int): String {
|
||||
val i = LAYERS.indexOf(current).coerceAtLeast(0)
|
||||
@@ -127,6 +128,7 @@ private val QUEUED = Color(0xFFFFB86B)
|
||||
private val ROW_SHAPE = RoundedCornerShape(10.dp)
|
||||
private val LAYER_SHAPE = RoundedCornerShape(12.dp)
|
||||
|
||||
@OptIn(androidx.compose.ui.ExperimentalComposeUiApi::class)
|
||||
@Composable
|
||||
fun ComponentsPage(
|
||||
snapshot: Snapshot?,
|
||||
@@ -417,12 +419,14 @@ fun ComponentsPage(
|
||||
var driverShown by remember { mutableStateOf<String?>(null) }
|
||||
var driverLeaving by remember { mutableStateOf(false) }
|
||||
var driverFrom by remember { mutableStateOf<Origin?>(null) }
|
||||
val slotFocus = remember { mapOf(SLOT_DISPLAY to FocusRequester(), SLOT_RUNTIME to FocusRequester()) }
|
||||
LaunchedEffect(driverPage) {
|
||||
val d = driverPage
|
||||
if (d != null) { driverLeaving = false; driverShown = d }
|
||||
else if (driverShown != null) {
|
||||
else driverShown?.let { closed ->
|
||||
if (driverFrom != null) { driverLeaving = true; delay(Motion.ms(PAGE_RETURN_MS).toLong()) }
|
||||
driverShown = null; driverLeaving = false; driverFrom = null
|
||||
if (inputMode.inputMode == InputMode.Keyboard) focusSoon { slotFocus.getValue(closed) }
|
||||
}
|
||||
}
|
||||
var narrowOpen by rememberSaveable { mutableStateOf<String?>(null) }
|
||||
@@ -467,16 +471,6 @@ fun ComponentsPage(
|
||||
val compState = { l: String -> view?.components?.get(l) }
|
||||
val bar: @Composable (String) -> Unit = { l ->
|
||||
when (l) {
|
||||
GPU_TAB -> {
|
||||
val active = gpu.activePair
|
||||
InUseBar(
|
||||
queued = gpu.busy != null,
|
||||
sentence = (active?.let { "${it.name} ${it.version}" } ?: gpu.activeBundle ?: stringResource(R.string.gpu_builtin))
|
||||
.let { if (gpu.auto) stringResource(R.string.gpu_bar_auto, it) else it },
|
||||
note = if (gpu.busy != null) (if (gpu.percent >= 0) "${gpu.percent}%" else "…")
|
||||
else gpu.autoStatus.ifEmpty { if (active != null || gpu.activeBundle != null) "" else gpu.pairs.firstOrNull { it.recommended }?.let { stringResource(R.string.gpu_recommended_for, it.name) } ?: stringResource(R.string.gpu_refresh_hint) },
|
||||
)
|
||||
}
|
||||
PROTON_TAB -> InUseBar(
|
||||
queued = false,
|
||||
sentence = view?.let { stringResource(R.string.comp_proton_bar, it.proton.name) } ?: stringResource(R.string.comp_no_proton),
|
||||
@@ -500,51 +494,20 @@ fun ComponentsPage(
|
||||
}
|
||||
}
|
||||
|
||||
var showAllPairs by rememberSaveable { mutableStateOf(false) }
|
||||
val installedTitle: @Composable (String) -> String = { l ->
|
||||
when (l) {
|
||||
GPU_TAB -> stringResource(R.string.comp_installed_count, 1 + gpu.pairs.count { it.installed && (it.suits || showAllPairs) })
|
||||
PROTON_TAB -> stringResource(R.string.comp_installed_count, views.size)
|
||||
else -> stringResource(R.string.comp_installed_count, installedFor(l, view, snapshot).size)
|
||||
}
|
||||
}
|
||||
val availableTitle: @Composable (String) -> String = { l ->
|
||||
when (l) {
|
||||
GPU_TAB -> stringResource(R.string.comp_available_count, gpu.pairs.count { !it.installed && it.complete && (it.suits || showAllPairs) })
|
||||
PROTON_TAB -> stringResource(R.string.comp_available_count, protons.rows.count { it.installed == null || it.update != null })
|
||||
else -> stringResource(R.string.comp_nightlies_count, availableFor(l, catalog, snapshot).size)
|
||||
}
|
||||
}
|
||||
val installedRows: @Composable ColumnScope.(String, Boolean) -> Unit = { l, right ->
|
||||
when (l) {
|
||||
GPU_TAB -> {
|
||||
val autoKey = "gpu:auto"
|
||||
ChoiceLine(
|
||||
stringResource(R.string.common_auto), stringResource(R.string.gpu_auto_keeps), gpu.auto, removable = false,
|
||||
modifier = Modifier.focusRequester(firstRow).trackRow(autoKey, rowsAt),
|
||||
onSelect = {
|
||||
if (gpu.auto) return@ChoiceLine
|
||||
ask(autoKey, right, ctx.getString(R.string.gpu_use_title, ctx.getString(R.string.common_auto)), ctx.getString(R.string.gpu_auto_hint), ctx.getString(R.string.common_use), false, ctx.getString(R.string.common_auto)) {
|
||||
gpuActions.onAuto(true); flyHome(autoKey, GPU_TAB)
|
||||
}
|
||||
},
|
||||
)
|
||||
for (p in gpu.pairs.filter { it.installed && (it.suits || showAllPairs) }) {
|
||||
val key = "gpu:${p.key}"
|
||||
ChoiceLine(
|
||||
p.name, "${p.version} · ${p.detail}", !gpu.auto && p.active, removable = false,
|
||||
badge = if (p.recommended) stringResource(R.string.gpu_recommended_caps) else null,
|
||||
progress = if (gpu.busy == p.key) gpu.percent else null,
|
||||
modifier = Modifier.trackRow(key, rowsAt),
|
||||
onSelect = {
|
||||
if (!gpu.auto && p.active || gpu.busy != null) return@ChoiceLine
|
||||
ask(key, right, ctx.getString(R.string.gpu_use_title, p.name), "${p.version} · ${p.detail}", ctx.getString(R.string.common_use), false, p.name) {
|
||||
gpuActions.onAuto(false); gpuActions.onPair(p.key); flyHome(key, GPU_TAB)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
PROTON_TAB -> {
|
||||
if (views.isEmpty()) EmptyLine(stringResource(if (snapshot == null) R.string.comp_reading else R.string.comp_no_proton))
|
||||
views.forEachIndexed { i, v ->
|
||||
@@ -599,17 +562,6 @@ fun ComponentsPage(
|
||||
}
|
||||
val availableRows: @Composable ColumnScope.(String) -> Unit = { l ->
|
||||
when (l) {
|
||||
GPU_TAB -> {
|
||||
val shown = gpu.pairs.filter { !it.installed && it.complete && (it.suits || showAllPairs) }
|
||||
if (shown.isEmpty()) EmptyLine(stringResource(if (gpu.checking) R.string.gpu_checking else R.string.gpu_none_listed))
|
||||
for (p in shown) GetLine(
|
||||
p.name, "${p.version} · ${p.detail}", progress = if (gpu.busy == p.key) gpu.percent else null, enabled = gpu.busy == null,
|
||||
badge = if (p.recommended) stringResource(R.string.gpu_recommended_caps) else null,
|
||||
) { gpuActions.onAuto(false); gpuActions.onPair(p.key) }
|
||||
if (gpu.pairs.any { !it.suits }) Box(Modifier.padding(horizontal = 6.dp, vertical = 4.dp)) {
|
||||
FocusText(stringResource(if (showAllPairs) R.string.gpu_hide_other else R.string.gpu_show_other), pal.signal) { showAllPairs = !showAllPairs }
|
||||
}
|
||||
}
|
||||
PROTON_TAB -> {
|
||||
val rows = protons.rows.filter { it.installed == null || it.update != null }
|
||||
if (rows.isEmpty()) EmptyLine(stringResource(R.string.comp_nothing_new))
|
||||
@@ -640,28 +592,6 @@ fun ComponentsPage(
|
||||
val actions: @Composable (String) -> Unit = { l ->
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(14.dp), verticalAlignment = Alignment.CenterVertically) {
|
||||
when (l) {
|
||||
GPU_TAB -> {
|
||||
SmallButton(stringResource(R.string.comp_import_zip), onClick = gpuActions.onImportZip)
|
||||
var at by remember { mutableStateOf<Rect?>(null) }
|
||||
Box(Modifier.onGloballyPositioned { at = it.boundsInRoot() }) {
|
||||
FocusText(stringResource(R.string.gpu_separately) + " ›", pal.signal) {
|
||||
val from = at
|
||||
val title = ctx.getString(R.string.gpu_separately)
|
||||
if (from == null) { driverPage = "rt"; return@FocusText }
|
||||
Steps.ask(StepAsk(anchor = from, side = StepSide.Right, accent = pal.signal, pillCorner = 10.dp, items = 3, handle = {}) {
|
||||
StepTitle(title)
|
||||
StepList {
|
||||
StepChoice(ctx.getString(R.string.comp_runtime_driver), enabled = open, modifier = Modifier.fillMaxWidth().stepItem(1).focusRequester(first)) {
|
||||
Steps.fold(); driverFrom = Origin(from.translate(-pageAt), 10f * density.density); driverPage = "rt"
|
||||
}
|
||||
StepChoice(ctx.getString(R.string.comp_display_driver), enabled = open, modifier = Modifier.fillMaxWidth().stepItem(2)) {
|
||||
Steps.fold(); driverFrom = Origin(from.translate(-pageAt), 10f * density.density); driverPage = "panel"
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
PROTON_TAB -> {
|
||||
val idle = protons.busyId == null && protons.runtimeReady && !protons.sessionRunning
|
||||
for (row in protons.rows.filter { it.installedAll.size > 1 }) {
|
||||
@@ -700,7 +630,10 @@ fun ComponentsPage(
|
||||
val detail: @Composable (String, Boolean) -> Unit = { l, narrowPage ->
|
||||
androidx.compose.foundation.layout.BoxWithConstraints(Modifier.fillMaxSize()) {
|
||||
val single = narrowPage || maxWidth < 600.dp
|
||||
Column(Modifier.fillMaxSize()) {
|
||||
if (l == GPU_TAB) GpuDriversBody(gpu, gpuActions, single, firstRow, slotFocus) { slot, at ->
|
||||
driverFrom = Origin(at.translate(-pageAt), 10f * density.density); driverPage = slot
|
||||
}
|
||||
else Column(Modifier.fillMaxSize()) {
|
||||
AnimatedContent(l, transitionSpec = { fadeIn(Motion.tw(240)) togetherWith fadeOut(Motion.tw(160)) }, label = "inUse") { k -> bar(k) }
|
||||
val detailScroll = androidx.compose.runtime.key(l) { rememberScrollState() }
|
||||
Column(Modifier.weight(1f).fillMaxWidth().verticalScroll(detailScroll).padding(top = 12.dp, bottom = 16.dp)) {
|
||||
@@ -857,7 +790,8 @@ fun ComponentsPage(
|
||||
Row(Modifier.weight(1f).fillMaxWidth()) {
|
||||
Box(
|
||||
(if (narrow) Modifier.fillMaxWidth() else Modifier.width(250.dp)).fillMaxHeight()
|
||||
.onGloballyPositioned { stackAt = it.positionInRoot() },
|
||||
.onGloballyPositioned { stackAt = it.positionInRoot() }
|
||||
.focusProperties { enter = { layerFocus.getValue(layer) } }.focusGroup(),
|
||||
) {
|
||||
val tint = rememberUpdatedState(pal.signal)
|
||||
val local = cardsAt[layer]?.translate(-stackAt)
|
||||
@@ -897,17 +831,17 @@ fun ComponentsPage(
|
||||
driverShown?.let { d ->
|
||||
val body: @Composable () -> Unit = {
|
||||
Box(Modifier.fillMaxSize().background(colors.background).pointerInput(Unit) { detectTapGestures { } }) {
|
||||
if (d == "rt") DriverPage(
|
||||
if (d == SLOT_RUNTIME) DriverPage(
|
||||
title = stringResource(R.string.comp_runtime_driver), hint = stringResource(R.string.comp_runtime_driver_hint),
|
||||
rows = gpu.linuxRows, selected = gpu.linuxSelected, downloads = gpu.linuxDownloads,
|
||||
status = gpu.releaseStatus, checking = gpu.checking, importLabel = stringResource(R.string.comp_import_turnip), canRestore = false,
|
||||
status = gpu.releaseStatus, checking = gpu.checking, checkedAt = gpu.checkedAt, importLabel = stringResource(R.string.comp_import_turnip), canRestore = false,
|
||||
onSelect = gpuActions.onSelectLinux, onDelete = gpuActions.onRemoveLinux, onRefresh = gpuActions.onRefresh,
|
||||
onDownload = gpuActions.onDownloadDriver, onImport = gpuActions.onImportLinux, onRestore = {}, onBack = { driverPage = null },
|
||||
)
|
||||
else DriverPage(
|
||||
title = stringResource(R.string.comp_display_driver), hint = stringResource(R.string.comp_display_driver_hint),
|
||||
rows = gpu.androidRows, selected = gpu.androidSelected, downloads = gpu.androidDownloads,
|
||||
status = gpu.releaseStatus, checking = gpu.checking, importLabel = stringResource(R.string.comp_import_adrenotools),
|
||||
status = gpu.releaseStatus, checking = gpu.checking, checkedAt = gpu.checkedAt, importLabel = stringResource(R.string.comp_import_adrenotools),
|
||||
canRestore = gpu.canRestoreBundled,
|
||||
onSelect = gpuActions.onSelectAndroid, onDelete = gpuActions.onRemoveAndroid, onRefresh = gpuActions.onRefresh,
|
||||
onDownload = gpuActions.onDownloadDriver, onImport = gpuActions.onImportAndroid, onRestore = gpuActions.onRestoreBundled,
|
||||
@@ -1010,7 +944,7 @@ private fun Stack(
|
||||
LayerCard(
|
||||
title = LayerTitle(l),
|
||||
value = when (l) {
|
||||
GPU_TAB -> if (gpu.auto) auto else gpu.activePair?.name ?: gpu.activeBundle ?: auto
|
||||
GPU_TAB -> gpuCardValue(gpu, auto)
|
||||
PROTON_TAB -> (view?.proton?.name ?: "") + " ▾"
|
||||
else -> st?.let { if (it.activeFile == null) original else it.inUse } ?: ""
|
||||
},
|
||||
@@ -1022,6 +956,9 @@ private fun Stack(
|
||||
)
|
||||
}
|
||||
Column(Modifier.fillMaxWidth().verticalScroll(rememberScrollState()), verticalArrangement = Arrangement.spacedBy(3.dp)) {
|
||||
StackHeading(stringResource(R.string.comp_this_device))
|
||||
card(GPU_TAB)
|
||||
Spacer(Modifier.height(6.dp))
|
||||
StackHeading(stringResource(R.string.comp_this_proton))
|
||||
card(PROTON_TAB)
|
||||
Row(Modifier.fillMaxWidth().height(IntrinsicSize.Min)) {
|
||||
@@ -1030,9 +967,6 @@ private fun Stack(
|
||||
card("dxvk"); card("vkd3d"); card("fex")
|
||||
}
|
||||
}
|
||||
Spacer(Modifier.height(6.dp))
|
||||
StackHeading(stringResource(R.string.comp_every_proton))
|
||||
card(GPU_TAB)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1534,8 +1468,8 @@ private fun ProgressBit(progress: Int) {
|
||||
private fun DeviceChip(s: GpuDriversState) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val pal = LocalPalette.current
|
||||
val tint = if (s.supported && !s.unsupported) pal.good else AttentionAmber
|
||||
val label = stringResource(
|
||||
val tint = if (s.supported && !s.unsupported && !s.display.pending) pal.good else AttentionAmber
|
||||
val label = if (s.display.pending) stringResource(R.string.gpu_chip_restart, s.gpuName) else stringResource(
|
||||
when {
|
||||
s.unsupported -> R.string.comp_device_unsupported
|
||||
s.supported -> R.string.comp_device_tested
|
||||
@@ -1590,3 +1524,13 @@ class ProtonRow(
|
||||
val id: String, val name: String, val installed: String?, val queued: Boolean,
|
||||
val installedAll: List<String> = listOfNotNull(installed), val update: String? = null,
|
||||
)
|
||||
|
||||
@Composable
|
||||
private fun gpuCardValue(gpu: GpuDriversState, auto: String): String {
|
||||
val value = when (gpu.mode) {
|
||||
GPU_MODE_AUTO -> gpu.activePair?.name?.let { stringResource(R.string.drivers_summary, auto, it) } ?: auto
|
||||
else -> gpu.activePair?.name?.takeIf { gpu.mode == GPU_MODE_PAIR }
|
||||
?: if (gpu.display.name == gpu.runtime.name) gpu.display.name else stringResource(R.string.gpu_summary_mix, gpu.display.name, gpu.runtime.name)
|
||||
}
|
||||
return if (gpu.display.pending) stringResource(R.string.gpu_summary_restart, value) else value
|
||||
}
|
||||
@@ -65,6 +65,7 @@ fun DriverPage(
|
||||
status: String,
|
||||
checking: Boolean,
|
||||
importLabel: String,
|
||||
checkedAt: Long = Long.MAX_VALUE,
|
||||
canRestore: Boolean,
|
||||
onSelect: (String) -> Unit,
|
||||
onDelete: (String) -> Unit,
|
||||
@@ -79,6 +80,9 @@ fun DriverPage(
|
||||
val pal = LocalPalette.current
|
||||
var confirm by remember { mutableStateOf<DriverRow?>(null) }
|
||||
BackHandler(onBack = onBack)
|
||||
LaunchedEffect(Unit) {
|
||||
if (!checking && System.currentTimeMillis() - checkedAt > 6 * 3_600_000L) onRefresh()
|
||||
}
|
||||
val refreshFocus = remember { FocusRequester() }
|
||||
val selectedFocus = remember { FocusRequester() }
|
||||
val inputMode = LocalInputModeManager.current
|
||||
|
||||
@@ -377,7 +377,11 @@ private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Com
|
||||
LaunchedEffect(s.shortcutPicker) { if (s.shortcutPicker) selected = "games" }
|
||||
LaunchedEffect(s.navigate) {
|
||||
val target = s.navigate ?: return@LaunchedEffect
|
||||
if (target == "stores:downloads") { com.droiddeck.launcher.stores.StoresState.openDownloads = true; selected = "stores" } else selected = target
|
||||
when (target) {
|
||||
"stores:downloads" -> { com.droiddeck.launcher.stores.StoresState.openDownloads = true; selected = "stores" }
|
||||
"components" -> a.onComponents(true)
|
||||
else -> selected = target
|
||||
}
|
||||
a.onNavigated()
|
||||
}
|
||||
var showWirelessAdbFix by rememberSaveable { mutableStateOf(false) }
|
||||
|
||||
@@ -2,7 +2,20 @@ package com.droiddeck.launcher.ui
|
||||
|
||||
import com.droiddeck.launcher.R
|
||||
import androidx.compose.animation.AnimatedVisibility
|
||||
import androidx.compose.foundation.focusGroup
|
||||
import androidx.compose.ui.geometry.Offset
|
||||
import androidx.compose.ui.layout.LayoutCoordinates
|
||||
import androidx.compose.ui.layout.boundsInRoot
|
||||
import androidx.compose.ui.layout.onGloballyPositioned
|
||||
import androidx.compose.ui.geometry.Rect
|
||||
import androidx.compose.foundation.focusable
|
||||
import androidx.compose.ui.focus.focusProperties
|
||||
import androidx.compose.foundation.layout.IntrinsicSize
|
||||
import androidx.compose.foundation.layout.fillMaxHeight
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.material.icons.outlined.Monitor
|
||||
import androidx.compose.material.icons.outlined.Refresh
|
||||
import androidx.compose.material.icons.outlined.SportsEsports
|
||||
import androidx.compose.material.icons.outlined.ExpandLess
|
||||
import androidx.compose.material.icons.outlined.ExpandMore
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
@@ -58,6 +71,9 @@ import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.compose.ui.focus.onFocusChanged
|
||||
import kotlinx.coroutines.launch
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.ui.focus.FocusRequester
|
||||
import androidx.compose.ui.focus.focusRequester
|
||||
@@ -74,6 +90,17 @@ class PairRow(
|
||||
val active: Boolean,
|
||||
)
|
||||
|
||||
const val GPU_MODE_AUTO = "auto"
|
||||
const val GPU_MODE_PAIR = "pair"
|
||||
const val GPU_MODE_MIX = "mix"
|
||||
|
||||
class DriverSlot(
|
||||
val name: String = "",
|
||||
val source: String = "",
|
||||
val pending: Boolean = false,
|
||||
val status: String = "",
|
||||
)
|
||||
|
||||
class GpuDriversState(
|
||||
val gpuName: String = "",
|
||||
val gpuFamily: String = "",
|
||||
@@ -96,6 +123,11 @@ class GpuDriversState(
|
||||
val androidDownloads: List<DownloadRow> = emptyList(),
|
||||
val canRestoreBundled: Boolean = false,
|
||||
val activeBundle: String? = null,
|
||||
val mode: String = GPU_MODE_AUTO,
|
||||
val display: DriverSlot = DriverSlot(),
|
||||
val runtime: DriverSlot = DriverSlot(),
|
||||
val canRestart: Boolean = true,
|
||||
val checkedAt: Long = 0L,
|
||||
) {
|
||||
val activePair: PairRow? get() = pairs.firstOrNull { it.active }
|
||||
}
|
||||
@@ -113,6 +145,8 @@ class GpuDriversActions(
|
||||
val onImportAndroid: () -> Unit = {},
|
||||
val onImportZip: () -> Unit = {},
|
||||
val onRestoreBundled: () -> Unit = {},
|
||||
val onMode: (String) -> Unit = {},
|
||||
val onRestart: () -> Unit = {},
|
||||
)
|
||||
|
||||
@Composable
|
||||
@@ -168,3 +202,257 @@ private fun DeviceInfoSection(section: DeviceInfo.Section) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private const val STALE_MS = 6 * 3_600_000L
|
||||
|
||||
@OptIn(androidx.compose.ui.ExperimentalComposeUiApi::class)
|
||||
@Composable
|
||||
internal fun GpuDriversBody(
|
||||
gpu: GpuDriversState,
|
||||
actions: GpuDriversActions,
|
||||
single: Boolean,
|
||||
first: FocusRequester,
|
||||
slotFocus: Map<String, FocusRequester>,
|
||||
onOpenSlot: (String, Rect) -> Unit,
|
||||
) {
|
||||
LaunchedEffect(Unit) {
|
||||
if (!gpu.checking && gpu.busy == null && System.currentTimeMillis() - gpu.checkedAt > STALE_MS) actions.onRefresh()
|
||||
}
|
||||
val scroll = rememberScrollState()
|
||||
val scope = rememberCoroutineScope()
|
||||
val placed = remember { arrayOfNulls<LayoutCoordinates>(2) }
|
||||
// Focusing the top mode shows as much of the in-use card above it as fits, without hiding the mode itself.
|
||||
val revealCard = {
|
||||
val (viewport, top) = placed
|
||||
if (viewport != null && top != null && viewport.isAttached && top.isAttached) scope.launch {
|
||||
val bottom = viewport.localPositionOf(top, Offset(0f, top.size.height.toFloat())).y + scroll.value
|
||||
scroll.animateScrollTo((bottom - viewport.size.height).toInt().coerceAtLeast(0))
|
||||
}
|
||||
}
|
||||
Column(
|
||||
verticalArrangement = Arrangement.spacedBy(14.dp),
|
||||
modifier = Modifier.fillMaxSize().onGloballyPositioned { placed[0] = it }.verticalScroll(scroll).padding(bottom = 16.dp)
|
||||
.focusProperties { enter = { first } }.focusGroup(),
|
||||
) {
|
||||
InUseCard(gpu, actions, first)
|
||||
PanelHeading(stringResource(R.string.gpu_mode_title))
|
||||
val modes = listOf(
|
||||
Triple(GPU_MODE_AUTO, R.string.common_auto, R.string.gpu_mode_auto_detail),
|
||||
Triple(GPU_MODE_PAIR, R.string.gpu_mode_pair, R.string.gpu_mode_pair_detail),
|
||||
Triple(GPU_MODE_MIX, R.string.gpu_mode_mix, R.string.gpu_mode_mix_detail),
|
||||
)
|
||||
val choice: @Composable (Int, Modifier) -> Unit = { i, mod ->
|
||||
val (id, title, detail) = modes[i]
|
||||
PanelRow(
|
||||
stringResource(title), stringResource(detail), gpu.mode == id,
|
||||
modifier = mod.then(if (gpu.mode == id) Modifier.focusRequester(first) else Modifier)
|
||||
.then(if (i == 0) Modifier.onGloballyPositioned { placed[1] = it }.onFocusChanged { if (it.isFocused) revealCard() } else Modifier),
|
||||
onClick = { if (gpu.mode != id) actions.onMode(id) },
|
||||
)
|
||||
}
|
||||
if (single) Column(verticalArrangement = Arrangement.spacedBy(8.dp)) { modes.indices.forEach { choice(it, Modifier) } }
|
||||
else Row(horizontalArrangement = Arrangement.spacedBy(10.dp), modifier = Modifier.fillMaxWidth().height(IntrinsicSize.Min)) {
|
||||
modes.indices.forEach { choice(it, Modifier.weight(1f).fillMaxHeight()) }
|
||||
}
|
||||
when (gpu.mode) {
|
||||
GPU_MODE_AUTO -> AutoBody(gpu)
|
||||
GPU_MODE_PAIR -> PairBody(gpu, actions)
|
||||
else -> MixBody(single, actions, slotFocus, onOpenSlot)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun InUseCard(gpu: GpuDriversState, actions: GpuDriversActions, first: FocusRequester) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val pal = LocalPalette.current
|
||||
val shape = RoundedCornerShape(14.dp)
|
||||
Column(
|
||||
verticalArrangement = Arrangement.spacedBy(10.dp),
|
||||
modifier = Modifier.fillMaxWidth().clip(shape).background(colors.surface).border(1.dp, pal.line, shape).padding(horizontal = 16.dp, vertical = 12.dp),
|
||||
) {
|
||||
SlotLine(Icons.Outlined.Monitor, stringResource(R.string.comp_display_driver), gpu.display)
|
||||
Box(Modifier.fillMaxWidth().height(1.dp).background(pal.line))
|
||||
SlotLine(Icons.Outlined.SportsEsports, stringResource(R.string.comp_runtime_driver), gpu.runtime)
|
||||
if (gpu.busy != null) LinearProgressIndicator(
|
||||
progress = { (gpu.percent.coerceAtLeast(0)) / 100f }, modifier = Modifier.fillMaxWidth(),
|
||||
)
|
||||
if (gpu.display.pending) RestartBanner(gpu.display.name, gpu.canRestart, first, actions.onRestart)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun SlotLine(icon: ImageVector, label: String, slot: DriverSlot) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val pal = LocalPalette.current
|
||||
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(12.dp)) {
|
||||
Box(contentAlignment = Alignment.Center, modifier = Modifier.size(40.dp).clip(RoundedCornerShape(10.dp)).background(colors.surfaceVariant)) {
|
||||
Icon(icon, contentDescription = null, tint = colors.onBackground, modifier = Modifier.size(20.dp))
|
||||
}
|
||||
Column(Modifier.weight(1f)) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
Text(label, fontSize = 12.5.sp, color = colors.onSurfaceVariant)
|
||||
Pill(slot.source, pal.line2.copy(alpha = 0.6f), colors.onBackground)
|
||||
}
|
||||
Text(slot.name, fontSize = 16.sp, fontWeight = FontWeight.SemiBold, color = colors.onBackground, maxLines = 1, overflow = TextOverflow.Ellipsis)
|
||||
if (slot.status.isNotEmpty()) Text(
|
||||
slot.status, fontSize = 12.5.sp, color = if (slot.pending) AttentionAmber else colors.onSurfaceVariant,
|
||||
modifier = Modifier.padding(top = 2.dp),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun RestartBanner(target: String, canRestart: Boolean, afterLater: FocusRequester, onRestart: () -> Unit) {
|
||||
var later by rememberSaveable(target) { mutableStateOf(false) }
|
||||
if (later) return
|
||||
val shape = RoundedCornerShape(12.dp)
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(10.dp),
|
||||
modifier = Modifier.fillMaxWidth().clip(shape).background(AttentionAmber.copy(alpha = 0.12f))
|
||||
.border(1.dp, AttentionAmber.copy(alpha = 0.45f), shape).padding(horizontal = 12.dp, vertical = 8.dp),
|
||||
) {
|
||||
Icon(Icons.Outlined.Refresh, contentDescription = null, tint = AttentionAmber, modifier = Modifier.size(20.dp))
|
||||
Text(
|
||||
stringResource(if (canRestart) R.string.gpu_restart_banner else R.string.gpu_restart_blocked),
|
||||
fontSize = 13.5.sp, color = MaterialTheme.colorScheme.onBackground, modifier = Modifier.weight(1f),
|
||||
)
|
||||
FocusText(stringResource(R.string.gpu_restart_later), MaterialTheme.colorScheme.onBackground) {
|
||||
runCatching { afterLater.requestFocus() }
|
||||
later = true
|
||||
}
|
||||
if (canRestart) FocusText(stringResource(R.string.gpu_restart_now), AttentionAmber, onClick = onRestart)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun AutoBody(gpu: GpuDriversState) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
Column(verticalArrangement = Arrangement.spacedBy(10.dp)) {
|
||||
PanelTitle(
|
||||
stringResource(if (gpu.activePair != null) R.string.gpu_auto_title else R.string.gpu_auto_builtin_title, gpu.gpuName),
|
||||
stringResource(R.string.gpu_auto_reason, gpu.gpuFamily),
|
||||
)
|
||||
gpu.activePair?.let { p -> PanelRow(p.name, "${p.version} · ${p.detail}", selected = true, onClick = null) }
|
||||
if (gpu.autoStatus.isNotEmpty()) Text(gpu.autoStatus, fontSize = 13.sp, color = colors.onSurfaceVariant)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun PairBody(gpu: GpuDriversState, actions: GpuDriversActions) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val pal = LocalPalette.current
|
||||
var showAll by rememberSaveable { mutableStateOf(false) }
|
||||
Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
PanelTitle(stringResource(R.string.gpu_pair_title), stringResource(R.string.gpu_pair_hint))
|
||||
val rows = gpu.pairs.filter { (it.installed || it.complete) && (it.suits || showAll) }
|
||||
if (rows.isEmpty()) Text(
|
||||
stringResource(if (gpu.checking) R.string.gpu_checking else R.string.gpu_none_listed),
|
||||
fontSize = 13.sp, color = colors.onSurfaceVariant,
|
||||
)
|
||||
for (p in rows) PanelRow(
|
||||
p.name, "${p.version} · ${p.detail}", selected = p.active,
|
||||
badge = if (p.recommended) stringResource(R.string.gpu_autos_pick) else null,
|
||||
trailing = when {
|
||||
gpu.busy == p.key -> "${gpu.percent.coerceAtLeast(0)}%"
|
||||
p.installed -> stringResource(R.string.gpu_installed)
|
||||
else -> stringResource(R.string.common_download)
|
||||
},
|
||||
enabled = gpu.busy == null,
|
||||
onClick = { if (!p.active) actions.onPair(p.key) },
|
||||
)
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
if (gpu.pairs.any { !it.suits }) FocusText(stringResource(if (showAll) R.string.gpu_hide_other else R.string.gpu_show_other), pal.signal) { showAll = !showAll }
|
||||
FocusText(stringResource(R.string.comp_import_zip), pal.signal, onClick = actions.onImportZip)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun MixBody(single: Boolean, actions: GpuDriversActions, slotFocus: Map<String, FocusRequester>, onOpenSlot: (String, Rect) -> Unit) {
|
||||
val pal = LocalPalette.current
|
||||
Column(verticalArrangement = Arrangement.spacedBy(10.dp)) {
|
||||
PanelTitle(stringResource(R.string.gpu_mix_title), stringResource(R.string.gpu_mix_hint))
|
||||
val at = remember { mutableMapOf<String, Rect>() }
|
||||
val slotButton: @Composable (String, Int, Modifier) -> Unit = { slot, label, mod ->
|
||||
SecondaryButton(
|
||||
stringResource(label),
|
||||
modifier = mod.focusRequester(slotFocus.getValue(slot)).onGloballyPositioned { at[slot] = it.boundsInRoot() },
|
||||
) { onOpenSlot(slot, at[slot] ?: Rect.Zero) }
|
||||
}
|
||||
val buttons: @Composable (Modifier) -> Unit = { mod ->
|
||||
slotButton(SLOT_DISPLAY, R.string.gpu_change_display, mod)
|
||||
slotButton(SLOT_RUNTIME, R.string.gpu_change_runtime, mod)
|
||||
}
|
||||
if (single) Column(verticalArrangement = Arrangement.spacedBy(8.dp)) { buttons(Modifier.fillMaxWidth()) }
|
||||
else Row(horizontalArrangement = Arrangement.spacedBy(10.dp)) { buttons(Modifier.weight(1f)) }
|
||||
FocusText(stringResource(R.string.comp_import_zip), pal.signal, onClick = actions.onImportZip)
|
||||
}
|
||||
}
|
||||
|
||||
internal const val SLOT_DISPLAY = "panel"
|
||||
internal const val SLOT_RUNTIME = "rt"
|
||||
|
||||
@Composable
|
||||
private fun PanelHeading(text: String) {
|
||||
Text(text.uppercase(), fontSize = 12.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 1.5.sp, color = MaterialTheme.colorScheme.onSurfaceVariant)
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun PanelTitle(title: String, hint: String) {
|
||||
Column(verticalArrangement = Arrangement.spacedBy(3.dp), modifier = Modifier.padding(top = 4.dp)) {
|
||||
Text(title, fontSize = 18.sp, fontWeight = FontWeight.SemiBold, color = MaterialTheme.colorScheme.onBackground)
|
||||
Text(hint, fontSize = 13.sp, color = MaterialTheme.colorScheme.onSurfaceVariant)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun Pill(text: String, fill: Color, ink: Color) {
|
||||
if (text.isEmpty()) return
|
||||
Text(
|
||||
text, fontSize = 11.sp, fontWeight = FontWeight.Bold, letterSpacing = 0.8.sp, color = ink, maxLines = 1,
|
||||
modifier = Modifier.clip(RoundedCornerShape(6.dp)).background(fill).padding(horizontal = 7.dp, vertical = 3.dp),
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun PanelRow(
|
||||
title: String,
|
||||
detail: String,
|
||||
selected: Boolean,
|
||||
modifier: Modifier = Modifier,
|
||||
badge: String? = null,
|
||||
trailing: String? = null,
|
||||
enabled: Boolean = true,
|
||||
onClick: (() -> Unit)?,
|
||||
) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val pal = LocalPalette.current
|
||||
val src = remember { MutableInteractionSource() }
|
||||
val hot = rememberHot(src)
|
||||
val shape = RoundedCornerShape(12.dp)
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(12.dp),
|
||||
modifier = modifier.fillMaxWidth().heightIn(min = 56.dp).clip(shape)
|
||||
.background(if (hot) pal.signal.copy(alpha = 0.14f) else if (selected) pal.signal.copy(alpha = 0.08f) else colors.surface)
|
||||
.glideBorder(hot, shape, pal.signal, if (selected) pal.signal.copy(alpha = 0.7f) else pal.line)
|
||||
.then(
|
||||
if (onClick != null) Modifier.hoverable(src)
|
||||
.clickable(interactionSource = src, indication = null, enabled = enabled, role = Role.RadioButton, onClick = onClick)
|
||||
else Modifier,
|
||||
)
|
||||
.padding(horizontal = 14.dp, vertical = 10.dp),
|
||||
) {
|
||||
Box(
|
||||
contentAlignment = Alignment.Center,
|
||||
modifier = Modifier.size(20.dp).border(2.dp, if (selected) pal.signal else colors.onSurfaceVariant, CircleShape),
|
||||
) { if (selected) Box(Modifier.size(10.dp).background(pal.signal, CircleShape)) }
|
||||
Column(Modifier.weight(1f)) {
|
||||
Text(title, fontSize = 15.sp, fontWeight = FontWeight.SemiBold, color = if (selected) pal.signal else colors.onBackground, maxLines = 1, overflow = TextOverflow.Ellipsis)
|
||||
if (detail.isNotEmpty()) Text(detail, fontSize = 12.5.sp, color = colors.onSurfaceVariant, maxLines = 2, overflow = TextOverflow.Ellipsis)
|
||||
}
|
||||
if (badge != null) Pill(badge, pal.signal.copy(alpha = 0.16f), pal.signal)
|
||||
if (trailing != null) Text(trailing, fontSize = 13.sp, color = colors.onSurfaceVariant, maxLines = 1)
|
||||
}
|
||||
}
|
||||
@@ -287,6 +287,9 @@ class DrawerActions(
|
||||
val onGameNoSteam: (Long, Boolean) -> Unit = { _, _ -> },
|
||||
val onComponentSwap: (protonId: String, comp: String, value: String) -> Unit = { _, _, _ -> },
|
||||
val onGameComponent: (appId: Long, comp: String, file: String?) -> Unit = { _, _, _ -> },
|
||||
val defaultProtonId: String? = null,
|
||||
val onDefaultProton: (protonId: String) -> Unit = {},
|
||||
val onGameProton: (appId: Long, protonId: String?) -> Unit = { _, _ -> },
|
||||
)
|
||||
|
||||
@OptIn(ExperimentalComposeUiApi::class)
|
||||
@@ -1205,9 +1208,21 @@ private fun ComponentsDrawerPage(host: MenuHost, a: DrawerActions, track: (Strin
|
||||
return
|
||||
}
|
||||
SettingsGroup(stringResource(R.string.drawer_page_components)) {
|
||||
Column(modifier = Modifier.fillMaxWidth().padding(horizontal = 14.dp, vertical = 11.dp)) {
|
||||
ProfileSummaryRow(stringResource(R.string.comp_proton), gameProfile.proton.value)
|
||||
}
|
||||
DrawerStackedChoice(
|
||||
host = host,
|
||||
key = "game-cmp-proton",
|
||||
label = stringResource(R.string.comp_proton),
|
||||
hint = if (gameProfile.proton.inherited && gameProfile.proton.value.isNotEmpty()) {
|
||||
stringResource(R.string.drawer_component_inherited, gameProfile.proton.value)
|
||||
} else {
|
||||
null
|
||||
},
|
||||
options = listOf<Pair<String?, String>>(null to stringResource(R.string.comp_game_use_general)) +
|
||||
snap.protons.map { it.proton.id to it.proton.name },
|
||||
selected = if (gameProfile.proton.inherited) null else gameProfile.protonId,
|
||||
chipModifier = track("cmp-proton"),
|
||||
onPick = { id -> a.onGameProton(gameProfile.appId, id) },
|
||||
)
|
||||
for (comp in ComponentsManager.COMPONENTS) {
|
||||
val value = gameProfile.components.getValue(comp)
|
||||
val options: List<Pair<String?, String>> =
|
||||
@@ -1238,8 +1253,7 @@ private fun ComponentsDrawerPage(host: MenuHost, a: DrawerActions, track: (Strin
|
||||
return
|
||||
}
|
||||
val running = snap.protons.filter { it.inUseByGame }
|
||||
var pick by rememberSaveable { mutableStateOf<String?>(null) }
|
||||
val view = snap.protons.firstOrNull { it.proton.id == pick } ?: running.firstOrNull() ?: snap.protons.firstOrNull()
|
||||
val view = snap.protons.firstOrNull { it.proton.id == a.defaultProtonId } ?: running.firstOrNull() ?: snap.protons.firstOrNull()
|
||||
SettingsGroup(stringResource(R.string.drawer_running_now)) {
|
||||
val src = remember { MutableInteractionSource() }
|
||||
val hot = src.collectIsFocusedAsState().value
|
||||
@@ -1280,7 +1294,7 @@ private fun ComponentsDrawerPage(host: MenuHost, a: DrawerActions, track: (Strin
|
||||
view.reappliedAt.takeIf { it > 0 }?.let { stringResource(R.string.drawer_reapplied, java.text.DateFormat.getTimeInstance(java.text.DateFormat.SHORT).format(java.util.Date(it * 1000))) },
|
||||
).joinToString(" · "),
|
||||
snap.protons.map { it.proton.id to it.proton.name }, p.id,
|
||||
chipModifier = track("cmp-proton"), onPick = { pick = it },
|
||||
chipModifier = track("cmp-proton"), onPick = { if (it != p.id) a.onDefaultProton(it) },
|
||||
)
|
||||
val originalLabel = stringResource(R.string.drawer_original)
|
||||
val build = ComponentsManager.safeName(p.version)
|
||||
|
||||
@@ -81,8 +81,9 @@ internal fun stepPath(
|
||||
val rbr = minOf(box, (pb - tt) / 2f)
|
||||
val rbl = minOf(lerpF(minOf(box, (pb - tt) / 2f), minOf(box, h / 2f), (sw / box).coerceIn(0f, 1f)), (r - l) / 2f)
|
||||
val rpl = minOf(box, sw / 2f, h / 2f)
|
||||
val f = minOf(fillet, sw / 2f)
|
||||
val yl = minOf(pt + rpl, pb - rbl)
|
||||
val sy = yl - rpl
|
||||
val f = minOf(fillet, sw / 2f, (sy - tt - rt).coerceAtLeast(0f))
|
||||
fun corner(rect: Rect, start: Float, sweep: Float, endX: Float, endY: Float) {
|
||||
if (rect.width < 0.5f) path.lineTo(endX, endY) else path.arcTo(rect, start, sweep, false)
|
||||
}
|
||||
@@ -94,9 +95,9 @@ internal fun stepPath(
|
||||
path.lineTo(l + rbl, pb)
|
||||
corner(Rect(l, pb - 2 * rbl, l + 2 * rbl, pb), 90f, 90f, l, pb - rbl)
|
||||
path.lineTo(l, yl)
|
||||
corner(Rect(l, pt, l + 2 * rpl, pt + 2 * rpl), 180f, 90f, l + rpl, pt)
|
||||
path.lineTo(tl - f, pt)
|
||||
corner(Rect(tl - 2 * f, pt - 2 * f, tl, pt), 90f, -90f, tl, pt - f)
|
||||
corner(Rect(l, sy, l + 2 * rpl, sy + 2 * rpl), 180f, 90f, l + rpl, sy)
|
||||
path.lineTo(tl - f, sy)
|
||||
corner(Rect(tl - 2 * f, sy - 2 * f, tl, sy), 90f, -90f, tl, sy - f)
|
||||
path.lineTo(tl, tt + rt)
|
||||
corner(Rect(tl, tt, tl + 2 * rt, tt + 2 * rt), 180f, 90f, tl + rt, tt)
|
||||
path.close()
|
||||
|
||||
@@ -7,6 +7,10 @@ import com.droiddeck.launcher.session.SessionState
|
||||
object CompositorHost {
|
||||
@Volatile
|
||||
private var started = false
|
||||
|
||||
@Volatile
|
||||
var displayChoice: String? = null
|
||||
|
||||
@Volatile
|
||||
private var vsyncRunning = false
|
||||
|
||||
|
||||
@@ -1033,7 +1033,6 @@
|
||||
<string name="gpu_set_with_runtime">يُضبَط مع برنامج تشغيل بيئة التشغيل معًا: يحمل %1$s كلاهما.</string>
|
||||
<string name="gpu_runtime_hint">يُستخدَم في الألعاب وسطح المكتب.</string>
|
||||
<string name="gpu_runtime_default">الافتراضي لبيئة التشغيل</string>
|
||||
<string name="gpu_display_hint">يرسم الإطارات على الشاشة. يُطبَّق بعد إعادة تشغيل DroidDeck.</string>
|
||||
<string name="gpu_auto_by_gpu">تلقائي - يُحدَّد بحسب GPU</string>
|
||||
<string name="gpu_manage">تنزيل أو استيراد أو حذف…</string>
|
||||
<string name="gpu_in_use_caps">قيد الاستخدام</string>
|
||||
|
||||
@@ -1009,7 +1009,6 @@
|
||||
<string name="gpu_set_with_runtime">Задава се заедно с драйвера за изпълнение: %1$s включва и двете.</string>
|
||||
<string name="gpu_runtime_hint">Използва се от игрите и работния плот.</string>
|
||||
<string name="gpu_runtime_default">Стандартен за изпълнение</string>
|
||||
<string name="gpu_display_hint">Изобразява кадрите на екрана. Прилага се след рестартиране на DroidDeck.</string>
|
||||
<string name="gpu_auto_by_gpu">Автоматично – избрано според GPU</string>
|
||||
<string name="gpu_manage">Изтегляне, импортиране или изтриване…</string>
|
||||
<string name="gpu_in_use_caps">В УПОТРЕБА</string>
|
||||
|
||||
@@ -1021,7 +1021,6 @@
|
||||
<string name="gpu_set_with_runtime">Nastaveno společně s ovladačem runtime: %1$s obsahuje oba.</string>
|
||||
<string name="gpu_runtime_hint">Používají hry a desktop.</string>
|
||||
<string name="gpu_runtime_default">Výchozí runtime</string>
|
||||
<string name="gpu_display_hint">Vykresluje snímky na obrazovku. Použije se po restartu DroidDecku.</string>
|
||||
<string name="gpu_auto_by_gpu">Automaticky - podle GPU</string>
|
||||
<string name="gpu_manage">Stáhnout, importovat nebo smazat…</string>
|
||||
<string name="gpu_in_use_caps">POUŽÍVÁ SE</string>
|
||||
|
||||
@@ -1009,7 +1009,6 @@
|
||||
<string name="gpu_set_with_runtime">Angives sammen med runtimedriveren: %1$s dækker begge.</string>
|
||||
<string name="gpu_runtime_hint">Bruges af spil og skrivebordet.</string>
|
||||
<string name="gpu_runtime_default">Runtime-standard</string>
|
||||
<string name="gpu_display_hint">Tegner billeder til skærmen. Gælder, når DroidDeck genstarter.</string>
|
||||
<string name="gpu_auto_by_gpu">Auto – valgt efter GPU</string>
|
||||
<string name="gpu_manage">Download, importer eller slet…</string>
|
||||
<string name="gpu_in_use_caps">I BRUG</string>
|
||||
|
||||
@@ -1009,7 +1009,6 @@
|
||||
<string name="gpu_set_with_runtime">Zusammen mit dem Laufzeittreiber festgelegt: %1$s enthält beide.</string>
|
||||
<string name="gpu_runtime_hint">Wird von Spielen und dem Desktop genutzt.</string>
|
||||
<string name="gpu_runtime_default">Laufzeit-Standard</string>
|
||||
<string name="gpu_display_hint">Bringt die Frames auf den Bildschirm. Gilt nach einem Neustart von DroidDeck.</string>
|
||||
<string name="gpu_auto_by_gpu">Auto - nach GPU gewählt</string>
|
||||
<string name="gpu_manage">Herunterladen, importieren oder löschen…</string>
|
||||
<string name="gpu_in_use_caps">IN VERWENDUNG</string>
|
||||
|
||||
@@ -1009,7 +1009,6 @@
|
||||
<string name="gpu_set_with_runtime">Ορίζεται μαζί με το πρόγραμμα οδήγησης runtime: το %1$s φέρει και τα δύο.</string>
|
||||
<string name="gpu_runtime_hint">Χρησιμοποιείται από παιχνίδια και την επιφάνεια εργασίας.</string>
|
||||
<string name="gpu_runtime_default">Προεπιλογή runtime</string>
|
||||
<string name="gpu_display_hint">Σχεδιάζει καρέ στην οθόνη. Εφαρμόζεται μετά την επανεκκίνηση του DroidDeck.</string>
|
||||
<string name="gpu_auto_by_gpu">Αυτόματο - επιλέγεται από τη GPU</string>
|
||||
<string name="gpu_manage">Λήψη, εισαγωγή ή διαγραφή…</string>
|
||||
<string name="gpu_in_use_caps">ΣΕ ΧΡΗΣΗ</string>
|
||||
|
||||
@@ -1023,7 +1023,6 @@
|
||||
<string name="gpu_set_with_runtime">Se define junto con el controlador de runtime: %1$s incluye ambos.</string>
|
||||
<string name="gpu_runtime_hint">Lo usan los juegos y el escritorio.</string>
|
||||
<string name="gpu_runtime_default">Predeterminado del runtime</string>
|
||||
<string name="gpu_display_hint">Dibuja los fotogramas en pantalla. Se aplica al reiniciar DroidDeck.</string>
|
||||
<string name="gpu_auto_by_gpu">Auto - elegido según la GPU</string>
|
||||
<string name="gpu_manage">Descargar, importar o eliminar…</string>
|
||||
<string name="gpu_in_use_caps">EN USO</string>
|
||||
|
||||
@@ -1009,7 +1009,6 @@
|
||||
<string name="gpu_set_with_runtime">Asetetaan yhdessä ajoympäristöajurin kanssa: %1$s kattaa molemmat.</string>
|
||||
<string name="gpu_runtime_hint">Käytetään peleissä ja työpöydällä.</string>
|
||||
<string name="gpu_runtime_default">Ajoympäristön oletus</string>
|
||||
<string name="gpu_display_hint">Piirtää kuvat näytölle. Käytössä DroidDeckin uudelleenkäynnistyksen jälkeen.</string>
|
||||
<string name="gpu_auto_by_gpu">Automaattinen - valittu GPU:n mukaan</string>
|
||||
<string name="gpu_manage">Lataa, tuo tai poista…</string>
|
||||
<string name="gpu_in_use_caps">KÄYTÖSSÄ</string>
|
||||
|
||||
@@ -1023,7 +1023,6 @@
|
||||
<string name="gpu_set_with_runtime">Configuré avec le pilote d\'exécution : %1$s inclut les deux.</string>
|
||||
<string name="gpu_runtime_hint">Utilisé par les jeux et le bureau.</string>
|
||||
<string name="gpu_runtime_default">Par défaut de l\'environnement d\'exécution</string>
|
||||
<string name="gpu_display_hint">Responsable de la sortie vidéo vers l\'écran. Prendra effet après le redémarrage de DroidDeck.</string>
|
||||
<string name="gpu_auto_by_gpu">Auto - Sélection par GPU</string>
|
||||
<string name="gpu_manage">Télécharger, importer ou supprimer…</string>
|
||||
<string name="gpu_in_use_caps">Utilisé</string>
|
||||
|
||||
@@ -1009,7 +1009,6 @@
|
||||
<string name="gpu_set_with_runtime">रनटाइम ड्राइवर के साथ सेट: %1$s दोनों साथ लाता है।</string>
|
||||
<string name="gpu_runtime_hint">गेम और डेस्कटॉप में उपयोग होता है।</string>
|
||||
<string name="gpu_runtime_default">रनटाइम डिफ़ॉल्ट</string>
|
||||
<string name="gpu_display_hint">स्क्रीन पर फ़्रेम बनाता है। DroidDeck रीस्टार्ट होने के बाद लागू होता है।</string>
|
||||
<string name="gpu_auto_by_gpu">ऑटो - GPU के हिसाब से चुना गया</string>
|
||||
<string name="gpu_manage">डाउनलोड, इंपोर्ट या डिलीट करें…</string>
|
||||
<string name="gpu_in_use_caps">उपयोग में</string>
|
||||
|
||||
@@ -1009,7 +1009,6 @@
|
||||
<string name="gpu_set_with_runtime">A futtatókörnyezet-illesztőprogrammal együtt beállítva: a %1$s mindkettőt tartalmazza.</string>
|
||||
<string name="gpu_runtime_hint">A játékok és az asztal használja.</string>
|
||||
<string name="gpu_runtime_default">Futtatókörnyezet alapértelmezése</string>
|
||||
<string name="gpu_display_hint">A képkockákat rajzolja a képernyőre. A DroidDeck újraindítása után lép érvénybe.</string>
|
||||
<string name="gpu_auto_by_gpu">Automatikus – GPU szerint kiválasztva</string>
|
||||
<string name="gpu_manage">Letöltés, importálás vagy törlés…</string>
|
||||
<string name="gpu_in_use_caps">HASZNÁLATBAN</string>
|
||||
|
||||
@@ -1003,7 +1003,6 @@
|
||||
<string name="gpu_set_with_runtime">Diatur bersama driver runtime: %1$s membawa keduanya.</string>
|
||||
<string name="gpu_runtime_hint">Digunakan oleh gim dan desktop.</string>
|
||||
<string name="gpu_runtime_default">Default runtime</string>
|
||||
<string name="gpu_display_hint">Menggambar frame ke layar. Berlaku setelah DroidDeck dimulai ulang.</string>
|
||||
<string name="gpu_auto_by_gpu">Otomatis - dipilih berdasarkan GPU</string>
|
||||
<string name="gpu_manage">Unduh, impor, atau hapus…</string>
|
||||
<string name="gpu_in_use_caps">DIGUNAKAN</string>
|
||||
|
||||
@@ -1015,7 +1015,6 @@
|
||||
<string name="gpu_set_with_runtime">Impostato insieme al driver del runtime: %1$s include entrambi.</string>
|
||||
<string name="gpu_runtime_hint">Usato dai giochi e dal desktop.</string>
|
||||
<string name="gpu_runtime_default">Runtime predefinito</string>
|
||||
<string name="gpu_display_hint">Disegna i fotogrammi sullo schermo. Si applica dopo il riavvio di DroidDeck.</string>
|
||||
<string name="gpu_auto_by_gpu">Auto - scelto in base alla GPU</string>
|
||||
<string name="gpu_manage">Scarica, importa o elimina…</string>
|
||||
<string name="gpu_in_use_caps">IN USO</string>
|
||||
|
||||
@@ -1011,7 +1011,6 @@
|
||||
<string name="gpu_set_with_runtime">ランタイムドライバーと一緒に設定:%1$s は両方を含みます。</string>
|
||||
<string name="gpu_runtime_hint">ゲームとデスクトップで使用されます。</string>
|
||||
<string name="gpu_runtime_default">ランタイムデフォルト</string>
|
||||
<string name="gpu_display_hint">画面への出力を担当します。DroidDeckの再起動後に有効になります。</string>
|
||||
<string name="gpu_auto_by_gpu">自動 - GPUごとに選択</string>
|
||||
<string name="gpu_manage">ダウンロード、インポート、削除…</string>
|
||||
<string name="gpu_in_use_caps">使用中</string>
|
||||
|
||||
@@ -1011,7 +1011,6 @@
|
||||
<string name="gpu_set_with_runtime">런타임 드라이버와 함께 설정: %1$s에 둘 다 포함됩니다.</string>
|
||||
<string name="gpu_runtime_hint">게임 및 데스크톱에서 사용됩니다.</string>
|
||||
<string name="gpu_runtime_default">런타임 기본값</string>
|
||||
<string name="gpu_display_hint">화면 출력을 담당합니다. DroidDeck을 다시 시작한 후 적용됩니다.</string>
|
||||
<string name="gpu_auto_by_gpu">자동 - GPU별 선택</string>
|
||||
<string name="gpu_manage">다운로드, 가져오기 또는 삭제…</string>
|
||||
<string name="gpu_in_use_caps">사용 중</string>
|
||||
|
||||
@@ -1003,7 +1003,6 @@
|
||||
<string name="gpu_set_with_runtime">Ditetapkan bersama pemacu masa jalan: %1$s membawa kedua-duanya.</string>
|
||||
<string name="gpu_runtime_hint">Digunakan oleh permainan dan desktop.</string>
|
||||
<string name="gpu_runtime_default">Lalai masa jalan</string>
|
||||
<string name="gpu_display_hint">Melukis bingkai ke skrin. Berkuat kuasa selepas DroidDeck dimulakan semula.</string>
|
||||
<string name="gpu_auto_by_gpu">Auto - dipilih mengikut GPU</string>
|
||||
<string name="gpu_manage">Muat turun, import atau padam…</string>
|
||||
<string name="gpu_in_use_caps">SEDANG DIGUNAKAN</string>
|
||||
|
||||
@@ -1009,7 +1009,6 @@
|
||||
<string name="gpu_set_with_runtime">Angis sammen med kjøretidsdriveren: %1$s bærer begge.</string>
|
||||
<string name="gpu_runtime_hint">Brukes av spill og skrivebordet.</string>
|
||||
<string name="gpu_runtime_default">Kjøretidsstandard</string>
|
||||
<string name="gpu_display_hint">Tegner bilder til skjermen. Gjelder etter at DroidDeck starter på nytt.</string>
|
||||
<string name="gpu_auto_by_gpu">Auto – valgt etter GPU</string>
|
||||
<string name="gpu_manage">Last ned, importer eller slett…</string>
|
||||
<string name="gpu_in_use_caps">I BRUK</string>
|
||||
|
||||
@@ -1009,7 +1009,6 @@
|
||||
<string name="gpu_set_with_runtime">Wordt samen met de runtimedriver ingesteld: %1$s bevat beide.</string>
|
||||
<string name="gpu_runtime_hint">Gebruikt door games en de desktop.</string>
|
||||
<string name="gpu_runtime_default">Runtimestandaard</string>
|
||||
<string name="gpu_display_hint">Tekent frames naar het scherm. Geldt nadat DroidDeck opnieuw is gestart.</string>
|
||||
<string name="gpu_auto_by_gpu">Automatisch - gekozen op basis van de GPU</string>
|
||||
<string name="gpu_manage">Downloaden, importeren of verwijderen…</string>
|
||||
<string name="gpu_in_use_caps">IN GEBRUIK</string>
|
||||
|
||||
@@ -1021,7 +1021,6 @@
|
||||
<string name="gpu_set_with_runtime">Ustawiany wraz ze sterownikiem środowiska: %1$s obejmuje oba.</string>
|
||||
<string name="gpu_runtime_hint">Używany przez gry i pulpit.</string>
|
||||
<string name="gpu_runtime_default">Domyślny dla środowiska</string>
|
||||
<string name="gpu_display_hint">Rysuje obraz na ekranie. Działa po ponownym uruchomieniu DroidDeck.</string>
|
||||
<string name="gpu_auto_by_gpu">Auto – wybrany według GPU</string>
|
||||
<string name="gpu_manage">Pobierz, zaimportuj lub usuń…</string>
|
||||
<string name="gpu_in_use_caps">W UŻYCIU</string>
|
||||
|
||||
@@ -1015,7 +1015,6 @@
|
||||
<string name="gpu_set_with_runtime">Definido em conjunto com o controlador de execução: %1$s inclui ambos.</string>
|
||||
<string name="gpu_runtime_hint">Utilizado pelos jogos e pelo ambiente de trabalho.</string>
|
||||
<string name="gpu_runtime_default">Padrão do ambiente de execução</string>
|
||||
<string name="gpu_display_hint">Desenha os fotogramas no ecrã. Aplica-se depois de o DroidDeck reiniciar.</string>
|
||||
<string name="gpu_auto_by_gpu">Automático - escolhido conforme a GPU</string>
|
||||
<string name="gpu_manage">Transferir, importar ou eliminar…</string>
|
||||
<string name="gpu_in_use_caps">EM UTILIZAÇÃO</string>
|
||||
|
||||
@@ -1015,7 +1015,6 @@
|
||||
<string name="gpu_set_with_runtime">Definido junto com o driver do runtime: %1$s contém os dois.</string>
|
||||
<string name="gpu_runtime_hint">Usado pelos jogos e pela área de trabalho.</string>
|
||||
<string name="gpu_runtime_default">Padrão do runtime</string>
|
||||
<string name="gpu_display_hint">Desenha os quadros na tela. Vale depois que o DroidDeck reiniciar.</string>
|
||||
<string name="gpu_auto_by_gpu">Automático - escolhido pela GPU</string>
|
||||
<string name="gpu_manage">Baixar, importar ou excluir…</string>
|
||||
<string name="gpu_in_use_caps">EM USO</string>
|
||||
|
||||
@@ -1015,7 +1015,6 @@
|
||||
<string name="gpu_set_with_runtime">Setat împreună cu driverul mediului de execuție: %1$s include ambele.</string>
|
||||
<string name="gpu_runtime_hint">Folosit de jocuri și de desktop.</string>
|
||||
<string name="gpu_runtime_default">Implicit pentru mediul de execuție</string>
|
||||
<string name="gpu_display_hint">Desenează cadrele pe ecran. Se aplică după repornirea DroidDeck.</string>
|
||||
<string name="gpu_auto_by_gpu">Automat - ales în funcție de GPU</string>
|
||||
<string name="gpu_manage">Descarcă, importă sau șterge…</string>
|
||||
<string name="gpu_in_use_caps">ÎN UZ</string>
|
||||
|
||||
@@ -1029,7 +1029,6 @@
|
||||
<string name="gpu_set_with_runtime">Настраивается вместе с драйвером среды выполнения: %1$s включает оба.</string>
|
||||
<string name="gpu_runtime_hint">Используется играми и рабочим столом.</string>
|
||||
<string name="gpu_runtime_default">Стандартный драйвер среды выполнения</string>
|
||||
<string name="gpu_display_hint">Отвечает за вывод изображения на экран. Вступит в силу после перезапуска DroidDeck.</string>
|
||||
<string name="gpu_auto_by_gpu">Авто — по GPU</string>
|
||||
<string name="gpu_manage">Скачать, импортировать или удалить…</string>
|
||||
<string name="gpu_in_use_caps">ИСПОЛЬЗУЕТСЯ</string>
|
||||
|
||||
@@ -1009,7 +1009,6 @@
|
||||
<string name="gpu_set_with_runtime">Ställs in tillsammans med körmiljödrivrutinen: %1$s innehåller båda.</string>
|
||||
<string name="gpu_runtime_hint">Används av spel och skrivbordet.</string>
|
||||
<string name="gpu_runtime_default">Standard för körmiljön</string>
|
||||
<string name="gpu_display_hint">Ritar bildrutor på skärmen. Gäller efter att DroidDeck har startats om.</string>
|
||||
<string name="gpu_auto_by_gpu">Auto – valt efter GPU</string>
|
||||
<string name="gpu_manage">Ladda ned, importera eller ta bort…</string>
|
||||
<string name="gpu_in_use_caps">I BRUK</string>
|
||||
|
||||
@@ -1003,7 +1003,6 @@
|
||||
<string name="gpu_set_with_runtime">ตั้งค่าร่วมกับไดรเวอร์รันไทม์: %1$s รวมทั้งสองอย่าง</string>
|
||||
<string name="gpu_runtime_hint">ใช้โดยเกมและเดสก์ท็อป</string>
|
||||
<string name="gpu_runtime_default">ค่าเริ่มต้นของรันไทม์</string>
|
||||
<string name="gpu_display_hint">วาดเฟรมบนหน้าจอ จะมีผลหลัง DroidDeck รีสตาร์ท</string>
|
||||
<string name="gpu_auto_by_gpu">อัตโนมัติ - เลือกตาม GPU</string>
|
||||
<string name="gpu_manage">ดาวน์โหลด นำเข้า หรือลบ…</string>
|
||||
<string name="gpu_in_use_caps">กำลังใช้งาน</string>
|
||||
|
||||
@@ -1009,7 +1009,6 @@
|
||||
<string name="gpu_set_with_runtime">Çalışma ortamı sürücüsüyle birlikte ayarlanır: %1$s ikisini de taşır.</string>
|
||||
<string name="gpu_runtime_hint">Oyunlar ve masaüstü tarafından kullanılır.</string>
|
||||
<string name="gpu_runtime_default">Çalışma ortamı varsayılanı</string>
|
||||
<string name="gpu_display_hint">Kareleri ekrana çizer. DroidDeck yeniden başlatıldıktan sonra uygulanır.</string>
|
||||
<string name="gpu_auto_by_gpu">Otomatik - GPU\'ya göre seçilir</string>
|
||||
<string name="gpu_manage">İndir, içe aktar veya sil…</string>
|
||||
<string name="gpu_in_use_caps">KULLANIMDA</string>
|
||||
|
||||
@@ -1021,7 +1021,6 @@
|
||||
<string name="gpu_set_with_runtime">Задається разом із драйвером середовища: %1$s містить обидва.</string>
|
||||
<string name="gpu_runtime_hint">Використовується іграми та робочим столом.</string>
|
||||
<string name="gpu_runtime_default">Стандартний для середовища</string>
|
||||
<string name="gpu_display_hint">Виводить кадри на екран. Застосовується після перезапуску DroidDeck.</string>
|
||||
<string name="gpu_auto_by_gpu">Авто — вибирається за GPU</string>
|
||||
<string name="gpu_manage">Завантажити, імпортувати або видалити…</string>
|
||||
<string name="gpu_in_use_caps">ВИКОРИСТОВУЄТЬСЯ</string>
|
||||
|
||||
@@ -1003,7 +1003,6 @@
|
||||
<string name="gpu_set_with_runtime">Được đặt cùng với driver runtime: %1$s mang cả hai.</string>
|
||||
<string name="gpu_runtime_hint">Dùng bởi game và desktop.</string>
|
||||
<string name="gpu_runtime_default">Mặc định runtime</string>
|
||||
<string name="gpu_display_hint">Vẽ khung hình lên màn hình. Áp dụng sau khi DroidDeck khởi động lại.</string>
|
||||
<string name="gpu_auto_by_gpu">Tự động - chọn theo GPU</string>
|
||||
<string name="gpu_manage">Tải, nhập hoặc xóa…</string>
|
||||
<string name="gpu_in_use_caps">ĐANG DÙNG</string>
|
||||
|
||||
@@ -1019,7 +1019,6 @@
|
||||
<string name="gpu_set_with_runtime">与运行时驱动一起设置:%1$s 同时携带两者。</string>
|
||||
<string name="gpu_runtime_hint">由游戏和桌面使用。</string>
|
||||
<string name="gpu_runtime_default">运行时默认</string>
|
||||
<string name="gpu_display_hint">把帧绘制到屏幕。重启 DroidDeck 后生效。</string>
|
||||
<string name="gpu_auto_by_gpu">自动 — 按 GPU 选择</string>
|
||||
<string name="gpu_manage">下载、导入或删除…</string>
|
||||
<string name="gpu_in_use_caps">使用中</string>
|
||||
|
||||
@@ -1011,7 +1011,6 @@
|
||||
<string name="gpu_set_with_runtime">與運行環境驅動程式一併設定:%1$s 同時包含兩者。</string>
|
||||
<string name="gpu_runtime_hint">供遊戲和桌面使用。</string>
|
||||
<string name="gpu_runtime_default">運行環境預設</string>
|
||||
<string name="gpu_display_hint">負責將畫面繪製到螢幕。DroidDeck 重新啟動後生效。</string>
|
||||
<string name="gpu_auto_by_gpu">自動 - 按 GPU 選擇</string>
|
||||
<string name="gpu_manage">下載、匯入或刪除…</string>
|
||||
<string name="gpu_in_use_caps">正在使用</string>
|
||||
|
||||
@@ -1011,7 +1011,6 @@
|
||||
<string name="gpu_set_with_runtime">與執行環境驅動程式一起設定:%1$s 同時包含兩者。</string>
|
||||
<string name="gpu_runtime_hint">供遊戲和桌面使用。</string>
|
||||
<string name="gpu_runtime_default">執行環境預設</string>
|
||||
<string name="gpu_display_hint">負責將畫面輸出到螢幕。重新啟動 DroidDeck 後生效。</string>
|
||||
<string name="gpu_auto_by_gpu">自動 - 按 GPU 選擇</string>
|
||||
<string name="gpu_manage">下載、匯入或刪除…</string>
|
||||
<string name="gpu_in_use_caps">正在使用</string>
|
||||
|
||||
@@ -1056,7 +1056,6 @@
|
||||
<string name="gpu_set_with_runtime">Set together with the runtime driver: %1$s carries both.</string>
|
||||
<string name="gpu_runtime_hint">Used by games and the desktop.</string>
|
||||
<string name="gpu_runtime_default">Runtime default</string>
|
||||
<string name="gpu_display_hint">Draws frames to the screen. Applies after DroidDeck restarts.</string>
|
||||
<string name="gpu_auto_by_gpu">Auto - picked by GPU</string>
|
||||
<string name="gpu_manage">Download, import or delete…</string>
|
||||
<string name="gpu_in_use_caps">IN USE</string>
|
||||
@@ -2190,6 +2189,45 @@
|
||||
<string name="gpu_bar_auto">Auto · %1$s</string>
|
||||
<string name="gpu_separately">Runtime and display drivers separately</string>
|
||||
<string name="gpu_use_title">Use %1$s?</string>
|
||||
<string name="gpu_mode_title">How drivers are chosen</string>
|
||||
<string name="gpu_mode_auto_detail">Best pair for this GPU, kept current</string>
|
||||
<string name="gpu_mode_pair">Matched pair</string>
|
||||
<string name="gpu_mode_pair_detail">Pick one pair; it sets both drivers</string>
|
||||
<string name="gpu_mode_mix">Mix and match</string>
|
||||
<string name="gpu_mode_mix_detail">Choose display and runtime separately</string>
|
||||
<string name="gpu_mode_pair_short">Pair</string>
|
||||
<string name="gpu_mode_mix_short">Mixed</string>
|
||||
<string name="gpu_src_auto">AUTO</string>
|
||||
<string name="gpu_src_pair">PAIR</string>
|
||||
<string name="gpu_src_bundle">BUNDLE</string>
|
||||
<string name="gpu_src_chosen">CHOSEN</string>
|
||||
<string name="gpu_src_by_gpu">BY GPU</string>
|
||||
<string name="gpu_src_default">DEFAULT</string>
|
||||
<string name="gpu_display_live">Drawing now</string>
|
||||
<string name="gpu_display_pending">Restart pending · %1$s draws until then</string>
|
||||
<string name="gpu_runtime_live">Running now</string>
|
||||
<string name="gpu_runtime_pending">Next session · this session keeps %1$s</string>
|
||||
<string name="gpu_display_next">Draws the screen. Applies from the next session.</string>
|
||||
<string name="gpu_previous_driver">the previous driver</string>
|
||||
<string name="gpu_restart_banner">Restart to switch the display driver.</string>
|
||||
<string name="gpu_restart_blocked">Stop the running session, then restart DroidDeck to switch the display driver.</string>
|
||||
<string name="gpu_restart_now">Restart now</string>
|
||||
<string name="gpu_restart_later">Later</string>
|
||||
<string name="gpu_auto_title">Auto picked this pair for your %1$s</string>
|
||||
<string name="gpu_auto_builtin_title">Auto is using the built-in drivers for your %1$s</string>
|
||||
<string name="gpu_auto_reason">Chosen for the %1$s family. New releases install in the background.</string>
|
||||
<string name="gpu_pair_title">Pick a pair</string>
|
||||
<string name="gpu_pair_hint">A pair sets the display and runtime drivers together.</string>
|
||||
<string name="gpu_mix_title">Choose each driver</string>
|
||||
<string name="gpu_mix_hint">A bundle fills both slots. Display changes apply after a restart, runtime changes on the next session.</string>
|
||||
<string name="gpu_change_display">Change display driver</string>
|
||||
<string name="gpu_change_runtime">Change runtime driver</string>
|
||||
<string name="gpu_autos_pick">AUTO\'S PICK</string>
|
||||
<string name="gpu_installed">Installed</string>
|
||||
<string name="gpu_summary_mix">%1$s + %2$s</string>
|
||||
<string name="gpu_summary_restart">%1$s · restart to apply</string>
|
||||
<string name="gpu_chip_restart">%1$s · restart pending</string>
|
||||
<string name="comp_this_device">This device</string>
|
||||
<string name="proton_remove_title">Remove %1$s?</string>
|
||||
<string name="setup_tab_diagnostics">Diagnostics</string>
|
||||
<string name="setup_ready">Ready to play</string>
|
||||
|
||||
@@ -4,8 +4,8 @@ import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
class LayerStepTest {
|
||||
@Test fun theStackRunsFromTheProtonDownToTheGpuDrivers() {
|
||||
assertEquals(listOf(PROTON_TAB, "dxvk", "vkd3d", "fex", GPU_TAB), LAYERS)
|
||||
@Test fun theStackRunsFromTheGpuDriversDownThroughTheProton() {
|
||||
assertEquals(listOf(GPU_TAB, PROTON_TAB, "dxvk", "vkd3d", "fex"), LAYERS)
|
||||
}
|
||||
|
||||
@Test fun rbStepsDownAndWraps() {
|
||||
@@ -19,6 +19,6 @@ class LayerStepTest {
|
||||
}
|
||||
|
||||
@Test fun anUnknownLayerStartsFromTheTop() {
|
||||
assertEquals("dxvk", layerStep("tab-from-an-older-build", 1))
|
||||
assertEquals(PROTON_TAB, layerStep("tab-from-an-older-build", 1))
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.droiddeck.launcher.ui
|
||||
|
||||
import androidx.compose.ui.geometry.Rect
|
||||
import androidx.compose.ui.graphics.Path
|
||||
import androidx.compose.ui.graphics.PathMeasure
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertNotNull
|
||||
import org.junit.Assert.assertNull
|
||||
@@ -9,6 +10,7 @@ import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.annotation.Config
|
||||
import org.robolectric.annotation.GraphicsMode
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
@Config(sdk = [28], manifest = Config.NONE)
|
||||
@@ -44,6 +46,15 @@ class StepOutTest {
|
||||
assertEquals(pill.bottom, b.bottom, 0.5f)
|
||||
}
|
||||
|
||||
@GraphicsMode(GraphicsMode.Mode.NATIVE)
|
||||
@Test fun aNearlyClosedOutlineDoesNotDoubleBackPastThePillCorner() {
|
||||
val path = Path()
|
||||
stepPath(path, pill, left = pill.left - 1f, bottom = pill.bottom + 2f, pullTop = pill.bottom + 6f, box = 16f, fillet = 10f, pillCorner = 12f)
|
||||
val length = PathMeasure().apply { setPath(path, false) }.length
|
||||
val arcs = (Math.PI / 2).toFloat() * (12f + 16f + 15f + 0.5f + 12f)
|
||||
assertEquals(175f + arcs, length, 2f)
|
||||
}
|
||||
|
||||
@Test fun aCardMarkIsTakenOnceAndOnlyForItsGame() {
|
||||
StoresMotion.markCard(CardMark("gog:1", pill, 10f, null))
|
||||
assertNull(StoresMotion.takeCard("gog:2"))
|
||||
|
||||
Reference in new issue
Block a user