From b5359b7da0dc5d86b4cbbcf5170c818083ac7766 Mon Sep 17 00:00:00 2001 From: Daniel Hill Date: Thu, 18 Jan 2024 20:35:13 +1300 Subject: [PATCH] winex11.drv: Improve DetectLayout heuristics. Dvorak detection would sometimes fallback to Phantom keys, because we only use seq as a tie breaker greater emphasis on locality is required for layouts using the same language. Signed-off-by: Daniel Hill --- dlls/winex11.drv/keyboard.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c index 89bf7da550a..2e7a118c110 100644 --- a/dlls/winex11.drv/keyboard.c +++ b/dlls/winex11.drv/keyboard.c @@ -1522,8 +1522,7 @@ X11DRV_KEYBOARD_DetectLayout( Display *display ) } TRACE("matches=%d, mismatches=%d, seq=%d, score=%d\n", match, mismatch, seq, score); - if ((score > max_score) || - ((score == max_score) && (seq > max_seq))) { + if (score + (int)seq > max_score + (int)max_seq) { /* best match so far */ kbd_layout = current; max_score = score;