Changeset 19440


Ignore:
Timestamp:
Jul 18, 2002, 11:54:59 PM (23 years ago)
Author:
achimha
Message:

documentation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified tags/trunk/src/user32/pmwindow.cpp

    r19286 r19440  
    1 /* $Id: pmwindow.cpp,v 1.180 2002-06-20 14:25:49 sandervl Exp $ */
     1/* $Id: pmwindow.cpp,v 1.181 2002-07-18 21:54:59 achimha Exp $ */
    22/*
    33 * Win32 Window Managment Code for OS/2
     
    9999
    100100//******************************************************************************
    101 //Initialize PM; create hab, message queue and register special Win32 window classes
     101// Initialize PM; create hab, message queue and register special Win32 window classes
     102//
     103// This is called from the initterm, so we call it only once for each process.
     104// We make sure PM is up and running for our purposes and init the existing
     105// thread 0.
    102106//******************************************************************************
    103107BOOL InitPM()
     
    136140        }
    137141    }
     142
     143    // store our HAB and HMQ in the TEB - we need it quite often
     144    // and they don't map 1:1 to Windows entities
    138145    SetThreadHAB(hab);
    139146    dprintf(("InitPM: hmq = %x", hmq));
     
    176183    dprintf(("WC_FRAME style %x", FrameClassInfo.flClassStyle));
    177184
     185    // this is our OS/2 window class for frame windows
    178186    if(!WinRegisterClass(                 /* Register window class        */
    179187        hab,                               /* Anchor block handle          */
     
    187195    }
    188196
     197    // get the screen dimensions and store them
    189198    WinQueryWindowRect(HWND_DESKTOP, &desktopRectl);
    190199    ScreenWidth  = desktopRectl.xRight;
     
    196205                        NULL, NULL, NULL};
    197206
    198     /* create memory device context */
     207    /* create memory device context - it's temporary to query some information */
    199208    hdc = DevOpenDC(hab, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&dop, NULLHANDLE);
    200209
     210    // check if we have the OS/2 Look and Feel enabled
    201211    fOS2Look = PROFILE_GetOdinIniBool(ODINSYSTEM_SECTION, "OS2Look", FALSE);
    202212    if(fOS2Look)
     
    207217        SYSCOLOR_Init(FALSE); //use OS/2 colors
    208218
     219        // query the name of the display driver resource DLL to load
     220        // some standard bitmaps from it
    209221        DspInitSystemDriverName(szDisplay, sizeof(szDisplay));
    210222        DosQueryModuleHandle(szDisplay, &hModDisplay);
     
    215227    }
    216228
     229    // find out which colordepth we're running
    217230    DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1, (PLONG)&ScreenBitsPerPel);
    218231
     
    228241//menu.cpp
    229242BOOL MENU_Init();
     243//******************************************************************************
     244// AH TODO 2002-07-18
     245// Note: this looks a lot like unnecessary code duplication. We should call this
     246// function from InitPM...
    230247//******************************************************************************
    231248void WIN32API SetWindowAppearance(int fLooks)
     
    412429}
    413430//******************************************************************************
    414 //Win32 window message handler
     431// Win32 window message handler
     432// The PM window procedure for our client window class (non frame)
    415433//******************************************************************************
    416434MRESULT EXPENTRY Win32WindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
     
    423441 OSLIBPOINT       point, ClientPoint;
    424442
    425     //Restore our FS selector
     443    // restore our FS selector
    426444    SetWin32TIB();
    427445
    428     //NOTE-------------->>>>>> If this is changed, also change Win32WindowProc!! <<<<<<<<<<<-------------------- BEGIN
     446    // BEGIN NOTE-------------->>>>>> If this is changed, also change Win32WindowProc!! <<<<<<<<<<<-------------------- BEGIN
    429447    teb = GetThreadTEB();
    430448    win32wnd = Win32BaseWindow::GetWindowFromOS2Handle(hwnd);
     
    432450////    dprintf(("window %x msg %x", (win32wnd) ? win32wnd->getWindowHandle() : 0, msg));
    433451
     452    // do some sanity checking here:
     453    // - we need to have a TEB handle
     454    // - unless this is WM_CREATE (the very first message), there has to be
     455    //   a USER32 window object for this window handle
    434456    if(!teb || (msg != WM_CREATE && win32wnd == NULL)) {
    435457        dprintf(("OS2: Invalid win32wnd pointer for window %x msg %x", hwnd, msg));
     
    440462////    }
    441463
     464    // check if the message state counter in the TEB is odd
     465    // this means that DispatchMessage has been called
    442466    if((teb->o.odin.msgstate & 1) == 0)
    443     {//message that was sent directly to our window proc handler; translate it here
     467    {
     468        // message that was sent directly to our window proc handler; translate it here
    444469        QMSG qmsg;
    445470
     
    462487        teb->o.odin.msgstate++;
    463488    }
    464     //NOTE-------------->>>>>> If this is changed, also change Win32WindowProc!! <<<<<<<<<<<-------------------- END
     489    // END NOTE-------------->>>>>> If this is changed, also change Win32WindowProc!! <<<<<<<<<<<-------------------- END
    465490
    466491    if(msg >= WIN32APP_POSTMSG) {
     
    9761001    SetWin32TIB();
    9771002
    978     //NOTE-------------->>>>>> If this is changed, also change Win32WindowProc!! <<<<<<<<<<<-------------------- BEGIN
     1003    // BEGIN NOTE-------------->>>>>> If this is changed, also change Win32WindowProc!! <<<<<<<<<<<-------------------- BEGIN
    9791004    teb = GetThreadTEB();
    9801005    win32wnd = Win32BaseWindow::GetWindowFromOS2FrameHandle(hwnd);
    9811006
     1007    // do some sanity checking here:
     1008    // - we need to have a TEB handle
     1009    // - unless this is WM_CREATE (the very first message), there has to be
     1010    //   a USER32 window object for this window handle
    9821011    if(!teb || (msg != WM_CREATE && win32wnd == NULL)) {
    9831012        dprintf(("PMFRAME: Invalid win32wnd pointer for window %x msg %x", hwnd, msg));
     
    9881017////    }
    9891018
     1019    // check if the message state counter in the TEB is odd
    9901020    if((teb->o.odin.msgstate & 1) == 0)
    9911021    {//message that was sent directly to our window proc handler; translate it here
     
    10101040        teb->o.odin.msgstate++;
    10111041    }
    1012     //NOTE-------------->>>>>> If this is changed, also change Win32WindowProc!! <<<<<<<<<<<-------------------- END
     1042    // END NOTE-------------->>>>>> If this is changed, also change Win32WindowProc!! <<<<<<<<<<<-------------------- END
    10131043
    10141044    switch( msg )
Note: See TracChangeset for help on using the changeset viewer.