From cd276286524f95bb7388d6794313ead442cef7d2 Mon Sep 17 00:00:00 2001 From: Darcy Wong Date: Sat, 23 Sep 2023 10:31:40 +0700 Subject: [PATCH 01/67] chore(developer): Add non-printing characters --- .../src/tike/xml/layoutbuilder/constants.js | 35 +++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/developer/src/tike/xml/layoutbuilder/constants.js b/developer/src/tike/xml/layoutbuilder/constants.js index d79850bc23a..117020e5d51 100644 --- a/developer/src/tike/xml/layoutbuilder/constants.js +++ b/developer/src/tike/xml/layoutbuilder/constants.js @@ -551,8 +551,8 @@ $(function() { } this.lookupKeyNames.sort(); - // Defines the PUA code mapping for the various 'special' modifier/control keys on keyboards. - // This is lifted directly from visualKeyboard.ts and must be kept in sync. See also CompileKeymanWeb.pas: CSpecialText10 + // Defines the PUA code mapping for the various 'special' modifier/control/non-printing keys on keyboards. + // This is lifted directly from specialCharacters.ts and must be kept in sync. See also CompileKeymanWeb.pas: CSpecialText10 this.specialCharacters = { '*Shift*': 8, '*Enter*': 5, @@ -586,7 +586,9 @@ $(function() { '*RAltShift*': 0x68, '*LCtrlShift*': 0x69, '*RCtrlShift*': 0x70, - // Following codes introduced in Keyman 14.0 + // Added in Keyman 14.0 + '*LTREnter*': 0x05, // Default alias of '*Enter*'. + '*LTRBkSp*': 0x04, // Default alias of '*BkSp*'. '*RTLEnter*': 0x71, '*RTLBkSp*': 0x72, '*ShiftLock*': 0x73, @@ -594,8 +596,29 @@ $(function() { '*ZWNJ*': 0x75, // * If this one is specified, auto-detection will kick in. '*ZWNJiOS*': 0x75, // The iOS version will be used by default, but the '*ZWNJAndroid*': 0x76, // Android platform has its own default glyph. - '*LTREnter*': 5, // * Forces LTR shaping for the Enter/BkSp keys regardless - '*LTRBkSp*': 4, // of layout's directionality. + // Added in Keyman 17.0. + // Reference: https://github.com/silnrsi/font-symchar/blob/v4.000/documentation/encoding.md + '*ZWNJGeneric*': 0x79, // Generic version of ZWNJ (no override) + '*Sp*': 0x80, // Space + '*NBSp*': 0x82, // No-break Space + '*NarNBSp*': 0x83, // Narrow No-break Space + '*EnQ*': 0x84, // En Quad + '*EmQ*': 0x85, // Em Quad + '*EnSp*': 0x86, // En Space + '*EmSp*': 0x87, // Em Space + // TODO: Skipping #-per-em-space + '*PunctSp*': 0x8c, // Punctuation Space + '*ThSp*': 0x8d, // Thin Space + '*HSp*': 0x8e, // Hair Space + '*ZWSp*': 0x81, // Zero Width Space + '*ZWJ*': 0x77, // Zero Width Joiner + '*WJ*': 0x78, // Word Joiner + '*CGJ*': 0x7a, // Combining Grapheme Joiner + '*LTRM*': 0x90, // Left-to-right Mark + '*RTLM*': 0x91, // Right-to-left Mark + '*SH*': 0xa1, // Soft Hyphen + '*HTab*': 0xa2, // Horizontal Tabulation + // TODO: Skipping size references }; this.specialKeyNames = Object.entries(this.specialCharacters).map(ch => ch[0]); @@ -711,4 +734,4 @@ $(function() { return r; }; -}.bind(builder)); \ No newline at end of file +}.bind(builder)); From bf0a0938a84b895b70ff0d71267a40a31b630231 Mon Sep 17 00:00:00 2001 From: Darcy Wong Date: Wed, 25 Oct 2023 14:44:48 +0700 Subject: [PATCH 02/67] chore(developer): Add handling for new characters --- .../src/kmw-compiler/compiler-globals.ts | 4 +++ .../src/kmc-kmn/src/kmw-compiler/constants.ts | 9 ++++++- .../src/kmw-compiler/validate-layout-file.ts | 26 ++++++++++++++++--- 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/developer/src/kmc-kmn/src/kmw-compiler/compiler-globals.ts b/developer/src/kmc-kmn/src/kmw-compiler/compiler-globals.ts index 26981f5711c..92cba914c5e 100644 --- a/developer/src/kmc-kmn/src/kmw-compiler/compiler-globals.ts +++ b/developer/src/kmc-kmn/src/kmw-compiler/compiler-globals.ts @@ -46,3 +46,7 @@ export function IsKeyboardVersion14OrLater(): boolean { export function IsKeyboardVersion15OrLater(): boolean { return fk.fileVersion >= KMX.KMXFile.VERSION_150; } + +export function IsKeyboardVersion17OrLater(): boolean { + return fk.fileVersion >= KMX.KMXFile.VERSION_170; +} diff --git a/developer/src/kmc-kmn/src/kmw-compiler/constants.ts b/developer/src/kmc-kmn/src/kmw-compiler/constants.ts index 55bae9fdb90..a8d88538843 100644 --- a/developer/src/kmc-kmn/src/kmw-compiler/constants.ts +++ b/developer/src/kmc-kmn/src/kmw-compiler/constants.ts @@ -21,7 +21,14 @@ export const ['*ShiftedLock*', '*Shifted*'], ['*ZWNJ*', '<|>'], ['*ZWNJiOS*', '<|>'], - ['*ZWNJAndroid*', '<|>'] + ['*ZWNJAndroid*', '<|>'], + ], + // these names were added in Keyman 17 + CSpecialText17: string = '*Sp*\0*NBSp*\0*NarNBSp*\0*EnQ*\0*EmQ*\0*EnSp*\0*EmSp*\0*PunctSp*\0' + + '*ThSp*\0*HSp*\0*ZWSp*\0*ZWJ*\0*WJ*\0*CGJ*\0*LTRM*\0*RTLM*\0*SH*\0*HTab*\0', + CSpecialText17ZWNJ: string = '*ZWNJGeneric*', + CSpecialText17Map: string[][] = [ + ['*ZWNJGeneric*', '<|>'] ]; diff --git a/developer/src/kmc-kmn/src/kmw-compiler/validate-layout-file.ts b/developer/src/kmc-kmn/src/kmw-compiler/validate-layout-file.ts index 6a28c38b477..7a1ee1842c4 100644 --- a/developer/src/kmc-kmn/src/kmw-compiler/validate-layout-file.ts +++ b/developer/src/kmc-kmn/src/kmw-compiler/validate-layout-file.ts @@ -1,7 +1,7 @@ import { KMX, Osk, TouchLayout, TouchLayoutFileReader, TouchLayoutFileWriter } from "@keymanapp/common-types"; -import { callbacks, IsKeyboardVersion14OrLater, IsKeyboardVersion15OrLater } from "./compiler-globals.js"; +import { callbacks, IsKeyboardVersion14OrLater, IsKeyboardVersion15OrLater, IsKeyboardVersion17OrLater } from "./compiler-globals.js"; import { JavaScript_Key } from "./javascript-strings.js"; -import { TRequiredKey, CRequiredKeys, CSpecialText10, CSpecialText14, CSpecialText14ZWNJ, CSpecialText14Map } from "./constants.js"; +import { TRequiredKey, CRequiredKeys, CSpecialText10, CSpecialText14, CSpecialText14ZWNJ, CSpecialText14Map, CSpecialText17, CSpecialText17ZWNJ, CSpecialText17Map } from "./constants.js"; import { KeymanWebTouchStandardKeyNames, KMWAdditionalKeyNames, VKeyNames } from "./keymanweb-key-codes.js"; import { KmwCompilerMessages } from "./messages.js"; @@ -147,6 +147,8 @@ function CheckKey( if((CSpecialText10.includes(FText) || CSpecialText14.includes(FText)) && !CSpecialText14ZWNJ.includes(FText) && !IsKeyboardVersion14OrLater() && + !CSpecialText17ZWNJ.includes(FText) && + !IsKeyboardVersion17OrLater() && !([TouchLayout.TouchLayoutKeySp.special, TouchLayout.TouchLayoutKeySp.specialActive].includes(FKeyType))) { callbacks.reportMessage(KmwCompilerMessages.Warn_TouchLayoutSpecialLabelOnNormalKey({ keyId: FId, @@ -199,6 +201,22 @@ function TransformSpecialKeys14(FDebug: boolean, sLayoutFile: string): string { return sLayoutFile; } +function TransformSpecialKeys17(FDebug: boolean, sLayoutFile: string): string { + // Rewrite Special key labels that are only supported in Keyman 17+ + // This code is a little ugly but effective. + if(!IsKeyboardVersion17OrLater()) { + for(let i = 0; i < CSpecialText17Map.length; i++) { + // Assumes the JSON output format will not change + if(FDebug) { + sLayoutFile = sLayoutFile.replaceAll('"text": "'+CSpecialText17Map[i][0]+'"', '"text": this._v>16 ? "'+CSpecialText17Map[i][0]+'" : "'+CSpecialText17Map[i][1]+'"'); + } else { + sLayoutFile = sLayoutFile.replaceAll('"text":"'+CSpecialText17Map[i][0]+'"', '"text":this._v>16?"'+CSpecialText17Map[i][0]+'":"'+CSpecialText17Map[i][1]+'"'); + } + } + } + return sLayoutFile; +} + export function ValidateLayoutFile(fk: KMX.KEYBOARD, FDebug: boolean, sLayoutFile: string, sVKDictionary: string, displayMap: Osk.PuaMap): VLFOutput { // I4060 // I4139 let FDictionary: string[] = sVKDictionary.split(/\s+/); @@ -282,8 +300,10 @@ export function ValidateLayoutFile(fk: KMX.KEYBOARD, FDebug: boolean, sLayoutFil sLayoutFile = TransformSpecialKeys14(FDebug, sLayoutFile); + sLayoutFile = TransformSpecialKeys17(FDebug, sLayoutFile); + return { output: sLayoutFile, result } -} \ No newline at end of file +} From 7b00306954e55fd637ac0458ef6b2f3250708c82 Mon Sep 17 00:00:00 2001 From: Darcy Wong Date: Thu, 26 Oct 2023 04:46:57 +0700 Subject: [PATCH 03/67] fix(developer): Add check for CSpecialText17 --- developer/src/kmc-kmn/src/kmw-compiler/validate-layout-file.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/developer/src/kmc-kmn/src/kmw-compiler/validate-layout-file.ts b/developer/src/kmc-kmn/src/kmw-compiler/validate-layout-file.ts index 7a1ee1842c4..4d12425df09 100644 --- a/developer/src/kmc-kmn/src/kmw-compiler/validate-layout-file.ts +++ b/developer/src/kmc-kmn/src/kmw-compiler/validate-layout-file.ts @@ -144,7 +144,7 @@ function CheckKey( // Keyman versions before 14 do not support '*special*' labels on non-special keys. // ZWNJ use, however, is safe because it will be transformed in function // TransformSpecialKeys14 to '<|>', which does not require the custom OSK font. - if((CSpecialText10.includes(FText) || CSpecialText14.includes(FText)) && + if((CSpecialText10.includes(FText) || CSpecialText14.includes(FText) || CSpecialText17.includes(FText)) && !CSpecialText14ZWNJ.includes(FText) && !IsKeyboardVersion14OrLater() && !CSpecialText17ZWNJ.includes(FText) && From 1a2a85affdaa3363096981b126977567870e764d Mon Sep 17 00:00:00 2001 From: Eberhard Beilharz Date: Tue, 24 Oct 2023 18:14:51 +0200 Subject: [PATCH 04/67] chore(linux): Use workflow_dispatch instead of repository_dispatch This makes it possible to manually trigger workflow runs. Closes #9548. --- .github/workflows/deb-packaging.yml | 64 ++++++++++++++++++--------- resources/build/trigger-builds.inc.sh | 19 ++++---- 2 files changed, 52 insertions(+), 31 deletions(-) diff --git a/.github/workflows/deb-packaging.yml b/.github/workflows/deb-packaging.yml index 8cc431f1787..8a61206497e 100644 --- a/.github/workflows/deb-packaging.yml +++ b/.github/workflows/deb-packaging.yml @@ -1,8 +1,33 @@ name: "Ubuntu packaging" -run-name: "Ubuntu packaging - ${{ github.event.client_payload.branch }} (branch ${{ github.head_ref }}), by @${{ github.actor }}" +run-name: "Ubuntu packaging - ${{ github.event.inputs.branch }} (branch ${{ github.head_ref }}), by @${{ github.actor }}" on: - repository_dispatch: - types: ['deb-release-packaging:*', 'deb-pr-packaging:*'] + workflow_dispatch: + inputs: + ref: + description: 'For a PR `refs/pull//merge`' + required: true + headRef: + description: 'The ref of HEAD. For a PR `refs/pull//head`.' + required: true + branch: + description: 'The branch. For a PR `PR-`.' + required: true + default: 'master' + baseBranch: + description: 'For a PR the base branch, otherwise the same as `branch`.' + required: true + default: 'master' + baseRef: + description: 'The ref of the previous commit. For a PR the same as `baseBranch`.' + required: true + user: + description: 'The user that triggered the build or created the PR' + required: true + isTestBuild: + description: 'True if this is a test build. False if this is a release build.' + required: false + default: 'true' + env: COLOR_GREEN: "\e[32m" GH_TOKEN: ${{ github.token }} @@ -17,26 +42,21 @@ jobs: outputs: VERSION: ${{ steps.version_step.outputs.VERSION }} PRERELEASE_TAG: ${{ steps.prerelease_tag.outputs.PRERELEASE_TAG }} - GIT_SHA: ${{ steps.set_status.outputs.GIT_SHA }} - GHA_TEST_BUILD: ${{ github.event.client_payload.isTestBuild }} - GHA_BRANCH: ${{ github.event.client_payload.branch }} steps: - name: Checkout uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c #v3.3.0 with: - ref: '${{ github.event.client_payload.ref }}' + ref: '${{ github.event.inputs.ref }}' - name: Set pending status on PR builds id: set_status - if: github.event.client_payload.isTestBuild == 'true' + if: github.event.inputs.isTestBuild == 'true' shell: bash run: | - GIT_SHA="${{ github.event.client_payload.sha }}" - echo "GIT_SHA=$GIT_SHA" >> $GITHUB_OUTPUT gh api \ --method POST \ -H "Accept: application/vnd.github+json" \ - /repos/$GITHUB_REPOSITORY/statuses/$GIT_SHA \ + /repos/$GITHUB_REPOSITORY/statuses/${{ github.sha }} \ -f state='pending' \ -f target_url="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" \ -f description='Debian packaging started' \ @@ -72,8 +92,8 @@ jobs: id: prerelease_tag shell: bash run: | - if [ "${{ github.event.client_payload.isTestBuild }}" == "true" ]; then - PRERELEASE_TAG="~${{ github.event.client_payload.branch }}-$GITHUB_RUN_NUMBER.$GITHUB_RUN_ATTEMPT" + if [ "${{ github.event.inputs.isTestBuild }}" == "true" ]; then + PRERELEASE_TAG="~${{ github.event.inputs.branch }}-$GITHUB_RUN_NUMBER.$GITHUB_RUN_ATTEMPT" else PRERELEASE_TAG="" fi @@ -81,10 +101,10 @@ jobs: - name: Output which branch or PR we're building plus name of .dsc file run: | - if [ "${{ github.event.client_payload.isTestBuild }}" == "true" ]; then - echo ":checkered_flag: **Test build of version ${{ steps.version_step.outputs.VERSION }} for ${{ github.event.client_payload.branch }}**" >> $GITHUB_STEP_SUMMARY + if [ "${{ github.event.inputs.isTestBuild }}" == "true" ]; then + echo ":checkered_flag: **Test build of version ${{ steps.version_step.outputs.VERSION }} for ${{ github.event.inputs.branch }}**" >> $GITHUB_STEP_SUMMARY else - echo ":ship: **Release build of ${{ github.event.client_payload.branch }} branch (${{ github.event.client_payload.ref}}), version ${{ steps.version_step.outputs.VERSION }}**" >> $GITHUB_STEP_SUMMARY + echo ":ship: **Release build of ${{ github.event.inputs.branch }} branch (${{ github.event.inputs.ref}}), version ${{ steps.version_step.outputs.VERSION }}**" >> $GITHUB_STEP_SUMMARY fi echo "" >> $GITHUB_STEP_SUMMARY echo ":gift: Generated source package:" >> $GITHUB_STEP_SUMMARY @@ -146,7 +166,7 @@ jobs: needs: [sourcepackage, binary_packages] runs-on: ubuntu-latest environment: "deploy (linux)" - if: github.event.client_payload.isTestBuild == 'false' + if: github.event.inputs.isTestBuild == 'false' steps: - name: Sign packages @@ -165,7 +185,7 @@ jobs: needs: [sourcepackage, deb_signing] runs-on: self-hosted environment: "deploy (linux)" - if: github.event.client_payload.isTestBuild == 'false' + if: github.event.inputs.isTestBuild == 'false' steps: - name: Install dput @@ -195,7 +215,7 @@ jobs: - name: Upload run: | - case ${{ github.event.client_payload.branch }} in + case ${{ github.event.inputs.branch }} in stable-*) destination='' ;; beta) destination='-proposed' ;; *) destination='-experimental' ;; @@ -227,7 +247,7 @@ jobs: - name: Checkout uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c #v3.3.0 with: - ref: '${{ github.event.client_payload.ref }}' + ref: '${{ github.event.inputs.ref }}' - name: Download Artifacts uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 @@ -259,7 +279,7 @@ jobs: name: Set result status on PR builds needs: [sourcepackage, binary_packages, api_verification] runs-on: ubuntu-latest - if: ${{ always() && github.event.client_payload.isTestBuild == 'true' }} + if: ${{ always() && github.event.inputs.isTestBuild == 'true' }} steps: - name: Set success if: needs.sourcepackage.result == 'success' && needs.binary_packages.result == 'success' && needs.api_verification.result == 'success' @@ -284,7 +304,7 @@ jobs: gh api \ --method POST \ -H "Accept: application/vnd.github+json" \ - /repos/$GITHUB_REPOSITORY/statuses/${{ needs.sourcepackage.outputs.GIT_SHA }} \ + /repos/$GITHUB_REPOSITORY/statuses/${{ github.sha }} \ -f state="$RESULT" \ -f target_url="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" \ -f description="$MSG" \ diff --git a/resources/build/trigger-builds.inc.sh b/resources/build/trigger-builds.inc.sh index 8d6297b9e1f..60e2b5c22cc 100644 --- a/resources/build/trigger-builds.inc.sh +++ b/resources/build/trigger-builds.inc.sh @@ -69,30 +69,31 @@ function triggerGitHubActionsBuild() { local IS_TEST_BUILD="$1" local GITHUB_ACTION="$2" local GIT_BRANCH="${3:-master}" - local GIT_REF GIT_SHA + local GIT_REF GIT_HEAD_REF - local GITHUB_SERVER=https://api.github.com/repos/keymanapp/keyman/dispatches + local GITHUB_SERVER=https://api.github.com/repos/keymanapp/keyman if [ "${action:-""}" == "commit" ]; then # This will only be true if we created and pushed a tag GIT_REF="refs/tags/release@$VERSION_WITH_TAG" - GIT_SHA="$(git rev-parse "${GIT_REF}")" + GIT_HEAD_REF="${GIT_REF}" GIT_EVENT_TYPE="${GITHUB_ACTION}: release@${VERSION_WITH_TAG}" elif [[ $GIT_BRANCH != stable-* ]] && [[ $GIT_BRANCH =~ [0-9]+ ]]; then GIT_REF="refs/pull/${GIT_BRANCH}/merge" - GIT_SHA="$(git rev-parse "refs/pull/${GIT_BRANCH}/head")" + GIT_HEAD_REF="refs/pull/${GIT_BRANCH}/head" GIT_EVENT_TYPE="${GITHUB_ACTION}: PR #${GIT_BRANCH}" GIT_BRANCH="PR-${GIT_BRANCH}" else GIT_REF="refs/heads/${GIT_BRANCH}" - GIT_SHA="$(git rev-parse "${GIT_REF}")" + GIT_HEAD_REF="${GIT_REF}" GIT_EVENT_TYPE="${GITHUB_ACTION}: ${GIT_BRANCH}" fi - local DATA="{\"event_type\": \"$GIT_EVENT_TYPE\", \ - \"client_payload\": { \ + local DATA="{ + \"ref\": \"$GIT_REF\", \ + \"inputs\": { \ \"ref\": \"$GIT_REF\", \ - \"sha\": \"$GIT_SHA\", \ + \"headRef\": \"$GIT_HEAD_REF\", \ \"branch\": \"$GIT_BRANCH\", \ \"isTestBuild\": \"$IS_TEST_BUILD\" \ }}" @@ -106,5 +107,5 @@ function triggerGitHubActionsBuild() { --header "Accept: application/vnd.github+json" \ --header "Authorization: token $GITHUB_TOKEN" \ --data "$DATA" \ - $GITHUB_SERVER + ${GITHUB_SERVER}/actions/workflows/deb-packaging.yml/dispatches } From 9257750bb8db6d4b0d3b835d7b1c5016cf87ed50 Mon Sep 17 00:00:00 2001 From: Eberhard Beilharz Date: Fri, 20 Oct 2023 16:09:25 +0200 Subject: [PATCH 05/67] chore(linux): Refactor deb-packaging.sh script Make use of builder_run_action. --- linux/scripts/deb-packaging.sh | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/linux/scripts/deb-packaging.sh b/linux/scripts/deb-packaging.sh index 3a669ab9af2..e6e05a33141 100755 --- a/linux/scripts/deb-packaging.sh +++ b/linux/scripts/deb-packaging.sh @@ -28,13 +28,11 @@ else END_STEP="" fi -if builder_start_action dependencies; then +dependencies_action() { sudo mk-build-deps --install --tool='apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes' debian/control - builder_finish_action success dependencies - exit 0 -fi +} -if builder_start_action source; then +source_action() { echo "${START_STEP}Make source package for keyman${COLOR_RESET}" echo "${START_STEP}reconfigure${COLOR_RESET}" @@ -50,25 +48,23 @@ if builder_start_action source; then echo "${END_STEP}" mv builddebs/* "${OUTPUT_PATH:-..}" +} - builder_finish_action success source - exit 0 -fi - -if builder_start_action verify; then +verify_action() { tar xf "${SRC_PKG}" - if [ ! -f debian/libkeymancore.symbols ]; then - echo ":warning: Missing libkeymancore.symbols file" >&2 + PKG_NAME=libkeymancore + LIB_NAME=libkeymancore + if [ ! -f debian/${PKG_NAME}.symbols ]; then + echo ":warning: Missing ${PKG_NAME}.symbols file" >&2 else - PKG_NAME=libkeymancore - LIB_NAME=libkeymancore - tmpDir=$(mktemp -d) dpkg -x "${BIN_PKG}" "$tmpDir" cd debian dpkg-gensymbols -v"${PKG_VERSION}" -p${PKG_NAME} -e"${tmpDir}"/usr/lib/x86_64-linux-gnu/${LIB_NAME}.so* -O${PKG_NAME}.symbols -c4 echo ":heavy_check_mark: ${LIB_NAME} API didn't change" >&2 fi - builder_finish_action success verify - exit 0 -fi +} + +builder_run_action dependencies dependencies_action +builder_run_action source source_action +builder_run_action verify verify_action From 7665ab35aa1eb67cb39e5ed94fbd3df9e02d431c Mon Sep 17 00:00:00 2001 From: Eberhard Beilharz Date: Tue, 24 Oct 2023 16:14:59 +0200 Subject: [PATCH 06/67] chore(linux): Add Core API version number Closes #9801. --- core/CORE_API_VERSION.md | 1 + core/meson.build | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 core/CORE_API_VERSION.md diff --git a/core/CORE_API_VERSION.md b/core/CORE_API_VERSION.md new file mode 100644 index 00000000000..3eefcb9dd5b --- /dev/null +++ b/core/CORE_API_VERSION.md @@ -0,0 +1 @@ +1.0.0 diff --git a/core/meson.build b/core/meson.build index 2061942d61b..716faca2dc2 100644 --- a/core/meson.build +++ b/core/meson.build @@ -12,14 +12,15 @@ project('keyman_core', 'cpp', 'c', 'cpp_std=c++14', 'b_vscrt=static_from_buildtype', 'warning_level=2'], - meson_version: '>=0.53.0') + meson_version: '>=0.57.0') # Import our standard compiler defines; this is copied from # /resources/build/standard.meson.build by build.sh, because # meson doesn't allow us to reference a file outside its root subdir('resources') -lib_version = '1.0.0' +fs = import('fs') +lib_version = fs.read('CORE_API_VERSION.md').strip() py = import('python') python = py.find_installation() From 30250e3d8d71b93bd90d3dd6dc67c78efd0f49e8 Mon Sep 17 00:00:00 2001 From: Eberhard Beilharz Date: Tue, 24 Oct 2023 16:51:00 +0200 Subject: [PATCH 07/67] chore(linux): Enhance GHA API check This change adds additional checks for the symbols file: - if a line with a method name gets changed, the package version number in that line also needs to be updated - for major API changes (methods renamed or removed) the API version numbers needs to be incremented - the API version numbers in the .symbols file and in `CORE_API_VERSION.md` need to match --- .github/workflows/deb-packaging.yml | 17 +-- docs/linux/ibus-keyman.md | 2 +- linux/scripts/deb-packaging.sh | 166 +++++++++++++++++++++++--- resources/build/trigger-builds.inc.sh | 17 ++- 4 files changed, 174 insertions(+), 28 deletions(-) diff --git a/.github/workflows/deb-packaging.yml b/.github/workflows/deb-packaging.yml index 8a61206497e..d9ea32e1478 100644 --- a/.github/workflows/deb-packaging.yml +++ b/.github/workflows/deb-packaging.yml @@ -1,14 +1,11 @@ name: "Ubuntu packaging" -run-name: "Ubuntu packaging - ${{ github.event.inputs.branch }} (branch ${{ github.head_ref }}), by @${{ github.actor }}" +run-name: "Ubuntu packaging - ${{ github.event.inputs.branch }} (branch ${{ github.event.inputs.baseBranch }}), by @${{ github.event.inputs.user }}" on: workflow_dispatch: inputs: ref: description: 'For a PR `refs/pull//merge`' required: true - headRef: - description: 'The ref of HEAD. For a PR `refs/pull//head`.' - required: true branch: description: 'The branch. For a PR `PR-`.' required: true @@ -248,6 +245,7 @@ jobs: uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c #v3.3.0 with: ref: '${{ github.event.inputs.ref }}' + fetch-depth: 0 - name: Download Artifacts uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 @@ -263,10 +261,13 @@ jobs: run: | cd linux PKG_NAME=libkeymancore - SRC_PKG="${GITHUB_WORKSPACE}/artifacts/keyman-srcpkg/keyman_${{ needs.sourcepackage.outputs.VERSION }}-1.debian.tar.xz" \ - BIN_PKG="${GITHUB_WORKSPACE}/artifacts/keyman-binarypkgs/${PKG_NAME}_${{ needs.sourcepackage.outputs.VERSION }}-1${{ needs.sourcepackage.outputs.PRERELEASE_TAG }}+jammy1_amd64.deb" \ - PKG_VERSION="${{ needs.sourcepackage.outputs.VERSION }}" \ - ./scripts/deb-packaging.sh --gha verify 2>> $GITHUB_STEP_SUMMARY + ./scripts/deb-packaging.sh \ + --gha \ + --bin-pkg "${GITHUB_WORKSPACE}/artifacts/keyman-binarypkgs/${PKG_NAME}_${{ needs.sourcepackage.outputs.VERSION }}-1${{ needs.sourcepackage.outputs.PRERELEASE_TAG }}+jammy1_amd64.deb" \ + --pkg-version "${{ needs.sourcepackage.outputs.VERSION }}" \ + --git-ref "${{ github.sha }}" \ + --git-base "${{ github.event.inputs.baseRef }}" \ + verify 2>> $GITHUB_STEP_SUMMARY - name: Archive .symbols file uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 diff --git a/docs/linux/ibus-keyman.md b/docs/linux/ibus-keyman.md index db09d67f5a8..ffc7b06c1cf 100644 --- a/docs/linux/ibus-keyman.md +++ b/docs/linux/ibus-keyman.md @@ -6,7 +6,7 @@ Source code for Keyman engine for IBus is in [linux/ibus-keyman](../../linux/ibu ## Requirements -meson (>= 0.53) +meson (>= 0.57) ## Building diff --git a/linux/scripts/deb-packaging.sh b/linux/scripts/deb-packaging.sh index e6e05a33141..8ac8de96c6d 100755 --- a/linux/scripts/deb-packaging.sh +++ b/linux/scripts/deb-packaging.sh @@ -1,7 +1,9 @@ #!/usr/bin/env bash +# shellcheck disable=SC2154 # (variables are set in build-utils.sh) # Actions for creating a Debian source package. Used by deb-packaging.yml GHA. set -eu +shopt -s inherit_errexit ## START STANDARD BUILD SCRIPT INCLUDE # adjust relative paths as necessary @@ -11,14 +13,18 @@ THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")" builder_describe \ "Helper for building Debian packages." \ - "dependencies Install dependencies as found in debian/control" \ - "source+ Build source package" \ - "verify Verify API" \ - "--gha Build from GitHub Action" + "dependencies Install dependencies as found in debian/control" \ + "source+ Build source package" \ + "verify Verify API" \ + "--gha Build from GitHub Action" \ + "--bin-pkg=BIN_PKG Path and name of binary Debian package (for verify action)" \ + "--pkg-version=PKG_VERSION The version of the Debian package (for verify action)" \ + "--git-ref=GIT_REF The ref of the HEAD commit, e.g. HEAD of the PR branch (for verify action)" \ + "--git-base=GIT_BASE The ref of the base commit, e.g. HEAD of the master branch (for verify action)" builder_parse "$@" -cd "$REPO_ROOT/linux" +cd "${REPO_ROOT}/linux" if builder_has_option --gha; then START_STEP="::group::${COLOR_GREEN}" @@ -50,19 +56,151 @@ source_action() { mv builddebs/* "${OUTPUT_PATH:-..}" } +output_log() { + echo "$1" >&2 + builder_echo "$1" +} + +output_ok() { + echo ":heavy_check_mark: $1" >&2 + builder_echo green "OK: $1" +} + +output_warning() { + echo ":warning: $1" >&2 + builder_echo warning "WARNING: $1" +} + +output_error() { + echo ":x: $1" >&2 + builder_echo error "ERROR: $1" +} + +check_api_not_changed() { + # Checks that the API did not change compared to what's documented in the .symbols file + tmpDir=$(mktemp -d) + dpkg -x "${BIN_PKG}" "${tmpDir}" + cd debian + dpkg-gensymbols -v"${PKG_VERSION}" -p"${PKG_NAME}" -e"${tmpDir}"/usr/lib/x86_64-linux-gnu/"${LIB_NAME}".so* -O"${PKG_NAME}.symbols" -c4 + output_ok "${LIB_NAME} API didn't change" + cd "${REPO_ROOT}/linux" +} + +is_symbols_file_changed() { + local CHANGED_REF CHANGED_BASE + CHANGED_REF=$(git rev-parse "${GIT_REF}":"linux/debian/${PKG_NAME}.symbols") + CHANGED_BASE=$(git rev-parse "${GIT_BASE}":"linux/debian/${PKG_NAME}.symbols") + if [[ "${CHANGED_REF}" == "${CHANGED_BASE}" ]]; then + return 1 + fi + return 0 +} + +check_updated_version_number() { + # Checks that the package version number got updated in the .symbols file if it got changed + # shellcheck disable=SC2310 + if is_symbols_file_changed; then + # .symbols file changed, now check if the package version got updated as well + # Note: We don't check that ALL changes in that file have an updated package version - + # we hope this gets flagged in code review. + if ! git log -p -1 -- "debian/${PKG_NAME}.symbols" | grep -q "${PKG_VERSION}"; then + output_error "${PKG_NAME}.symbols file got changed without changing the package version number of the symbol" + EXIT_CODE=1 + else + output_ok "${PKG_NAME}.symbols file got updated with package version number" + fi + else + output_ok "${PKG_NAME}.symbols file didn't change" + fi +} + +get_api_version_in_symbols_file() { + # Extract 1 from "libkeymancore.so.1 libkeymancore #MINVER#" + local firstline + firstline=$(head -1 "debian/${PKG_NAME}.symbols") + firstline="${firstline#"${PKG_NAME}".so.}" + firstline="${firstline%% *}" + echo "${firstline}" +} + +is_api_version_updated() { + local NEW_VERSION OLD_VERSION + git checkout "${GIT_REF}" -- "debian/${PKG_NAME}.symbols" + NEW_VERSION=$(get_api_version_in_symbols_file) + git checkout "${GIT_BASE}" -- "debian/${PKG_NAME}.symbols" + OLD_VERSION=$(get_api_version_in_symbols_file) + git checkout "${GIT_REF}" -- "debian/${PKG_NAME}.symbols" + if (( NEW_VERSION > OLD_VERSION )); then + return 0 + fi + return 1 +} + +check_for_major_api_changes() { + # Checks that API version number gets updated if API changes + local WHAT_CHANGED CHANGES INSERTED DELETED MODIFIED + + # shellcheck disable=2310 + if ! is_symbols_file_changed; then + output_ok "No major API change" + return + fi + + WHAT_CHANGED=$(git diff "${GIT_BASE}".."${GIT_REF}" -- "debian/${PKG_NAME}.symbols" | diffstat -m -t | tail -1) + + IFS=',' read -r -a CHANGES <<< "${WHAT_CHANGED}" + INSERTED="${CHANGES[0]}" + DELETED="${CHANGES[1]}" + MODIFIED="${CHANGES[2]}" + + if (( DELETED > 0 )) || (( MODIFIED > 0 )); then + builder_echo "Major API change: ${DELETED} lines deleted and ${MODIFIED} lines modified" + # shellcheck disable=2310 + if ! is_api_version_updated; then + output_error "Major API change without updating API version number in ${PKG_NAME}.symbols file" + EXIT_CODE=2 + else + output_ok "API version number got updated in ${PKG_NAME}.symbols file after major API change" + fi + elif (( INSERTED > 0 )); then + output_ok "Minor API change: ${INSERTED} lines added" + # We currently don't check version number for minor API changes + else + output_ok "No major API change" + fi +} + +check_for_api_version_consistency() { + # Checks that the (major) API version number in the .symbols file and + # in CORE_API_VERSION.md are the same + local symbols_version api_version + symbols_version=$(get_api_version_in_symbols_file) + api_version=$(cat ../core/CORE_API_VERSION.md) + # Extract major version number from "1.0.0" + api_version=${api_version%%.*} + + if (( symbols_version == api_version )); then + output_ok "API version in .symbols file and in CORE_API_VERSION.md is the same" + else + output_error "API version in .symbols file and in CORE_API_VERSION.md is different" + EXIT_CODE=3 + fi +} + verify_action() { - tar xf "${SRC_PKG}" PKG_NAME=libkeymancore LIB_NAME=libkeymancore - if [ ! -f debian/${PKG_NAME}.symbols ]; then - echo ":warning: Missing ${PKG_NAME}.symbols file" >&2 - else - tmpDir=$(mktemp -d) - dpkg -x "${BIN_PKG}" "$tmpDir" - cd debian - dpkg-gensymbols -v"${PKG_VERSION}" -p${PKG_NAME} -e"${tmpDir}"/usr/lib/x86_64-linux-gnu/${LIB_NAME}.so* -O${PKG_NAME}.symbols -c4 - echo ":heavy_check_mark: ${LIB_NAME} API didn't change" >&2 + if [[ ! -f debian/${PKG_NAME}.symbols ]]; then + output_warning "Missing ${PKG_NAME}.symbols file" + exit 0 fi + + EXIT_CODE=0 + check_api_not_changed + check_updated_version_number + check_for_major_api_changes + check_for_api_version_consistency + exit "${EXIT_CODE}" } builder_run_action dependencies dependencies_action diff --git a/resources/build/trigger-builds.inc.sh b/resources/build/trigger-builds.inc.sh index 60e2b5c22cc..fb780afa2cb 100644 --- a/resources/build/trigger-builds.inc.sh +++ b/resources/build/trigger-builds.inc.sh @@ -69,23 +69,28 @@ function triggerGitHubActionsBuild() { local IS_TEST_BUILD="$1" local GITHUB_ACTION="$2" local GIT_BRANCH="${3:-master}" - local GIT_REF GIT_HEAD_REF + local GIT_BASE_BRANCH="${GIT_BRANCH}" + local GIT_USER="keyman-server" + local GIT_REF GIT_BASE_REF JSON local GITHUB_SERVER=https://api.github.com/repos/keymanapp/keyman if [ "${action:-""}" == "commit" ]; then # This will only be true if we created and pushed a tag GIT_REF="refs/tags/release@$VERSION_WITH_TAG" - GIT_HEAD_REF="${GIT_REF}" + GIT_BASE_REF="$(git rev-parse "${GIT_REF}^")" GIT_EVENT_TYPE="${GITHUB_ACTION}: release@${VERSION_WITH_TAG}" elif [[ $GIT_BRANCH != stable-* ]] && [[ $GIT_BRANCH =~ [0-9]+ ]]; then GIT_REF="refs/pull/${GIT_BRANCH}/merge" - GIT_HEAD_REF="refs/pull/${GIT_BRANCH}/head" GIT_EVENT_TYPE="${GITHUB_ACTION}: PR #${GIT_BRANCH}" + JSON=$(curl -s "${GITHUB_SERVER}/pulls/${GIT_BRANCH}") + GIT_USER="$(echo "$JSON" | $JQ -r '.user.login')" + GIT_BASE_REF="$(echo "$JSON" | $JQ -r '.base.ref')" + GIT_BASE_BRANCH="${GIT_BASE_REF}" GIT_BRANCH="PR-${GIT_BRANCH}" else GIT_REF="refs/heads/${GIT_BRANCH}" - GIT_HEAD_REF="${GIT_REF}" + GIT_BASE_REF="$(git rev-parse "${GIT_REF}^")" GIT_EVENT_TYPE="${GITHUB_ACTION}: ${GIT_BRANCH}" fi @@ -93,8 +98,10 @@ function triggerGitHubActionsBuild() { \"ref\": \"$GIT_REF\", \ \"inputs\": { \ \"ref\": \"$GIT_REF\", \ - \"headRef\": \"$GIT_HEAD_REF\", \ \"branch\": \"$GIT_BRANCH\", \ + \"baseBranch\": \"$GIT_BASE_BRANCH\", \ + \"baseRef\": \"$GIT_BASE_REF\", \ + \"user\": \"$GIT_USER\", \ \"isTestBuild\": \"$IS_TEST_BUILD\" \ }}" From 4085612ad9b4a724aca31abf218bf60f40cf6a0e Mon Sep 17 00:00:00 2001 From: Darcy Wong Date: Mon, 30 Oct 2023 09:26:22 +0700 Subject: [PATCH 08/67] fix(developer): Revise check on special characters --- .../src/kmc-kmn/src/kmw-compiler/constants.ts | 15 +++++++++++++-- .../src/kmw-compiler/validate-layout-file.ts | 12 +++++------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/developer/src/kmc-kmn/src/kmw-compiler/constants.ts b/developer/src/kmc-kmn/src/kmw-compiler/constants.ts index a8d88538843..90f71cefeac 100644 --- a/developer/src/kmc-kmn/src/kmw-compiler/constants.ts +++ b/developer/src/kmc-kmn/src/kmw-compiler/constants.ts @@ -8,9 +8,9 @@ export const // See also builder.js: specialCharacters; web/source/osk/oskKey.ts: specialCharacters export const CSpecialText10: string = '*Shift*\0*Enter*\0*Tab*\0*BkSp*\0*Menu*\0*Hide*\0*Alt*\0*Ctrl*\0*Caps*\0' + - '*ABC*\0*abc*\0*123*\0*Symbol*\0*Currency*\0*Shifted*\0*AltGr*\0*TabLeft*', + '*ABC*\0*abc*\0*123*\0*Symbol*\0*Currency*\0*Shifted*\0*AltGr*\0*TabLeft*\0', // these names were added in Keyman 14 - CSpecialText14: string = '*LTREnter*\0*LTRBkSp*\0*RTLEnter*\0*RTLBkSp*\0*ShiftLock*\0*ShiftedLock*\0*ZWNJ*\0*ZWNJiOS*\0*ZWNJAndroid*', + CSpecialText14: string = '*LTREnter*\0*LTRBkSp*\0*RTLEnter*\0*RTLBkSp*\0*ShiftLock*\0*ShiftedLock*\0*ZWNJ*\0*ZWNJiOS*\0*ZWNJAndroid*\0', CSpecialText14ZWNJ: string = '*ZWNJ*\0*ZWNJiOS*\0*ZWNJAndroid*', CSpecialText14Map: string[][] = [ ['*LTREnter*', '*Enter*'], @@ -31,6 +31,17 @@ export const ['*ZWNJGeneric*', '<|>'] ]; + // Map for checking minimum versions and Special Text + export const CSpecialText = new Map([ + [10, CSpecialText10], + [11, CSpecialText10], + [12, CSpecialText10], + [13, CSpecialText10], + [14, CSpecialText14 + CSpecialText10], + [15, CSpecialText14 + CSpecialText10], + [16, CSpecialText14 + CSpecialText10], + [17, CSpecialText17 + CSpecialText14 + CSpecialText10] + ]); // These correspond to TSS_ values in kmx.ts export const diff --git a/developer/src/kmc-kmn/src/kmw-compiler/validate-layout-file.ts b/developer/src/kmc-kmn/src/kmw-compiler/validate-layout-file.ts index 4d12425df09..cc86d4bca32 100644 --- a/developer/src/kmc-kmn/src/kmw-compiler/validate-layout-file.ts +++ b/developer/src/kmc-kmn/src/kmw-compiler/validate-layout-file.ts @@ -1,7 +1,7 @@ import { KMX, Osk, TouchLayout, TouchLayoutFileReader, TouchLayoutFileWriter } from "@keymanapp/common-types"; -import { callbacks, IsKeyboardVersion14OrLater, IsKeyboardVersion15OrLater, IsKeyboardVersion17OrLater } from "./compiler-globals.js"; +import { callbacks, fk, IsKeyboardVersion14OrLater, IsKeyboardVersion15OrLater, IsKeyboardVersion17OrLater } from "./compiler-globals.js"; import { JavaScript_Key } from "./javascript-strings.js"; -import { TRequiredKey, CRequiredKeys, CSpecialText10, CSpecialText14, CSpecialText14ZWNJ, CSpecialText14Map, CSpecialText17, CSpecialText17ZWNJ, CSpecialText17Map } from "./constants.js"; +import { TRequiredKey, CRequiredKeys, CSpecialText, CSpecialText14ZWNJ, CSpecialText14Map, CSpecialText17ZWNJ, CSpecialText17Map } from "./constants.js"; import { KeymanWebTouchStandardKeyNames, KMWAdditionalKeyNames, VKeyNames } from "./keymanweb-key-codes.js"; import { KmwCompilerMessages } from "./messages.js"; @@ -144,11 +144,9 @@ function CheckKey( // Keyman versions before 14 do not support '*special*' labels on non-special keys. // ZWNJ use, however, is safe because it will be transformed in function // TransformSpecialKeys14 to '<|>', which does not require the custom OSK font. - if((CSpecialText10.includes(FText) || CSpecialText14.includes(FText) || CSpecialText17.includes(FText)) && - !CSpecialText14ZWNJ.includes(FText) && - !IsKeyboardVersion14OrLater() && - !CSpecialText17ZWNJ.includes(FText) && - !IsKeyboardVersion17OrLater() && + const mapVersion = (fk.fileVersion > 17 ? 17 : fk.fileVersion < 10 ? 10 : fk.fileVersion); + const specialText = CSpecialText.get(mapVersion); + if(specialText.includes(FText) && !([TouchLayout.TouchLayoutKeySp.special, TouchLayout.TouchLayoutKeySp.specialActive].includes(FKeyType))) { callbacks.reportMessage(KmwCompilerMessages.Warn_TouchLayoutSpecialLabelOnNormalKey({ keyId: FId, From 2064ac4556a2ffdb558a7e753163d0f5e90cfe91 Mon Sep 17 00:00:00 2001 From: Darcy Wong Date: Mon, 30 Oct 2023 09:29:30 +0700 Subject: [PATCH 09/67] chore(developer): Cleanup unused ZWNJ --- developer/src/kmc-kmn/src/kmw-compiler/validate-layout-file.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/developer/src/kmc-kmn/src/kmw-compiler/validate-layout-file.ts b/developer/src/kmc-kmn/src/kmw-compiler/validate-layout-file.ts index cc86d4bca32..fb0e21d83a0 100644 --- a/developer/src/kmc-kmn/src/kmw-compiler/validate-layout-file.ts +++ b/developer/src/kmc-kmn/src/kmw-compiler/validate-layout-file.ts @@ -1,7 +1,7 @@ import { KMX, Osk, TouchLayout, TouchLayoutFileReader, TouchLayoutFileWriter } from "@keymanapp/common-types"; import { callbacks, fk, IsKeyboardVersion14OrLater, IsKeyboardVersion15OrLater, IsKeyboardVersion17OrLater } from "./compiler-globals.js"; import { JavaScript_Key } from "./javascript-strings.js"; -import { TRequiredKey, CRequiredKeys, CSpecialText, CSpecialText14ZWNJ, CSpecialText14Map, CSpecialText17ZWNJ, CSpecialText17Map } from "./constants.js"; +import { TRequiredKey, CRequiredKeys, CSpecialText, CSpecialText14Map, CSpecialText17Map } from "./constants.js"; import { KeymanWebTouchStandardKeyNames, KMWAdditionalKeyNames, VKeyNames } from "./keymanweb-key-codes.js"; import { KmwCompilerMessages } from "./messages.js"; From b26b6a37d75c3fa3ed4da1bf43c742cc31d2b19d Mon Sep 17 00:00:00 2001 From: Marc Durdin Date: Wed, 1 Nov 2023 04:43:42 +0700 Subject: [PATCH 10/67] fix(developer): use KeymanWeb.Codes for 17.0+ Fixes #8147. Keyboards debug-compiled for web 17.0+ will use `KeymanWeb.Codes.` instead of `keyman.osk.`. --- .../src/kmc-kmn/src/kmw-compiler/compiler-globals.ts | 4 ++++ .../src/kmc-kmn/src/kmw-compiler/kmw-compiler.ts | 11 ++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/developer/src/kmc-kmn/src/kmw-compiler/compiler-globals.ts b/developer/src/kmc-kmn/src/kmw-compiler/compiler-globals.ts index 26981f5711c..92cba914c5e 100644 --- a/developer/src/kmc-kmn/src/kmw-compiler/compiler-globals.ts +++ b/developer/src/kmc-kmn/src/kmw-compiler/compiler-globals.ts @@ -46,3 +46,7 @@ export function IsKeyboardVersion14OrLater(): boolean { export function IsKeyboardVersion15OrLater(): boolean { return fk.fileVersion >= KMX.KMXFile.VERSION_150; } + +export function IsKeyboardVersion17OrLater(): boolean { + return fk.fileVersion >= KMX.KMXFile.VERSION_170; +} diff --git a/developer/src/kmc-kmn/src/kmw-compiler/kmw-compiler.ts b/developer/src/kmc-kmn/src/kmw-compiler/kmw-compiler.ts index 986db18050e..b3baaea9fb2 100644 --- a/developer/src/kmc-kmn/src/kmw-compiler/kmw-compiler.ts +++ b/developer/src/kmc-kmn/src/kmw-compiler/kmw-compiler.ts @@ -1,6 +1,6 @@ import { KMX, CompilerOptions, CompilerCallbacks, KvkFileReader, VisualKeyboard, KmxFileReader, KvkFile } from "@keymanapp/common-types"; import { ExpandSentinel, incxstr, xstrlen } from "./util.js"; -import { options, nl, FTabStop, setupGlobals, IsKeyboardVersion10OrLater, callbacks, FFix183_LadderLength, FCallFunctions, fk } from "./compiler-globals.js"; +import { options, nl, FTabStop, setupGlobals, IsKeyboardVersion10OrLater, callbacks, FFix183_LadderLength, FCallFunctions, fk, IsKeyboardVersion17OrLater } from "./compiler-globals.js"; import { JavaScript_ContextMatch, JavaScript_KeyAsString, JavaScript_Name, JavaScript_OutputString, JavaScript_Rules, JavaScript_Shift, JavaScript_ShiftAsString, JavaScript_Store, zeroPadHex } from './javascript-strings.js'; import { KmwCompilerMessages } from "./messages.js"; import { ValidateLayoutFile } from "./validate-layout-file.js"; @@ -435,8 +435,13 @@ function GetKeyboardModifierBitmask(keyboard: KMX.KEYBOARD, fMnemonic: boolean): function JavaScript_SetupDebug() { if(IsKeyboardVersion10OrLater()) { if(options.saveDebug) { - return 'var modCodes = keyman.osk.modifierCodes;'+nl+ - FTabStop+'var keyCodes = keyman.osk.keyCodes;'+nl; + if(IsKeyboardVersion17OrLater()) { + return 'var modCodes = KeymanWeb.Codes.modifierCodes;'+nl+ + FTabStop+'var keyCodes = KeymanWeb.Codes.keyCodes;'+nl; + } else { + return 'var modCodes = keyman.osk.modifierCodes;'+nl+ + FTabStop+'var keyCodes = keyman.osk.keyCodes;'+nl; + } } } return ''; From 4ce16a08fc8d3b6ae765eddcdc4d20e503c9b3a4 Mon Sep 17 00:00:00 2001 From: Marc Durdin Date: Wed, 1 Nov 2023 05:57:13 +0700 Subject: [PATCH 11/67] fix(developer): don't use osk-always-visible on touch devices Fixes #9845. It seems that the logic for `osk-always-visible` is not quite right on touch devices -- the OSK disappears on blur but remains touchable -- so presses in the OSK region emit key events. For Keyman Developer Server, the simple workaround is to only use `` when on desktop devices. We should review the logic for `osk-always-visible` in KeymanWeb, so that this issue does not arise on touch devices. This patch addresses the issue in Keyman Developer Server, and matches the behaviour we want on touch devices in any case, as we don't really want the OSK visible when blurred, unlike on desktop. --- developer/src/server/src/site/index.html | 2 +- developer/src/server/src/site/test.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/developer/src/server/src/site/index.html b/developer/src/server/src/site/index.html index 5a4fd139a55..8147a849a46 100644 --- a/developer/src/server/src/site/index.html +++ b/developer/src/server/src/site/index.html @@ -21,7 +21,7 @@ - +