- Timestamp:
- Feb 13, 2003, 11:12:27 AM (23 years ago)
- Location:
- trunk/src/user32
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/oslibmsg.cpp
r9598 r9791 1 /* $Id: oslibmsg.cpp,v 1.6 4 2003-01-03 16:35:54 sandervl Exp $ */1 /* $Id: oslibmsg.cpp,v 1.65 2003-02-13 10:12:24 sandervl Exp $ */ 2 2 /* 3 3 * Window message translation functions for OS/2 … … 48 48 #include <winscan.h> 49 49 #include <winkeyboard.h> 50 #include "user32api.h" 50 51 51 52 #define DBG_LOCALLOG DBG_oslibmsg … … 265 266 teb->o.odin.fTranslated = FALSE; 266 267 memcpy(pMsg, &teb->o.odin.msgWCHAR, sizeof(MSG)); 268 269 //After SetFocus(0), all keystrokes are converted in WM_SYS* 270 if(pMsg->message == WINWM_CHAR && fIgnoreKeystrokes) { 271 pMsg->message = WINWM_SYSCHAR; 272 } 273 267 274 teb->o.odin.os2msg.msg = 0; 268 275 teb->o.odin.os2msg.hwnd = 0; … … 423 430 } 424 431 memcpy(pMsg, &teb->o.odin.msgWCHAR, sizeof(MSG)); 432 //After SetFocus(0), all keystrokes are converted in WM_SYS* 433 if(pMsg->message == WINWM_CHAR && fIgnoreKeystrokes) { 434 pMsg->message = WINWM_SYSCHAR; 435 } 436 425 437 426 438 if(!IsWindow(pMsg->hwnd)) { -
trunk/src/user32/oslibmsgtranslate.cpp
r9765 r9791 1 /* $Id: oslibmsgtranslate.cpp,v 1. 99 2003-02-06 20:28:38sandervl Exp $ */1 /* $Id: oslibmsgtranslate.cpp,v 1.100 2003-02-13 10:12:25 sandervl Exp $ */ 2 2 /* 3 3 * Window message translation functions for OS/2 … … 38 38 #include <winkeyboard.h> 39 39 #include "hook.h" 40 #include "user32api.h" 40 41 41 42 #define DBG_LOCALLOG DBG_oslibmsgtranslate … … 662 663 // adjust our WM_CHAR code 663 664 extramsg.lParam = 0x01460001; 664 extramsg.message = WINWM_CHAR; 665 666 //After SetFocus(0), all keystrokes are converted in WM_SYS* 667 extramsg.message = (fIgnoreKeystrokes) ? WINWM_SYSCHAR : WINWM_CHAR; 668 665 669 setThreadQueueExtraCharMessage(teb, &extramsg); 666 670 // and finally adjust our WM_KEYDOWN code … … 712 716 memcpy(&extramsg, winMsg, sizeof(MSG)); 713 717 714 extramsg.message = WINWM_CHAR; 718 //After SetFocus(0), all keystrokes are converted in WM_SYS* 719 extramsg.message = (fIgnoreKeystrokes) ? WINWM_SYSCHAR : WINWM_CHAR; 715 720 716 721 // insert message into the queue … … 729 734 memcpy(&extramsg, winMsg, sizeof(MSG)); 730 735 731 extramsg.message = WINWM_CHAR; 736 //After SetFocus(0), all keystrokes are converted in WM_SYS* 737 extramsg.message = (fIgnoreKeystrokes) ? WINWM_SYSCHAR : WINWM_CHAR; 732 738 733 739 // insert message into the queue … … 766 772 winMsg->lParam |= WIN_KEY_ALTHELD; 767 773 } 774 } 775 //After SetFocus(0), all keystrokes are converted in WM_SYS* 776 if(fIgnoreKeystrokes) { 777 if(winMsg->message == WINWM_KEYDOWN) { 778 winMsg->message = WINWM_SYSKEYDOWN; 779 } 780 else 781 if(winMsg->message == WINWM_KEYUP) { 782 winMsg->message = WINWM_SYSKEYUP; 783 } 768 784 } 769 785 break; … … 992 1008 993 1009 994 if(msg->message >= WINWM_SYSKEYDOWN) 1010 //After SetFocus(0), all keystrokes are converted in WM_SYS* 1011 if(msg->message >= WINWM_SYSKEYDOWN || fIgnoreKeystrokes) 995 1012 extramsg.message = WINWM_SYSCHAR; 996 1013 else -
trunk/src/user32/user32api.h
r9005 r9791 1 /* $Id: user32api.h,v 1. 1 2002-08-15 10:14:30sandervl Exp $ */1 /* $Id: user32api.h,v 1.2 2003-02-13 10:12:25 sandervl Exp $ */ 2 2 //Internal user32 functions 3 3 … … 7 7 HWND WINAPI GetAncestor( HWND hwnd, UINT type ); 8 8 9 //Notify that focus has changed (necessary for SetFocus(0) handling) 10 void SetFocusChanged(); 11 12 extern BOOL fIgnoreKeystrokes; 13 9 14 #endif -
trunk/src/user32/win32wbase.cpp
r9785 r9791 1 /* $Id: win32wbase.cpp,v 1.35 7 2003-02-11 14:20:01sandervl Exp $ */1 /* $Id: win32wbase.cpp,v 1.358 2003-02-13 10:12:25 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 1097 1097 ULONG Win32BaseWindow::MsgSetFocus(HWND hwnd) 1098 1098 { 1099 //Notify that focus has changed (necessary for SetFocus(0) handling) 1100 SetFocusChanged(); 1101 1099 1102 //SvL: Don't send WM_(NC)ACTIVATE messages when the window is being destroyed 1100 1103 if(fDestroyWindowCalled) { … … 1113 1116 ULONG Win32BaseWindow::MsgKillFocus(HWND hwnd) 1114 1117 { 1118 //Notify that focus has changed (necessary for SetFocus(0) handling) 1119 SetFocusChanged(); 1120 1115 1121 //SvL: Don't send WM_(NC)ACTIVATE messages when the window is being destroyed 1116 1122 if(fDestroyWindowCalled) { … … 1183 1189 if (win32top) { 1184 1190 //Must use client window handle (not frame!!) 1185 OSLibWinSetFocus(win32top->getOS2WindowHandle());1191 SetFocus(win32top->getWindowHandle()); 1186 1192 RELEASE_WNDOBJ(win32top); 1187 1193 } -
trunk/src/user32/win32wbasenonclient.cpp
r9598 r9791 1 /* $Id: win32wbasenonclient.cpp,v 1.4 7 2003-01-03 16:35:57 sandervl Exp $ */1 /* $Id: win32wbasenonclient.cpp,v 1.48 2003-02-13 10:12:27 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 (non-client methods) … … 270 270 //SvL: Calling topparent->SetActiveWindow() causes focus problems 271 271 ::SetActiveWindow(hwndTopParent); 272 //// OSLibWinSetFocus(topparent->getOS2WindowHandle());272 //// SetFocus(topparent->getWindowHandle()); 273 273 } 274 274 if (GetActiveWindow() == hwndTopParent) … … 1071 1071 dprintf(("DoNCPaint %x %x %d", getWindowHandle(), clip, suppress_menupaint)); 1072 1072 1073 if ( getStyle() & WS_MINIMIZE||1073 if ( (getStyle() & WS_MINIMIZE) || 1074 1074 !IsWindowVisible( getWindowHandle() )) { 1075 1075 return; /* Nothing to do */ 1076 1076 } 1077 1077 1078 1078 rect.top = rect.left = 0; -
trunk/src/user32/window.cpp
r9590 r9791 1 /* $Id: window.cpp,v 1.13 0 2003-01-02 17:02:06sandervl Exp $ */1 /* $Id: window.cpp,v 1.131 2003-02-13 10:12:27 sandervl Exp $ */ 2 2 /* 3 3 * Win32 window apis for OS/2 … … 748 748 } 749 749 //****************************************************************************** 750 BOOL fIgnoreKeystrokes = FALSE; 751 //****************************************************************************** 752 void SetFocusChanged() 753 { 754 //Focus has changed; invalidate SetFocus(0) state 755 fIgnoreKeystrokes = FALSE; 756 } 757 //****************************************************************************** 750 758 //****************************************************************************** 751 759 HWND WIN32API SetFocus(HWND hwnd) … … 762 770 DebugInt3(); 763 771 return 0; 772 } 773 //Special case; SetFocus(0) tells Windows to ignore keystrokes. Pressing 774 //a key now generates WM_SYSKEYDOWN/(WM_SYSCHAR)/WM_SYSKEYUP instead 775 //of WM_KEYDOWN/(WM_CHAR)/WM_KEYUP 776 //WM_KILLFOCUS is sent to the window that currently has focus 777 if(hwnd == 0) { 778 lastFocus_W = GetFocus(); 779 if(lastFocus_W == 0) return 0; //nothing to do 780 781 if(HOOK_CallHooksA(WH_CBT, HCBT_SETFOCUS, 0, (LPARAM)lastFocus_W)) { 782 dprintf(("hook cancelled SetFocus call!")); 783 return 0; 784 } 785 SendMessageA(lastFocus_W, WM_KILLFOCUS, 0, 0); 786 787 fIgnoreKeystrokes = TRUE; 788 789 return lastFocus_W; 764 790 } 765 791 … … 820 846 dprintf(("USER32: Delay SetFocus call!")); 821 847 teb->o.odin.hwndFocus = hwnd; 822 //mp1 = win32 window handle 823 //mp2 = top parent if activation required 824 OSLibPostMessageDirect(hwnd_O, WIN32APP_SETFOCUSMSG, hwnd, (activate) ? hwndTopParent : 0); 848 849 //If keystrokes were ignored and focus is set to the old focus window, then 850 //PM won't send us a WM_SETFOCUS message. (as we don't inform PM for SetFocus(0)) 851 if(fIgnoreKeystrokes && lastFocus_W == hwnd) { 852 dprintf(("Manually send WM_SETFOCUS; real focus window hasn't changed")); 853 SendMessageA(lastFocus_W, WM_SETFOCUS, 0, 0); 854 } 855 else { 856 //mp1 = win32 window handle 857 //mp2 = top parent if activation required 858 OSLibPostMessageDirect(hwnd_O, WIN32APP_SETFOCUSMSG, hwnd, (activate) ? hwndTopParent : 0); 859 } 825 860 RELEASE_WNDOBJ(window); 826 861 return lastFocus_W; … … 832 867 ret = (OSLibWinSetFocus(OSLIB_HWND_DESKTOP, hwnd_O, activate)) ? lastFocus_W : 0; 833 868 RELEASE_WNDOBJ(window); 869 870 //If keystrokes were ignored and focus is set to the old focus window, then 871 //PM won't send us a WM_SETFOCUS message. (as we don't inform PM for SetFocus(0)) 872 if(fIgnoreKeystrokes && lastFocus_W == hwnd) { 873 dprintf(("Manually send WM_SETFOCUS; real focus window hasn't changed")); 874 SendMessageA(lastFocus_W, WM_SETFOCUS, 0, 0); 875 } 876 877 fIgnoreKeystrokes = FALSE; 834 878 return ret; 835 879 } … … 844 888 if(teb == NULL) { 845 889 DebugInt3(); 890 return 0; 891 } 892 //If keystrokes are ignored (SetFocus(0)), then return 0 893 if(fIgnoreKeystrokes) { 894 dprintf(("GetFocus; returning 0 after SetFocus(0) call")); 846 895 return 0; 847 896 }
Note:
See TracChangeset
for help on using the changeset viewer.