Changeset 740 for trunk/src


Ignore:
Timestamp:
Aug 29, 1999, 10:05:08 PM (26 years ago)
Author:
sandervl
Message:

Mouse message handling changes

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

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/new/defwndproc.cpp

    r392 r740  
    1 /* $Id: defwndproc.cpp,v 1.4 1999-07-25 15:51:55 sandervl Exp $ */
     1/* $Id: defwndproc.cpp,v 1.5 1999-08-29 20:05:07 sandervl Exp $ */
    22
    33/*
     
    66 * Copyright 1998 Sander van Leeuwen
    77 *
     8 *
     9 * TODO: Incomplete default window handlers + incorrect handler (defframe)
    810 *
    911 * Project Odin Software License can be found in LICENSE.TXT
     
    116118}
    117119//******************************************************************************
     120//TODO: Should be handled differently than the normal wnd proc
    118121//******************************************************************************
    119122LRESULT WIN32API DefFrameProcA(HWND hwndFrame, HWND hwndClient, UINT Msg, WPARAM wParam, LPARAM lParam)
    120123{
    121 #ifdef DEBUG
    122 ////    WriteLog("*DFP*");
    123 #endif
    124     switch(Msg) {
    125         case WM_SETREDRAW: //Open32 does not set the visible flag
    126                 if(wParam)
    127                   SetWindowLongA (hwndClient, GWL_STYLE, GetWindowLongA (hwndClient, GWL_STYLE) | WS_VISIBLE);
    128                 else
    129                   SetWindowLongA (hwndClient, GWL_STYLE, GetWindowLongA (hwndClient, GWL_STYLE) & ~WS_VISIBLE);
    130                 return O32_DefFrameProc(hwndFrame, hwndClient, Msg, wParam, lParam);
    131         case WM_NCCREATE://SvL: YAOFM (yet another open32 feature missing)
    132                 return(TRUE);
    133         case WM_CTLCOLORMSGBOX:
    134         case WM_CTLCOLOREDIT:
    135         case WM_CTLCOLORLISTBOX:
    136         case WM_CTLCOLORBTN:
    137         case WM_CTLCOLORDLG:
    138         case WM_CTLCOLORSTATIC:
    139         case WM_CTLCOLORSCROLLBAR:
    140                 SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
    141                 SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
    142                 return GetSysColorBrush(COLOR_BTNFACE);
    143 
    144     case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
    145         dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwndFrame));
    146         return 0;
    147 
    148         default:
    149                 return O32_DefFrameProc(hwndFrame, hwndClient, Msg, wParam, lParam);
     124  Win32Window *window;
     125
     126    window = Win32Window::GetWindowFromHandle(hwndFrame);
     127    if(!window) {
     128        dprintf(("DefFrameProcA, window %x not found", hwndFrame));
     129        return 0;
     130    }
     131    return window->DefWindowProcA(Msg, wParam, lParam);
     132}
     133//******************************************************************************
     134//TODO: Should be handled differently than the normal wnd proc
     135//******************************************************************************
     136LRESULT WIN32API DefFrameProcW(HWND hwndFrame, HWND hwndClient, UINT Msg, WPARAM wParam, LPARAM lParam)
     137{
     138  Win32Window *window;
     139
     140    window = Win32Window::GetWindowFromHandle(hwndFrame);
     141    if(!window) {
     142        dprintf(("DefFrameProcW, window %x not found", hwndFrame));
     143        return 0;
     144    }
     145    return window->DefWindowProcW(Msg, wParam, lParam);
     146}
     147//******************************************************************************
     148//******************************************************************************
     149LRESULT WIN32API DefMDIChildProcA(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
     150{
     151#ifdef DEBUG
     152////    WriteLog("*DMP*");
     153#endif
     154    switch(Msg) {
     155        case WM_SETREDRAW: //Open32 does not set the visible flag
     156                if(wParam)
     157                  SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) | WS_VISIBLE);
     158                else
     159                  SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) & ~WS_VISIBLE);
     160                return O32_DefMDIChildProc(hwnd, Msg, wParam, lParam);
     161        case WM_NCCREATE://SvL: YAOFM (yet another open32 feature missing)
     162                return(TRUE);
     163        case WM_CTLCOLORMSGBOX:
     164        case WM_CTLCOLOREDIT:
     165        case WM_CTLCOLORLISTBOX:
     166        case WM_CTLCOLORBTN:
     167        case WM_CTLCOLORDLG:
     168        case WM_CTLCOLORSTATIC:
     169        case WM_CTLCOLORSCROLLBAR:
     170                SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
     171                SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
     172                return GetSysColorBrush(COLOR_BTNFACE);
     173
     174    case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
     175        dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
     176        return 0;
     177
     178        default:
     179                return O32_DefMDIChildProc(hwnd, Msg, wParam, lParam);
    150180    }
    151181}
     
    153183//NOTE: Unicode msg translation!
    154184//******************************************************************************
    155 LRESULT WIN32API DefFrameProcW(HWND hwndFrame, HWND hwndClient, UINT Msg, WPARAM wParam, LPARAM lParam)
    156 {
    157 #ifdef DEBUG
    158 ////    WriteLog("*DFPW*");
    159 #endif
    160     switch(Msg) {
    161         case WM_SETREDRAW: //Open32 does not set the visible flag
    162                 if(wParam)
    163                   SetWindowLongA (hwndClient, GWL_STYLE, GetWindowLongA (hwndClient, GWL_STYLE) | WS_VISIBLE);
    164                 else
    165                   SetWindowLongA (hwndClient, GWL_STYLE, GetWindowLongA (hwndClient, GWL_STYLE) & ~WS_VISIBLE);
    166                 return O32_DefFrameProc(hwndFrame, hwndClient, Msg, wParam, lParam);
    167         case WM_NCCREATE://SvL: YAOFM (yet another open32 feature missing)
    168                 return(TRUE);
    169         case WM_CTLCOLORMSGBOX:
    170         case WM_CTLCOLOREDIT:
    171         case WM_CTLCOLORLISTBOX:
    172         case WM_CTLCOLORBTN:
    173         case WM_CTLCOLORDLG:
    174         case WM_CTLCOLORSTATIC:
    175         case WM_CTLCOLORSCROLLBAR:
    176                 SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
    177                 SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
    178                 return GetSysColorBrush(COLOR_BTNFACE);
    179 
    180     case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
    181         dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwndFrame));
    182         return 0;
    183 
    184         default:
    185                 return O32_DefFrameProc(hwndFrame, hwndClient, Msg, wParam, lParam);
    186     }
    187 }
    188 //******************************************************************************
    189 //******************************************************************************
    190 LRESULT WIN32API DefMDIChildProcA(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
    191 {
    192 #ifdef DEBUG
    193 ////    WriteLog("*DMP*");
    194 #endif
    195     switch(Msg) {
    196         case WM_SETREDRAW: //Open32 does not set the visible flag
    197                 if(wParam)
    198                   SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) | WS_VISIBLE);
    199                 else
    200                   SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) & ~WS_VISIBLE);
    201                 return O32_DefMDIChildProc(hwnd, Msg, wParam, lParam);
    202         case WM_NCCREATE://SvL: YAOFM (yet another open32 feature missing)
    203                 return(TRUE);
    204         case WM_CTLCOLORMSGBOX:
    205         case WM_CTLCOLOREDIT:
    206         case WM_CTLCOLORLISTBOX:
    207         case WM_CTLCOLORBTN:
    208         case WM_CTLCOLORDLG:
    209         case WM_CTLCOLORSTATIC:
    210         case WM_CTLCOLORSCROLLBAR:
    211                 SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
    212                 SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
    213                 return GetSysColorBrush(COLOR_BTNFACE);
    214 
    215     case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
    216         dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
    217         return 0;
    218 
    219         default:
    220                 return O32_DefMDIChildProc(hwnd, Msg, wParam, lParam);
    221     }
    222 }
    223 //******************************************************************************
    224 //NOTE: Unicode msg translation!
    225 //******************************************************************************
    226185LRESULT WIN32API DefMDIChildProcW(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
    227186{
  • trunk/src/user32/new/oslibmsg.cpp

    r342 r740  
    1 /* $Id: oslibmsg.cpp,v 1.2 1999-07-20 07:42:35 sandervl Exp $ */
     1/* $Id: oslibmsg.cpp,v 1.3 1999-08-29 20:05:07 sandervl Exp $ */
    22/*
    33 * Window message translation functions for OS/2
     
    6262void OSLibWinPostQuitMessage(ULONG nExitCode)
    6363{
    64   WinPostQueueMsg(GetThreadMessageQueue(), WM_QUIT, (MPARAM)nExitCode, 0);
     64  WinPostQueueMsg(NULLHANDLE, WM_QUIT, (MPARAM)nExitCode, 0);
    6565}
    6666//******************************************************************************
  • trunk/src/user32/new/pmwindow.cpp

    r729 r740  
    1 /* $Id: pmwindow.cpp,v 1.24 1999-08-28 19:32:46 sandervl Exp $ */
     1/* $Id: pmwindow.cpp,v 1.25 1999-08-29 20:05:07 sandervl Exp $ */
    22/*
    33 * Win32 Window Managment Code for OS/2
     
    434434    case WM_MOUSEMOVE:
    435435    {
     436        //Only send this message when the mouse isn't captured
     437        if(WinQueryCapture(HWND_DESKTOP) != NULLHANDLE) {
     438                goto RunDefWndProc;
     439        }
    436440        ULONG keystate = 0;
    437441        if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON1))
     
    589593
    590594    case WM_HITTEST:
    591         if(win32wnd->MsgHitTest((*(POINTS *)&mp1).x, MapOS2ToWin32Y(OSLIB_HWND_DESKTOP, hwnd, (*(POINTS *)&mp1).y))) {
    592                 goto RunDefWndProc;
    593         }
     595        // Only send this message if the window is enabled
     596        if (WinIsWindowEnabled(hwnd))
     597        {
     598                if(win32wnd->MsgHitTest((*(POINTS *)&mp1).x, MapOS2ToWin32Y(OSLIB_HWND_DESKTOP, hwnd, (*(POINTS *)&mp1).y))) {
     599                        goto RunDefWndProc;
     600                }
     601        }
     602        else    goto RunDefWndProc;
    594603        break;
    595604
  • trunk/src/user32/new/win32wnd.cpp

    r729 r740  
    1 /* $Id: win32wnd.cpp,v 1.34 1999-08-28 19:32:47 sandervl Exp $ */
     1/* $Id: win32wnd.cpp,v 1.35 1999-08-29 20:05:07 sandervl Exp $ */
    22/*
    33 * Win32 Window Code for OS/2
     
    880880{
    881881    if(hwnd == 0) {
    882         //other app lost focus
    883         SendInternalMessageA(WM_ACTIVATEAPP, TRUE, 0); //TODO: Need thread id from hwnd app
    884     }
    885     return SendInternalMessageA(WM_SETFOCUS, hwnd, 0);
     882            //other app lost focus
     883            SendInternalMessageA(WM_ACTIVATEAPP, TRUE, 0); //TODO: Need thread id from hwnd app
     884    }
     885    return  SendInternalMessageA(WM_SETFOCUS, hwnd, 0);
    886886}
    887887//******************************************************************************
     
    890890{
    891891    if(hwnd == 0) {
    892         //other app lost focus
    893         SendInternalMessageA(WM_ACTIVATEAPP, FALSE, 0); //TODO: Need thread id from hwnd app
    894     }
    895     return SendInternalMessageA(WM_KILLFOCUS, hwnd, 0);
     892            //other app lost focus
     893            SendInternalMessageA(WM_ACTIVATEAPP, FALSE, 0); //TODO: Need thread id from hwnd app
     894    }
     895    return  SendInternalMessageA(WM_KILLFOCUS, hwnd, 0);
    896896}
    897897//******************************************************************************
     
    949949        }
    950950    }
    951     SendInternalMessageA(win32ncmsg, lastHitTestVal, MAKELONG(ncx, ncy)); //TODO:
    952     return SendInternalMessageA(win32msg, 0, MAKELONG(clx, cly));
     951    SendInternalMessageA(WM_SETCURSOR, Win32Hwnd, MAKELONG(lastHitTestVal, win32ncmsg));
     952
     953    //WM_NC*BUTTON* is posted when the cursor is in a non-client area of the window
     954    if(lastHitTestVal != HTCLIENT) {
     955            SendInternalMessageA(win32ncmsg, lastHitTestVal, MAKELONG(ncx, ncy)); //TODO:
     956    }
     957    return  SendInternalMessageA(win32msg, 0, MAKELONG(clx, cly));
    953958}
    954959//******************************************************************************
     
    957962{
    958963 ULONG winstate = 0;
     964 ULONG setcursormsg = WM_MOUSEMOVE;
    959965
    960966    if(keystate & WMMOVE_LBUTTON)
     
    969975        winstate |= MK_CONTROL;
    970976
    971     return SendInternalMessageA(WM_MOUSEMOVE, keystate, MAKELONG(x, y));
     977    if(lastHitTestVal != HTCLIENT) {
     978        setcursormsg = WM_NCMOUSEMOVE;
     979    }
     980    //TODO: hiword should be 0 if window enters menu mode (SDK docs)
     981    SendInternalMessageA(WM_SETCURSOR, Win32Hwnd, MAKELONG(lastHitTestVal, setcursormsg));
     982
     983    //WM_NCMOUSEMOVE is posted when the cursor moves into a non-client area of the window
     984    if(lastHitTestVal != HTCLIENT) {
     985            SendInternalMessageA(WM_NCMOUSEMOVE, lastHitTestVal, MAKELONG(x, y));
     986    }
     987    return  SendInternalMessageA(WM_MOUSEMOVE, keystate, MAKELONG(x, y));
    972988}
    973989//******************************************************************************
     
    11471163        return 0;           //TODO: Send WM_SYSCOMMAND if required
    11481164
    1149     case WM_NCHITTEST: //TODO:
    1150         return 0;
     1165    case WM_NCHITTEST: //TODO: Calculate position of
     1166        return HTCLIENT;
    11511167
    11521168    default:
  • trunk/src/user32/new/window.cpp

    r724 r740  
    1 /* $Id: window.cpp,v 1.17 1999-08-28 14:09:30 sandervl Exp $ */
     1/* $Id: window.cpp,v 1.18 1999-08-29 20:05:08 sandervl Exp $ */
    22/*
    33 * Win32 window apis for OS/2
     
    8282//******************************************************************************
    8383//******************************************************************************
    84 HWND WIN32API CreateMDIWindowA(LPCSTR arg1, LPCSTR arg2, DWORD arg3,
    85                                int arg4, int arg5, int arg6, int arg7,
    86                                HWND arg8, HINSTANCE arg9, LPARAM  arg10)
    87 {
    88  HWND hwnd;
    89 
    90     dprintf(("USER32:  CreateMDIWindowA\n"));
    91 
    92     hwnd = O32_CreateMDIWindow((LPSTR)arg1, (LPSTR)arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10);
    93 
    94     dprintf(("USER32:  CreateMDIWindowA returned %X\n", hwnd));
    95     return hwnd;
    96 }
    97 //******************************************************************************
    98 //******************************************************************************
    99 HWND WIN32API CreateMDIWindowW(LPCWSTR arg1, LPCWSTR arg2, DWORD arg3, int arg4,
    100                                int arg5, int arg6, int arg7, HWND arg8, HINSTANCE arg9,
    101                                LPARAM arg10)
    102 {
    103  HWND hwnd;
    104  char *astring1 = NULL, *astring2 = NULL;
    105 
    106     if((int)arg1 >> 16 != 0) {
    107         astring1 = UnicodeToAsciiString((LPWSTR)arg1);
    108     }
    109     else    astring1 = (char *)arg2;
    110 
    111     astring2 = UnicodeToAsciiString((LPWSTR)arg2);
    112 
    113     hwnd = O32_CreateMDIWindow(astring1, astring2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10);
    114 
    115     if(astring1)    FreeAsciiString(astring1);
    116     FreeAsciiString(astring2);
    117     dprintf(("USER32:  CreateMDIWindowW hwnd = %X\n", hwnd));
    118     return(hwnd);
    119 }
    120 //******************************************************************************
    121 //******************************************************************************
    12284HWND WIN32API CreateWindowExW(DWORD exStyle, LPCWSTR className,
    12385                              LPCWSTR windowName, DWORD style, INT x,
     
    171133    }
    172134    return window->getWindowHandle();
     135}
     136//******************************************************************************
     137//******************************************************************************
     138HWND WIN32API CreateMDIWindowA(LPCSTR lpszClassName, LPCSTR lpszWindowName,
     139                               DWORD dwStyle, int x, int y, int nWidth,
     140                               int nHeight, HWND hwndParent,
     141                               HINSTANCE hInstance, LPARAM lParam )
     142{
     143 HWND hwnd;
     144 MDICREATESTRUCTA cs;
     145 Win32Window *window;
     146
     147    window = Win32Window::GetWindowFromHandle(hwndParent);
     148    if(!window) {
     149        dprintf(("CreateMDIWindowA, window %x not found", hwndParent));
     150        return 0;
     151    }
     152
     153    dprintf(("USER32:  CreateMDIWindowA\n"));
     154    cs.szClass        = lpszClassName;
     155    cs.szTitle        = lpszWindowName;
     156    cs.hOwner         = hInstance;
     157    cs.x              = x;
     158    cs.y              = y;
     159    cs.cx             = nHeight;
     160    cs.cy             = nWidth;
     161    cs.style          = dwStyle;
     162    cs.lParam         = lParam;
     163
     164    return window->SendMessageA(WM_MDICREATE, 0, (LPARAM)&cs);
     165}
     166//******************************************************************************
     167//******************************************************************************
     168HWND WIN32API CreateMDIWindowW(LPCWSTR lpszClassName, LPCWSTR lpszWindowName,
     169                               DWORD dwStyle, int x, int y, int nWidth,
     170                               int nHeight, HWND hwndParent,
     171                               HINSTANCE hInstance, LPARAM lParam )
     172{
     173 HWND hwnd;
     174 MDICREATESTRUCTW cs;
     175 Win32Window *window;
     176
     177    window = Win32Window::GetWindowFromHandle(hwndParent);
     178    if(!window) {
     179        dprintf(("CreateMDIWindowW, window %x not found", hwndParent));
     180        return 0;
     181    }
     182
     183    dprintf(("USER32:  CreateMDIWindowW\n"));
     184    cs.szClass        = lpszClassName;
     185    cs.szTitle        = lpszWindowName;
     186    cs.hOwner         = hInstance;
     187    cs.x              = x;
     188    cs.y              = y;
     189    cs.cx             = nHeight;
     190    cs.cy             = nWidth;
     191    cs.style          = dwStyle;
     192    cs.lParam         = lParam;
     193
     194    return window->SendMessageW(WM_MDICREATE, 0, (LPARAM)&cs);
    173195}
    174196//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.