Changeset 9791 for trunk/src/user32/window.cpp
- Timestamp:
- Feb 13, 2003, 11:12:27 AM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.