Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
856a289
chore: fix typos
SergeevPavel Jan 5, 2026
c958aef
feat: initial robot API for typing
SergeevPavel Jan 5, 2026
bd9d3e4
lint
SergeevPavel Jan 5, 2026
24a78d2
temporarily disable to speed up build
SergeevPavel Jan 5, 2026
10780fa
simple typing test
SergeevPavel Jan 6, 2026
4e70914
more keyboard tests
SergeevPavel Jan 6, 2026
f9a673b
the robot waits for the event to land
SergeevPavel Jan 7, 2026
8ca02f2
robot test
SergeevPavel Jan 7, 2026
880dae6
robot pumps tap on the separate thread
SergeevPavel Jan 7, 2026
2a54234
tests WIP
SergeevPavel Jan 8, 2026
aaf77b3
robot works
SergeevPavel Jan 8, 2026
d0e4817
refactor robot
SergeevPavel Jan 8, 2026
a30f4f9
refactor robot
SergeevPavel Jan 8, 2026
980b379
add test to check that robot can press modifiers correctly
SergeevPavel Jan 8, 2026
f5bd2a7
remove unnecessary synchronization
SergeevPavel Jan 8, 2026
921882d
shutdown the robot properly
SergeevPavel Jan 8, 2026
bf447ea
improve error handling
SergeevPavel Jan 8, 2026
b735033
lint
SergeevPavel Jan 8, 2026
a2c40df
option-shift keyboard test
SergeevPavel Jan 8, 2026
128477a
fix race conditions in robot tests
SergeevPavel Jan 8, 2026
36696dd
one more test
SergeevPavel Jan 8, 2026
14eacf7
one more test
SergeevPavel Jan 8, 2026
880bed3
one more test
SergeevPavel Jan 8, 2026
2cc2005
lint
SergeevPavel Jan 8, 2026
4c4d78f
run tests with info
SergeevPavel Jan 8, 2026
cb9010c
skip build and lint for the time
SergeevPavel Jan 8, 2026
09f0592
ignore key which is not reported on CI
SergeevPavel Jan 9, 2026
bcb89d6
lint
SergeevPavel Jan 9, 2026
0a2490e
ignore global shortcut used by Arc browser
SergeevPavel Jan 9, 2026
db7cf81
rearrange CI build steps
SergeevPavel Jan 9, 2026
45a27eb
add missing cbindgen:ignore
SergeevPavel Jan 9, 2026
6ae8c72
api for choosing keyboard layout
SergeevPavel Jan 12, 2026
52918e3
lint
SergeevPavel Jan 12, 2026
431291f
experiment with additional layout installation
SergeevPavel Jan 12, 2026
5cc00c7
add swedish test
SergeevPavel Jan 12, 2026
fdefcd5
typo
SergeevPavel Jan 12, 2026
bea8f55
make tests more robust, don't rely on choosen keyboard layout
SergeevPavel Jan 12, 2026
ac704ac
add assertions that we are using expected keyboard layout
SergeevPavel Jan 12, 2026
d88545f
add ABC layout
SergeevPavel Jan 13, 2026
1e1854d
dont use gradle daemon in tests
SergeevPavel Jan 13, 2026
b2c2472
enable debug logging by default
SergeevPavel Jan 13, 2026
542b9f5
disable lint temporarily
SergeevPavel Jan 13, 2026
7962f21
skip keyboard tests
SergeevPavel Jan 13, 2026
862ccdc
run smoke keyboard test
SergeevPavel Jan 13, 2026
b810dde
disable robot tests
SergeevPavel Jan 13, 2026
b49c52b
script for input sources installation
SergeevPavel Jan 14, 2026
4feddb6
lets check that robot tests are passing
SergeevPavel Jan 14, 2026
1b9dd50
logs
SergeevPavel Jan 14, 2026
0c7a5c3
enable cargo incremental
SergeevPavel Jan 14, 2026
1858195
check that event queue is not overflown
SergeevPavel Jan 14, 2026
963fe54
enable keyboard test
SergeevPavel Jan 14, 2026
7704906
full logs
SergeevPavel Jan 14, 2026
4b497af
choose layout before keyboard tests
SergeevPavel Jan 14, 2026
251a0cf
enable all remaining keyboard tests
SergeevPavel Jan 14, 2026
888463c
KeyboardTest: Log when window is focused
SergeevPavel Jan 15, 2026
b4d578b
more logs in keyboard handling
SergeevPavel Jan 15, 2026
1e45109
log all events in keyboard test
SergeevPavel Jan 15, 2026
339b1aa
log all events in tests
SergeevPavel Jan 15, 2026
59b79b0
use logger
SergeevPavel Jan 15, 2026
b2934b6
lint
SergeevPavel Jan 15, 2026
7637eda
ensure that window is focused
SergeevPavel Jan 15, 2026
f0f39ef
don't try to make window focused if it already is
SergeevPavel Jan 15, 2026
f672245
rename
SergeevPavel Jan 16, 2026
652acfb
cleanup
SergeevPavel Jan 16, 2026
20185e7
enable all CI tasks
SergeevPavel Jan 16, 2026
7a9c8fb
run keyboard and robot tests only on macos
SergeevPavel Jan 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ on:

