Ticket #441: patch.txt

File patch.txt, 1.8 KB (added by aleksey_s, 2 years ago)

Proposed implementation

Line 
1=== modified file 'source/NVDAHelper.py'
2--- source/NVDAHelper.py        2010-02-14 05:37:44 +0000
3+++ source/NVDAHelper.py        2010-02-15 17:23:37 +0000
4@@ -11,7 +11,6 @@
5 import api
6 import globalVars
7 from logHandler import log
8-import time
9 import globalVars
10 
11 EVENT_TYPEDCHARACTER=0X1000
12@@ -20,7 +19,6 @@
13 _remoteLoader64=None
14 localLib=None
15 generateBeep=None
16-lastKeyboardLayoutChangeEventTime=None
17 
18 winEventHookID=None
19 
20@@ -85,7 +83,6 @@
21 
22 @winUser.WINEVENTPROC
23 def winEventCallback(handle,eventID,window,objectID,childID,threadID,timestamp):
24-       global lastKeyboardLayoutChangeEventTime
25        try:
26                if eventID==EVENT_TYPEDCHARACTER:
27                        handleTypedCharacter(window,objectID,childID)
28
29=== modified file 'source/NVDAHelper/remote/inputLangChange.cpp'
30--- source/NVDAHelper/remote/inputLangChange.cpp        2010-02-13 10:53:50 +0000
31+++ source/NVDAHelper/remote/inputLangChange.cpp        2010-02-15 17:46:24 +0000
32@@ -10,13 +10,16 @@
33 
34 LRESULT CALLBACK inputLangChange_callWndProcHook(int code, WPARAM wParam, LPARAM lParam) {
35        static int lastInputLangChange=0;
36+       static unsigned lastInputLangChangeTime=0;
37+       static wchar_t buf[KL_NAMELENGTH ];
38        CWPSTRUCT* pcwp=(CWPSTRUCT*)lParam;
39-       if((pcwp->message==WM_INPUTLANGCHANGE)&&(pcwp->lParam!=lastInputLangChange)) {
40-               wchar_t* buf=(wchar_t*)malloc(sizeof(wchar_t)*1024);
41-               GetKeyboardLayoutName(buf);
42-               nvdaController_inputLangChangeNotify(GetCurrentThreadId(),pcwp->lParam,buf);
43-               free(buf);
44-               lastInputLangChange=pcwp->lParam;
45+       if((pcwp->message==WM_INPUTLANGCHANGE)) {
46+               if ((pcwp->lParam!=lastInputLangChange) && (GetTickCount()-lastInputLangChangeTime>100)) {
47+                       GetKeyboardLayoutName(buf);
48+                       nvdaController_inputLangChangeNotify(GetCurrentThreadId(),pcwp->lParam,buf);
49+                       lastInputLangChange=pcwp->lParam;
50+               }
51+               lastInputLangChangeTime=GetTickCount();
52        }
53        return 0;
54 }
55