From 6d0aa4cf51179ec262bb259a7e6df5497e3061d3 Mon Sep 17 00:00:00 2001
From: Jules Aguillon
Date: Sun, 31 Aug 2025 23:35:34 +0200
Subject: Use the mappings first when typing a gesture (#1085)
This allows assigning mappings to letters without changing the Shift
mappings and making uppercase impossible to type.
For gestures, the Shift modifier is still applied first, unless a custom
mapping for is set for the key.---
doc/Custom-layouts.md | 2 +-
srcs/juloo.keyboard2/KeyModifier.java | 7 +++++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/doc/Custom-layouts.md b/doc/Custom-layouts.md
index 60b9a1b..42ed106 100644
--- a/doc/Custom-layouts.md
+++ b/doc/Custom-layouts.md
@@ -134,7 +134,7 @@ This means that when the Fn modifier is on, the key `before` is changed into `af
```
This means that when the Ctrl modifier is on, the key `before` is changed into `after`. The `` mapping is special in that the Ctrl modifier is applied to `after` after the mapping.
-The clockwise circle and the round-trip gestures are affected by both `` and `` mappings. The Shift mappings are used first and if that did not modify the key, the Fn mappings are used instead.
+The clockwise circle and the round-trip gestures are affected by the `` mappings. Otherwise, they are defined by the Shift mappings (including the `` mappings), then, if that did not modify the key, the builtin 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 mapping:
diff --git a/srcs/juloo.keyboard2/KeyModifier.java b/srcs/juloo.keyboard2/KeyModifier.java
index 18fe2d7..e0705f7 100644
--- a/srcs/juloo.keyboard2/KeyModifier.java
+++ b/srcs/juloo.keyboard2/KeyModifier.java
@@ -368,6 +368,13 @@ public final class KeyModifier
private static KeyValue apply_gesture(KeyValue k)
{
KeyValue modified = apply_shift(k);
+ if (_modmap != null)
+ {
+ modified = _modmap.get(Modmap.M.Fn, k);
+ if (modified != null)
+ return modified;
+ }
+ modified = apply_shift(k);
if (modified != null && !modified.equals(k))
return modified;
modified = apply_fn(k);
--
cgit v1.2.3