From bf33230c26911f7a2e267c1ce5db4fcc096e1602 Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Sun, 30 Jun 2024 00:06:17 +0200 Subject: [PATCH 1/7] settings: Reword "Key repeat" into "Long press" The long press timeout is used for long press on keys that do not repeat, for example the keyboard switching key. This must be detached from the key repeat as it might be disableable in the future and more keys might be longpressable. --- res/values-cs/strings.xml | 2 +- res/values-de/strings.xml | 2 +- res/values-es/strings.xml | 2 +- res/values-fa/strings.xml | 2 +- res/values-fr/strings.xml | 2 +- res/values-it/strings.xml | 2 +- res/values-ko/strings.xml | 2 +- res/values-lv/strings.xml | 2 +- res/values-pl/strings.xml | 2 +- res/values-pt/strings.xml | 2 +- res/values-ro/strings.xml | 2 +- res/values-ru/strings.xml | 2 +- res/values-tr/strings.xml | 2 +- res/values-uk/strings.xml | 2 +- res/values-vi/strings.xml | 2 +- res/values-zh-rCN/strings.xml | 2 +- res/values/strings.xml | 2 +- 17 files changed, 17 insertions(+), 17 deletions(-) diff --git a/res/values-cs/strings.xml b/res/values-cs/strings.xml index 8474f7f..ffdc013 100644 --- a/res/values-cs/strings.xml +++ b/res/values-cs/strings.xml @@ -38,7 +38,7 @@ Tato aplikace neobsahuje žádné reklamy, nevyužívá připojení k síti a je Psaní Vzdálenost posunutí prstem Jak daleko je třeba posunout prst pro zadání znaku/znaménka v rohu klávey (%s) - Časová prodleva opakování znaků + Interval opakování znaků Dvojklik pro aktivaci Capslock(u) Umožňuje zamknout Shift dvojklikem, namísto podržení diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml index 513d982..32b57c0 100644 --- a/res/values-de/strings.xml +++ b/res/values-de/strings.xml @@ -38,7 +38,7 @@ Diese App enthält keine Werbung, benötigt keinen Netzwerkzugriff und ist quell Tippen Länge der Wischgeste Abstand der Zeichen in den Ecken der Tasten (%s) - Zeitüberschreitung bei Tastenwiederholung + Intervall der Tastenwiederholung Umschalttaste mit Doppeltippen einrasten Anstatt Taste längere Zeit gedrückt zu halten diff --git a/res/values-es/strings.xml b/res/values-es/strings.xml index 66ca26a..534c734 100644 --- a/res/values-es/strings.xml +++ b/res/values-es/strings.xml @@ -38,7 +38,7 @@ La misma no contiene ningún anuncio/publicidad, no realiza peticiones de red y Escritura Distancia de deslizamiento Distancia de caracteres en las esquinas de las teclas (%s) - Tiempo de espera para repetir tecla + Intervalo de repetición de tecla Doble toque en Mayús para bloquear las mayúsculas Se puede bloquear cualquier modificador manteniéndolo presionado diff --git a/res/values-fa/strings.xml b/res/values-fa/strings.xml index f8132ce..b881889 100644 --- a/res/values-fa/strings.xml +++ b/res/values-fa/strings.xml @@ -38,7 +38,7 @@ This application contains no ads, doesn't make any network requests and is Open درحال نوشتن فاصله کشیدن فاصله حروف از گوشه‌های کلیدها )(%s) - درنگ تکرار کلید + فاصله تکرار کلید دوبار ضربه روی دگرساز برای فعال شدن کپس لاک شما میتوانید قفل کنید هر میانبری را با نگه داشتن آن diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml index 5530a8b..d863cc5 100644 --- a/res/values-fr/strings.xml +++ b/res/values-fr/strings.xml @@ -38,7 +38,7 @@ Cette application ne contient pas de publicité, n'accède pas au réseau et est Saisie Distance de swipe La distance des caractères dans les coins (%s) - Délai avant répétition + Écart entre les répétitions Appuyer deux fois pour bloquer la majuscule Un appui long bloque la majuscule diff --git a/res/values-it/strings.xml b/res/values-it/strings.xml index 84c5706..2097e56 100644 --- a/res/values-it/strings.xml +++ b/res/values-it/strings.xml @@ -38,7 +38,7 @@ This application contains no ads, doesn't make any network requests and is Open Digitando Distanza swipe Distanza dei caratteri negli angoli dei tasti (%s) - Timeout ripetizione tasto + Intervallo ripetizione tasto Doppio tocco su Shift per attivare CapsLock Invece di premere i modificatori a lungo diff --git a/res/values-ko/strings.xml b/res/values-ko/strings.xml index f0c1996..67f9b32 100644 --- a/res/values-ko/strings.xml +++ b/res/values-ko/strings.xml @@ -38,7 +38,7 @@ This application contains no ads, doesn't make any network requests and is Open 타자 스와이프 범위 키 모서리 문자의 입력 범위 (%s) - 키 길게 누르기 지연 + 키 반복 간격 diff --git a/res/values-lv/strings.xml b/res/values-lv/strings.xml index c4c39b3..0bc39fe 100644 --- a/res/values-lv/strings.xml +++ b/res/values-lv/strings.xml @@ -38,7 +38,7 @@ Tagad lieliski piemērota izmantošanai ikdienā. Rakstīšana Pavilkšanas attālums Taustiņu stūros esošo rakstzīmju attālums (%s) - Taustiņa atkārtošanās ātrums + Taustiņa atkārtošanās aizture Divkāršs piesitiens burtslēgam Tā vietā, lai ilstoši piespiestu pārveidotāju diff --git a/res/values-pl/strings.xml b/res/values-pl/strings.xml index fdd4635..68c10f4 100644 --- a/res/values-pl/strings.xml +++ b/res/values-pl/strings.xml @@ -38,7 +38,7 @@ Aplikacja nie zawiera reklam, nie żąda dostępu do internetu, a jej kod źród Pisanie Odległość przesuwania Odległość znaków od rogów klawiszy (%s) - Opóźnienie powtarzania naciśnięć klawisza + Czas pomiędzy powtórzeniami Naciśnij Shift podwójnie, aby włączyć caps lock Możesz zablokować modyfikator poprzez jego długie naciśnięcie diff --git a/res/values-pt/strings.xml b/res/values-pt/strings.xml index 4eac2a7..fed1105 100644 --- a/res/values-pt/strings.xml +++ b/res/values-pt/strings.xml @@ -38,7 +38,7 @@ Este aplicativo não contém anúncios, não faz nenhuma solicitação de rede e Digitação Distância a deslizar Distância até acionar os cantos das teclas (%s) - Tempo até repetir tecla + Intervalo de repetição de tecla Tecle duas vezes no shift para travá-lo acionado Ao invés de apertar e segurar por um tempo diff --git a/res/values-ro/strings.xml b/res/values-ro/strings.xml index cf54f43..5dd13bc 100644 --- a/res/values-ro/strings.xml +++ b/res/values-ro/strings.xml @@ -38,7 +38,7 @@ Această aplicație nu conține publicitate, nu folosește rețeaua deloc și e Tipărire Distanța de glisare Distanța dintre caracterele din colțurile tastelor (%s) - Timeout pentru repetarea tastelor + Intervalul de repetare a tastelor Apăsare dublă pe Shift activează Caps Lock Puteți activa orice modificator, ținându-l apăsat diff --git a/res/values-ru/strings.xml b/res/values-ru/strings.xml index 2d77de6..6572103 100644 --- a/res/values-ru/strings.xml +++ b/res/values-ru/strings.xml @@ -38,7 +38,7 @@ Набор текста Длина жеста Расстояние между символами в углах клавиш (%s) - Задержка повтора клавиш + Интервал повтора клавиш CapsLock двойным нажатием Shift Также можно активировать модификатор долгим нажатием diff --git a/res/values-tr/strings.xml b/res/values-tr/strings.xml index 9f017ca..0d608cc 100644 --- a/res/values-tr/strings.xml +++ b/res/values-tr/strings.xml @@ -38,7 +38,7 @@ Bu uygulama açık kaynaklıdır. Reklam içermez ve internete bağlanmaz."Yazma Kaydırma mesafesi Tuşların köşelerinden kaydırma mesafesi (%s) - Tuşların tekrarlaması için geçmesi gereken süre + Tuşların tekrarlama sıklığı CapsLock için Shift tuşuna çift bas Uzun basarak CapsLock açılabilir diff --git a/res/values-uk/strings.xml b/res/values-uk/strings.xml index ff0f12a..a3c5253 100644 --- a/res/values-uk/strings.xml +++ b/res/values-uk/strings.xml @@ -38,7 +38,7 @@ Введення Відстань проведення Відстань між символами в кутах клавіш (%s) - Час очікування повтору клавіші + Інтервал повторення клавіш Двічі торкніться Shift для Caps Lock Ви можете заблокувати будь-який модифікатор, утримуючи його diff --git a/res/values-vi/strings.xml b/res/values-vi/strings.xml index a8bea74..46f6657 100644 --- a/res/values-vi/strings.xml +++ b/res/values-vi/strings.xml @@ -38,7 +38,7 @@ Bây giờ đã hoàn hảo cho việc sử dụng hàng ngày. Khoảng cách vuốt Khoảng cách giữa các ký tự ở góc phím (%s) - Thời hạn lặp phím + Khoảng thời gian lặp phím Nhấn hai lần Shift để bật Caps Lock Bạn có thể khóa phím hỗ trợ bằng cách giữ vào nó diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml index 20eba97..c585829 100644 --- a/res/values-zh-rCN/strings.xml +++ b/res/values-zh-rCN/strings.xml @@ -38,7 +38,7 @@ 输入 滑动触发距离 输入按键四角的符号需要滑动的距离 (%s) - 长按到开始重复输入的时间 + 长按后每次重复输入的时间间隔 双击 Shift 键锁定大写 任何时候长按修饰键均可将其锁定 diff --git a/res/values/strings.xml b/res/values/strings.xml index 9050ce8..a61b12c 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -38,7 +38,7 @@ This application contains no ads, doesn't make any network requests and is Open Typing Swiping distance Distance of characters in the corners of the keys (%s) - Key repeat timeout + Long press timeout Key repeat interval Double tap on shift for caps lock You can lock any modifier by holding it From bdb080657d4e829210270b17d21df976eadf632b Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Sun, 30 Jun 2024 00:24:39 +0200 Subject: [PATCH 2/7] Option to disable key repeat Internally "key repeat" is reword into "long press" when the same mechanism was used for both features. The constraint that 'timeoutWhat' must be set to '-1' when no message is expected has been lifted to simplify the code. --- res/values-cs/strings.xml | 1 + res/values-de/strings.xml | 1 + res/values-es/strings.xml | 1 + res/values-fa/strings.xml | 1 + res/values-fr/strings.xml | 1 + res/values-it/strings.xml | 1 + res/values-ko/strings.xml | 1 + res/values-lv/strings.xml | 1 + res/values-pl/strings.xml | 1 + res/values-pt/strings.xml | 1 + res/values-ro/strings.xml | 1 + res/values-ru/strings.xml | 1 + res/values-tr/strings.xml | 1 + res/values-uk/strings.xml | 1 + res/values-vi/strings.xml | 1 + res/values-zh-rCN/strings.xml | 1 + res/values/strings.xml | 1 + res/xml/settings.xml | 3 +- srcs/juloo.keyboard2/Config.java | 2 + srcs/juloo.keyboard2/Pointers.java | 66 +++++++++++++++--------------- 20 files changed, 53 insertions(+), 35 deletions(-) diff --git a/res/values-cs/strings.xml b/res/values-cs/strings.xml index ffdc013..0e645a7 100644 --- a/res/values-cs/strings.xml +++ b/res/values-cs/strings.xml @@ -40,6 +40,7 @@ Tato aplikace neobsahuje žádné reklamy, nevyužívá připojení k síti a je Jak daleko je třeba posunout prst pro zadání znaku/znaménka v rohu klávey (%s) Interval opakování znaků + Dvojklik pro aktivaci Capslock(u) Umožňuje zamknout Shift dvojklikem, namísto podržení Chování diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml index 32b57c0..8a63e4c 100644 --- a/res/values-de/strings.xml +++ b/res/values-de/strings.xml @@ -40,6 +40,7 @@ Diese App enthält keine Werbung, benötigt keinen Netzwerkzugriff und ist quell Abstand der Zeichen in den Ecken der Tasten (%s) Intervall der Tastenwiederholung + Umschalttaste mit Doppeltippen einrasten Anstatt Taste längere Zeit gedrückt zu halten Verhalten diff --git a/res/values-es/strings.xml b/res/values-es/strings.xml index 534c734..9f3322d 100644 --- a/res/values-es/strings.xml +++ b/res/values-es/strings.xml @@ -40,6 +40,7 @@ La misma no contiene ningún anuncio/publicidad, no realiza peticiones de red y Distancia de caracteres en las esquinas de las teclas (%s) Intervalo de repetición de tecla + Doble toque en Mayús para bloquear las mayúsculas Se puede bloquear cualquier modificador manteniéndolo presionado Comportamiento diff --git a/res/values-fa/strings.xml b/res/values-fa/strings.xml index b881889..f76e689 100644 --- a/res/values-fa/strings.xml +++ b/res/values-fa/strings.xml @@ -40,6 +40,7 @@ This application contains no ads, doesn't make any network requests and is Open فاصله حروف از گوشه‌های کلیدها )(%s) فاصله تکرار کلید + دوبار ضربه روی دگرساز برای فعال شدن کپس لاک شما میتوانید قفل کنید هر میانبری را با نگه داشتن آن ٰرفتار diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml index d863cc5..ba7d21a 100644 --- a/res/values-fr/strings.xml +++ b/res/values-fr/strings.xml @@ -40,6 +40,7 @@ Cette application ne contient pas de publicité, n'accède pas au réseau et est La distance des caractères dans les coins (%s) Écart entre les répétitions + Appuyer deux fois pour bloquer la majuscule Un appui long bloque la majuscule Comportement diff --git a/res/values-it/strings.xml b/res/values-it/strings.xml index 2097e56..f4da65d 100644 --- a/res/values-it/strings.xml +++ b/res/values-it/strings.xml @@ -40,6 +40,7 @@ This application contains no ads, doesn't make any network requests and is Open Distanza dei caratteri negli angoli dei tasti (%s) Intervallo ripetizione tasto + Doppio tocco su Shift per attivare CapsLock Invece di premere i modificatori a lungo diff --git a/res/values-ko/strings.xml b/res/values-ko/strings.xml index 67f9b32..20844c2 100644 --- a/res/values-ko/strings.xml +++ b/res/values-ko/strings.xml @@ -40,6 +40,7 @@ This application contains no ads, doesn't make any network requests and is Open 키 모서리 문자의 입력 범위 (%s) 키 반복 간격 + diff --git a/res/values-lv/strings.xml b/res/values-lv/strings.xml index 0bc39fe..7ae25b3 100644 --- a/res/values-lv/strings.xml +++ b/res/values-lv/strings.xml @@ -40,6 +40,7 @@ Tagad lieliski piemērota izmantošanai ikdienā. Taustiņu stūros esošo rakstzīmju attālums (%s) Taustiņa atkārtošanās aizture + Divkāršs piesitiens burtslēgam Tā vietā, lai ilstoši piespiestu pārveidotāju Uzvedība diff --git a/res/values-pl/strings.xml b/res/values-pl/strings.xml index 68c10f4..4531c8f 100644 --- a/res/values-pl/strings.xml +++ b/res/values-pl/strings.xml @@ -40,6 +40,7 @@ Aplikacja nie zawiera reklam, nie żąda dostępu do internetu, a jej kod źród Odległość znaków od rogów klawiszy (%s) Czas pomiędzy powtórzeniami + Naciśnij Shift podwójnie, aby włączyć caps lock Możesz zablokować modyfikator poprzez jego długie naciśnięcie Zachowanie diff --git a/res/values-pt/strings.xml b/res/values-pt/strings.xml index fed1105..1d98260 100644 --- a/res/values-pt/strings.xml +++ b/res/values-pt/strings.xml @@ -40,6 +40,7 @@ Este aplicativo não contém anúncios, não faz nenhuma solicitação de rede e Distância até acionar os cantos das teclas (%s) Intervalo de repetição de tecla + Tecle duas vezes no shift para travá-lo acionado Ao invés de apertar e segurar por um tempo Comportamento diff --git a/res/values-ro/strings.xml b/res/values-ro/strings.xml index 5dd13bc..b68f15e 100644 --- a/res/values-ro/strings.xml +++ b/res/values-ro/strings.xml @@ -40,6 +40,7 @@ Această aplicație nu conține publicitate, nu folosește rețeaua deloc și e Distanța dintre caracterele din colțurile tastelor (%s) Intervalul de repetare a tastelor + Apăsare dublă pe Shift activează Caps Lock Puteți activa orice modificator, ținându-l apăsat Comportament diff --git a/res/values-ru/strings.xml b/res/values-ru/strings.xml index 6572103..c7b7e78 100644 --- a/res/values-ru/strings.xml +++ b/res/values-ru/strings.xml @@ -40,6 +40,7 @@ Расстояние между символами в углах клавиш (%s) Интервал повтора клавиш + CapsLock двойным нажатием Shift Также можно активировать модификатор долгим нажатием Поведение diff --git a/res/values-tr/strings.xml b/res/values-tr/strings.xml index 0d608cc..4a77bbc 100644 --- a/res/values-tr/strings.xml +++ b/res/values-tr/strings.xml @@ -40,6 +40,7 @@ Bu uygulama açık kaynaklıdır. Reklam içermez ve internete bağlanmaz."Tuşların köşelerinden kaydırma mesafesi (%s) Tuşların tekrarlama sıklığı + CapsLock için Shift tuşuna çift bas Uzun basarak CapsLock açılabilir Klavye davranışı diff --git a/res/values-uk/strings.xml b/res/values-uk/strings.xml index a3c5253..93af083 100644 --- a/res/values-uk/strings.xml +++ b/res/values-uk/strings.xml @@ -40,6 +40,7 @@ Відстань між символами в кутах клавіш (%s) Інтервал повторення клавіш + Двічі торкніться Shift для Caps Lock Ви можете заблокувати будь-який модифікатор, утримуючи його Поведінка diff --git a/res/values-vi/strings.xml b/res/values-vi/strings.xml index 46f6657..8ea468d 100644 --- a/res/values-vi/strings.xml +++ b/res/values-vi/strings.xml @@ -40,6 +40,7 @@ Bây giờ đã hoàn hảo cho việc sử dụng hàng ngày. Khoảng cách giữa các ký tự ở góc phím (%s) Khoảng thời gian lặp phím + Nhấn hai lần Shift để bật Caps Lock Bạn có thể khóa phím hỗ trợ bằng cách giữ vào nó diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml index c585829..89b6c28 100644 --- a/res/values-zh-rCN/strings.xml +++ b/res/values-zh-rCN/strings.xml @@ -40,6 +40,7 @@ 输入按键四角的符号需要滑动的距离 (%s) 长按后每次重复输入的时间间隔 + 双击 Shift 键锁定大写 任何时候长按修饰键均可将其锁定 行为 diff --git a/res/values/strings.xml b/res/values/strings.xml index a61b12c..224aca5 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -40,6 +40,7 @@ This application contains no ads, doesn't make any network requests and is Open Distance of characters in the corners of the keys (%s) Long press timeout Key repeat interval + Key repeat on long press Double tap on shift for caps lock You can lock any modifier by holding it Behavior diff --git a/res/xml/settings.xml b/res/xml/settings.xml index 270dfcd..c6c553a 100644 --- a/res/xml/settings.xml +++ b/res/xml/settings.xml @@ -16,7 +16,8 @@ - + + diff --git a/srcs/juloo.keyboard2/Config.java b/srcs/juloo.keyboard2/Config.java index 8b72bc7..7570728 100644 --- a/srcs/juloo.keyboard2/Config.java +++ b/srcs/juloo.keyboard2/Config.java @@ -47,6 +47,7 @@ public final class Config public long vibrate_duration; public long longPressTimeout; public long longPressInterval; + public boolean keyrepeat_enabled; public float margin_bottom; public float keyHeight; public float horizontal_margin; @@ -152,6 +153,7 @@ public final class Config vibrate_duration = _prefs.getInt("vibrate_duration", 20); longPressTimeout = _prefs.getInt("longpress_timeout", 600); longPressInterval = _prefs.getInt("longpress_interval", 65); + keyrepeat_enabled = _prefs.getBoolean("keyrepeat_enabled", true); margin_bottom = get_dip_pref_oriented(dm, "margin_bottom", 7, 3); key_vertical_margin = get_dip_pref(dm, "key_vertical_margin", 1.5f) / 100; key_horizontal_margin = get_dip_pref(dm, "key_horizontal_margin", 2) / 100; diff --git a/srcs/juloo.keyboard2/Pointers.java b/srcs/juloo.keyboard2/Pointers.java index 55ca9c5..0b24b8f 100644 --- a/srcs/juloo.keyboard2/Pointers.java +++ b/srcs/juloo.keyboard2/Pointers.java @@ -24,14 +24,14 @@ public final class Pointers implements Handler.Callback /** Can't be locked, even when long pressing. */ public static final int FLAG_P_CANT_LOCK = (1 << 7); - private Handler _keyrepeat_handler; + private Handler _longpress_handler; private ArrayList _ptrs = new ArrayList(); private IPointerEventHandler _handler; private Config _config; public Pointers(IPointerEventHandler h, Config c) { - _keyrepeat_handler = new Handler(this); + _longpress_handler = new Handler(this); _handler = h; _config = c; } @@ -62,7 +62,7 @@ public final class Pointers implements Handler.Callback public void clear() { for (Pointer p : _ptrs) - stopKeyRepeat(p); + stopLongPress(p); _ptrs.clear(); } @@ -142,7 +142,7 @@ public final class Pointers implements Handler.Callback ptr.sliding.onTouchUp(ptr); return; } - stopKeyRepeat(ptr); + stopLongPress(ptr); KeyValue ptr_value = ptr.value; if (ptr.gesture != null && ptr.gesture.is_in_progress()) { @@ -206,7 +206,7 @@ public final class Pointers implements Handler.Callback KeyValue value = _handler.modifyKey(key.keys[0], mods); Pointer ptr = new Pointer(pointerId, key, value, x, y, mods); _ptrs.add(ptr); - startKeyRepeat(ptr); + startLongPress(ptr); _handler.onPointerDown(value, false); } @@ -313,7 +313,7 @@ public final class Pointers implements Handler.Callback else { ptr.value = apply_gesture(ptr, ptr.gesture.get_gesture()); - restartKeyRepeat(ptr); + restartLongPress(ptr); ptr.flags = 0; // Special behaviors are ignored during a gesture. } } @@ -382,7 +382,7 @@ public final class Pointers implements Handler.Callback // Key repeat - /** Message from [_keyrepeat_handler]. */ + /** Message from [_longpress_handler]. */ @Override public boolean handleMessage(Message msg) { @@ -390,11 +390,7 @@ public final class Pointers implements Handler.Callback { if (ptr.timeoutWhat == msg.what) { - if (handleKeyRepeat(ptr)) - _keyrepeat_handler.sendEmptyMessageDelayed(msg.what, - _config.longPressInterval); - else - ptr.timeoutWhat = -1; + handleLongPress(ptr); return true; } } @@ -403,60 +399,62 @@ public final class Pointers implements Handler.Callback private static int uniqueTimeoutWhat = 0; - private void startKeyRepeat(Pointer ptr) + private void startLongPress(Pointer ptr) { int what = (uniqueTimeoutWhat++); ptr.timeoutWhat = what; - _keyrepeat_handler.sendEmptyMessageDelayed(what, _config.longPressTimeout); + _longpress_handler.sendEmptyMessageDelayed(what, _config.longPressTimeout); } - private void stopKeyRepeat(Pointer ptr) + private void stopLongPress(Pointer ptr) { - if (ptr.timeoutWhat != -1) - { - _keyrepeat_handler.removeMessages(ptr.timeoutWhat); - ptr.timeoutWhat = -1; - } + _longpress_handler.removeMessages(ptr.timeoutWhat); } - private void restartKeyRepeat(Pointer ptr) + private void restartLongPress(Pointer ptr) { - stopKeyRepeat(ptr); - startKeyRepeat(ptr); + stopLongPress(ptr); + startLongPress(ptr); } - /** A pointer is repeating. Returns [true] if repeat should continue. */ - private boolean handleKeyRepeat(Pointer ptr) + /** A pointer is long pressing. */ + private void handleLongPress(Pointer ptr) { // Long press toggle lock on modifiers if ((ptr.flags & FLAG_P_LATCHABLE) != 0) { if (!ptr.hasFlagsAny(FLAG_P_CANT_LOCK)) lockPointer(ptr, true); - return false; + return; } - // Stop repeating: Latched key, no key + // Latched key, no key if (ptr.hasFlagsAny(FLAG_P_LATCHED) || ptr.value == null) - return false; + return; + // Key is long-pressable KeyValue kv = KeyModifier.modify_long_press(ptr.value); if (!kv.equals(ptr.value)) { ptr.value = kv; _handler.onPointerDown(kv, true); - return true; + return; } - // Stop repeating: Special keys + // Special keys if (kv.hasFlagsAny(KeyValue.FLAG_SPECIAL)) - return false; - _handler.onPointerHold(kv, ptr.modifiers); - return true; + return; + // For every other keys, key-repeat + if (_config.keyrepeat_enabled) + { + _handler.onPointerHold(kv, ptr.modifiers); + _longpress_handler.sendEmptyMessageDelayed(ptr.timeoutWhat, + _config.longPressInterval); + } } // Sliding void startSliding(Pointer ptr, float x) { - stopKeyRepeat(ptr); + stopLongPress(ptr); ptr.flags |= FLAG_P_SLIDING; ptr.sliding = new Sliding(x); } From 3a371c354b05e5c25196917e8a3aadb2a9fecdf7 Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Sun, 30 Jun 2024 00:46:25 +0200 Subject: [PATCH 3/7] doc: Correct mentions of gestures --- doc/Custom-layouts.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/doc/Custom-layouts.md b/doc/Custom-layouts.md index e771df7..f93bd64 100644 --- a/doc/Custom-layouts.md +++ b/doc/Custom-layouts.md @@ -85,7 +85,7 @@ The following optional properties define the effects of swipes: You can define a swipe only once with either compass-point or numeric notation. Unexpected Keyboard automatically puts a small legend in that direction from the center of the key. * `slider`: If `slider="true"`, and the key also has `w` and `e` properties, then the key tracks horizontal finger motion precisely and sends the `w` and `e` keystrokes repeatedly. In built-in layouts, this makes the space bar send left and right characters as the user slides on the space bar. -* `anticircle`: The key value to send when doing an anti-clockwise gesture on the key. (The clockwise gesture applies a Shift modifier and the round-trip gesture applies a Fn modifier. These results can be redefined using a modmap, as explained below.) +* `anticircle`: The key value to send when doing an anti-clockwise gesture on the key. ### Layout A key may have the following properties to control the row's layout: @@ -98,7 +98,7 @@ Normally, a key's width is 1.0 unit. Unexpected Keyboard occupies the full width * `indication`: An optional extra legend to show under the main label. For example, `` displays ABC at the bottom of the 2 key, as on a pinpad or some telephones. If the key also defines a downward swipe with `s` or `key8`, the legends overlap. ## Possible key values -The properties that define the effects of tapping or swiping a key may be one of the built-in strings documented on [this page](Possible-key-values). For example, `se="cut"` says that a southeast swipe produces the "cut" key (Ctrl-C). +The properties that define the effects of tapping or swiping a key may be one of the built-in strings documented on [this page](Possible-key-values.md). For example, `se="cut"` says that a southeast swipe produces the "cut" key (Ctrl-C). Some of those strings begin with `loc `. These are place-holders; the tap or swipe does nothing unless enabled through the "Add keys to keyboard" option in the Settings menu, or implicitly enabled by the language the device is set to use. For example, `ne="loc accent_aigu"` says that a northeast swipe produces the acute accent combinatorial key—if enabled. @@ -110,13 +110,15 @@ The string can output multiple characters, but cannot combine the built-in strin The ``...`` pair encloses custom mappings for modifier keys. The modmap is placed inside the ``...`` pair, but outside any row. A layout can have at most one modmap. A modmap can contain the following tags, each of which must have an `a` and a `b` property: -* `` —This says that, if the Shift modifier is on (or the user made a clockwise gesture on a key), and if the key would normally generate the value after "a", it must instead generate the value after "b". -* `` —This says that, if the Fn modifier is on (or the user made a round-trip gesture on a key), and if the key would normally generate the value after "a", it must instead generate the value after "b". +* `` If the Shift modifier is on, the key `before` is changed into `after`. +* `` If the Fn modifier is on, the key `before` is changed into `after`. -The "a" and "b" values are as specified above in **Possible key values**. A `` tag modifies a gesture only if no `` tag did. +Valid values for `before` and `after` are listed in [Possible key values](Possible-key-values.md). There can be as many of these tags inside `` as needed. +The clockwise circle and the round-trip gestures are affected by both Shift and Fn modmaps. The Shift mappings are used first and if that did not modify the key, the Fn mappings are used instead. + ### Examples ① Turkish keyboards use the Latin alphabet, but when "i" is shifted, it should produce "İ". This is achieved with the following modmap: From 2cb5e67d1f95bf6bc148b7f2da042e043b78439f Mon Sep 17 00:00:00 2001 From: Sergiy Stupar Date: Sun, 30 Jun 2024 12:02:56 +0000 Subject: [PATCH 4/7] Update Ukrainian translation (#682) --- res/values-uk/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/res/values-uk/strings.xml b/res/values-uk/strings.xml index 93af083..268dc8b 100644 --- a/res/values-uk/strings.xml +++ b/res/values-uk/strings.xml @@ -38,9 +38,9 @@ Введення Відстань проведення Відстань між символами в кутах клавіш (%s) - + Час очікування тривалого натискання Інтервал повторення клавіш - + Повторення клавіші при тривалому натисканні Двічі торкніться Shift для Caps Lock Ви можете заблокувати будь-який модифікатор, утримуючи його Поведінка From a2eea76e7011596e55061353b8f7f460b4d303df Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Wed, 3 Jul 2024 00:35:25 +0200 Subject: [PATCH 5/7] doc: Clarify the possible key values --- doc/Custom-layouts.md | 10 ++++------ doc/Possible-key-values.md | 5 ++++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/doc/Custom-layouts.md b/doc/Custom-layouts.md index f93bd64..5b18968 100644 --- a/doc/Custom-layouts.md +++ b/doc/Custom-layouts.md @@ -97,14 +97,12 @@ Normally, a key's width is 1.0 unit. Unexpected Keyboard occupies the full width ### Extra legend * `indication`: An optional extra legend to show under the main label. For example, `` displays ABC at the bottom of the 2 key, as on a pinpad or some telephones. If the key also defines a downward swipe with `s` or `key8`, the legends overlap. -## Possible key values -The properties that define the effects of tapping or swiping a key may be one of the built-in strings documented on [this page](Possible-key-values.md). For example, `se="cut"` says that a southeast swipe produces the "cut" key (Ctrl-C). +### Possible key values -Some of those strings begin with `loc `. These are place-holders; the tap or swipe does nothing unless enabled through the "Add keys to keyboard" option in the Settings menu, or implicitly enabled by the language the device is set to use. For example, `ne="loc accent_aigu"` says that a northeast swipe produces the acute accent combinatorial key—if enabled. +The possible key values are described in [this page](Possible-key-values.md). -If the string defining a tap or a swipe is anything other than one of the built-in strings, the defined string is output *verbatim.* This is what most of the taps and swipes on a typical keyboard do. So `key0="a"` simply outputs the letter a. - -The string can output multiple characters, but cannot combine the built-in strings to specify a sequence of keystrokes. +In a layout, a key value can also start with the `loc` prefix. These are place-holders, the tap or swipe does nothing unless enabled through the "Add keys to keyboard" option in the Settings menu, or implicitly enabled by the language the device is set to use. +For example, `ne="loc accent_aigu"` says that a northeast swipe produces the acute accent combinatorial key—if enabled. ## Modmap The ``...`` pair encloses custom mappings for modifier keys. The modmap is placed inside the ``...`` pair, but outside any row. A layout can have at most one modmap. diff --git a/doc/Possible-key-values.md b/doc/Possible-key-values.md index caf9380..b189971 100644 --- a/doc/Possible-key-values.md +++ b/doc/Possible-key-values.md @@ -1,6 +1,9 @@ # Key values -This is an exhaustive list of special values accepted for the `key0` through `key8` or `nw` through `se` attributes on a key. Any string that does not exactly match these will be printed verbatim. +This is an exhaustive list of special values accepted for the `key0` through `key8` or `nw` through `se` attributes on a key. + +Any string that does not exactly match these will be printed verbatim. +A key can output multiple characters, but cannot combine multiple built-in key values. ## Escape codes Value | Escape code for From 89d0e6c063d6c4e58d751fa6422143606ee70c26 Mon Sep 17 00:00:00 2001 From: solokot Date: Sat, 6 Jul 2024 12:15:49 +0300 Subject: [PATCH 6/7] Update Russian translation (#689) --- res/values-ru/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/res/values-ru/strings.xml b/res/values-ru/strings.xml index c7b7e78..47e925c 100644 --- a/res/values-ru/strings.xml +++ b/res/values-ru/strings.xml @@ -38,9 +38,9 @@ Набор текста Длина жеста Расстояние между символами в углах клавиш (%s) - + Задержка долгого нажатия Интервал повтора клавиш - + Повтор клавиши при долгом нажатии CapsLock двойным нажатием Shift Также можно активировать модификатор долгим нажатием Поведение From 6021a0b83c33a495fedde7bbb751ad3e3754bd98 Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Sat, 6 Jul 2024 13:33:53 +0200 Subject: [PATCH 7/7] Fix crash with narrow layouts The PreferredPos mechanism cause an out of bound access since 773147a. --- srcs/juloo.keyboard2/KeyboardData.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/srcs/juloo.keyboard2/KeyboardData.java b/srcs/juloo.keyboard2/KeyboardData.java index 8119f21..68ebd10 100644 --- a/srcs/juloo.keyboard2/KeyboardData.java +++ b/srcs/juloo.keyboard2/KeyboardData.java @@ -96,7 +96,7 @@ public final class KeyboardData { Row row = rows.get(i_row); int i_col = p.col; - int i_col_end = p.col; + int i_col_end = Math.min(p.col, row.keys.size() - 1); if (p.col == -1) { i_col = 0; i_col_end = row.keys.size() - 1; } for (; i_col <= i_col_end; i_col++) {