Changeset 5713 for trunk/src/user32/window.cpp
- Timestamp:
- May 15, 2001, 4:31:40 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/window.cpp
r5698 r5713 1 /* $Id: window.cpp,v 1.9 7 2001-05-12 08:25:57sandervl Exp $ */1 /* $Id: window.cpp,v 1.98 2001-05-15 14:31:40 sandervl Exp $ */ 2 2 /* 3 3 * Win32 window apis for OS/2 … … 39 39 #include <heapstring.h> 40 40 #include <winuser32.h> 41 #include "hook.h" 41 42 42 43 #define DBG_LOCALLOG DBG_window … … 715 716 HWND WIN32API SetFocus(HWND hwnd) 716 717 { 717 Win32BaseWindow *window; 718 Win32BaseWindow *window, *topparent; 719 Win32BaseWindow *oldfocuswnd; 718 720 HWND lastFocus, lastFocus_W, hwnd_O; 719 721 BOOL activate; … … 739 741 else lastFocus = OSLibWinQueryFocus (OSLIB_HWND_DESKTOP); 740 742 741 activate = ((hwnd_O == lastFocus) || OSLibWinIsChild (lastFocus, hwnd_O)); 743 topparent = window->GetTopParent(); 744 activate = FALSE; 742 745 lastFocus_W = OS2ToWin32Handle (lastFocus); 743 744 dprintf(("SetFocus %x (%x) -> %x (%x)\n", lastFocus_W, lastFocus, hwnd, hwnd_O)); 746 if(lastFocus_W) { 747 oldfocuswnd = Win32BaseWindow::GetWindowFromHandle(lastFocus_W); 748 if(lastFocus_W != hwnd && topparent != oldfocuswnd->GetTopParent()) { 749 activate = TRUE; 750 } 751 } 752 else activate = TRUE; 753 754 dprintf(("SetFocus %x (%x) -> %x (%x) act %d", lastFocus_W, lastFocus, hwnd, hwnd_O, activate)); 755 756 if(HOOK_CallHooksA(WH_CBT, HCBT_SETFOCUS, hwnd, (LPARAM)lastFocus_W)) { 757 dprintf(("hook cancelled SetFocus call!")); 758 return 0; 759 } 745 760 746 761 //PM doesn't allow SetFocus calls during WM_SETFOCUS message processing; … … 750 765 teb->o.odin.hwndFocus = hwnd; 751 766 //mp1 = win32 window handle 752 //mp2 = activate flag753 OSLibPostMessageDirect(hwnd_O, WIN32APP_SETFOCUSMSG, hwnd, activate);767 //mp2 = top parent if activation required 768 OSLibPostMessageDirect(hwnd_O, WIN32APP_SETFOCUSMSG, hwnd, (activate) ? topparent->getWindowHandle() : 0); 754 769 return lastFocus_W; 755 770 } 756 771 teb->o.odin.hwndFocus = 0; 757 return (OSLibWinSetFocus (OSLIB_HWND_DESKTOP, hwnd_O, activate)) ? lastFocus_W : 0; 772 if(activate) { 773 SetActiveWindow(topparent->getWindowHandle()); 774 } 775 if(!IsWindow(hwnd)) return FALSE; //abort if window destroyed 776 777 return (OSLibWinSetFocus(OSLIB_HWND_DESKTOP, hwnd_O, 0)) ? lastFocus_W : 0; 758 778 } 759 779 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.