Ignore:
Timestamp:
Nov 25, 1999, 8:22:04 PM (26 years ago)
Author:
sandervl
Message:

desktop + misc fixes

File:
1 edited

Legend:

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

    r1837 r1839  
    1 /* $Id: win32wbase.cpp,v 1.94 1999-11-24 20:28:20 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.95 1999-11-25 19:22:02 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    634634  else
    635635  {
    636         dprintf(("Set window ID to %x", cs->hMenu));
    637636        setWindowId((DWORD)cs->hMenu);
    638637  }
     
    15441543
    15451544    case WM_SETREDRAW:
     1545    {
     1546     DWORD oldStyle = getStyle();
     1547
    15461548        if(wParam)
    1547                 SetWindowLongA (GWL_STYLE, GetWindowLongA (GWL_STYLE) | WS_VISIBLE);
    1548         else    SetWindowLongA (GWL_STYLE, GetWindowLongA (GWL_STYLE) & ~WS_VISIBLE);
     1549                setStyle(getStyle() | WS_VISIBLE);
     1550        else    setStyle(getStyle() & ~WS_VISIBLE);
     1551
     1552        updateWindowStyle(getExStyle(), oldStyle);
    15491553
    15501554        return 0; //TODO
    1551 
     1555    }
    15521556    case WM_NCCREATE:
    15531557        return(TRUE);
     
    20682072}
    20692073//******************************************************************************
    2070 //TODO: Probably not complete compatible with win32 implementation
    2071 //******************************************************************************
    2072 LRESULT Win32BaseWindow::BroadcastMessageA(int type, UINT msg, WPARAM wParam, LPARAM lParam)
     2074//Send message to window of another process
     2075//******************************************************************************
     2076LRESULT Win32BaseWindow::SendMessageToProcess(UINT msg, WPARAM wParam, LPARAM lParam, BOOL fUnicode)
    20732077{
    20742078 POSTMSG_PACKET *packet = (POSTMSG_PACKET *)_smalloc(sizeof(POSTMSG_PACKET));
    20752079
    2076     dprintf(("BroadCastMessageA %x %x %x", msg, wParam, lParam));
    2077     return 0;
    2078 
     2080    dprintf(("SendMessageToProcess %x %x %x %x", getOS2WindowHandle(), msg, wParam, lParam));
    20792081    packet->Msg = msg;
    20802082    packet->wParam = wParam;
    20812083    packet->lParam = lParam;
    2082     packet->fUnicode = FALSE;
    2083 
    2084     return OSLibWinBroadcastMsg(WIN32APP_POSTMSG, WIN32PM_MAGIC, (DWORD)packet, type == BROADCAST_SEND);
    2085 }
    2086 //******************************************************************************
    2087 //TODO: Probably not complete compatible with win32 implementation
     2084    packet->fUnicode = fUnicode;
     2085    return OSLibSendMessage(getOS2WindowHandle(), WIN32APP_POSTMSG, WIN32PM_MAGIC, (DWORD)packet);
     2086}
     2087//******************************************************************************
     2088//TODO: Do this more efficiently
     2089//******************************************************************************
     2090LRESULT Win32BaseWindow::BroadcastMessageA(int type, UINT msg, WPARAM wParam, LPARAM lParam)
     2091{
     2092 Win32BaseWindow *window;
     2093 HWND hwnd = WNDHANDLE_MAGIC_HIGHWORD;
     2094 DWORD processid, myprocessid;
     2095
     2096    dprintf(("BroadCastMessageA %x %x %x", msg, wParam, lParam, GetFS()));
     2097    myprocessid = GetCurrentProcessId();
     2098
     2099    for(int i=0;i<MAX_WINDOW_HANDLES;i++) {
     2100        window = GetWindowFromHandle(hwnd++);
     2101        if(window) {
     2102            if (window->getStyle() & WS_POPUP || (window->getStyle() & WS_CAPTION) == WS_CAPTION)
     2103            {
     2104
     2105                if(type == BROADCAST_SEND) {
     2106                        GetWindowThreadProcessId(hwnd, &processid);
     2107                        if(processid == myprocessid) {
     2108                            window->SendMessageA(msg, wParam, lParam);
     2109                        }
     2110                        else {
     2111                            window->SendMessageToProcess(msg, wParam, lParam, FALSE);
     2112                        }
     2113                }
     2114                else    window->PostMessageA(msg, wParam, lParam);
     2115            }
     2116        }
     2117    }
     2118    return 0;
     2119}
     2120//******************************************************************************
     2121//TODO: Do this more efficiently
    20882122//******************************************************************************
    20892123LRESULT Win32BaseWindow::BroadcastMessageW(int type, UINT msg, WPARAM wParam, LPARAM lParam)
    20902124{
    2091  POSTMSG_PACKET *packet = (POSTMSG_PACKET *)_smalloc(sizeof(POSTMSG_PACKET));
     2125 Win32BaseWindow *window;
     2126 HWND hwnd = WNDHANDLE_MAGIC_HIGHWORD;
     2127 DWORD processid, myprocessid;
     2128
    20922129
    20932130    dprintf(("BroadCastMessageW %x %x %x", msg, wParam, lParam));
     2131    myprocessid = GetCurrentProcessId();
     2132
     2133    for(int i=0;i<MAX_WINDOW_HANDLES;i++) {
     2134        window = GetWindowFromHandle(hwnd++);
     2135        if(window) {
     2136            if (window->getStyle() & WS_POPUP || (window->getStyle() & WS_CAPTION) == WS_CAPTION)
     2137            {
     2138
     2139                if(type == BROADCAST_SEND) {
     2140                        GetWindowThreadProcessId(hwnd, &processid);
     2141                        if(processid == myprocessid) {
     2142                            window->SendMessageW(msg, wParam, lParam);
     2143                        }
     2144                        else {
     2145                            window->SendMessageToProcess(msg, wParam, lParam, TRUE);
     2146                        }
     2147                }
     2148                else    window->PostMessageW(msg, wParam, lParam);
     2149            }
     2150        }
     2151    }
    20942152    return 0;
    2095 
    2096     packet->Msg = msg;
    2097     packet->wParam = wParam;
    2098     packet->lParam = lParam;
    2099     packet->fUnicode = TRUE;
    2100 
    2101     return OSLibWinBroadcastMsg(WIN32APP_POSTMSG, WIN32PM_MAGIC, (DWORD)packet, type == BROADCAST_SEND);
    21022153}
    21032154//******************************************************************************
     
    24032454        return oldhwnd;
    24042455   }
    2405    SetLastError(ERROR_INVALID_PARAMETER);
    2406    return 0;
     2456   else {
     2457    setParent(windowDesktop);
     2458        getParent()->AddChild(this);
     2459        OSLibWinSetParent(getOS2FrameWindowHandle(), OSLIB_HWND_DESKTOP);
     2460        return oldhwnd;
     2461   }
    24072462}
    24082463//******************************************************************************
     
    28142869                SendMessageA(WM_STYLECHANGING,GWL_EXSTYLE,(LPARAM)&ss);
    28152870                setExStyle(ss.styleNew);
    2816                 updateWindowStyle(ss.styleOld,dwStyle);
     2871                updateWindowStyle(ss.styleOld,getStyle());
    28172872                SendMessageA(WM_STYLECHANGED,GWL_EXSTYLE,(LPARAM)&ss);
    28182873                return ss.styleOld;
     
    28252880                    return value;
    28262881
    2827                 ss.styleOld = dwStyle;
    2828                 ss.styleNew = value;
    2829                 dprintf(("SetWindowLong GWL_STYLE %x old %x new style %x", getWindowHandle(), dwStyle, value));
     2882                        value &= ~(WS_VISIBLE | WS_CHILD);      /* Some bits can't be changed this way (WINE) */
     2883                ss.styleOld = getStyle();
     2884                        ss.styleNew = value | (ss.styleOld & (WS_VISIBLE | WS_CHILD));
     2885                dprintf(("SetWindowLong GWL_STYLE %x old %x new style %x", getWindowHandle(), getStyle(), value));
    28302886                SendMessageA(WM_STYLECHANGING,GWL_STYLE,(LPARAM)&ss);
    28312887                setStyle(ss.styleNew);
    28322888                updateWindowStyle(dwExStyle,ss.styleOld);
    28332889                SendMessageA(WM_STYLECHANGED,GWL_STYLE,(LPARAM)&ss);
     2890#ifdef DEBUG
     2891                PrintWindowStyle(ss.styleNew, 0);
     2892#endif
    28342893                return ss.styleOld;
    28352894        }
     
    29372996{
    29382997    windowId = id;
     2998    dprintf(("Set window ID to %x", id));
    29392999    OSLibSetWindowID(OS2HwndFrame, id);
    29403000}
Note: See TracChangeset for help on using the changeset viewer.