Ignore:
Timestamp:
Sep 22, 2001, 8:21:01 PM (24 years ago)
Author:
sandervl
Message:

focus/activation fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/win32wbase.cpp

    r6773 r6783  
    1 /* $Id: win32wbase.cpp,v 1.283 2001-09-20 12:57:15 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.284 2001-09-22 18:21:00 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    7878//For quick lookup of current process id
    7979static ULONG currentProcessId = -1;
     80static int iF10Key = 0;
     81static int iMenuSysKey = 0;
    8082
    8183//******************************************************************************
     
    994996    else SendInternalMessageA(WM_ACTIVATEAPP, 0, threadidhwnd);  //deactivate; specify thread id of other process
    995997    return rc;
     998}
     999//******************************************************************************
     1000//******************************************************************************
     1001ULONG Win32BaseWindow::MsgChildActivate(BOOL fActivate)
     1002{
     1003    //SvL: Don't send WM_(NC)ACTIVATE messages when the window is being destroyed
     1004    if(fDestroyWindowCalled) {
     1005        return 0;
     1006    }
     1007
     1008    //According to SDK docs, if app returns FALSE & window is being deactivated,
     1009    //default processing is cancelled
     1010    //TODO: According to Wine we should proceed anyway if window is sysmodal
     1011    if(SendInternalMessageA(WM_NCACTIVATE, fActivate, 0) == FALSE && !fActivate)
     1012    {
     1013        dprintf(("WARNING: WM_NCACTIVATE return code = FALSE -> cancel processing"));
     1014        return 0;
     1015    }
     1016    /* child windows get a WM_CHILDACTIVATE message */
     1017    if((getStyle() & (WS_CHILD | WS_POPUP)) == WS_CHILD )
     1018    {
     1019        if(fActivate) {//WM_CHILDACTIVE is for activation only
     1020            SendInternalMessageA(WM_CHILDACTIVATE, 0, 0L);
     1021        }
     1022        return 0;
     1023    }
     1024    DebugInt3();
     1025    return 0;
    9961026}
    9971027//******************************************************************************
     
    17331763
    17341764    case WM_SYSKEYDOWN:
    1735         if(wParam == VK_F4) /* try to close the window */
    1736         {
    1737             Win32BaseWindow *window = GetWindowFromHandle(GetTopParent());
    1738             if(window && !(window->getClass()->getStyle() & CS_NOCLOSE))
    1739                 PostMessageA(window->getWindowHandle(), WM_SYSCOMMAND, SC_CLOSE, 0);
    1740             if(window) RELEASE_WNDOBJ(window);
    1741             return 0;
    1742         }
     1765    {
     1766        if( HIWORD(lParam) & KEYDATA_ALT )
     1767        {
     1768            /* if( HIWORD(lParam) & ~KEYDATA_PREVSTATE ) */
     1769              if( wParam == VK_MENU && !iMenuSysKey )
     1770                iMenuSysKey = 1;
     1771              else
     1772                iMenuSysKey = 0;
     1773           
     1774            iF10Key = 0;
     1775
     1776            if( wParam == VK_F4 )       /* try to close the window */
     1777            {
     1778                HWND top = GetTopWindow();
     1779                if (!(GetClassLongW( top, GCL_STYLE ) & CS_NOCLOSE))
     1780                    PostMessageW( top, WM_SYSCOMMAND, SC_CLOSE, 0 );
     1781            }
     1782        }
     1783        else if( wParam == VK_F10 )
     1784                iF10Key = 1;
     1785             else
     1786                if( wParam == VK_ESCAPE && (GetKeyState(VK_SHIFT) & 0x8000))
     1787                    SendMessageW(WM_SYSCOMMAND, SC_KEYMENU, VK_SPACE );
    17431788
    17441789        Win32BaseWindow *siblingWindow;
     
    17791824
    17801825        return 0;
    1781 
    1782 #if 0 //CB: todo: MSDN docu: Windown handles these messages and not WM_SYSCHAR (the code below doesn't work)
    1783     case WM_KEYDOWN:
     1826    }
     1827
    17841828    case WM_KEYUP:
    1785     case WM_SYSKEYDOWN:
    17861829    case WM_SYSKEYUP:
    1787 #endif
     1830        /* Press and release F10 or ALT */
     1831        if (((wParam == VK_MENU) && iMenuSysKey) ||
     1832            ((wParam == VK_F10) && iF10Key))
     1833              ::SendMessageW( GetTopWindow(), WM_SYSCOMMAND, SC_KEYMENU, 0L );
     1834        iMenuSysKey = iF10Key = 0;
     1835        break;
    17881836
    17891837    case WM_SYSCHAR:
    17901838    {
    1791         int iMenuSysKey = 0;
     1839        iMenuSysKey = 0;
    17921840        if (wParam == VK_RETURN && (getStyle() & WS_MINIMIZE))
    17931841        {
     
    18011849                        break;
    18021850                if (wParam == VK_SPACE && (getStyle() & WS_CHILD)) {
    1803                         getParent()->SendMessageA(Msg, wParam, lParam );
     1851                        ::SendMessageW(GetParent(), Msg, wParam, lParam );
    18041852                }
    18051853                else    SendMessageA(WM_SYSCOMMAND, (WPARAM)SC_KEYMENU, (LPARAM)(DWORD)wParam );
Note: See TracChangeset for help on using the changeset viewer.