diff --git a/windows/src/engine/keyman32/appint/aiTIP.cpp b/windows/src/engine/keyman32/appint/aiTIP.cpp
index 7241ee9fdb..a3b6491ec3 100644
--- a/windows/src/engine/keyman32/appint/aiTIP.cpp
+++ b/windows/src/engine/keyman32/appint/aiTIP.cpp
@@ -100,14 +100,17 @@ void ProcessToggleChange(UINT key) { // I4793
switch(key) {
case VK_CAPITAL: flag = CAPITALFLAG; break;
case VK_NUMLOCK: flag = NUMLOCKFLAG; break;
+ default: return;
}
- if(*Globals::ShiftState() & flag) {
- *Globals::ShiftState() &= ~flag;
- }
- else {
+ if (GetKeyState(key) & 1) {
+ SendDebugMessageFormat(0, sdmAIDefault, 0, "ProcessToggleChange: Setting %s", flag == CAPITALFLAG ? "CAPITALFLAG" : "NUMLOCKFLAG");
*Globals::ShiftState() |= flag;
}
+ else {
+ SendDebugMessageFormat(0, sdmAIDefault, 0, "ProcessToggleChange: Clearing %s", flag == CAPITALFLAG ? "CAPITALFLAG" : "NUMLOCKFLAG");
+ *Globals::ShiftState() &= ~flag;
+ }
}
extern "C" __declspec(dllexport) BOOL WINAPI TIPProcessKey(WPARAM wParam, LPARAM lParam, // I3589 // I3588
@@ -131,6 +134,11 @@ extern "C" __declspec(dllexport) BOOL WINAPI TIPProcessKey(WPARAM wParam, LPARAM
}
if(scan == SCAN_FLAG_KEYMAN_KEY_EVENT) { // I4370
+ if (wParam == VK_CAPITAL && !isUp) {
+ // Must also record toggle state change when Keyman has generated
+ // a Caps Lock event
+ ProcessToggleChange((UINT)wParam); // I4793
+ }
SendDebugMessageFormat(0, sdmAIDefault, 0, "TIPProcessKey: Virtual Key was generated by Keyman [Scan=0xFF]");
return FALSE;
}
@@ -154,10 +162,10 @@ extern "C" __declspec(dllexport) BOOL WINAPI TIPProcessKey(WPARAM wParam, LPARAM
switch(wParam) {
case VK_CAPITAL:
if(!isUp) ProcessToggleChange((UINT) wParam); // I4793
- KeyCapsLockPress(isUp); // I4548
+ if(!Updateable) KeyCapsLockPress(isUp); // I4548
return FALSE;
case VK_SHIFT:
- KeyShiftPress(isUp); // I4548
+ if (!Updateable) KeyShiftPress(isUp); // I4548
// Fall through
case VK_MENU:
case VK_CONTROL:
diff --git a/windows/src/engine/keyman32/appint/aiWin2000Unicode.cpp b/windows/src/engine/keyman32/appint/aiWin2000Unicode.cpp
index 52a3824d13..d91b3453d4 100644
--- a/windows/src/engine/keyman32/appint/aiWin2000Unicode.cpp
+++ b/windows/src/engine/keyman32/appint/aiWin2000Unicode.cpp
@@ -87,9 +87,7 @@ BOOL AIWin2000Unicode::IsWindowHandled(HWND ahwnd)
BOOL AIWin2000Unicode::IsUnicode()
{
BOOL Result = IsWindowUnicode(hwnd);
-
- SendDebugMessageFormat(0, sdmAIDefault, 0, "IsWindowUnicode=%s WM_UNICHAR:%s",
- Result ? "Yes" : "No", FUnicharOkay ? "Yes" : "No");
+ SendDebugMessageFormat(0, sdmAIDefault, 0, "IsWindowUnicode=%s", Result ? "Yes" : "No");
return Result;
}
diff --git a/windows/src/engine/keyman32/appint/aiWin2000Unicode.h b/windows/src/engine/keyman32/appint/aiWin2000Unicode.h
index 52c83d1501..3866137074 100644
--- a/windows/src/engine/keyman32/appint/aiWin2000Unicode.h
+++ b/windows/src/engine/keyman32/appint/aiWin2000Unicode.h
@@ -30,9 +30,6 @@ class AIWin2000Unicode:public AppIntegration
{
private:
- BYTE kbstate[256];
- BOOL FUnicharOkay;
-
BOOL PostKeys();
diff --git a/windows/src/engine/keyman32/capsstate.cpp b/windows/src/engine/keyman32/capsstate.cpp
index e4d6c75a1e..68461b446c 100644
--- a/windows/src/engine/keyman32/capsstate.cpp
+++ b/windows/src/engine/keyman32/capsstate.cpp
@@ -26,12 +26,6 @@
*/
#include "pch.h"
-static BYTE kbstate[256];
-extern BOOL FShouldIgnoreNextKey[256];
-
-//extern "C" void FAR PASCAL keybd_event(void);
-
-
void ResetCapsLock(void)
{
PKEYMAN64THREADDATA _td = ThreadGlobals();
@@ -63,7 +57,8 @@ void KeyCapsLockPress(BOOL FIsUp) // I3284 - void // I3529
if(_td->lpActiveKeyboard->Keyboard->dwFlags & KF_CAPSONONLY)
{
- if(FIsUp && !(GetKeyState(VK_CAPITAL) & 1)) // I267 - 24/11/2006 invert GetKeyState test
+ SendDebugMessageFormat(0, sdmAIDefault, 0, "KeyCapsLockPress: KF_CAPSONONLY: FIsUp=%d CapsState=%d", FIsUp, GetKeyState(VK_CAPITAL) & 1);
+ if(FIsUp && !(GetKeyState(VK_CAPITAL) & 1)) // I267 - 24/11/2006 invert GetKeyState test
{
keybd_event(VK_CAPITAL, SCAN_FLAG_KEYMAN_KEY_EVENT, 0, 0);
keybd_event(VK_CAPITAL, SCAN_FLAG_KEYMAN_KEY_EVENT, KEYEVENTF_KEYUP, 0);
@@ -71,7 +66,8 @@ void KeyCapsLockPress(BOOL FIsUp) // I3284 - void // I3529
}
else if(_td->lpActiveKeyboard->Keyboard->dwFlags & KF_CAPSALWAYSOFF)
{
- if(!FIsUp && (GetKeyState(VK_CAPITAL) & 1))
+ SendDebugMessageFormat(0, sdmAIDefault, 0, "KeyCapsLockPress: KF_CAPSALWAYSOFF: FIsUp=%d CapsState=%d", FIsUp, GetKeyState(VK_CAPITAL) & 1);
+ if(!FIsUp && (GetKeyState(VK_CAPITAL) & 1))
{ // I267 - 24/11/2006 invert GetKeyState test
keybd_event(VK_CAPITAL, SCAN_FLAG_KEYMAN_KEY_EVENT, KEYEVENTF_KEYUP, 0);
keybd_event(VK_CAPITAL, SCAN_FLAG_KEYMAN_KEY_EVENT, 0, 0);
@@ -86,11 +82,10 @@ void KeyShiftPress(BOOL FIsUp) // I3284 - void // I3529
if(!_td) return;
if(!_td->lpActiveKeyboard) return; // pass through to window
- if((GetKeyState(VK_CAPITAL) & 1) == 0) return;
-
if(_td->lpActiveKeyboard->Keyboard->dwFlags & KF_SHIFTFREESCAPS)
{
- if(!FIsUp)
+ SendDebugMessageFormat(0, sdmAIDefault, 0, "KeyShiftPress: KF_SHIFTFREESCAPS: FIsUp=%d CapsState=%d", FIsUp, GetKeyState(VK_CAPITAL) & 1);
+ if(!FIsUp && (GetKeyState(VK_CAPITAL) & 1))
{
keybd_event(VK_CAPITAL, SCAN_FLAG_KEYMAN_KEY_EVENT, 0, 0);
keybd_event(VK_CAPITAL, SCAN_FLAG_KEYMAN_KEY_EVENT, KEYEVENTF_KEYUP, 0);
diff --git a/windows/src/engine/keyman32/keystate.cpp b/windows/src/engine/keyman32/keystate.cpp
index 1be9fe4658..eb66b2e70d 100644
--- a/windows/src/engine/keyman32/keystate.cpp
+++ b/windows/src/engine/keyman32/keystate.cpp
@@ -23,9 +23,6 @@
*/
#include "pch.h" // I4551
-BYTE kbstate[256];
-
-
#define MAX_RSHIFT 24
#define MAX_KSHIFT 18
diff --git a/windows/src/engine/kmtip/keys.cpp b/windows/src/engine/kmtip/keys.cpp
index de4732a14e..d66e4d65c8 100644
--- a/windows/src/engine/kmtip/keys.cpp
+++ b/windows/src/engine/kmtip/keys.cpp
@@ -174,7 +174,8 @@ STDAPI CKMTipTextService::OnTestKeyDown(ITfContext *pContext, WPARAM wParam, LPA
{
LogKey("CKMTipTextService::OnTestKeyDown", 0, wParam, lParam);
// If the keystroke is a Keyman-generated key, ignore it
- if((lParam & 0x00FF0000L) == 0xFF0000L) // I3566
+ if((lParam & 0x00FF0000L) == 0xFF0000L &&
+ wParam != VK_CAPITAL) // I3566
*pfEaten = FALSE;
else
*pfEaten = _KeymanProcessKeystroke(pContext, wParam, lParam, FALSE, FALSE); // I3588
@@ -208,7 +209,8 @@ STDAPI CKMTipTextService::OnKeyDown(ITfContext *pContext, WPARAM wParam, LPARAM
STDAPI CKMTipTextService::OnTestKeyUp(ITfContext *pContext, WPARAM wParam, LPARAM lParam, BOOL *pfEaten)
{
LogKey("CKMTipTextService::OnTestKeyUp", 2, wParam, lParam);
- if((lParam & 0x00FF0000L) == 0xFF0000L) // I3566
+ if((lParam & 0x00FF0000L) == 0xFF0000L &&
+ wParam != VK_CAPITAL) // I3566
*pfEaten = FALSE;
else
{
@@ -230,7 +232,8 @@ STDAPI CKMTipTextService::OnTestKeyUp(ITfContext *pContext, WPARAM wParam, LPARA
STDAPI CKMTipTextService::OnKeyUp(ITfContext *pContext, WPARAM wParam, LPARAM lParam, BOOL *pfEaten)
{
LogKey("CKMTipTextService::OnKeyUp", 3, wParam, lParam);
- if((lParam & 0x00FF0000L) == 0xFF0000L) // I3566 // I3605
+ if((lParam & 0x00FF0000L) == 0xFF0000L &&
+ wParam != VK_CAPITAL) // I3566 // I3605
*pfEaten = FALSE;
else
{
diff --git a/windows/src/engine/kmtip/kmkey.cpp b/windows/src/engine/kmtip/kmkey.cpp
index 275d02faf8..40ace7a5b7 100644
--- a/windows/src/engine/kmtip/kmkey.cpp
+++ b/windows/src/engine/kmtip/kmkey.cpp
@@ -117,7 +117,8 @@ BOOL CKMTipTextService::_KeymanProcessKeystroke(ITfContext *pContext, WPARAM wPa
Log(L"_KeymanProcessKeystroke (%x %x %s %s ex=%x)", wParam, lParam, fUpdate?L"update":L"", fPreserved?L"preserved":L"", GetMessageExtraInfo()); // I4378
// Don't process keystrokes generated by Keyman (scan code = 0xFF)
- if ((lParam & 0xFF0000) == 0xFF0000) {
+ if ((lParam & 0xFF0000) == 0xFF0000 &&
+ wParam != VK_CAPITAL) {
return FALSE; // I4378
}
@@ -200,8 +201,8 @@ STDAPI CKeymanEditSession::DoEditSession(TfEditCookie ec)
else
{
if (!(*pTIPProcessKey)(_wParam, _lParam, ExtKeymanProcessOutput, ExtKeymanGetContext, _fUpdate, _fPreserved)) {
- SendDebugMessage(L"DoEditSession: TIPProcessKey failed");
- _hr = E_FAIL;
+ SendDebugMessage(L"DoEditSession: TIPProcessKey did not handle the keystroke");
+ _hr = E_FAIL; // TODO: use S_FALSE -> this tells _KeymanProcessKeystroke to pass keystroke on
}
}
ExtEditSession = NULL;
diff --git a/windows/src/test/manual-tests/caps_lock_headers/HISTORY.md b/windows/src/test/manual-tests/caps_lock_headers/HISTORY.md
new file mode 100644
index 0000000000..f2b6acd03b
--- /dev/null
+++ b/windows/src/test/manual-tests/caps_lock_headers/HISTORY.md
@@ -0,0 +1,6 @@
+caps_lock_shift_frees_caps Change History
+====================
+
+1.0 (2019-01-07)
+----------------
+* Created by
diff --git a/windows/src/test/manual-tests/caps_lock_headers/LICENSE.md b/windows/src/test/manual-tests/caps_lock_headers/LICENSE.md
new file mode 100644
index 0000000000..714cb32594
--- /dev/null
+++ b/windows/src/test/manual-tests/caps_lock_headers/LICENSE.md
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+©
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/windows/src/test/manual-tests/caps_lock_headers/README.md b/windows/src/test/manual-tests/caps_lock_headers/README.md
new file mode 100644
index 0000000000..bc3b3b42ea
--- /dev/null
+++ b/windows/src/test/manual-tests/caps_lock_headers/README.md
@@ -0,0 +1,29 @@
+caps_lock_shift_frees_caps keyboard
+==============
+
+©
+
+Version 1.0
+
+Description
+-----------
+
+caps_lock_shift_frees_caps generated from template
+
+Links
+-----
+
+Supported Platforms
+-------------------
+ * Windows
+ * macOS
+ * Linux
+ * Web
+ * iPhone
+ * iPad
+ * Android phone
+ * Android tablet
+ * Mobile devices
+ * Desktop devices
+ * Tablet devices
+
diff --git a/windows/src/test/manual-tests/caps_lock_headers/build/caps_lock_caps_always_off.kmx b/windows/src/test/manual-tests/caps_lock_headers/build/caps_lock_caps_always_off.kmx
new file mode 100644
index 0000000000..793c77615f
Binary files /dev/null and b/windows/src/test/manual-tests/caps_lock_headers/build/caps_lock_caps_always_off.kmx differ
diff --git a/windows/src/test/manual-tests/caps_lock_headers/build/caps_lock_caps_always_off.kvk b/windows/src/test/manual-tests/caps_lock_headers/build/caps_lock_caps_always_off.kvk
new file mode 100644
index 0000000000..06fe5344c1
Binary files /dev/null and b/windows/src/test/manual-tests/caps_lock_headers/build/caps_lock_caps_always_off.kvk differ
diff --git a/windows/src/test/manual-tests/caps_lock_headers/build/caps_lock_caps_on_only.kmx b/windows/src/test/manual-tests/caps_lock_headers/build/caps_lock_caps_on_only.kmx
new file mode 100644
index 0000000000..3ec75e634b
Binary files /dev/null and b/windows/src/test/manual-tests/caps_lock_headers/build/caps_lock_caps_on_only.kmx differ
diff --git a/windows/src/test/manual-tests/caps_lock_headers/build/caps_lock_caps_on_only.kvk b/windows/src/test/manual-tests/caps_lock_headers/build/caps_lock_caps_on_only.kvk
new file mode 100644
index 0000000000..0e1ea70914
Binary files /dev/null and b/windows/src/test/manual-tests/caps_lock_headers/build/caps_lock_caps_on_only.kvk differ
diff --git a/windows/src/test/manual-tests/caps_lock_headers/build/caps_lock_headers.kmp b/windows/src/test/manual-tests/caps_lock_headers/build/caps_lock_headers.kmp
new file mode 100644
index 0000000000..a74095c428
Binary files /dev/null and b/windows/src/test/manual-tests/caps_lock_headers/build/caps_lock_headers.kmp differ
diff --git a/windows/src/test/manual-tests/caps_lock_headers/build/caps_lock_shift_frees_caps.kmp b/windows/src/test/manual-tests/caps_lock_headers/build/caps_lock_shift_frees_caps.kmp
new file mode 100644
index 0000000000..ebb4429abe
Binary files /dev/null and b/windows/src/test/manual-tests/caps_lock_headers/build/caps_lock_shift_frees_caps.kmp differ
diff --git a/windows/src/test/manual-tests/caps_lock_headers/build/caps_lock_shift_frees_caps.kmx b/windows/src/test/manual-tests/caps_lock_headers/build/caps_lock_shift_frees_caps.kmx
new file mode 100644
index 0000000000..4942a3dc27
Binary files /dev/null and b/windows/src/test/manual-tests/caps_lock_headers/build/caps_lock_shift_frees_caps.kmx differ
diff --git a/windows/src/test/manual-tests/caps_lock_headers/build/caps_lock_shift_frees_caps.kvk b/windows/src/test/manual-tests/caps_lock_headers/build/caps_lock_shift_frees_caps.kvk
new file mode 100644
index 0000000000..2cd73a93a3
Binary files /dev/null and b/windows/src/test/manual-tests/caps_lock_headers/build/caps_lock_shift_frees_caps.kvk differ
diff --git a/windows/src/test/manual-tests/caps_lock_headers/caps_lock_headers.keyboard_info b/windows/src/test/manual-tests/caps_lock_headers/caps_lock_headers.keyboard_info
new file mode 100644
index 0000000000..75346d748f
--- /dev/null
+++ b/windows/src/test/manual-tests/caps_lock_headers/caps_lock_headers.keyboard_info
@@ -0,0 +1,7 @@
+{
+ "license": "mit",
+ "languages": [
+
+ ],
+ "description": "caps_lock_shift_frees_caps generated from template"
+}
diff --git a/windows/src/test/manual-tests/caps_lock_headers/caps_lock_headers.kpj b/windows/src/test/manual-tests/caps_lock_headers/caps_lock_headers.kpj
new file mode 100644
index 0000000000..1bef06328b
--- /dev/null
+++ b/windows/src/test/manual-tests/caps_lock_headers/caps_lock_headers.kpj
@@ -0,0 +1,119 @@
+
+
+ caps_lock_shift_frees_caps 1.0 generated from template. +
+ +©
+ + + diff --git a/windows/src/test/manual-tests/caps_lock_headers/source/welcome.htm b/windows/src/test/manual-tests/caps_lock_headers/source/welcome.htm new file mode 100644 index 0000000000..5155c2ff91 --- /dev/null +++ b/windows/src/test/manual-tests/caps_lock_headers/source/welcome.htm @@ -0,0 +1,27 @@ + + + + ++ caps_lock_shift_frees_caps 1.0 generated from template. +
+ +©
+ + + \ No newline at end of file