View the DQSD CVS repository here:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/dqsd/
Update of /cvsroot/dqsd/dqsd/src/DQSDTools
In directory sc8-pr-cvs1:/tmp/cvs-serv6256/src/DQSDTools
Modified Files:
KeyboardHook.cpp
Log Message:
- KeyboardProc only echoes keypresses if DQSD is docked on the taskbar (#648656)
- On-screen check in NotificationWndProc now accounts for multi-monitor systems
- NotificationWndProc is more robust overall, no longer goes into a loop if DQSD is
not "focusable"
Index: KeyboardHook.cpp
===================================================================
RCS file: /cvsroot/dqsd/dqsd/src/DQSDTools/KeyboardHook.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** KeyboardHook.cpp 6 Jan 2003 00:49:39 -0000 1.19
--- KeyboardHook.cpp 29 Jun 2003 14:37:29 -0000 1.20
***************
*** 36,108 ****
}
! //-----VVVVV-----NOTE: You need to link with IMM32.LIB---
! // check if the IME is up
! {
! HIMC himc = ImmGetContext(hFocusWnd);
! bool bImmOn = (ImmGetOpenStatus (himc) != 0);
! ImmReleaseContext (hFocusWnd, himc);
! if (bImmOn)
! {
! // This is not us - don't do anything
! ATLTRACE("IMM is on\n");
! return CallNextHookEx(hHook, code, wParam, lParam);
! }
}
- //-----^^^^^^------
bool bKeyDown = !(lParam & 0x80000000);
!
! if(wParam == VK_INSERT)
{
! if(GetAsyncKeyState(VK_SHIFT) & 0x80000000)
{
! ATLTRACE(_T("Shift-INS: %c\n"), bKeyDown ? 'P' : 'R');
! if(bKeyDown)
{
// Shift-INS is paste - send a CTRL-V
SendMessage(hFocusWnd, WM_CHAR, 'V'-'@', 0);
return 0;
}
! }
! else if(GetAsyncKeyState(VK_CONTROL) & 0x80000000)
! {
! ATLTRACE(_T("Ctrl-INS: %c\n"), bKeyDown ? 'P' : 'R');
! if(bKeyDown)
{
// Ctrl-INS is copy - send a CTRL-C
SendMessage(hFocusWnd, WM_CHAR, 'C'-'@', 0);
return 0;
}
}
! }
! else if(wParam == VK_DELETE)
! {
! ATLTRACE(_T("DEL: %c\n"), bKeyDown ? 'P' : 'R');
! if(GetAsyncKeyState(VK_SHIFT) & 0x80000000)
! {
! ATLTRACE(_T("Shift-DEL: %c\n"), bKeyDown ? 'P' : 'R');
! if(bKeyDown)
! {
// Shift-DEL is cut - send a CTRL-X
SendMessage(hFocusWnd, WM_CHAR, 'X'-'@', 0);
return 0;
}
! }
! else
! {
! // It's a DEL
! if(bKeyDown)
{
! // Send a CTRL-D - special handler for this in
search.htm
SendMessage(hFocusWnd, WM_CHAR, 'D'-'@', 0);
return 0;
}
}
! }
! else if(wParam == VK_UP)
! {
! if ( bKeyDown )
{
// Send a CTRL-P
--- 36,90 ----
}
! // Check if the IME is up (NOTE: You need to link with IMM32.LIB)
! HIMC himc = ImmGetContext(hFocusWnd);
! bool bImmOn = (ImmGetOpenStatus (himc) != 0);
! ImmReleaseContext (hFocusWnd, himc);
! if (bImmOn)
! {
! // This is not us - don't do anything
! ATLTRACE("IMM is on\n");
! return CallNextHookEx(hHook, code, wParam, lParam);
}
bool bKeyDown = !(lParam & 0x80000000);
! if(bKeyDown && IsWindowOnTaskbar(hFocusWnd))
{
! if(wParam == VK_INSERT)
{
! if(GetAsyncKeyState(VK_SHIFT) & 0x80000000)
{
// Shift-INS is paste - send a CTRL-V
+ ATLTRACE(_T("Shift-INS: %c\n"), bKeyDown ? 'P'
: 'R');
SendMessage(hFocusWnd, WM_CHAR, 'V'-'@', 0);
return 0;
}
! else if(GetAsyncKeyState(VK_CONTROL) & 0x80000000)
{
// Ctrl-INS is copy - send a CTRL-C
+ ATLTRACE(_T("Ctrl-INS: %c\n"), bKeyDown ? 'P'
: 'R');
SendMessage(hFocusWnd, WM_CHAR, 'C'-'@', 0);
return 0;
}
}
! else if(wParam == VK_DELETE)
! {
! ATLTRACE(_T("DEL: %c\n"), bKeyDown ? 'P' : 'R');
! if(GetAsyncKeyState(VK_SHIFT) & 0x80000000)
! {
// Shift-DEL is cut - send a CTRL-X
+ ATLTRACE(_T("Shift-DEL: %c\n"), bKeyDown ? 'P'
: 'R');
SendMessage(hFocusWnd, WM_CHAR, 'X'-'@', 0);
return 0;
}
! else
{
! // It's a DEL. Send a CTRL-D - special handler
for this in search.htm
SendMessage(hFocusWnd, WM_CHAR, 'D'-'@', 0);
return 0;
}
}
! else if(wParam == VK_UP)
{
// Send a CTRL-P
***************
*** 110,117 ****
return 0;
}
! }
! else if(wParam == VK_DOWN)
! {
! if ( bKeyDown )
{
// Send a CTRL-N
--- 92,96 ----
return 0;
}
! else if(wParam == VK_DOWN)
{
// Send a CTRL-N
***************
*** 119,136 ****
return 0;
}
! }
! else if(g_mapKeyCodeToCharCode.find( wParam ) !=
g_mapKeyCodeToCharCode.end() )
! {
! if ( bKeyDown )
{
! SendMessage(hFocusWnd, WM_CHAR,
g_mapKeyCodeToCharCode[ wParam ], 0);
return 0;
}
! }
! else
! {
! ATLTRACE(_T("Hook: %d (focus 0x%x)\n"), wParam, GetFocus());
}
}
return CallNextHookEx(hHook, code, wParam, lParam);
}
--- 98,113 ----
return 0;
}
! else if(g_mapKeyCodeToCharCode.find(wParam) !=
g_mapKeyCodeToCharCode.end())
{
! SendMessage(hFocusWnd, WM_CHAR,
g_mapKeyCodeToCharCode[wParam], 0);
return 0;
}
! else
! {
! ATLTRACE(_T("Hook: %d (focus 0x%x)\n"), wParam,
GetFocus());
! }
}
}
+
return CallNextHookEx(hHook, code, wParam, lParam);
}
***************
*** 172,178 ****
if(uMsg == WM_HOTKEY || (uMsg == WM_TIMER && wParam == 0x5744))
{
- // _RPT0(_CRT_WARN, "HotKey\n");
- // OutputDebugString("HotKey\n");
-
if(uMsg == WM_HOTKEY)
{
--- 149,152 ----
***************
*** 181,189 ****
else
{
! nAttempts++;
! if(nAttempts > 20)
{
! // We've failed in some way - kill the timer
KillTimer(hwnd, 0x5744);
}
}
--- 155,163 ----
else
{
! if(++nAttempts > 20)
{
! // We've failed in some way - kill the timer and return
KillTimer(hwnd, 0x5744);
+ return 0;
}
}
***************
*** 206,217 ****
// SetForegroundWindow is crippled nowadays, and because the DQSD edit
control
// doesn't actually seem to get a proper caret if you SFW to it anyway.
! ATLTRACE("TaskBarRect: %d,%d,%d,%d\n", taskBarRect.left,
taskBarRect.top, taskBarRect.right, taskBarRect.bottom);
! if(taskBarRect.top >= GetSystemMetrics(SM_CYSCREEN)
! || taskBarRect.bottom < 0
! || taskBarRect.left >= GetSystemMetrics(SM_CXSCREEN)
! || taskBarRect.right < 0)
{
// The taskbar is auto-hidden - we need to send more than one
click - one to unhide the tool bar,
// and one to set the focus
SetTimer(hwnd, 0x5744, 50, NULL);
}
--- 180,188 ----
// SetForegroundWindow is crippled nowadays, and because the DQSD edit
control
// doesn't actually seem to get a proper caret if you SFW to it anyway.
! if(!IsWindowOnScreen(hBarWnd))
{
// The taskbar is auto-hidden - we need to send more than one
click - one to unhide the tool bar,
// and one to set the focus
+ ATLTRACE("Search bar is off-screen - attempt to bring it into
the light...\n");
SetTimer(hwnd, 0x5744, 50, NULL);
}
***************
*** 237,241 ****
}
! // Calculate the position of a simultated mouse click
// The SendInput structure takes a position scaled 0-65536 across the
primary monitor
// Hence the muldivs
--- 208,212 ----
}
! // Calculate the position of a simulated mouse click
// The SendInput structure takes a position scaled 0-65536 across the
primary monitor
// Hence the muldivs
***************
*** 258,262 ****
else if(uMsg == WM_DESTROY)
{
! // OutputDebugString("HotKey Destroy\n");
UnregisterHotKey(hwnd, GetWindowLong(hwnd, GWL_USERDATA));
}
--- 229,233 ----
else if(uMsg == WM_DESTROY)
{
! ATLTRACE("Unregistering HotKey...\n");
UnregisterHotKey(hwnd, GetWindowLong(hwnd, GWL_USERDATA));
}
***************
*** 333,337 ****
if(hExistingWindow != NULL)
{
! // THere's already hotkey window
ATLTRACE("HotKey - window exists\n");
DestroyWindow(hExistingWindow);
--- 304,308 ----
if(hExistingWindow != NULL)
{
! // There's already hotkey window
ATLTRACE("HotKey - window exists\n");
DestroyWindow(hExistingWindow);
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01
_______________________________________________
DQSD-CVS mailing list
https://lists.sourceforge.net/lists/listinfo/dqsd-cvs
DQSD CVS repository:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/dqsd/