env:
RUST_VERSION: 1.91.0 # the same as in rust-toolchain
# ACTIONS_STEP_DEBUG: true
ACTIONS_STEP_DEBUG: true
CARGO_INCREMENTAL: 1

jobs:
build_all:
Expand All @@ -34,6 +35,10 @@ jobs:
sudo apt update
sudo apt install libwayland-dev libxkbcommon-dev

- name: Install Keyboard Layouts
if: ${{ startsWith(matrix.targets.os, 'macos') }}
run: ./scripts/macos_install_input_sources.sh

- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
Expand All @@ -53,10 +58,10 @@ jobs:
uses: gradle/actions/setup-gradle@v4
- name: Lint with Gradle
run: ./gradlew lint
- name: Test with Gradle
run: ./gradlew test --info
- name: Build with Gradle
run: ./gradlew build
- name: Test with Gradle
run: ./gradlew test --rerun


- name: Publish Test Report
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ jobs:
sudo apt install libwayland-dev libxkbcommon-dev
shell: bash

- name: Install Keyboard Layouts
if: ${{ startsWith(matrix.targets.os, 'macos') }}
run: ./scripts/macos_install_input_sources.sh

- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
Expand Down
1 change: 1 addition & 0 deletions kotlin-desktop-toolkit/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ tasks.test {
}

testLogging {
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
events("failed")
events("passed")
events("skipped")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,39 @@ public object Application {
}
}

public fun currentInputSource(): String? {
val layout = ffiDownCall {
desktop_macos_h.application_current_input_source()
}
if (layout == MemorySegment.NULL) return null
return try {
layout.getUtf8String(0)
} finally {
ffiDownCall { desktop_macos_h.string_drop(layout) }
}
}

public fun listInputSources(): List<String> {
return ffiDownCall {
Arena.ofConfined().use { arena ->
val result = desktop_macos_h.application_list_input_sources(arena)
try {
listOfStringsFromNative(result)
} finally {
ffiDownCall { desktop_macos_h.string_array_drop(result) }
}
}
}
}

public fun chooseInputSource(sourceId: String): Boolean {
return ffiDownCall {
Arena.ofConfined().use { arena ->
desktop_macos_h.application_choose_input_source(arena.allocateUtf8String(sourceId))
}
}
}

private var isSafeToQuit: () -> Boolean = { true }

// called from native
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ package org.jetbrains.desktop.macos
* keycode.
*/
@JvmInline
public value class KeyCode internal constructor(private val value: Short) {
public value class KeyCode internal constructor(internal val value: Short) {
@Suppress("MemberVisibilityCanBePrivate")
public companion object {
public val ANSI_A: KeyCode = KeyCode(0)
Expand Down Expand Up @@ -355,6 +355,7 @@ public object CodepointConstants {
public const val LineSeparatorCharacter: Int = 0x2028
public const val ParagraphSeparatorCharacter: Int = 0x2029

// Unicode private use area
public const val UpArrowFunctionKey: Int = 0xF700
public const val DownArrowFunctionKey: Int = 0xF701
public const val LeftArrowFunctionKey: Int = 0xF702
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package org.jetbrains.desktop.macos

import org.jetbrains.desktop.macos.generated.desktop_macos_h

public class Robot : AutoCloseable {

init {
ffiDownCall {
desktop_macos_h.robot_initialize()
}
}

public fun emulateKeyboardEvent(key: KeyCode, isKeyDown: Boolean) {
ffiDownCall {
desktop_macos_h.emulate_keyboard_event(key.value, isKeyDown)
}
}

override fun close() {
ffiDownCall {
desktop_macos_h.robot_deinitialize()
}
}
}
Loading