From fefd94d8efdbeb994182e83f32fe090a45792354 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Mon, 26 Dec 2016 06:02:49 +0000 Subject: [PATCH] Windows: Make layout switch duplicate guard bidirectional. git-svn-id: https://svn.eduke32.com/eduke32@5971 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/src/winbits.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/polymer/eduke32/build/src/winbits.c b/polymer/eduke32/build/src/winbits.c index d7201b25c..0c0f13f35 100644 --- a/polymer/eduke32/build/src/winbits.c +++ b/polymer/eduke32/build/src/winbits.c @@ -281,21 +281,21 @@ void Win_GetOriginalLayoutName(void) void Win_SetKeyboardLayoutUS(int const toggle) { - if (toggle) - { - static int done = 0; + static int currentstate; - if (!done) + if (toggle != currentstate) + { + if (toggle) { // 00000409 is "American English" switchlayout("00000409"); - - done = 1; + currentstate = toggle; + } + else if (OriginalLayoutName[0]) + { + switchlayout(OriginalLayoutName); + currentstate = toggle; } - } - else if (OriginalLayoutName[0]) - { - switchlayout(OriginalLayoutName); } }