From 28f3c07d5f8945b48c093260c4f562282b16d7b4 Mon Sep 17 00:00:00 2001 From: Aleksandras Kostarevas Date: Fri, 27 Sep 2024 18:50:47 +0300 Subject: [PATCH] Fix landscape floating keyboard going offscreen on the right --- java/src/org/futo/inputmethod/latin/LatinIME.kt | 1 + java/src/org/futo/inputmethod/latin/uix/UixManager.kt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/java/src/org/futo/inputmethod/latin/LatinIME.kt b/java/src/org/futo/inputmethod/latin/LatinIME.kt index 814cd2f16..b66dc222e 100644 --- a/java/src/org/futo/inputmethod/latin/LatinIME.kt +++ b/java/src/org/futo/inputmethod/latin/LatinIME.kt @@ -490,6 +490,7 @@ class LatinIME : InputMethodServiceCompose(), LatinIMELegacy.SuggestionStripCont fun getInputViewHeight(): Int = inputViewHeight fun getViewHeight(): Int = composeView?.height ?: resources.displayMetrics.heightPixels + fun getViewWidth(): Int = composeView?.width ?: resources.displayMetrics.widthPixels private var isInputModal = false fun setInputModal(to: Boolean) { diff --git a/java/src/org/futo/inputmethod/latin/uix/UixManager.kt b/java/src/org/futo/inputmethod/latin/uix/UixManager.kt index af168e7d0..22f365ba7 100644 --- a/java/src/org/futo/inputmethod/latin/uix/UixManager.kt +++ b/java/src/org/futo/inputmethod/latin/uix/UixManager.kt @@ -709,7 +709,7 @@ class UixManager(private val latinIME: LatinIME) { newOffset.y.coerceAtLeast(0.0f) ) newOffset = newOffset.copy( - newOffset.x.coerceAtMost(configuration.screenWidthDp.dp.toPx() - size.width), + newOffset.x.coerceAtMost(latinIME.getViewWidth().toFloat() - size.width), newOffset.y.coerceAtMost(latinIME.getViewHeight().toFloat() - measuredTouchableHeight) )