Ignore:
Timestamp:
Oct 9, 2001, 7:18:05 AM (24 years ago)
Author:
phaller
Message:

enabled low-level keyboard hook

File:
1 edited

Legend:

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

    r6783 r6972  
    1 /* $Id: window.cpp,v 1.107 2001-09-22 18:21:01 sandervl Exp $ */
     1/* $Id: window.cpp,v 1.108 2001-10-09 05:18:04 phaller Exp $ */
    22/*
    33 * Win32 window apis for OS/2
     
    2121 */
    2222
     23#include <odin.h>
     24#include <odinwrap.h>
     25#include <os2sel.h>
     26
    2327#include <os2win.h>
    2428#include <misc.h>
     
    4347#include "dbglocal.h"
    4448
    45 //******************************************************************************
    46 //******************************************************************************
    47 HWND WIN32API CreateWindowExA(DWORD exStyle, LPCSTR className,
    48                               LPCSTR windowName, DWORD style, INT x,
    49                               INT y, INT width, INT height,
    50                               HWND parent, HMENU menu,
    51                               HINSTANCE instance, LPVOID data )
     49ODINDEBUGCHANNEL(USER32-WINDOW)
     50
     51
     52//******************************************************************************
     53//******************************************************************************
     54ODINFUNCTION12(HWND,      CreateWindowExA,
     55               DWORD,     exStyle,
     56               LPCSTR,    className,
     57               LPCSTR,    windowName,
     58               DWORD,     style,
     59               INT,       x,
     60               INT,       y,
     61               INT,       width,
     62               INT,       height,
     63               HWND,      parent,
     64               HMENU,     menu,
     65               HINSTANCE, instance,
     66               LPVOID,    data )
    5267{
    5368  Win32BaseWindow *window;
     
    133148    }
    134149    HWND hwnd = window->getWindowHandle();
     150 
     151    // set myself as last active popup / window
     152    window->setLastActive( hwnd );
     153 
    135154    RELEASE_WNDOBJ(window);
    136155    return hwnd;
     
    138157//******************************************************************************
    139158//******************************************************************************
    140 HWND WIN32API CreateWindowExW(DWORD exStyle, LPCWSTR className,
    141                               LPCWSTR windowName, DWORD style, INT x,
    142                               INT y, INT width, INT height,
    143                               HWND parent, HMENU menu,
    144                               HINSTANCE instance, LPVOID data )
     159ODINFUNCTION12(HWND,      CreateWindowExW,
     160               DWORD,     exStyle,
     161               LPCWSTR,   className,
     162               LPCWSTR,   windowName,
     163               DWORD,     style,
     164               INT,       x,
     165               INT,       y,
     166               INT,       width,
     167               INT,       height,
     168               HWND,      parent,
     169               HMENU,     menu,
     170               HINSTANCE, instance,
     171               LPVOID,    data )
    145172{
    146173  Win32BaseWindow *window;
     
    227254    }
    228255    HWND hwnd = window->getWindowHandle();
     256 
     257    // set myself as last active popup / window
     258    window->setLastActive( hwnd );
     259 
    229260    RELEASE_WNDOBJ(window);
    230261    return hwnd;
     
    232263//******************************************************************************
    233264//******************************************************************************
    234 HWND WIN32API CreateFakeWindowEx(HWND hwndOS2)
     265ODINFUNCTION1(HWND, CreateFakeWindowEx,
     266              HWND, hwndOS2)
    235267{
    236268 Win32BaseWindow *window;
     
    243275    }
    244276    HWND hwnd = window->getWindowHandle();
     277 
     278    // set myself as last active popup / window
     279    window->setLastActive( hwnd );
     280 
    245281    RELEASE_WNDOBJ(window);
    246282    return hwnd;
     
    248284//******************************************************************************
    249285//******************************************************************************
    250 BOOL WIN32API DestroyWindow(HWND hwnd)
     286ODINFUNCTION1(BOOL, DestroyWindow,
     287              HWND, hwnd)
    251288{
    252289  Win32BaseWindow *window;
     
    265302//******************************************************************************
    266303//******************************************************************************
    267 HWND WIN32API SetActiveWindow( HWND hwnd)
     304ODINFUNCTION1(HWND, SetActiveWindow,
     305              HWND, hwnd)
    268306{
    269307  Win32BaseWindow *window;
     
    277315    }
    278316    hwndActive = window->SetActiveWindow();
     317 
     318    // check last active popup window
     319    if (hwndActive)
     320    {
     321      // TODO:
     322      // set last active popup window to the ancestor window
     323      dprintf(("support for last active popup incorrectly implemented"));
     324    }
     325 
    279326    RELEASE_WNDOBJ(window);
    280327    return hwndActive;
     
    283330//Note: does not set last error if no parent (verified in NT4, SP6)
    284331//******************************************************************************
    285 HWND WIN32API GetParent( HWND hwnd)
     332ODINFUNCTION1(HWND, GetParent,
     333              HWND, hwnd)
    286334{
    287335  Win32BaseWindow *window;
     
    301349//******************************************************************************
    302350//******************************************************************************
    303 HWND WIN32API SetParent( HWND hwndChild, HWND hwndNewParent)
     351ODINFUNCTION2(HWND, SetParent,
     352              HWND, hwndChild,
     353              HWND, hwndNewParent)
    304354{
    305355  Win32BaseWindow *window;
     
    330380//******************************************************************************
    331381//******************************************************************************
    332 BOOL WIN32API IsChild( HWND hwndParent, HWND hwnd)
     382ODINFUNCTION2(BOOL, IsChild,
     383              HWND, hwndParent,
     384              HWND, hwnd)
    333385{
    334386  Win32BaseWindow *window;
     
    348400//******************************************************************************
    349401//******************************************************************************
    350 HWND WIN32API GetTopWindow( HWND hwnd)
     402ODINFUNCTION1(HWND, GetTopWindow,
     403              HWND, hwnd)
    351404{
    352405  Win32BaseWindow *window;
     
    372425//******************************************************************************
    373426//******************************************************************************
    374 BOOL WIN32API IsIconic( HWND hwnd)
     427ODINFUNCTION1(BOOL, IsIconic,
     428              HWND, hwnd)
    375429{
    376430  Win32BaseWindow *window;
     
    390444//******************************************************************************
    391445//******************************************************************************
    392 HWND WIN32API GetWindow(HWND hwnd, UINT uCmd)
     446ODINFUNCTION2(HWND, GetWindow,
     447              HWND, hwnd,
     448              UINT, uCmd)
    393449{
    394450  Win32BaseWindow *window;
     
    407463//******************************************************************************
    408464//******************************************************************************
    409 BOOL WIN32API EnableWindow( HWND hwnd, BOOL fEnable)
     465ODINFUNCTION2(BOOL, EnableWindow,
     466              HWND, hwnd,
     467              BOOL, fEnable)
    410468{
    411469  Win32BaseWindow *window;
     
    425483//******************************************************************************
    426484//******************************************************************************
    427 BOOL WIN32API BringWindowToTop(HWND hwnd)
     485ODINFUNCTION1(BOOL, BringWindowToTop,
     486              HWND, hwnd)
    428487{
    429488    dprintf(("BringWindowToTop %x", hwnd));
     
    433492 *           SetInternalWindowPos   (USER32.483)
    434493 */
    435 void WIN32API SetInternalWindowPos(HWND    hwnd,
    436                                    UINT    showCmd,
    437                                    LPRECT  lpRect,
    438                                    LPPOINT lpPoint )
    439 {
    440     dprintf(("USER32: SetInternalWindowPos(%08xh,%08xh,%08xh,%08xh)",
    441            hwnd, showCmd, lpRect, lpPoint));
    442 
     494ODINPROCEDURE4(SetInternalWindowPos,
     495               HWND,    hwnd,
     496               UINT,    showCmd,
     497               LPRECT,  lpRect,
     498               LPPOINT, lpPoint )
     499{
    443500    if( IsWindow(hwnd) )
    444501    {
     
    467524 *           GetInternalWindowPos   (USER32.245)
    468525 */
    469 UINT WIN32API GetInternalWindowPos(HWND    hwnd,
    470                                    LPRECT  rectWnd,
    471                                    LPPOINT ptIcon )
     526ODINFUNCTION3(UINT,    GetInternalWindowPos,
     527              HWND,    hwnd,
     528              LPRECT,  rectWnd,
     529              LPPOINT, ptIcon )
    472530{
    473531    WINDOWPLACEMENT wndpl;
    474 
    475     dprintf(("USER32: GetInternalWindowPos(%08xh,%08xh,%08xh)\n",
    476              hwnd,
    477              rectWnd,
    478              ptIcon));
    479532
    480533    if(GetWindowPlacement( hwnd, &wndpl ))
     
    488541//******************************************************************************
    489542//******************************************************************************
    490 HWND WIN32API GetActiveWindow()
     543ODINFUNCTION0(HWND, GetActiveWindow)
    491544{
    492545    return Win32BaseWindow::GetActiveWindow();
     
    494547//******************************************************************************
    495548//******************************************************************************
    496 BOOL WIN32API ShowWindow(HWND hwnd, int nCmdShow)
     549ODINFUNCTION2(BOOL, ShowWindow,
     550              HWND, hwnd,
     551              int,  nCmdShow)
    497552{
    498553  Win32BaseWindow *window;
     
    523578 * Author    : Patrick Haller [Thu, 1998/02/26 11:55]
    524579 *****************************************************************************/
    525 BOOL WIN32API ShowWindowAsync (HWND hwnd,
    526                                int  nCmdShow)
     580ODINFUNCTION2(BOOL, ShowWindowAsync,
     581              HWND, hwnd,
     582              int,  nCmdShow)
    527583{
    528584  dprintf(("USER32:ShowWindowAsync (%08xh,%08x) not correctly implemented.\n",
     
    534590//******************************************************************************
    535591//******************************************************************************
    536 BOOL WIN32API SetWindowPos(HWND hwnd, HWND hwndInsertAfter, int x, int y, int cx, int cy, UINT fuFlags)
     592ODINFUNCTION7(BOOL, SetWindowPos,
     593              HWND, hwnd,
     594              HWND, hwndInsertAfter,
     595              int,  x,
     596              int,  y,
     597              int,  cx,
     598              int,  cy,
     599              UINT, fuFlags)
    537600{
    538601  Win32BaseWindow *window;
     
    557620//NOTE: length must equal structure size or else api fails (verified in NT4, SP6)
    558621//******************************************************************************
    559 BOOL WIN32API SetWindowPlacement(HWND hwnd, const WINDOWPLACEMENT *winpos)
     622ODINFUNCTION2(BOOL, SetWindowPlacement,
     623              HWND, hwnd,
     624              const WINDOWPLACEMENT *, winpos)
    560625{
    561626  Win32BaseWindow *window;
     
    581646//      (Verified in NT4, SP6)
    582647//******************************************************************************
    583 BOOL WIN32API GetWindowPlacement(HWND hwnd, LPWINDOWPLACEMENT winpos)
     648ODINFUNCTION2(BOOL, GetWindowPlacement,
     649              HWND, hwnd,
     650              LPWINDOWPLACEMENT, winpos)
    584651{
    585652  Win32BaseWindow *window;
     
    603670//******************************************************************************
    604671//******************************************************************************
    605 BOOL WIN32API IsWindow( HWND hwnd)
     672ODINFUNCTION1(BOOL, IsWindow,
     673              HWND, hwnd)
    606674{
    607675  Win32BaseWindow *window;
     
    620688//******************************************************************************
    621689//******************************************************************************
    622 BOOL WIN32API IsWindowEnabled( HWND hwnd)
     690ODINFUNCTION1(BOOL, IsWindowEnabled,
     691              HWND, hwnd)
    623692{
    624693  DWORD            dwStyle;
     
    638707//******************************************************************************
    639708//******************************************************************************
    640 BOOL WIN32API IsWindowVisible(HWND hwnd)
     709ODINFUNCTION1(BOOL, IsWindowVisible,
     710              HWND, hwnd)
    641711{
    642712  BOOL             ret;
     
    681751//******************************************************************************
    682752//******************************************************************************
    683 HWND WIN32API SetFocus(HWND hwnd)
     753ODINFUNCTION1(HWND, SetFocus,
     754              HWND, hwnd)
    684755{
    685756 Win32BaseWindow *window;
     
    748819//******************************************************************************
    749820//******************************************************************************
    750 HWND WIN32API GetFocus(void)
     821ODINFUNCTION0(HWND, GetFocus)
    751822{
    752823 TEB *teb;
     
    774845//******************************************************************************
    775846//******************************************************************************
    776 BOOL WIN32API IsZoomed(HWND hwnd)
     847ODINFUNCTION1(BOOL, IsZoomed,
     848              HWND, hwnd)
    777849{
    778850 DWORD style;
     
    785857//******************************************************************************
    786858//******************************************************************************
    787 BOOL WIN32API LockWindowUpdate(HWND hwnd)
    788 {
    789     dprintf(("USER32: LockWindowUpdate %x", hwnd));
    790     return OSLibWinLockWindowUpdate(Win32ToOS2Handle(hwnd));
    791 }
    792 //******************************************************************************
    793 //******************************************************************************
    794 BOOL WIN32API GetWindowRect( HWND hwnd, PRECT pRect)
     859ODINFUNCTION1(BOOL, LockWindowUpdate,
     860              HWND, hwnd)
     861{
     862  return OSLibWinLockWindowUpdate(Win32ToOS2Handle(hwnd));
     863}
     864//******************************************************************************
     865//******************************************************************************
     866ODINFUNCTION2(BOOL,  GetWindowRect,
     867              HWND,  hwnd,
     868              PRECT, pRect)
    795869{
    796870  Win32BaseWindow *window;
     
    825899//******************************************************************************
    826900//******************************************************************************
    827 int WIN32API GetWindowTextLengthA( HWND hwnd)
     901ODINFUNCTION1(int,  GetWindowTextLengthA,
     902              HWND, hwnd)
    828903{
    829904   Win32BaseWindow *window;
     
    17321807//TODO: -> needs testing
    17331808//******************************************************************************
    1734 BOOL WIN32API ShowOwnedPopups(HWND hwndOwner, BOOL fShow)
     1809ODINFUNCTION2(BOOL, ShowOwnedPopups,
     1810              HWND, hwndOwner,
     1811              BOOL, fShow)
    17351812{
    17361813    Win32BaseWindow *window, *owner;
     
    17861863//******************************************************************************
    17871864//******************************************************************************
    1788 HWND WIN32API GetForegroundWindow(void)
    1789 {
    1790  HWND hwnd;
    1791 
    1792     hwnd = OS2ToWin32Handle(OSLibWinQueryActiveWindow());
    1793     dprintf(("USER32: GetForegroundWindow returned %x", hwnd));
    1794     return hwnd;
    1795 }
    1796 //******************************************************************************
    1797 //******************************************************************************
    1798 HWND WIN32API GetLastActivePopup( HWND hWnd)
    1799 {
    1800  HWND hwnd;
    1801 
    1802     hwnd = Win32ToOS2Handle(hWnd);
    1803 ////    hwnd = OS2ToWin32Handle(O32_GetLastActivePopup(hwnd));
    1804 
    1805     dprintf(("GetLastActivePopup %x returned %x NOT CORRECTLY IMPLEMENTED", hWnd, hwnd));
     1865ODINFUNCTION0(HWND, GetForegroundWindow)
     1866{
     1867  HWND hwnd;
     1868
     1869  hwnd = OS2ToWin32Handle(OSLibWinQueryActiveWindow());
     1870  return hwnd;
     1871}
     1872//******************************************************************************
     1873
     1874/******************************************************************************
     1875 * The return value identifies the most recently active pop-up window.
     1876 * The return value is the same as the hWnd parameter, if any of the
     1877 * following conditions are met:
     1878 *
     1879 * - The window identified by hWnd was most recently active.
     1880 * - The window identified by hWnd does not own any pop-up windows.
     1881 * - The window identified by hWnd is not a top-level window or it is
     1882 *   owned by another window.
     1883 */
     1884ODINFUNCTION1(HWND, GetLastActivePopup,
     1885              HWND, hWnd)
     1886{
     1887  Win32BaseWindow *owner;
     1888
     1889  owner = Win32BaseWindow::GetWindowFromHandle(hWnd);
     1890  if(!owner)
     1891  {
     1892    dprintf(("GetLastActivePopup, window %x not found", hWnd));
     1893    SetLastError(ERROR_INVALID_WINDOW_HANDLE);
    18061894    return hWnd;
    1807 }
    1808 //******************************************************************************
    1809 //******************************************************************************
    1810 DWORD WIN32API GetWindowThreadProcessId(HWND hWnd, PDWORD  lpdwProcessId)
    1811 {
    1812     dprintf2(("USER32:  GetWindowThreadProcessId"));
    1813     hWnd = Win32ToOS2Handle(hWnd);
    1814 
    1815     return O32_GetWindowThreadProcessId(hWnd,lpdwProcessId);
    1816 }
    1817 //******************************************************************************
    1818 //******************************************************************************
    1819 DWORD WIN32API GetWindowContextHelpId(HWND hwnd)
     1895  }
     1896
     1897  HWND hwndRetVal = owner->getLastActive();
     1898  if (!IsWindow( hwndRetVal ))
     1899    hwndRetVal = owner->getWindowHandle();
     1900 
     1901  RELEASE_WNDOBJ(owner);
     1902 
     1903  return hwndRetVal;
     1904}
     1905//******************************************************************************
     1906//******************************************************************************
     1907ODINFUNCTION2(DWORD,   GetWindowThreadProcessId,
     1908              HWND,    hWnd,
     1909              PDWORD,  lpdwProcessId)
     1910{
     1911  hWnd = Win32ToOS2Handle(hWnd);
     1912  return O32_GetWindowThreadProcessId(hWnd,lpdwProcessId);
     1913}
     1914//******************************************************************************
     1915//******************************************************************************
     1916ODINFUNCTION1(DWORD, GetWindowContextHelpId,
     1917              HWND,  hwnd)
    18201918{
    18211919  Win32BaseWindow *window;
     
    18341932//******************************************************************************
    18351933//******************************************************************************
    1836 BOOL WIN32API SetWindowContextHelpId(HWND hwnd, DWORD dwContextHelpId)
     1934ODINFUNCTION2(BOOL,  SetWindowContextHelpId,
     1935              HWND,  hwnd,
     1936              DWORD, dwContextHelpId)
    18371937{
    18381938  Win32BaseWindow *window;
     
    18511951//******************************************************************************
    18521952//******************************************************************************
    1853 HANDLE WINAPI GetPropA( HWND hwnd, LPCSTR str )
     1953ODINFUNCTION2(HANDLE, GetPropA,
     1954              HWND,   hwnd,
     1955              LPCSTR, str )
    18541956{
    18551957  Win32BaseWindow *window;
     
    18671969//******************************************************************************
    18681970//******************************************************************************
    1869 HANDLE WINAPI GetPropW( HWND hwnd, LPCWSTR str )
     1971ODINFUNCTION2(HANDLE,  GetPropW,
     1972              HWND,    hwnd,
     1973              LPCWSTR, str )
    18701974{
    18711975    LPSTR strA;
     
    18801984//******************************************************************************
    18811985//******************************************************************************
    1882 BOOL WINAPI SetPropA( HWND hwnd, LPCSTR str, HANDLE handle )
     1986ODINFUNCTION3(BOOL,   SetPropA,
     1987              HWND,   hwnd,
     1988              LPCSTR, str,
     1989              HANDLE, handle )
    18831990{
    18841991  Win32BaseWindow *window;
     
    18962003//******************************************************************************
    18972004//******************************************************************************
    1898 BOOL WINAPI SetPropW( HWND hwnd, LPCWSTR str, HANDLE handle )
     2005ODINFUNCTION3(BOOL,    SetPropW,
     2006              HWND,    hwnd,
     2007              LPCWSTR, str,
     2008              HANDLE,  handle )
    18992009{
    19002010    BOOL ret;
     
    19102020//******************************************************************************
    19112021//******************************************************************************
    1912 HANDLE WINAPI RemovePropA( HWND hwnd, LPCSTR str )
     2022ODINFUNCTION2(HANDLE, RemovePropA,
     2023              HWND,   hwnd,
     2024              LPCSTR, str )
    19132025{
    19142026  Win32BaseWindow *window;
     
    19262038//******************************************************************************
    19272039//******************************************************************************
    1928 HANDLE WINAPI RemovePropW( HWND hwnd, LPCWSTR str )
     2040ODINFUNCTION2(HANDLE,  RemovePropW,
     2041              HWND,    hwnd,
     2042              LPCWSTR, str )
    19292043{
    19302044    LPSTR strA;
     
    19402054//******************************************************************************
    19412055//******************************************************************************
    1942 INT WINAPI EnumPropsA( HWND hwnd, PROPENUMPROCA func )
     2056ODINFUNCTION2(INT, EnumPropsA,
     2057              HWND, hwnd,
     2058              PROPENUMPROCA, func )
    19432059{
    19442060    return EnumPropsExA( hwnd, (PROPENUMPROCEXA)func, 0 );
     
    19462062//******************************************************************************
    19472063//******************************************************************************
    1948 INT WINAPI EnumPropsW( HWND hwnd, PROPENUMPROCW func )
     2064ODINFUNCTION2(INT, EnumPropsW,
     2065              HWND, hwnd,
     2066              PROPENUMPROCW, func )
    19492067{
    19502068    return EnumPropsExW( hwnd, (PROPENUMPROCEXW)func, 0 );
     
    19522070//******************************************************************************
    19532071//******************************************************************************
    1954 INT WINAPI EnumPropsExA(HWND hwnd, PROPENUMPROCEXA func, LPARAM lParam)
     2072ODINFUNCTION3(INT, EnumPropsExA,
     2073              HWND, hwnd,
     2074              PROPENUMPROCEXA, func,
     2075              LPARAM, lParam)
    19552076{
    19562077  Win32BaseWindow *window;
     
    19682089//******************************************************************************
    19692090//******************************************************************************
    1970 INT WINAPI EnumPropsExW(HWND hwnd, PROPENUMPROCEXW func, LPARAM lParam)
     2091ODINFUNCTION3(INT, EnumPropsExW,
     2092              HWND, hwnd,
     2093              PROPENUMPROCEXW, func,
     2094              LPARAM, lParam)
    19712095{
    19722096  Win32BaseWindow *window;
     
    19842108//******************************************************************************
    19852109//******************************************************************************
     2110
     2111
     2112/*****************************************************************************
     2113 * Name      : BOOL WIN32API AnyPopup
     2114 * Purpose   : The AnyPopup function indicates whether an owned, visible,
     2115 *             top-level pop-up, or overlapped window exists on the screen. The
     2116 *             function searches the entire Windows screen, not just the calling
     2117 *             application's client area.
     2118 * Parameters: VOID
     2119 * Variables :
     2120 * Result    : If a pop-up window exists, the return value is TRUE even if the
     2121 *             pop-up window is completely covered by other windows. Otherwise,
     2122 *             it is FALSE.
     2123 * Remark    : AnyPopup is a Windows version 1.x function and is retained for
     2124 *             compatibility purposes. It is generally not useful.
     2125 * Status    : UNTESTED STUB
     2126 *
     2127 * Author    : Patrick Haller [Thu, 1998/02/26 11:55]
     2128 *****************************************************************************/
     2129ODINFUNCTION0(BOOL, AnyPopup)
     2130{
     2131  dprintf(("USER32:AnyPopup() not implemented.\n"));
     2132
     2133  return (FALSE);
     2134}
Note: See TracChangeset for help on using the changeset viewer.