Changeset 2426 for trunk/src


Ignore:
Timestamp:
Jan 13, 2000, 2:54:55 PM (26 years ago)
Author:
sandervl
Message:

wm_activate fixes, scrollbar fix, drawframe fix

Location:
trunk/src/user32/new
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/new/makefile

    r2415 r2426  
    1 # $Id: makefile,v 1.57 2000-01-12 12:40:41 sandervl Exp $
     1# $Id: makefile,v 1.58 2000-01-13 13:54:51 sandervl Exp $
    22
    33#
     
    144144oslibutil.obj:  oslibutil.cpp oslibutil.h $(PDWIN32_INCLUDE)\wprocess.h oslibmsg.h
    145145oslibmsg.obj:   oslibmsg.cpp oslibmsg.h timer.h win32wbase.h win32wnd.h $(PDWIN32_INCLUDE)\win\thread.h
    146 oslibmsgtranslate.obj: oslibmsgtranslate.cpp oslibmsg.h timer.h win32wbase.h win32wnd.h $(PDWIN32_INCLUDE)\win\thread.h
     146oslibmsgtranslate.obj: oslibmsgtranslate.cpp oslibmsg.h timer.h win32wbase.h win32wnd.h $(PDWIN32_INCLUDE)\win\thread.h win32wdesktop.h
    147147oslibgdi.obj:   oslibgdi.cpp oslibgdi.h win32wbase.h
    148148oslibres.obj:   oslibres.cpp oslibwin.h oslibres.h $(PDWIN32_INCLUDE)\winconst.h
  • trunk/src/user32/new/oslibmsgtranslate.cpp

    r2418 r2426  
    1 /* $Id: oslibmsgtranslate.cpp,v 1.12 2000-01-12 15:14:15 sandervl Exp $ */
     1/* $Id: oslibmsgtranslate.cpp,v 1.13 2000-01-13 13:54:52 sandervl Exp $ */
    22/*
    33 * Window message translation functions for OS/2
     
    2323#include <misc.h>
    2424#include "oslibmsg.h"
    25 #include <win32wnd.h>
     25#include "win32wnd.h"
     26#include "win32wdesktop.h"
    2627#include "oslibutil.h"
    2728#include "timer.h"
     
    104105ULONG GetMouseKeyState()
    105106{
    106   ULONG keystate;
     107  ULONG keystate = 0;
    107108
    108109  if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON1) & 0x8000)
     
    349350        if(WinQueryWindowULong(hwndActivate, OFFSET_WIN32PM_MAGIC) != WIN32PM_MAGIC) {
    350351                //another (non-win32) application's window
    351                 //set to NULL (allowed according to win32 SDK) to avoid problems
    352                 hwndActivate = NULL;
     352                //set to desktop window handle
     353                hwndActivate = windowDesktop->getWindowHandle();
    353354        }
    354355        else    hwndActivate = Win32BaseWindow::OS2ToWin32Handle(hwndActivate);
     
    441442          winMsg->wParam  = (WPARAM)hittest;
    442443          winMsg->lParam  = MAKELONG(winMsg->pt.x,winMsg->pt.y);
    443         } else
     444        }
     445        else
    444446        {
    445447          winMsg->message = WINWM_MOUSEMOVE;
  • trunk/src/user32/new/pmframe.cpp

    r2425 r2426  
    1 /* $Id: pmframe.cpp,v 1.14 2000-01-12 22:07:28 cbratschi Exp $ */
     1/* $Id: pmframe.cpp,v 1.15 2000-01-13 13:54:52 sandervl Exp $ */
    22/*
    33 * Win32 Frame Managment Code for OS/2
     
    263263        if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0)
    264264        {
    265                 swpClient.hwnd = win32wnd->getOS2WindowHandle();
    266                 swpClient.hwndInsertBehind = 0;
    267                 swpClient.x  = 0;
    268                 swpClient.y  = 0;
    269                 swpClient.cx = 0;
    270                 swpClient.cy = 0;
    271                 swpClient.fl = pswp->fl & ~SWP_ZORDER;
    272                 WinSetMultWindowPos(thdb->hab, &swpClient, 1);
    273                 goto PosChangedEnd;
     265                goto RunDefFrameProc;
    274266        }
    275267
     
    284276        OSLibMapSWPtoWINDOWPOSFrame(pswp, &wp, &swpOld, hParent, hwnd);
    285277
     278        if(pswp->fl & SWP_ACTIVATE)
     279        {
     280             WinSendMsg(hwnd, WM_ACTIVATE, (MPARAM)TRUE, (MPARAM)hwnd);
     281        }
     282
    286283        if(pswp->fl & (SWP_MOVE | SWP_SIZE))
    287284        {
    288           win32wnd->setWindowRect(wp.x, wp.y, wp.x+wp.cx, wp.y+wp.cy);
    289 
    290           win32wnd->MsgFormatFrame();
     285          //Note: Also updates the new window rectangle
     286          win32wnd->MsgFormatFrame(&wp);
     287
    291288          //CB: todo: use result for WM_CALCVALIDRECTS
    292289          mapWin32ToOS2Rect(WinQueryWindow(hwnd,QW_PARENT),hwnd,win32wnd->getClientRectPtr(),(PRECTLOS2)&rect);
     
    328325            {
    329326              WinInvalidateRect(hwnd,NULL,TRUE);
    330             } else
     327            }
     328            else
    331329            {
    332330              HPS hps = WinGetPS(hwnd);
     
    362360            }
    363361          }
    364         } else
     362        }
     363        else
    365364        {
    366365          //update child positions: rectWindow is in window coordinates
     
    390389        USHORT flags = WinQueryWindowUShort(hwnd,QWS_FLAGS);
    391390
     391        dprintf(("PMFRAME: WM_ACTIVATE %x %x", hwnd, mp2));
    392392        if (win32wnd->IsWindowCreated())
    393393        {
     
    449449  SWP swpClient = {0};
    450450
    451         win32wnd->MsgFormatFrame();
     451        win32wnd->MsgFormatFrame(NULL);
    452452        //CB: todo: use result for WM_CALCVALIDRECTS
    453453        mapWin32ToOS2Rect(WinQueryWindow(win32wnd->getOS2FrameWindowHandle(),QW_PARENT),win32wnd->getOS2FrameWindowHandle(),win32wnd->getClientRectPtr(),(PRECTLOS2)&rect);
  • trunk/src/user32/new/pmwindow.cpp

    r2425 r2426  
    1 /* $Id: pmwindow.cpp,v 1.39 2000-01-12 22:07:28 cbratschi Exp $ */
     1/* $Id: pmwindow.cpp,v 1.40 2000-01-13 13:54:52 sandervl Exp $ */
    22/*
    33 * Win32 Window Managment Code for OS/2
     
    259259    case WM_ACTIVATE:
    260260    {
    261       HWND hwndActivate = (HWND)mp2;
    262       BOOL fMinimized = FALSE;
    263 
    264         dprintf(("OS2: WM_ACTIVATE %x %x", hwnd, hwndActivate));
    265         if(WinQueryWindowULong(hwndActivate, OFFSET_WIN32PM_MAGIC) != WIN32PM_MAGIC) {
    266                 //another (non-win32) application's window
    267                 //set to NULL (allowed according to win32 SDK) to avoid problems
    268                 hwndActivate = NULL;
    269         }
    270         if(WinQueryWindowULong(hwnd, QWL_STYLE) & WS_MINIMIZED)
    271         {
    272            fMinimized = TRUE;
    273         }
    274 
    275         win32wnd->MsgActivate(SHORT1FROMMP(mp1), fMinimized, Win32BaseWindow::OS2ToWin32Handle(hwndActivate));
     261        dprintf(("OS2: WM_ACTIVATE %x %x", hwnd, mp2));
     262
     263        if(win32wnd->IsWindowCreated())
     264          win32wnd->MsgActivate((LOWORD(pWinMsg->wParam) == WA_ACTIVE_W) ? 1 : 0, HIWORD(pWinMsg->wParam), pWinMsg->lParam, (HWND)mp2);
     265
    276266        break;
    277267    }
  • trunk/src/user32/new/scroll.cpp

    r2418 r2426  
    1 /* $Id: scroll.cpp,v 1.9 2000-01-12 15:14:16 sandervl Exp $ */
     1/* $Id: scroll.cpp,v 1.10 2000-01-13 13:54:53 sandervl Exp $ */
    22/*
    33 * Scrollbar control
     
    125125        if (!win32wnd) return FALSE;
    126126        rectClient = *win32wnd->getClientRectPtr();
    127         mapWin32Rect(win32wnd->getParent() ? win32wnd->getParent()->getOS2WindowHandle():OSLIB_HWND_DESKTOP,win32wnd->getOS2FrameWindowHandle(),&rectClient);
     127        if(win32wnd->getParent())
     128                mapWin32Rect(win32wnd->getParent() ? win32wnd->getParent()->getOS2WindowHandle():OSLIB_HWND_DESKTOP,win32wnd->getOS2FrameWindowHandle(),&rectClient);
    128129        lprect->left   = rectClient.left;
    129130        lprect->top    = rectClient.bottom;
     
    147148        if (!win32wnd) return FALSE;
    148149        rectClient = *win32wnd->getClientRectPtr();
    149         mapWin32Rect(win32wnd->getParent() ? win32wnd->getParent()->getOS2WindowHandle():OSLIB_HWND_DESKTOP,win32wnd->getOS2FrameWindowHandle(),&rectClient);
     150        if(win32wnd->getParent())
     151                mapWin32Rect(win32wnd->getParent() ? win32wnd->getParent()->getOS2WindowHandle():OSLIB_HWND_DESKTOP,win32wnd->getOS2FrameWindowHandle(),&rectClient);
    150152        lprect->left   = rectClient.right;
    151153        lprect->top    = rectClient.top;
  • trunk/src/user32/new/win32wbase.cpp

    r2421 r2426  
    1 /* $Id: win32wbase.cpp,v 1.37 2000-01-12 17:37:29 cbratschi Exp $ */
     1/* $Id: win32wbase.cpp,v 1.38 2000-01-13 13:54:53 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    834834//******************************************************************************
    835835//******************************************************************************
    836 ULONG Win32BaseWindow::MsgActivate(BOOL fActivate, BOOL fMinimized, HWND hwnd)
    837 {
    838  ULONG rc, curprocid, procidhwnd = -1, threadidhwnd = 0;
     836ULONG Win32BaseWindow::MsgActivate(BOOL fActivate, BOOL fMinimized, HWND hwnd, HWND hwndOS2Win)
     837{
     838 ULONG rc, procidhwnd = -1, threadidhwnd = 0;
    839839
    840840
     
    842842    //default processing is cancelled
    843843    //TODO: According to Wine we should proceed anyway if window is sysmodal
     844#if 0
    844845    if(SendInternalMessageA(WM_NCACTIVATE, fActivate, 0) == FALSE && !fActivate)
    845846    {
    846847        return 0;
    847848    }
     849#endif
    848850    rc = SendInternalMessageA(WM_ACTIVATE, MAKELONG((fActivate) ? WA_ACTIVE : WA_INACTIVE, fMinimized), hwnd);
    849851
    850     curprocid  = GetCurrentProcessId();
    851     if(hwnd) {
    852             threadidhwnd = GetWindowThreadProcessId(hwnd, &procidhwnd);
    853     }
    854 
    855     if(curprocid != procidhwnd && fActivate) {
    856         SendInternalMessageA(WM_ACTIVATEAPP, 1, threadidhwnd);
    857     }
     852    if(hwndOS2Win) {
     853            threadidhwnd = O32_GetWindowThreadProcessId(hwndOS2Win, &procidhwnd);
     854    }
     855
     856    if(fActivate) {
     857            SendInternalMessageA(WM_ACTIVATEAPP, 1, dwThreadId);    //activate; specify window thread id
     858    }
     859    else    SendInternalMessageA(WM_ACTIVATEAPP, 0, threadidhwnd);  //deactivate; specify thread id of other process
    858860    return rc;
    859861}
     
    10511053}
    10521054//******************************************************************************
    1053 //******************************************************************************
    1054 ULONG  Win32BaseWindow::MsgFormatFrame()
    1055 {
    1056   RECT window = rectWindow,client = rectClient,rect;
     1055//Called when either the frame's size or position has changed (lpWndPos != NULL)
     1056//or when the frame layout has changed (i.e. scrollbars added/removed) (lpWndPos == NULL)
     1057//******************************************************************************
     1058ULONG Win32BaseWindow::MsgFormatFrame(WINDOWPOS *lpWndPos)
     1059{
     1060  RECT oldWindowRect = rectWindow, client = rectClient, newWindowRect;
    10571061  WINDOWPOS wndPos;
    10581062
    1059   wndPos.hwnd = Win32Hwnd;
    1060   wndPos.hwndInsertAfter = 0;
    1061   rect = rectWindow;
    1062   if (getParent()) mapWin32Rect(OSLIB_HWND_DESKTOP,getParent()->getOS2WindowHandle(),&rect);
    1063   wndPos.x = rect.left;
    1064   wndPos.y = rect.top;
    1065   wndPos.cx = rect.right-rect.left;
    1066   wndPos.cy = rect.bottom-rect.top;
    1067   wndPos.flags = 0; //dummy
    1068 
    1069   return SendNCCalcSize(TRUE,&window,&window,&client,&wndPos,&rectClient);
     1063  if(lpWndPos) {
     1064    //set new window rectangle
     1065    setWindowRect(lpWndPos->x, lpWndPos->y, lpWndPos->x + lpWndPos->cx, lpWndPos->y + lpWndPos->cy);
     1066    newWindowRect = rectWindow;
     1067  }
     1068  else {
     1069    wndPos.hwnd  = Win32Hwnd;
     1070    wndPos.hwndInsertAfter = 0;
     1071    newWindowRect= rectWindow;
     1072    if (getParent()) mapWin32Rect(OSLIB_HWND_DESKTOP,getParent()->getOS2WindowHandle(),&newWindowRect);
     1073    wndPos.x     = newWindowRect.left;
     1074    wndPos.y     = newWindowRect.top;
     1075    wndPos.cx    = newWindowRect.right - newWindowRect.left;
     1076    wndPos.cy    = newWindowRect.bottom - newWindowRect.top;
     1077    wndPos.flags = SWP_FRAMECHANGED;
     1078    lpWndPos = &wndPos;
     1079  }
     1080
     1081  return SendNCCalcSize(TRUE, &oldWindowRect, &newWindowRect, &client, &wndPos, &rectClient);
    10701082}
    10711083//******************************************************************************
     
    25372549 ULONG         magic;
    25382550
    2539   hwndActive = OSLibWinSetActiveWindow(OS2HwndFrame);
    2540   win32wnd = (Win32BaseWindow *)OSLibWinGetWindowULong(hwndActive, OFFSET_WIN32WNDPTR);
    2541   magic    = OSLibWinGetWindowULong(hwndActive, OFFSET_WIN32PM_MAGIC);
    2542   if(CheckMagicDword(magic) && win32wnd)
    2543   {
     2551    dprintf(("SetActiveWindow %x", getWindowHandle()));
     2552    hwndActive = OSLibWinSetActiveWindow(OS2HwndFrame);
     2553    win32wnd = (Win32BaseWindow *)OSLibWinGetWindowULong(hwndActive, OFFSET_WIN32WNDPTR);
     2554    magic    = OSLibWinGetWindowULong(hwndActive, OFFSET_WIN32PM_MAGIC);
     2555    if(CheckMagicDword(magic) && win32wnd)
     2556    {
    25442557        return win32wnd->getWindowHandle();
    2545   }
    2546   return 0;
     2558    }
     2559    return windowDesktop->getWindowHandle(); //pretend the desktop was active
    25472560}
    25482561//******************************************************************************
  • trunk/src/user32/new/win32wbase.h

    r2415 r2426  
    1 /* $Id: win32wbase.h,v 1.25 2000-01-12 12:40:49 sandervl Exp $ */
     1/* $Id: win32wbase.h,v 1.26 2000-01-13 13:54:54 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    107107         ULONG  MsgPosChanging(LPARAM lp);
    108108         ULONG  MsgPosChanged(LPARAM lp);
    109 virtual  ULONG  MsgActivate(BOOL fActivate, BOOL fMinimized, HWND hwnd);
     109virtual  ULONG  MsgActivate(BOOL fActivate, BOOL fMinimized, HWND hwnd, HWND hwndOS2Win);
    110110         ULONG  MsgSetFocus(HWND hwnd);
    111111         ULONG  MsgKillFocus(HWND hwnd);
     
    117117         ULONG  MsgHitTest(ULONG x, ULONG y);
    118118         ULONG  MsgNCPaint();
    119          ULONG  MsgFormatFrame();
     119         ULONG  MsgFormatFrame(WINDOWPOS *lpWndPos);
    120120         ULONG  DispatchMsgA(MSG *msg);
    121121         ULONG  DispatchMsgW(MSG *msg);
  • trunk/src/user32/new/win32wbasenonclient.cpp

    r2411 r2426  
    1 /* $Id: win32wbasenonclient.cpp,v 1.3 2000-01-11 18:32:07 cbratschi Exp $ */
     1/* $Id: win32wbasenonclient.cpp,v 1.4 2000-01-13 13:54:54 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2 (non-client methods)
     
    586586    width = GetSystemMetrics(SM_CXDLGFRAME) - GetSystemMetrics(SM_CXEDGE);
    587587    height = GetSystemMetrics(SM_CYDLGFRAME) - GetSystemMetrics(SM_CYEDGE);
    588   } else
     588  }
     589  else
    589590  {
    590591    width = GetSystemMetrics(SM_CXFRAME) - GetSystemMetrics(SM_CXEDGE);
     
    595596
    596597  /* Draw frame */
    597 
    598   PatBlt(hdc,rect->left,rect->top,rect->right-rect->left,height,PATCOPY);
    599   PatBlt(hdc,rect->left,rect->top,width,rect->bottom-rect->top,PATCOPY);
    600   PatBlt(hdc,rect->left,rect->bottom-1,rect->right-rect->left,-height,PATCOPY);
    601   PatBlt(hdc,rect->right-1,rect->top,-width,rect->bottom-rect->top,PATCOPY);
     598  PatBlt(hdc,rect->left,   rect->top,      rect->right-rect->left, height,PATCOPY);
     599  PatBlt(hdc,rect->left,   rect->top,      width,                  rect->bottom-rect->top,PATCOPY);
     600  PatBlt(hdc,rect->left,   rect->bottom, rect->right-rect->left,-height,PATCOPY);
     601  //SvL: Was PatBlt(hdc,rect->left,   rect->bottom-1, rect->right-rect->left,-height,PATCOPY);
     602  PatBlt(hdc,rect->right,  rect->top,     -width,                  rect->bottom-rect->top,PATCOPY);
     603  //SvL: Was PatBlt(hdc,rect->right-1,  rect->top,     -width,                  rect->bottom-rect->top,PATCOPY);
    602604  SelectObject(hdc,oldBrush);
    603605
     
    11441146
    11451147    case SC_MOVE:
    1146       FrameTrackFrame(this,TFOS_MOVE);
    1147       break;
     1148        FrameTrackFrame(this,TFOS_MOVE);
     1149        break;
    11481150
    11491151    case SC_MINIMIZE:
  • trunk/src/user32/new/win32wmdichild.cpp

    r2292 r2426  
    1 /* $Id: win32wmdichild.cpp,v 1.7 2000-01-02 19:30:45 cbratschi Exp $ */
     1/* $Id: win32wmdichild.cpp,v 1.8 2000-01-13 13:54:55 sandervl Exp $ */
    22/*
    33 * Win32 MDI Child Window Class for OS/2
     
    5757//******************************************************************************
    5858//******************************************************************************
    59 ULONG Win32MDIChildWindow::MsgActivate(BOOL fActivate, BOOL fMinimized, HWND hwnd)
    60 {
    61  ULONG rc, curprocid, procidhwnd = -1, threadidhwnd = 0;
     59ULONG Win32MDIChildWindow::MsgActivate(BOOL fActivate, BOOL fMinimized, HWND hwnd, HWND hwndOS2Win)
     60{
     61 ULONG rc, procidhwnd = -1, threadidhwnd = 0;
    6262
    6363    //According to SDK docs, if app returns FALSE & window is being deactivated,
    6464    //default processing is cancelled
    6565    //TODO: According to Wine we should proceed anyway if window is sysmodal
     66#if 0
    6667    if(SendInternalMessageA(WM_NCACTIVATE, fActivate, 0) == FALSE && !fActivate)
    6768    {
    6869        return 0;
    6970    }
     71#endif
     72
    7073    if(fActivate)
    7174    {
    7275         rc = SendInternalMessageA(WM_CHILDACTIVATE, MAKELONG((fActivate) ? WA_ACTIVE : WA_INACTIVE, fMinimized), hwnd);
    73          curprocid  = GetCurrentProcessId();
    74          if(hwnd) {
    75                 threadidhwnd = GetWindowThreadProcessId(hwnd, &procidhwnd);
    76          }
    77 
    78          if(curprocid != procidhwnd && fActivate) {
    79             SendInternalMessageA(WM_ACTIVATEAPP, 1, threadidhwnd);
    80          }
     76         if(hwndOS2Win) {
     77            threadidhwnd = O32_GetWindowThreadProcessId(hwndOS2Win, &procidhwnd);
     78         }
     79
     80         if(fActivate) {
     81                SendInternalMessageA(WM_ACTIVATEAPP, 1, dwThreadId);    //activate; specify window thread id
     82         }
     83         else   SendInternalMessageA(WM_ACTIVATEAPP, 0, threadidhwnd);  //deactivate; specify thread id of other process
    8184         return rc;
    8285    }
  • trunk/src/user32/new/win32wmdichild.h

    r2290 r2426  
    1 /* $Id: win32wmdichild.h,v 1.4 2000-01-01 14:54:56 cbratschi Exp $ */
     1/* $Id: win32wmdichild.h,v 1.5 2000-01-13 13:54:55 sandervl Exp $ */
    22/*
    33 * Win32 MDI Client Window Class for OS/2
     
    2424virtual        ~Win32MDIChildWindow();
    2525
    26 virtual  ULONG  MsgActivate(BOOL fActivate, BOOL fMinimized, HWND hwnd);
     26virtual  ULONG  MsgActivate(BOOL fActivate, BOOL fMinimized, HWND hwnd, HWND hwndOS2Win);
    2727
    2828   static HWND  createChild(Win32MDIClientWindow *client, LPMDICREATESTRUCTA cs);
  • trunk/src/user32/new/window.cpp

    r2410 r2426  
    1 /* $Id: window.cpp,v 1.30 2000-01-11 17:34:44 cbratschi Exp $ */
     1/* $Id: window.cpp,v 1.31 2000-01-13 13:54:55 sandervl Exp $ */
    22/*
    33 * Win32 window apis for OS/2
     
    328328        return 0;
    329329    }
    330     dprintf(("SetActiveWindow %x", hwnd));
    331330    return window->SetActiveWindow();
    332331}
Note: See TracChangeset for help on using the changeset viewer.