diff --git a/windows/src/engine/keyman32/hotkeys.cpp b/windows/src/engine/keyman32/hotkeys.cpp index ac16a3698e..8fb8f3a790 100644 --- a/windows/src/engine/keyman32/hotkeys.cpp +++ b/windows/src/engine/keyman32/hotkeys.cpp @@ -1,18 +1,18 @@ /* Name: hotkeys Copyright: Copyright (C) SIL International. - Documentation: - Description: + Documentation: + Description: Create Date: 1 Aug 2006 Modified Date: 25 Oct 2016 Authors: mcdurdin - Related Files: - Dependencies: + Related Files: + Dependencies: - Bugs: - Todo: - Notes: + Bugs: + Todo: + Notes: History: 01 Aug 2006 - mcdurdin - Initial version 11 Dec 2009 - mcdurdin - I934 - x64 - Initial version 12 Mar 2010 - mcdurdin - I934 - x64 - Complete @@ -26,6 +26,8 @@ // I5136 #include "pch.h" +// This file is used only in keyman32.dll; it tracks hotkeys for Keyman keyboard +// switching and events #ifndef _WIN64 Hotkeys *g_Hotkeys = NULL; // I4326 @@ -79,7 +81,7 @@ void Hotkeys::Load() { // I4390 m_hotkeys[m_nHotkeys].HotkeyValue = reg.ReadInteger(name); m_hotkeys[m_nHotkeys].Target = atoi(name); - SendDebugMessageFormat(0, sdmGlobal, 0, "InterfaceHotkey[%d] = {HotkeyValue: %x, Target: %d}", + SendDebugMessageFormat(0, sdmGlobal, 0, "InterfaceHotkey[%d] = {HotkeyValue: %x, Target: %d}", m_nHotkeys, m_hotkeys[m_nHotkeys].HotkeyValue, m_hotkeys[m_nHotkeys].Target); @@ -115,7 +117,7 @@ void Hotkeys::Load() { // I4390 WCHAR hkval[64]; reg.ReadString(valuename, hkval, 64); m_hotkeys[m_nHotkeys].HotkeyValue = _wtoi(hkval); - + SendDebugMessageFormat(0, sdmGlobal, 0, "LanguageHotkey[%d] = {HotkeyValue: %x, hkl: %x, profileGUID: %ws}", m_nHotkeys, m_hotkeys[m_nHotkeys].HotkeyValue, m_hotkeys[m_nHotkeys].hkl, diff --git a/windows/src/engine/keyman32/k32_lowlevelkeyboardhook.cpp b/windows/src/engine/keyman32/k32_lowlevelkeyboardhook.cpp index 79c46ebc59..75b0f225cf 100644 --- a/windows/src/engine/keyman32/k32_lowlevelkeyboardhook.cpp +++ b/windows/src/engine/keyman32/k32_lowlevelkeyboardhook.cpp @@ -26,6 +26,8 @@ #include "serialkeyeventserver.h" #include "kbd.h" /* DDK kbdlayout */ +// This file is used only in keyman32.dll; it implements our low level keyboard hook +// in the main keyman.exe process for hotkeys, serial key event server #ifndef _WIN64 BOOL ProcessHotkey(UINT vkCode, BOOL isUp, DWORD ShiftState); diff --git a/windows/src/engine/keyman32/kmhook_keyboard.cpp b/windows/src/engine/keyman32/kmhook_keyboard.cpp index c5859bccc0..eadf572d87 100644 --- a/windows/src/engine/keyman32/kmhook_keyboard.cpp +++ b/windows/src/engine/keyman32/kmhook_keyboard.cpp @@ -62,6 +62,10 @@ #include "pch.h" #include +// This file is used only in keyman32.dll; it has support functions for hotkeys +// which used to be in a keyboard hook but are now in the low-level keyboard +// hook +// TODO: rename this file #ifndef _WIN64 // I3617 diff --git a/windows/src/engine/keyman32/serialkeyeventserver.cpp b/windows/src/engine/keyman32/serialkeyeventserver.cpp index c6cd152d0b..2204074530 100644 --- a/windows/src/engine/keyman32/serialkeyeventserver.cpp +++ b/windows/src/engine/keyman32/serialkeyeventserver.cpp @@ -3,6 +3,7 @@ #include "security.h" #include "kbd.h" +// This file is used only in keyman32.dll; implements the serial key event server #ifndef _WIN64 /* diff --git a/windows/src/engine/keyman32/syskbdnt.cpp b/windows/src/engine/keyman32/syskbdnt.cpp index a3734a9903..1719a3a530 100644 --- a/windows/src/engine/keyman32/syskbdnt.cpp +++ b/windows/src/engine/keyman32/syskbdnt.cpp @@ -1,18 +1,18 @@ /* Name: syskbdnt Copyright: Copyright (C) SIL International. - Documentation: - Description: + Documentation: + Description: Create Date: 22 Jan 2007 Modified Date: 6 Feb 2015 Authors: mcdurdin - Related Files: - Dependencies: + Related Files: + Dependencies: - Bugs: - Todo: - Notes: + Bugs: + Todo: + Notes: History: 22 Jan 2007 - mcdurdin - Don't translate any number pad keys 13 Jul 2007 - mcdurdin - I911 - Fix for Ctrl+BKSP 10 Sep 2008 - mcdurdin - I1635 - mnemonic layouts on x64 fail @@ -35,8 +35,9 @@ //////////////////////////////////////////////////////////////////////////// #include "pch.h" -#include "kbd.h" /* DDK kbdlayout */ +#include "kbd.h" /* DDK kbdlayout */ +// This file is used only in keyman32.dll; it maps syskbd for x86 builds of Windows #ifndef _WIN64 extern BOOL KeyboardGivesCtrlRAltForRAlt_NT_x64(); @@ -73,19 +74,19 @@ BOOL LoadNewLibrary() if(r->ReadString("Layout File", buf, 32)) { hKbdLibrary = LoadLibrary(buf); - if(!hKbdLibrary) - { + if(!hKbdLibrary) + { SendDebugMessageFormat(GetFocus(), sdmKeyboard, 0, "LoadNewLibrary: Exit -- could not load library"); - return FALSE; + return FALSE; } PKBDLAYERDESCRIPTORFUNC KbdLayerDescriptorFunc = (PKBDLAYERDESCRIPTORFUNC) GetProcAddress(hKbdLibrary, "KbdLayerDescriptor"); if(KbdLayerDescriptorFunc) { KbdTables = (*KbdLayerDescriptorFunc)(); - if(KbdTables) + if(KbdTables) return TRUE; } - + FreeLibrary(hKbdLibrary); } } @@ -109,15 +110,15 @@ BOOL KeyboardGivesCtrlRAltForRAlt_NT() HKL hkl = GetKeyboardLayout(0); - /* Find the appropriate keyboard tables */ + /* Find the appropriate keyboard tables */ if(hkl != ActiveHKL_NT) { - ActiveHKL_NT = hkl; + ActiveHKL_NT = hkl; LoadNewLibrary(); } - if(!KbdTables) /* Could not load keyboard DLL */ + if(!KbdTables) /* Could not load keyboard DLL */ return FALSE; return (KbdTables->fLocaleFlags & 0x1) ? TRUE : FALSE; diff --git a/windows/src/engine/keyman32/syskbdnt64.cpp b/windows/src/engine/keyman32/syskbdnt64.cpp index 882bb4e030..428ca9a90c 100644 --- a/windows/src/engine/keyman32/syskbdnt64.cpp +++ b/windows/src/engine/keyman32/syskbdnt64.cpp @@ -1,18 +1,18 @@ /* Name: syskbdnt64 Copyright: Copyright (C) SIL International. - Documentation: - Description: + Documentation: + Description: Create Date: 10 Sep 2008 Modified Date: 6 Feb 2015 Authors: mcdurdin - Related Files: - Dependencies: + Related Files: + Dependencies: - Bugs: - Todo: - Notes: + Bugs: + Todo: + Notes: History: 10 Sep 2008 - mcdurdin - I1635 - Initial version 11 Mar 2009 - mcdurdin - I1894 - Fix threading bugs introduced in I1888 30 Nov 2009 - mcdurdin - I934 - Prep for x64 - change UINT to WORD for vkeys @@ -32,9 +32,10 @@ #include "pch.h" +// This file is used only in keyman32.dll; it maps syskbd for x64 builds of Windows #ifndef _WIN64 -#include "kbd.h" /* DDK kbdlayout */ +#include "kbd.h" /* DDK kbdlayout */ //#pragma warning ( disable : 4200 ) @@ -154,19 +155,19 @@ BOOL LoadNewLibrary_x64() if(r->ReadString("Layout File", buf, 32)) { hKbdLibrary_x64 = LoadLibrary(buf); - if(!hKbdLibrary_x64) - { + if(!hKbdLibrary_x64) + { SendDebugMessageFormat(GetFocus(), sdmKeyboard, 0, "LoadNewLibrary_x64: Exit -- could not load library"); - return FALSE; + return FALSE; } PKBDLAYERDESCRIPTORFUNC KbdLayerDescriptorFunc = (PKBDLAYERDESCRIPTORFUNC) GetProcAddress(hKbdLibrary_x64, "KbdLayerDescriptor"); if(KbdLayerDescriptorFunc) { KbdTables_x64 = (*KbdLayerDescriptorFunc)(); - if(KbdTables_x64) + if(KbdTables_x64) return TRUE; } - + FreeLibrary(hKbdLibrary_x64); } } @@ -186,15 +187,15 @@ BOOL KeyboardGivesCtrlRAltForRAlt_NT_x64() { HKL hkl = GetKeyboardLayout(0); - /* Find the appropriate keyboard tables */ + /* Find the appropriate keyboard tables */ if(hkl != ActiveHKL_NT_x64) { - ActiveHKL_NT_x64 = hkl; + ActiveHKL_NT_x64 = hkl; LoadNewLibrary_x64(); } - if(!KbdTables_x64) /* Could not load keyboard DLL */ + if(!KbdTables_x64) /* Could not load keyboard DLL */ return FALSE; return (KbdTables_x64->fLocaleFlags & 0x1) ? TRUE : FALSE; @@ -203,7 +204,7 @@ BOOL KeyboardGivesCtrlRAltForRAlt_NT_x64() typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL); -LPFN_ISWOW64PROCESS +LPFN_ISWOW64PROCESS fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress( GetModuleHandle("kernel32"),"IsWow64Process"); BOOL fStored = FALSE;