Changeset 1917 for trunk/src


Ignore:
Timestamp:
Dec 1, 1999, 11:49:45 AM (26 years ago)
Author:
sandervl
Message:

EB's SetWindowPos fix

File:
1 edited

Legend:

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

    r1860 r1917  
    1 /* $Id: win32wbase.cpp,v 1.98 1999-11-27 14:16:35 cbratschi Exp $ */
     1/* $Id: win32wbase.cpp,v 1.99 1999-12-01 10:49:45 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    14961496//******************************************************************************
    14971497//******************************************************************************
    1498 LRESULT Win32BaseWindow::DefWindowProcA(UINT Msg, WPARAM wParam, LPARAM lParam)
    1499 {
     1498LRESULT Win32BaseWindow::DefWindowProcA(UINT Msg, WPARAM wParam, LPARAM lParam, BOOL fReentered)
     1499{
     1500    //Lotus Notes v5.0.1 calls SetWindowTextA for unicode static window -> calls DefWindowProcA
     1501    if(IsUnicode() && !fReentered) {
     1502        return DefWindowProcW(Msg, wParam, lParam);
     1503    }
    15001504    switch(Msg)
    15011505    {
     
    15271531          windowNameW = (LPWSTR)_smalloc((wndNameLength+1)*sizeof(WCHAR));
    15281532          lstrcpyAtoW(windowNameW, windowNameA);
    1529         } else
     1533        }
     1534        else
    15301535        {
    15311536          windowNameA = NULL;
     
    15331538          wndNameLength = 0;
    15341539        }
    1535         dprintf(("WM_SETTEXT of %d to %s\n", Win32Hwnd, lParam));
     1540        dprintf(("WM_SETTEXT of %x to %s\n", Win32Hwnd, lParam));
    15361541
    15371542        if(OS2HwndFrame && (dwStyle & WS_CAPTION) == WS_CAPTION)
     
    17891794          windowNameW = (LPWSTR)_smalloc((wndNameLength+1)*sizeof(WCHAR));
    17901795          lstrcpyW(windowNameW,lpsz);
    1791         } else
     1796        }
     1797        else
    17921798        {
    17931799          windowNameA = NULL;
     
    18031809
    18041810    default:
    1805         return DefWindowProcA(Msg, wParam, lParam);
     1811        return DefWindowProcA(Msg, wParam, lParam, TRUE);
    18061812    }
    18071813}
     
    23442350       if (isChild())
    23452351       {
    2346            hParent = getParent()->getOS2WindowHandle();
     2352                Win32BaseWindow *windowParent = getParent();
     2353                if(windowParent) {
     2354                        hParent = getParent()->getOS2WindowHandle();
     2355                }
     2356                else    dprintf(("WARNING: Win32BaseWindow::SetWindowPos window %x is child but has no parent!!", getWindowHandle()));
    23472357       }
    23482358       OSLibWinQueryWindowPos(OS2HwndFrame, &swpOld);
     
    27342744HWND Win32BaseWindow::SetActiveWindow()
    27352745{
    2736   return OSLibWinSetActiveWindow(OS2HwndFrame);
    2737 }
    2738 //******************************************************************************
    2739 //WM_ENABLE is sent to hwnd, but not to it's children (as it should be)
    2740 //******************************************************************************
    2741 BOOL Win32BaseWindow::EnableWindow(BOOL fEnable)
    2742 {
    2743   return OSLibWinEnableWindow(OS2HwndFrame, fEnable);
    2744 }
    2745 //******************************************************************************
    2746 //******************************************************************************
    2747 BOOL Win32BaseWindow::CloseWindow()
    2748 {
    2749   return OSLibWinMinimizeWindow(OS2HwndFrame);
    2750 }
    2751 //******************************************************************************
    2752 //******************************************************************************
    2753 HWND Win32BaseWindow::GetActiveWindow()
    2754 {
    2755  HWND          hwndActive;
     2746 HWND hwndActive;
    27562747 Win32BaseWindow  *win32wnd;
    27572748 ULONG         magic;
    27582749
    2759   hwndActive = OSLibWinQueryActiveWindow();
    2760 
     2750  hwndActive = OSLibWinSetActiveWindow(OS2HwndFrame);
    27612751  win32wnd = (Win32BaseWindow *)OSLibWinGetWindowULong(hwndActive, OFFSET_WIN32WNDPTR);
    27622752  magic    = OSLibWinGetWindowULong(hwndActive, OFFSET_WIN32PM_MAGIC);
     
    27652755        return win32wnd->getWindowHandle();
    27662756  }
    2767   return hwndActive;
     2757  return 0;
     2758}
     2759//******************************************************************************
     2760//WM_ENABLE is sent to hwnd, but not to it's children (as it should be)
     2761//******************************************************************************
     2762BOOL Win32BaseWindow::EnableWindow(BOOL fEnable)
     2763{
     2764  return OSLibWinEnableWindow(OS2HwndFrame, fEnable);
     2765}
     2766//******************************************************************************
     2767//******************************************************************************
     2768BOOL Win32BaseWindow::CloseWindow()
     2769{
     2770  return OSLibWinMinimizeWindow(OS2HwndFrame);
     2771}
     2772//******************************************************************************
     2773//******************************************************************************
     2774HWND Win32BaseWindow::GetActiveWindow()
     2775{
     2776 HWND          hwndActive;
     2777 Win32BaseWindow  *win32wnd;
     2778 ULONG         magic;
     2779
     2780  hwndActive = OSLibWinQueryActiveWindow();
     2781
     2782  win32wnd = (Win32BaseWindow *)OSLibWinGetWindowULong(hwndActive, OFFSET_WIN32WNDPTR);
     2783  magic    = OSLibWinGetWindowULong(hwndActive, OFFSET_WIN32PM_MAGIC);
     2784  if(CheckMagicDword(magic) && win32wnd)
     2785  {
     2786        return win32wnd->getWindowHandle();
     2787  }
     2788  return 0;
     2789//  return hwndActive;
    27682790}
    27692791//******************************************************************************
     
    28232845BOOL Win32BaseWindow::SetWindowTextA(LPSTR lpsz)
    28242846{
     2847    //hmm. Notes v5.0.1 creates static window with CreateWindowExW and calls this...
     2848    if(IsUnicode() && lpsz) {
     2849        LPWSTR lpWindowNameW = (LPWSTR)alloca((strlen(lpsz)+1)*sizeof(WCHAR));
     2850        lstrcpyAtoW(lpWindowNameW, lpsz);
     2851
     2852        return SendInternalMessageW(WM_SETTEXT,0,(LPARAM)lpWindowNameW);
     2853    }
    28252854    return SendInternalMessageA(WM_SETTEXT,0,(LPARAM)lpsz);
    28262855}
     
    29342963
    29352964    switch(index) {
    2936         case GWL_EXSTYLE:
    2937                 value = dwExStyle;
     2965    case GWL_EXSTYLE:
     2966        value = dwExStyle;
    29382967        break;
    2939         case GWL_STYLE:
    2940                 value = dwStyle;
     2968    case GWL_STYLE:
     2969        value = dwStyle;
    29412970        break;
    2942         case GWL_WNDPROC:
    2943                 value = (ULONG)getWindowProc();
     2971    case GWL_WNDPROC:
     2972        value = (ULONG)getWindowProc();
    29442973        break;
    2945         case GWL_HINSTANCE:
    2946                 value = hInstance;
     2974    case GWL_HINSTANCE:
     2975        value = hInstance;
    29472976        break;
    2948         case GWL_HWNDPARENT:
    2949                 if(getParent()) {
    2950                         value = getParent()->getWindowHandle();
    2951                 }
    2952                 else    value = 0;
     2977    case GWL_HWNDPARENT:
     2978        if(getParent()) {
     2979            value = getParent()->getWindowHandle();
     2980        }
     2981        else value = 0;
    29532982        break;
    2954         case GWL_ID:
    2955                 value = getWindowId();
     2983    case GWL_ID:
     2984        value = getWindowId();
    29562985        break;
    2957         case GWL_USERDATA:
    2958                 value = userData;
     2986    case GWL_USERDATA:
     2987        value = userData;
    29592988        break;
    2960         default:
    2961                 if(index >= 0 && index/4 < nrUserWindowLong)
    2962                 {
    2963                         value = userWindowLong[index/4];
     2989    default:
     2990        if(index >= 0 && index/4 < nrUserWindowLong)
     2991        {
     2992            value = userWindowLong[index/4];
    29642993            break;
    2965                 }
    2966                 SetLastError(ERROR_INVALID_PARAMETER);
    2967                 return 0;
     2994        }
     2995        SetLastError(ERROR_INVALID_PARAMETER);
     2996        return 0;
    29682997    }
    29692998    dprintf2(("GetWindowLongA %x %d %x", getWindowHandle(), index, value));
     
    30133042         return window;
    30143043    }
    3015     else return NULL;
     3044//    dprintf2(("Win32BaseWindow::GetWindowFromHandle: not a win32 window %x", hwnd));
     3045    return NULL;
    30163046}
    30173047//******************************************************************************
     
    30333063        return win32wnd;
    30343064  }
     3065//  dprintf2(("Win32BaseWindow::GetWindowFromOS2Handle: not an Odin os2 window %x", hwnd));
    30353066  return 0;
    30363067}
     
    30503081            return window->getOS2WindowHandle();
    30513082    }
    3052     else    return hwnd;
     3083//    dprintf2(("Win32BaseWindow::Win32ToOS2Handle: not a win32 window %x", hwnd));
     3084    return hwnd;
    30533085}
    30543086//******************************************************************************
     
    30613093            return window->getOS2FrameWindowHandle();
    30623094    }
    3063     else    return hwnd;
     3095//    dprintf2(("Win32BaseWindow::Win32ToOS2FrameHandle: not a win32 window %x", hwnd));
     3096    return hwnd;
    30643097}
    30653098//******************************************************************************
     
    30763109            return window->getWindowHandle();
    30773110    }
    3078     else    return 0;
     3111//    dprintf2(("Win32BaseWindow::OS2ToWin32Handle: not a win32 window %x", hwnd));
     3112    return 0;
    30793113//    else    return hwnd;    //OS/2 window handle
    30803114}
Note: See TracChangeset for help on using the changeset viewer.