Skip to content

Commit 869d581

Browse files
authored
Fix PC Start button Meta command
Route the PC Window Start tile through keyboard.shortcut with Meta so the PC opens Start reliably.
1 parent a1a0e84 commit 869d581

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

app/src/main/java/com/enaboapps/switchify/screens/pc/PcWindowControlScreen.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import androidx.compose.ui.unit.dp
2121
import com.enaboapps.switchify.R
2222
import com.enaboapps.switchify.pc.PcControlCommand
2323
import com.enaboapps.switchify.pc.PcKeyboardKey
24+
import com.enaboapps.switchify.pc.PcKeyboardShortcutKey
2425
import com.enaboapps.switchify.pc.PcWindowControlAction
2526

2627
data class PcWindowControlSpec(
@@ -77,7 +78,7 @@ fun pcWindowControlSpecs(): List<PcWindowControlSpec> {
7778
return listOf(
7879
PcWindowControlSpec(
7980
R.string.pc_key_start,
80-
PcControlCommand.PressKey(PcKeyboardKey.Meta),
81+
PcControlCommand.KeyboardShortcut(listOf(PcKeyboardShortcutKey.Meta)),
8182
Icons.Rounded.Computer
8283
),
8384
PcWindowControlSpec(

app/src/test/java/com/enaboapps/switchify/screens/pc/PcMouseControlViewModelTest.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import com.enaboapps.switchify.pc.PcDiscovery
1616
import com.enaboapps.switchify.pc.PcDiscoveryStatus
1717
import com.enaboapps.switchify.pc.PcErrorReason
1818
import com.enaboapps.switchify.pc.PcKeyboardKey
19+
import com.enaboapps.switchify.pc.PcKeyboardShortcutKey
1920
import com.enaboapps.switchify.pc.PcLiveControlResult
2021
import com.enaboapps.switchify.pc.PcMouseRepeatManager
2122
import com.enaboapps.switchify.pc.PcMouseRepeatSettings
@@ -1006,11 +1007,11 @@ class PcMouseControlViewModelTest {
10061007
}
10071008

10081009
@Test
1009-
fun windowSurfaceCanSendStartKeyCommand() = runTest(dispatcher) {
1010+
fun windowSurfaceCanSendStartShortcutCommand() = runTest(dispatcher) {
10101011
val connector = FakeConnector()
10111012
val controller = connectedController(connector = connector)
10121013
val viewModel = viewModel(controller)
1013-
val command = PcControlCommand.PressKey(PcKeyboardKey.Meta)
1014+
val command = PcControlCommand.KeyboardShortcut(listOf(PcKeyboardShortcutKey.Meta))
10141015

10151016
viewModel.selectControlSurface(PcControlSurface.Window)
10161017
viewModel.send(command)

app/src/test/java/com/enaboapps/switchify/screens/pc/PcWindowControlScreenTest.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package com.enaboapps.switchify.screens.pc
33
import com.enaboapps.switchify.R
44
import com.enaboapps.switchify.pc.PcControlCommand
55
import com.enaboapps.switchify.pc.PcKeyboardKey
6+
import com.enaboapps.switchify.pc.PcKeyboardShortcutKey
67
import com.enaboapps.switchify.pc.PcWindowControlAction
78
import org.junit.Assert.assertEquals
89
import org.junit.Test
@@ -14,7 +15,7 @@ class PcWindowControlScreenTest {
1415

1516
assertEquals(
1617
listOf(
17-
PcControlCommand.PressKey(PcKeyboardKey.Meta),
18+
PcControlCommand.KeyboardShortcut(listOf(PcKeyboardShortcutKey.Meta)),
1819
PcControlCommand.WindowControl(PcWindowControlAction.SwitchNext),
1920
PcControlCommand.WindowControl(PcWindowControlAction.SwitchPrevious),
2021
PcControlCommand.WindowControl(PcWindowControlAction.TaskView),
@@ -32,7 +33,7 @@ class PcWindowControlScreenTest {
3233
val specs = pcWindowControlSpecs()
3334

3435
assertEquals(R.string.pc_key_start, specs[0].labelResId)
35-
assertEquals(PcControlCommand.PressKey(PcKeyboardKey.Meta), specs[0].command)
36+
assertEquals(PcControlCommand.KeyboardShortcut(listOf(PcKeyboardShortcutKey.Meta)), specs[0].command)
3637
assertEquals(R.string.pc_window_switch_next, specs[1].labelResId)
3738
assertEquals(PcControlCommand.WindowControl(PcWindowControlAction.SwitchNext), specs[1].command)
3839
assertEquals(R.string.pc_window_switch_previous, specs[2].labelResId)

0 commit comments

Comments
 (0)