Changeset 9930 for trunk/src


Ignore:
Timestamp:
Mar 20, 2003, 2:20:46 PM (22 years ago)
Author:
sandervl
Message:

Changes for fake windows. Moved them into a seperate C++ class and overload some methods to correct the behaviour

Location:
trunk/src/user32
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/Makefile

    r9810 r9930  
    1 # $Id: Makefile,v 1.105 2003-02-16 15:31:08 sandervl Exp $
     1# $Id: Makefile,v 1.106 2003-03-20 13:20:44 sandervl Exp $
    22
    33#
     
    6565$(OBJDIR)\win32wndhandle.obj \
    6666$(OBJDIR)\win32wmisc.obj \
     67$(OBJDIR)\win32wdesktop.obj \
     68$(OBJDIR)\win32wfake.obj \
    6769$(OBJDIR)\windowword.obj \
    6870$(OBJDIR)\windowmsg.obj \
     
    7375$(OBJDIR)\win32wmdiclient.obj \
    7476$(OBJDIR)\mdi.obj \
    75 $(OBJDIR)\win32wdesktop.obj \
    7677$(OBJDIR)\win32dlg.obj \
    7778$(OBJDIR)\windlgmsg.obj \
  • trunk/src/user32/dbglocal.cpp

    r9810 r9930  
    1 /* $Id: dbglocal.cpp,v 1.15 2003-02-16 15:31:09 sandervl Exp $ */
     1/* $Id: dbglocal.cpp,v 1.16 2003-03-20 13:20:44 sandervl Exp $ */
    22
    33/*
     
    9797"dragdrop",
    9898"oslibclip",
    99 "oslibkbd"
     99"oslibkbd",
     100"win32wfake"
    100101};
    101102//******************************************************************************
  • trunk/src/user32/dbglocal.h

    r9810 r9930  
    1 /* $Id: dbglocal.h,v 1.12 2003-02-16 15:31:09 sandervl Exp $ */
     1/* $Id: dbglocal.h,v 1.13 2003-03-20 13:20:44 sandervl Exp $ */
    22
    33/*
     
    9696#define DBG_oslibclip            74
    9797#define DBG_oslibkbd             75
    98 #define DBG_MAXFILES             76
     98#define DBG_win32wfake           76
     99#define DBG_MAXFILES             77
    99100
    100101extern USHORT DbgEnabledUSER32[DBG_MAXFILES];
  • trunk/src/user32/pmwindow.cpp

    r9866 r9930  
    1 /* $Id: pmwindow.cpp,v 1.201 2003-02-27 14:22:43 sandervl Exp $ */
     1/* $Id: pmwindow.cpp,v 1.202 2003-03-20 13:20:44 sandervl Exp $ */
    22/*
    33 * Win32 Window Managment Code for OS/2
     
    20482048//******************************************************************************
    20492049//******************************************************************************
     2050MRESULT EXPENTRY Win32FakeWindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
     2051{
     2052    PFNWP            pfnOldWindowProc;
     2053    Win32BaseWindow *win32wnd, *win32wndchild;
     2054    TEB             *teb;
     2055    MRESULT          rc = 0;
     2056
     2057    //Restore our FS selector
     2058    SetWin32TIB();
     2059
     2060    //We can't query the window object directly from this window as it's not the
     2061    //real thing. There should be a genuine win32 child window which we can use.
     2062    HWND hwndChild = WinQueryWindow(hwnd, QW_TOP);
     2063
     2064    win32wndchild = Win32BaseWindow::GetWindowFromOS2FrameHandle(hwndChild);
     2065    if(win32wndchild == NULL) {
     2066        DebugInt3();
     2067        goto RunDefWndProc;
     2068    }
     2069    //now get the parent window object
     2070    win32wnd = Win32BaseWindow::GetWindowFromHandle(GetParent(win32wndchild->getWindowHandle()));
     2071    if(win32wndchild) RELEASE_WNDOBJ(win32wndchild);
     2072
     2073    if(win32wnd == NULL) {
     2074        DebugInt3();
     2075        goto RunDefWndProc;
     2076    }
     2077
     2078    pfnOldWindowProc = (PFNWP)win32wnd->getOldPMWindowProc();
     2079    if(pfnOldWindowProc == NULL) {
     2080        DebugInt3();
     2081        goto RunDefWndProc;
     2082    }
     2083
     2084    rc = pfnOldWindowProc(hwnd, msg, mp1, mp2);
     2085    switch(msg) {
     2086    case WM_WINDOWPOSCHANGED:
     2087    {
     2088        PSWP      pswp    = (PSWP)mp1,pswpOld = pswp+1;
     2089        SWP       swpOld  = *(pswp + 1);
     2090        WINDOWPOS wp;
     2091
     2092        if(win32wnd->getParent()) {
     2093             OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, win32wnd->getParent()->getClientHeight(),
     2094                                    hwnd);
     2095        }
     2096        else OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, OSLibQueryScreenHeight(), hwnd);
     2097
     2098        win32wnd->SetWindowPos(wp.hwndInsertAfter, wp.x, wp.y, wp.cx, wp.cy, wp.flags);
     2099        break;
     2100    }
     2101
     2102    }
     2103    if(win32wnd) RELEASE_WNDOBJ(win32wnd);
     2104    RestoreOS2TIB();
     2105    return rc;
     2106
     2107RunDefWndProc:
     2108    RestoreOS2TIB();
     2109    return WinDefWindowProc( hwnd, msg, mp1, mp2 );
     2110}
     2111//******************************************************************************
     2112// PMWinSubclassFakeWindow
     2113//
     2114// Subclass a fake window (converted PM window)
     2115//
     2116// Parameters
     2117//
     2118//     HWND hwndOS2             - PM handle of fake window
     2119//
     2120// Returns
     2121//     NULL                     - Failure
     2122//     else                     - Old PM window procedure
     2123//
     2124//******************************************************************************
     2125PVOID PMWinSubclassFakeWindow(HWND hwndOS2)
     2126{
     2127    return WinSubclassWindow(hwndOS2, Win32FakeWindowProc);
     2128}
     2129//******************************************************************************
     2130//******************************************************************************
    20502131void FrameSetFocus(HWND hwnd)
    20512132{
  • trunk/src/user32/pmwindow.h

    r9437 r9930  
    1 /* $Id: pmwindow.h,v 1.18 2002-11-27 13:56:27 sandervl Exp $ */
     1/* $Id: pmwindow.h,v 1.19 2003-03-20 13:20:45 sandervl Exp $ */
    22/*
    33 * Win32 Window Managment Code for OS/2
     
    2121void RegisterSystemClasses(ULONG hModule);
    2222void UnregisterSystemClasses();
     23
     24PVOID PMWinSubclassFakeWindow(HWND hwndOS2);
    2325
    2426extern ULONG ScreenWidth;
  • trunk/src/user32/win32wbase.cpp

    r9871 r9930  
    1 /* $Id: win32wbase.cpp,v 1.361 2003-02-28 09:56:00 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.362 2003-03-20 13:20:45 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    9292//******************************************************************************
    9393//******************************************************************************
    94 Win32BaseWindow::Win32BaseWindow(HWND hwndOS2, ATOM classAtom)
    95                      : GenericObject(&windows, &critsect), ChildWindow(&critsect)
    96 {
    97     Init();
    98     OS2Hwnd = OS2HwndFrame = hwndOS2;
    99 
    100     /* Find the window class */
    101     windowClass = Win32WndClass::FindClass(NULL, (LPSTR)classAtom);
    102     if (!windowClass)
    103     {
    104         char buffer[32];
    105         GlobalGetAtomNameA( classAtom, buffer, sizeof(buffer) );
    106         dprintf(("Bad class '%s'", buffer ));
    107         DebugInt3();
    108     }
    109 
    110     //Allocate window words
    111     nrUserWindowBytes = windowClass->getExtraWndBytes();
    112     if(nrUserWindowBytes) {
    113         userWindowBytes = (char *)_smalloc(nrUserWindowBytes);
    114         memset(userWindowBytes, 0, nrUserWindowBytes);
    115     }
    116 
    117     WINPROC_SetProc((HWINDOWPROC *)&win32wndproc, windowClass->getWindowProc((isUnicode) ? WNDPROC_UNICODE : WNDPROC_ASCII), WINPROC_GetProcType(windowClass->getWindowProc((isUnicode) ? WNDPROC_UNICODE : WNDPROC_ASCII)), WIN_PROC_WINDOW);
    118     hInstance  = NULL;
    119     dwStyle    = WS_VISIBLE;
    120     dwOldStyle = dwStyle;
    121     dwExStyle  = 0;
    122 
    123     //We pretend this window has no parent and won't change size
    124     //(dangerous assumption!!)
    125     OSLibWinQueryWindowClientRect(OS2Hwnd, &rectClient);
    126     OSLibQueryWindowRectAbsolute (OS2Hwnd, &rectWindow);
    127 
    128     fFakeWindow = TRUE;
    129 }
    130 //******************************************************************************
    131 //******************************************************************************
    13294Win32BaseWindow::Win32BaseWindow(CREATESTRUCTA *lpCreateStructA, ATOM classAtom, BOOL isUnicode)
    13395                     : GenericObject(&windows, &critsect), ChildWindow(&critsect)
     
    156118  fVisibleRegionChanged = FALSE;
    157119  fEraseBkgndFlag  = TRUE;
    158   fFakeWindow      = FALSE;
    159120  fIsDragDropActive= FALSE;
    160121
     
    232193  lpVisRgnNotifyProc  = NULL;
    233194  dwVisRgnNotifyParam = NULL;
     195
     196  pfnOldPMWndProc     = NULL;
    234197}
    235198//******************************************************************************
     
    35093472    dprintf(("GetWindow %x %d returned %x", getWindowHandle(), uCmd, hwndRelated));
    35103473    return hwndRelated;
     3474}
     3475//******************************************************************************
     3476//******************************************************************************
     3477PRECT Win32BaseWindow::getWindowRect()
     3478{
     3479    return &rectWindow;
    35113480}
    35123481//******************************************************************************
  • trunk/src/user32/win32wbase.h

    r9598 r9930  
    1 /* $Id: win32wbase.h,v 1.148 2003-01-03 16:35:56 sandervl Exp $ */
     1/* $Id: win32wbase.h,v 1.149 2003-03-20 13:20:46 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    113113                Win32BaseWindow();
    114114                Win32BaseWindow(CREATESTRUCTA *lpCreateStructA, ATOM classAtom, BOOL isUnicode);
    115                 Win32BaseWindow(HWND hwndOS2, ATOM classAtom);
    116115
    117116virtual        ~Win32BaseWindow();
     
    201200         }
    202201         void   setClientRect(PRECT rect)       { rectClient = *rect; };
    203          PRECT  getWindowRect()                 { return &rectWindow; };
     202virtual  PRECT  getWindowRect();
    204203         void   setClientRect(LONG left, LONG top, LONG right, LONG bottom)
    205204         {
     
    232231
    233232         BOOL   ShowWindow(ULONG nCmdShow);
    234          BOOL   SetWindowPos(HWND hwndInsertAfter, int x, int y, int cx, int cy, UINT fuFlags, BOOL fShowWindow = FALSE);
     233virtual  BOOL   SetWindowPos(HWND hwndInsertAfter, int x, int y, int cx, int cy, UINT fuFlags, BOOL fShowWindow = FALSE);
    235234         BOOL   SetWindowPlacement(WINDOWPLACEMENT *winpos);
    236235         BOOL   GetWindowPlacement(LPWINDOWPLACEMENT winpos);
     
    246245         HWND   GetTopWindow();
    247246         HWND   GetTopParent();
     247
     248         PVOID  getOldPMWindowProc()                   { return pfnOldPMWndProc; };
     249         void   setOldPMWindowProc(PVOID pfnPMWndProc) { pfnOldPMWndProc = pfnPMWndProc; };
    248250
    249251         HWND   GetWindow(UINT uCmd);
     
    414416                 fVisibleRegionChanged:1, //set when visible region has changed -> erase background must be sent during next BeginPaint
    415417                 fEraseBkgndFlag:1,
    416                  fIsDragDropActive:1,
    417                  fFakeWindow:1;
     418                 fIsDragDropActive:1;
    418419
    419420        ULONG   state;
     
    437438        RECT    rectClient;  //relative to frame
    438439WINDOWPLACEMENT windowpos;
     440
     441        PVOID   pfnOldPMWndProc;
    439442
    440443    PROPERTY   *propertyList;
  • trunk/src/user32/window.cpp

    r9928 r9930  
    1 /* $Id: window.cpp,v 1.132 2003-03-20 09:15:31 sandervl Exp $ */
     1/* $Id: window.cpp,v 1.133 2003-03-20 13:20:46 sandervl Exp $ */
    22/*
    33 * Win32 window apis for OS/2
     
    262262    RELEASE_WNDOBJ(window);
    263263    return hwnd;
    264 }
    265 //******************************************************************************
    266 //******************************************************************************
    267 HWND WIN32API CreateFakeWindowEx(HWND  hwndOS2, ATOM  classAtom)
    268 {
    269  Win32BaseWindow *window;
    270 
    271     window = new Win32BaseWindow(hwndOS2, classAtom);
    272     if(window == NULL)
    273     {
    274         dprintf(("Win32BaseWindow creation failed!!"));
    275         return 0;
    276     }
    277     HWND hwnd = window->getWindowHandle();
    278  
    279     // set myself as last active popup / window
    280     window->setLastActive( hwnd );
    281  
    282     RELEASE_WNDOBJ(window);
    283     return hwnd;
    284 }
    285 //******************************************************************************
    286 //******************************************************************************
    287 BOOL WIN32API DestroyFakeWindow(HWND hwnd)
    288 {
    289   Win32BaseWindow *window;
    290 
    291     window = Win32BaseWindow::GetWindowFromHandle(hwnd);
    292     if(!window) {
    293         dprintf(("DestroyFakeWindow, window %x not found", hwnd));
    294         SetLastError(ERROR_INVALID_WINDOW_HANDLE);
    295         return 0;
    296     }
    297     delete window;
    298     return TRUE;
    299264}
    300265//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.