mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IJPL-248178 Implement synchronization between Screen reader support and JavaAtkWrapper
Refactoring (cherry picked from commit b9da9535786371a6da735a72d9decde1383ea610) GitOrigin-RevId: 338b8bb309ecf614a61f3e77e5e89c99785e44dc
This commit is contained in:
committed by
intellij-monorepo-bot
parent
fca1764396
commit
74887de333
+12
-12
@@ -23,22 +23,21 @@ import org.jetbrains.annotations.ApiStatus
|
||||
private val LOG = logger<LinuxAccessibilitySupport>()
|
||||
|
||||
private enum class LinuxA11yChoice(private val dialogCode: Int) {
|
||||
Cancel(0),
|
||||
EnableAtkWrapper(1),
|
||||
EnableAtkWrapperAndScreenReader(2);
|
||||
CANCEL(0),
|
||||
ENABLE_ATK_WRAPPER(1),
|
||||
ENABLE_ATK_WRAPPER_AND_SCREEN_READER(2);
|
||||
|
||||
fun toDialogCode(): Int = dialogCode
|
||||
|
||||
companion object {
|
||||
fun fromDialogCode(code: Int): LinuxA11yChoice {
|
||||
return entries.firstOrNull { it.dialogCode == code } ?: Cancel
|
||||
}
|
||||
fun fromDialogCode(code: Int): LinuxA11yChoice =
|
||||
entries.firstOrNull { it.dialogCode == code } ?: CANCEL
|
||||
|
||||
fun fromDialogResult(exitCode: Int, enableAccessibilityExitCode: Int, isScreenReaderCheckboxSelected: Boolean): LinuxA11yChoice {
|
||||
return when {
|
||||
exitCode != enableAccessibilityExitCode -> Cancel
|
||||
isScreenReaderCheckboxSelected -> EnableAtkWrapperAndScreenReader
|
||||
else -> EnableAtkWrapper
|
||||
exitCode != enableAccessibilityExitCode -> CANCEL
|
||||
isScreenReaderCheckboxSelected -> ENABLE_ATK_WRAPPER_AND_SCREEN_READER
|
||||
else -> ENABLE_ATK_WRAPPER
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -47,6 +46,7 @@ private enum class LinuxA11yChoice(private val dialogCode: Int) {
|
||||
@ApiStatus.Internal
|
||||
object LinuxAccessibilitySupport {
|
||||
private const val ENABLE_ACCESSIBILITY_BUTTON_INDEX = 0
|
||||
private const val ASSISTIVE_TECHNOLOGIES_VM_OPTION_PREFIX = "-D$ASSISTIVE_TECHNOLOGIES_PROPERTY="
|
||||
private const val FORCE_SCREEN_READER_DETECTION_PROPERTY = "force.screen.reader.detection"
|
||||
|
||||
@Volatile
|
||||
@@ -94,14 +94,14 @@ object LinuxAccessibilitySupport {
|
||||
}
|
||||
|
||||
when (askToEnableLinuxAccessibilitySupport(screenReaderDetected)) {
|
||||
LinuxA11yChoice.EnableAtkWrapper -> {
|
||||
LinuxA11yChoice.ENABLE_ATK_WRAPPER -> {
|
||||
linuxAccessibilitySupportRequested = true
|
||||
}
|
||||
LinuxA11yChoice.EnableAtkWrapperAndScreenReader -> {
|
||||
LinuxA11yChoice.ENABLE_ATK_WRAPPER_AND_SCREEN_READER -> {
|
||||
linuxAccessibilitySupportRequested = true
|
||||
screenReaderSupportRequested = true
|
||||
}
|
||||
LinuxA11yChoice.Cancel -> Unit
|
||||
LinuxA11yChoice.CANCEL -> Unit
|
||||
}
|
||||
|
||||
if (linuxAccessibilitySupportRequested) {
|
||||
|
||||
Reference in New Issue
Block a user