| 1 | /* $Id: pmwindow.cpp,v 1.43 2000-01-15 15:05:37 sandervl Exp $ */ | 
|---|
| 2 | /* | 
|---|
| 3 | * Win32 Window Managment Code for OS/2 | 
|---|
| 4 | * | 
|---|
| 5 | * Copyright 1998-1999 Sander van Leeuwen (sandervl@xs4all.nl) | 
|---|
| 6 | * Copyright 1999      Daniela Engert (dani@ngrt.de) | 
|---|
| 7 | * | 
|---|
| 8 | * | 
|---|
| 9 | * Project Odin Software License can be found in LICENSE.TXT | 
|---|
| 10 | * | 
|---|
| 11 | */ | 
|---|
| 12 | #define INCL_WIN | 
|---|
| 13 | #define INCL_GPI | 
|---|
| 14 | #define INCL_DEV                /* Device Function definitions  */ | 
|---|
| 15 | #define INCL_GPICONTROL         /* GPI control Functions        */ | 
|---|
| 16 | #define INCL_DOSPROCESS | 
|---|
| 17 |  | 
|---|
| 18 | #include <os2wrap.h> | 
|---|
| 19 | #include <stdlib.h> | 
|---|
| 20 | #include <string.h> | 
|---|
| 21 | #include "win32type.h" | 
|---|
| 22 | #include <winconst.h> | 
|---|
| 23 | #include <wprocess.h> | 
|---|
| 24 | #include <misc.h> | 
|---|
| 25 | #include <win32wbase.h> | 
|---|
| 26 | #include <win32dlg.h> | 
|---|
| 27 | #include "win32wdesktop.h" | 
|---|
| 28 | #include "pmwindow.h" | 
|---|
| 29 | #include "oslibwin.h" | 
|---|
| 30 | #include "oslibutil.h" | 
|---|
| 31 | #include "oslibgdi.h" | 
|---|
| 32 | #include "oslibmsg.h" | 
|---|
| 33 | #include "dc.h" | 
|---|
| 34 | #include <thread.h> | 
|---|
| 35 | #include <wprocess.h> | 
|---|
| 36 | #include "caret.h" | 
|---|
| 37 | #include "timer.h" | 
|---|
| 38 | #include <codepage.h> | 
|---|
| 39 |  | 
|---|
| 40 | HMQ  hmq = 0;                             /* Message queue handle         */ | 
|---|
| 41 | HAB  hab = 0; | 
|---|
| 42 |  | 
|---|
| 43 | RECTL desktopRectl = {0}; | 
|---|
| 44 | ULONG ScreenWidth  = 0; | 
|---|
| 45 | ULONG ScreenHeight = 0; | 
|---|
| 46 | ULONG ScreenBitsPerPel = 0; | 
|---|
| 47 |  | 
|---|
| 48 |  | 
|---|
| 49 | MRESULT EXPENTRY Win32WindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); | 
|---|
| 50 |  | 
|---|
| 51 | //****************************************************************************** | 
|---|
| 52 | //Initialize PM; create hab, message queue and register special Win32 window classes | 
|---|
| 53 | //****************************************************************************** | 
|---|
| 54 | BOOL InitPM() | 
|---|
| 55 | { | 
|---|
| 56 | CLASSINFO FrameClassInfo; | 
|---|
| 57 |  | 
|---|
| 58 | hab = WinInitialize(0); | 
|---|
| 59 | dprintf(("Winitialize returned %x", hab)); | 
|---|
| 60 | hmq = WinCreateMsgQueue(hab, 0); | 
|---|
| 61 |  | 
|---|
| 62 | if(!hab || !hmq) | 
|---|
| 63 | { | 
|---|
| 64 | UINT error; | 
|---|
| 65 | //CB: only fail on real error | 
|---|
| 66 | error = WinGetLastError(hab) & 0xFFFF; //error code | 
|---|
| 67 | if (!hab || (error != PMERR_MSG_QUEUE_ALREADY_EXISTS)) | 
|---|
| 68 | { | 
|---|
| 69 | dprintf(("WinInitialize or WinCreateMsgQueue failed %x %x", hab, hmq)); | 
|---|
| 70 | dprintf((" Error = %x",error)); | 
|---|
| 71 | return(FALSE); | 
|---|
| 72 | } | 
|---|
| 73 | else | 
|---|
| 74 | { | 
|---|
| 75 | if(!hab) { | 
|---|
| 76 | hab = WinQueryAnchorBlock(HWND_DESKTOP); | 
|---|
| 77 | dprintf(("WinQueryAnchorBlock returned %x", hab)); | 
|---|
| 78 | } | 
|---|
| 79 | if(!hmq) { | 
|---|
| 80 | hmq = HMQ_CURRENT; | 
|---|
| 81 | } | 
|---|
| 82 | } | 
|---|
| 83 | } | 
|---|
| 84 | SetThreadHAB(hab); | 
|---|
| 85 | dprintf(("InitPM: hmq = %x", hmq)); | 
|---|
| 86 | SetThreadMessageQueue(hmq); | 
|---|
| 87 |  | 
|---|
| 88 | BOOL rc = WinSetCp(hmq, GetDisplayCodepage()); | 
|---|
| 89 | dprintf(("InitPM: WinSetCP was %sOK", rc ? "" : "not ")); | 
|---|
| 90 |  | 
|---|
| 91 | if(!WinRegisterClass(                 /* Register window class        */ | 
|---|
| 92 | hab,                               /* Anchor block handle          */ | 
|---|
| 93 | (PSZ)WIN32_STDCLASS,               /* Window class name            */ | 
|---|
| 94 | (PFNWP)Win32WindowProc,            /* Address of window procedure  */ | 
|---|
| 95 | 0, | 
|---|
| 96 | NROF_WIN32WNDBYTES)) { | 
|---|
| 97 | dprintf(("WinRegisterClass Win32BaseWindow failed")); | 
|---|
| 98 | return(FALSE); | 
|---|
| 99 | } | 
|---|
| 100 | if(!WinRegisterClass(                 /* Register window class        */ | 
|---|
| 101 | hab,                               /* Anchor block handle          */ | 
|---|
| 102 | (PSZ)WIN32_STDCLASS2,              /* Window class name            */ | 
|---|
| 103 | (PFNWP)Win32WindowProc,            /* Address of window procedure  */ | 
|---|
| 104 | CS_SAVEBITS, | 
|---|
| 105 | NROF_WIN32WNDBYTES)) { | 
|---|
| 106 | dprintf(("WinRegisterClass Win32BaseWindow failed")); | 
|---|
| 107 | return(FALSE); | 
|---|
| 108 | } | 
|---|
| 109 | if (!WinQueryClassInfo (hab, WC_FRAME, &FrameClassInfo)) { | 
|---|
| 110 | dprintf (("WinQueryClassInfo WC_FRAME failed")); | 
|---|
| 111 | return (FALSE); | 
|---|
| 112 | } | 
|---|
| 113 | FrameClassInfo.flClassStyle &= ~(CS_PUBLIC | CS_CLIPSIBLINGS); | 
|---|
| 114 | if (!WinRegisterClass (hab, | 
|---|
| 115 | WIN32_INNERFRAME, | 
|---|
| 116 | FrameClassInfo.pfnWindowProc, | 
|---|
| 117 | FrameClassInfo.flClassStyle, | 
|---|
| 118 | FrameClassInfo.cbWindowData)) { | 
|---|
| 119 | dprintf (("WinRegisterClass Win32InnerFrame failed")); | 
|---|
| 120 | return (FALSE); | 
|---|
| 121 | } | 
|---|
| 122 |  | 
|---|
| 123 | WinQueryWindowRect(HWND_DESKTOP, &desktopRectl); | 
|---|
| 124 | ScreenWidth  = desktopRectl.xRight; | 
|---|
| 125 | ScreenHeight = desktopRectl.yTop; | 
|---|
| 126 |  | 
|---|
| 127 |  | 
|---|
| 128 | HDC   hdc;              /* Device-context handle                */ | 
|---|
| 129 | /* context data structure */ | 
|---|
| 130 | DEVOPENSTRUC dop = {NULL, "DISPLAY", NULL, NULL, NULL, NULL, | 
|---|
| 131 | NULL, NULL, NULL}; | 
|---|
| 132 |  | 
|---|
| 133 | /* create memory device context */ | 
|---|
| 134 | hdc = DevOpenDC(hab, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&dop, NULLHANDLE); | 
|---|
| 135 | DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1, (PLONG)&ScreenBitsPerPel); | 
|---|
| 136 | DevCloseDC(hdc); | 
|---|
| 137 |  | 
|---|
| 138 | dprintf(("InitPM: Desktop (%d,%d)", ScreenWidth, ScreenHeight)); | 
|---|
| 139 | return OSLibInitMsgQueue(); | 
|---|
| 140 | } /* End of main */ | 
|---|
| 141 | //****************************************************************************** | 
|---|
| 142 | //Win32 window message handler | 
|---|
| 143 | //****************************************************************************** | 
|---|
| 144 | MRESULT EXPENTRY Win32WindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 
|---|
| 145 | { | 
|---|
| 146 | POSTMSG_PACKET  *postmsg; | 
|---|
| 147 | OSLIBPOINT       point, ClientPoint; | 
|---|
| 148 | Win32BaseWindow *win32wnd; | 
|---|
| 149 | THDB            *thdb; | 
|---|
| 150 | APIRET           rc = 0; | 
|---|
| 151 | MSG              winMsg, *pWinMsg; | 
|---|
| 152 |  | 
|---|
| 153 | //Restore our FS selector | 
|---|
| 154 | SetWin32TIB(); | 
|---|
| 155 |  | 
|---|
| 156 | thdb = GetThreadTHDB(); | 
|---|
| 157 | win32wnd = Win32BaseWindow::GetWindowFromOS2Handle(hwnd); | 
|---|
| 158 |  | 
|---|
| 159 | if(!thdb || (msg != WM_CREATE && win32wnd == NULL)) { | 
|---|
| 160 | dprintf(("Invalid win32wnd pointer for window %x msg %x", hwnd, msg)); | 
|---|
| 161 | goto RunDefWndProc; | 
|---|
| 162 | } | 
|---|
| 163 |  | 
|---|
| 164 | if((thdb->msgstate & 1) == 0) | 
|---|
| 165 | {//message that was sent directly to our window proc handler; translate it here | 
|---|
| 166 | QMSG qmsg; | 
|---|
| 167 |  | 
|---|
| 168 | qmsg.msg  = msg; | 
|---|
| 169 | qmsg.hwnd = hwnd; | 
|---|
| 170 | qmsg.mp1  = mp1; | 
|---|
| 171 | qmsg.mp2  = mp2; | 
|---|
| 172 | qmsg.time = WinQueryMsgTime(thdb->hab); | 
|---|
| 173 | WinQueryMsgPos(thdb->hab, &qmsg.ptl); | 
|---|
| 174 | qmsg.reserved = 0; | 
|---|
| 175 |  | 
|---|
| 176 | if(OS2ToWinMsgTranslate((PVOID)thdb, &qmsg, &winMsg, FALSE, MSG_REMOVE) == FALSE) | 
|---|
| 177 | {//message was not translated | 
|---|
| 178 | memset(&winMsg, 0, sizeof(MSG)); | 
|---|
| 179 | } | 
|---|
| 180 | pWinMsg = &winMsg; | 
|---|
| 181 | } | 
|---|
| 182 | else { | 
|---|
| 183 | pWinMsg = &thdb->msg; | 
|---|
| 184 | thdb->msgstate++; | 
|---|
| 185 | } | 
|---|
| 186 |  | 
|---|
| 187 | if(msg == WIN32APP_POSTMSG) { | 
|---|
| 188 | //probably win32 app user message | 
|---|
| 189 | if((ULONG)mp1 == WIN32MSG_MAGICA) { | 
|---|
| 190 | return (MRESULT)win32wnd->DispatchMsgA(pWinMsg); | 
|---|
| 191 | } | 
|---|
| 192 | else | 
|---|
| 193 | if((ULONG)mp1 == WIN32MSG_MAGICW) { | 
|---|
| 194 | return (MRESULT)win32wnd->DispatchMsgW(pWinMsg); | 
|---|
| 195 | } | 
|---|
| 196 | } | 
|---|
| 197 | switch( msg ) | 
|---|
| 198 | { | 
|---|
| 199 | //OS/2 msgs | 
|---|
| 200 | case WM_CREATE: | 
|---|
| 201 | { | 
|---|
| 202 |  | 
|---|
| 203 | if(thdb->newWindow == 0) | 
|---|
| 204 | goto createfail; | 
|---|
| 205 |  | 
|---|
| 206 | //Processing is done in after WinCreateWindow returns | 
|---|
| 207 | dprintf(("OS2: WM_CREATE %x", hwnd)); | 
|---|
| 208 | win32wnd = (Win32BaseWindow *)thdb->newWindow; | 
|---|
| 209 | thdb->newWindow = 0; | 
|---|
| 210 |  | 
|---|
| 211 | if(win32wnd->MsgCreate(WinQueryWindow(hwnd, QW_PARENT), hwnd) == FALSE) | 
|---|
| 212 | { | 
|---|
| 213 | RestoreOS2TIB(); | 
|---|
| 214 | return (MRESULT)TRUE; //discontinue window creation | 
|---|
| 215 | } | 
|---|
| 216 | createfail: | 
|---|
| 217 | RestoreOS2TIB(); | 
|---|
| 218 | return (MRESULT)FALSE; | 
|---|
| 219 | } | 
|---|
| 220 |  | 
|---|
| 221 | case WM_QUIT: | 
|---|
| 222 | dprintf(("OS2: WM_QUIT %x", hwnd)); | 
|---|
| 223 | win32wnd->MsgQuit(); | 
|---|
| 224 | break; | 
|---|
| 225 |  | 
|---|
| 226 | case WM_CLOSE: | 
|---|
| 227 | dprintf(("OS2: WM_CLOSE %x", hwnd)); | 
|---|
| 228 | win32wnd->MsgClose(); | 
|---|
| 229 | break; | 
|---|
| 230 |  | 
|---|
| 231 | case WM_DESTROY: | 
|---|
| 232 | dprintf(("OS2: WM_DESTROY %x", hwnd)); | 
|---|
| 233 | win32wnd->MsgDestroy(); | 
|---|
| 234 | break; | 
|---|
| 235 |  | 
|---|
| 236 | case WM_ENABLE: | 
|---|
| 237 | dprintf(("OS2: WM_ENABLE %x", hwnd)); | 
|---|
| 238 | win32wnd->MsgEnable(SHORT1FROMMP(mp1)); | 
|---|
| 239 | break; | 
|---|
| 240 |  | 
|---|
| 241 | case WM_SHOW: | 
|---|
| 242 | dprintf(("OS2: WM_SHOW %x %d", hwnd, mp1)); | 
|---|
| 243 | win32wnd->MsgShow((ULONG)mp1); | 
|---|
| 244 | break; | 
|---|
| 245 |  | 
|---|
| 246 | case WM_ADJUSTWINDOWPOS: | 
|---|
| 247 | { | 
|---|
| 248 | PSWP      pswp   = (PSWP)mp1; | 
|---|
| 249 | dprintf(("PMWINDOW: WM_WINDOWPOSCHANGED (%x) %x %x (%d,%d) (%d,%d)", mp2, win32wnd->getWindowHandle(), pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy)); | 
|---|
| 250 | goto RunDefWndProc; | 
|---|
| 251 | } | 
|---|
| 252 |  | 
|---|
| 253 | case WM_WINDOWPOSCHANGED: | 
|---|
| 254 | { | 
|---|
| 255 | if(pWinMsg->message != 0) | 
|---|
| 256 | win32wnd->MsgPosChanged((LPARAM)&thdb->wp); | 
|---|
| 257 | goto RunDefWndProc; | 
|---|
| 258 | } | 
|---|
| 259 |  | 
|---|
| 260 | case WM_ACTIVATE: | 
|---|
| 261 | { | 
|---|
| 262 | dprintf(("OS2: WM_ACTIVATE %x %x", hwnd, mp2)); | 
|---|
| 263 |  | 
|---|
| 264 | if(win32wnd->IsWindowCreated()) | 
|---|
| 265 | win32wnd->MsgActivate((LOWORD(pWinMsg->wParam) == WA_ACTIVE_W) ? 1 : 0, HIWORD(pWinMsg->wParam), pWinMsg->lParam, (HWND)mp2); | 
|---|
| 266 |  | 
|---|
| 267 | break; | 
|---|
| 268 | } | 
|---|
| 269 |  | 
|---|
| 270 | case WM_SIZE: | 
|---|
| 271 | { | 
|---|
| 272 | dprintf(("OS2: WM_SIZE (%d,%d) (%d,%d)", SHORT1FROMMP(mp2), SHORT2FROMMP(mp2), SHORT1FROMMP(mp1), SHORT2FROMMP(mp2))); | 
|---|
| 273 | break; | 
|---|
| 274 | } | 
|---|
| 275 |  | 
|---|
| 276 | case WM_MINMAXFRAME: | 
|---|
| 277 | { | 
|---|
| 278 | dprintf(("OS2: WM_MINMAXFRAME")); | 
|---|
| 279 | break; | 
|---|
| 280 | } | 
|---|
| 281 |  | 
|---|
| 282 | case WM_OWNERPOSCHANGE: | 
|---|
| 283 | { | 
|---|
| 284 | dprintf(("OS2: WM_OWNERPOSCHANGE")); | 
|---|
| 285 | goto RunDefWndProc; | 
|---|
| 286 | } | 
|---|
| 287 |  | 
|---|
| 288 | case WM_CALCVALIDRECTS: | 
|---|
| 289 | RestoreOS2TIB(); | 
|---|
| 290 | return (MRESULT)(CVR_ALIGNLEFT | CVR_ALIGNTOP); | 
|---|
| 291 |  | 
|---|
| 292 | case WM_SETFOCUS: | 
|---|
| 293 | { | 
|---|
| 294 | HWND hwndFocus = (HWND)mp1; | 
|---|
| 295 |  | 
|---|
| 296 | dprintf(("OS2: WM_SETFOCUS %x %x %d", win32wnd->getWindowHandle(), mp1, mp2)); | 
|---|
| 297 | if(WinQueryWindowULong(hwndFocus, OFFSET_WIN32PM_MAGIC) != WIN32PM_MAGIC) { | 
|---|
| 298 | //another (non-win32) application's window | 
|---|
| 299 | //set to NULL (allowed according to win32 SDK) to avoid problems | 
|---|
| 300 | hwndFocus = NULL; | 
|---|
| 301 | } | 
|---|
| 302 | if((ULONG)mp2 == TRUE) { | 
|---|
| 303 | HWND hwndFocusWin32 = Win32BaseWindow::OS2ToWin32Handle(hwndFocus); | 
|---|
| 304 | recreateCaret (hwndFocusWin32); | 
|---|
| 305 | win32wnd->MsgSetFocus(hwndFocusWin32); | 
|---|
| 306 | } | 
|---|
| 307 | else win32wnd->MsgKillFocus(Win32BaseWindow::OS2ToWin32Handle(hwndFocus)); | 
|---|
| 308 | break; | 
|---|
| 309 | } | 
|---|
| 310 |  | 
|---|
| 311 | //************************************************************************** | 
|---|
| 312 | //Mouse messages (OS/2 Window coordinates -> Win32 coordinates relative to screen | 
|---|
| 313 | //************************************************************************** | 
|---|
| 314 | case WM_BUTTON1DOWN: | 
|---|
| 315 | case WM_BUTTON1UP: | 
|---|
| 316 | case WM_BUTTON1DBLCLK: | 
|---|
| 317 | case WM_BUTTON2DOWN: | 
|---|
| 318 | case WM_BUTTON2UP: | 
|---|
| 319 | case WM_BUTTON2DBLCLK: | 
|---|
| 320 | case WM_BUTTON3DOWN: | 
|---|
| 321 | case WM_BUTTON3UP: | 
|---|
| 322 | case WM_BUTTON3DBLCLK: | 
|---|
| 323 | win32wnd->MsgButton(pWinMsg); | 
|---|
| 324 | rc = TRUE; | 
|---|
| 325 | break; | 
|---|
| 326 |  | 
|---|
| 327 | case WM_BUTTON2MOTIONSTART: | 
|---|
| 328 | case WM_BUTTON2MOTIONEND: | 
|---|
| 329 | case WM_BUTTON2CLICK: | 
|---|
| 330 | case WM_BUTTON1MOTIONSTART: | 
|---|
| 331 | case WM_BUTTON1MOTIONEND: | 
|---|
| 332 | case WM_BUTTON1CLICK: | 
|---|
| 333 | case WM_BUTTON3MOTIONSTART: | 
|---|
| 334 | case WM_BUTTON3MOTIONEND: | 
|---|
| 335 | case WM_BUTTON3CLICK: | 
|---|
| 336 | goto RunDefWndProc; | 
|---|
| 337 |  | 
|---|
| 338 | case WM_MOUSEMOVE: | 
|---|
| 339 | { | 
|---|
| 340 | //OS/2 Window coordinates -> Win32 Window coordinates | 
|---|
| 341 | win32wnd->MsgMouseMove(pWinMsg); | 
|---|
| 342 | break; | 
|---|
| 343 | } | 
|---|
| 344 |  | 
|---|
| 345 | case WM_CONTROL: | 
|---|
| 346 | goto RunDefWndProc; | 
|---|
| 347 |  | 
|---|
| 348 | case WM_COMMAND: | 
|---|
| 349 | dprintf(("OS2: WM_COMMAND %x %x %x", hwnd, mp1, mp2)); | 
|---|
| 350 | win32wnd->DispatchMsgA(pWinMsg); | 
|---|
| 351 | break; | 
|---|
| 352 |  | 
|---|
| 353 | case WM_SYSCOMMAND: | 
|---|
| 354 | win32wnd->DispatchMsgA(pWinMsg); | 
|---|
| 355 | break; | 
|---|
| 356 |  | 
|---|
| 357 | case WM_CHAR: | 
|---|
| 358 | win32wnd->DispatchMsgA(pWinMsg); | 
|---|
| 359 | break; | 
|---|
| 360 |  | 
|---|
| 361 | case WM_TIMER: | 
|---|
| 362 | win32wnd->DispatchMsgA(pWinMsg); | 
|---|
| 363 | goto RunDefWndProc; | 
|---|
| 364 |  | 
|---|
| 365 | case WM_SETWINDOWPARAMS: | 
|---|
| 366 | { | 
|---|
| 367 | WNDPARAMS *wndParams = (WNDPARAMS *)mp1; | 
|---|
| 368 |  | 
|---|
| 369 | dprintf(("OS2: WM_SETWINDOWPARAMS %x", hwnd)); | 
|---|
| 370 | if(wndParams->fsStatus & WPM_TEXT) { | 
|---|
| 371 | win32wnd->MsgSetText(wndParams->pszText, wndParams->cchText); | 
|---|
| 372 | } | 
|---|
| 373 | goto RunDefWndProc; | 
|---|
| 374 | } | 
|---|
| 375 |  | 
|---|
| 376 | case WM_QUERYWINDOWPARAMS: | 
|---|
| 377 | { | 
|---|
| 378 | PWNDPARAMS wndpars = (PWNDPARAMS)mp1; | 
|---|
| 379 | ULONG textlen; | 
|---|
| 380 | PSZ   wintext; | 
|---|
| 381 |  | 
|---|
| 382 | if(wndpars->fsStatus & (WPM_CCHTEXT | WPM_TEXT)) | 
|---|
| 383 | { | 
|---|
| 384 | if(wndpars->fsStatus & WPM_CCHTEXT) | 
|---|
| 385 | wndpars->cchText = win32wnd->MsgGetTextLength(); | 
|---|
| 386 | if(wndpars->fsStatus & WPM_TEXT) | 
|---|
| 387 | wndpars->pszText = win32wnd->MsgGetText(); | 
|---|
| 388 |  | 
|---|
| 389 | wndpars->fsStatus = 0; | 
|---|
| 390 | wndpars->cbCtlData = 0; | 
|---|
| 391 | wndpars->cbPresParams = 0; | 
|---|
| 392 | RestoreOS2TIB(); | 
|---|
| 393 | return (MRESULT)TRUE; | 
|---|
| 394 | } | 
|---|
| 395 | goto RunDefWndProc; | 
|---|
| 396 | } | 
|---|
| 397 |  | 
|---|
| 398 | case WM_PAINT: | 
|---|
| 399 | dprintf(("OS2: WM_PAINT")); | 
|---|
| 400 | win32wnd->DispatchMsgA(pWinMsg); | 
|---|
| 401 | goto RunDefWndProc; | 
|---|
| 402 |  | 
|---|
| 403 | case WM_CONTEXTMENU: | 
|---|
| 404 | { | 
|---|
| 405 | win32wnd->DispatchMsgA(pWinMsg); | 
|---|
| 406 |  | 
|---|
| 407 | RestoreOS2TIB(); | 
|---|
| 408 | return (MRESULT)TRUE; | 
|---|
| 409 | } | 
|---|
| 410 |  | 
|---|
| 411 | case WM_ERASEBACKGROUND: | 
|---|
| 412 | { | 
|---|
| 413 | dprintf(("OS2: WM_ERASEBACKGROUND %x", win32wnd->getWindowHandle())); | 
|---|
| 414 | RestoreOS2TIB(); | 
|---|
| 415 | return (MRESULT)FALSE; | 
|---|
| 416 | } | 
|---|
| 417 |  | 
|---|
| 418 | case WM_FOCUSCHANGE: | 
|---|
| 419 | dprintf(("OS2: WM_FOCUSCHANGE %x", win32wnd->getWindowHandle())); | 
|---|
| 420 | goto RunDefWndProc; | 
|---|
| 421 |  | 
|---|
| 422 | case WM_INITMENU: | 
|---|
| 423 | case WM_MENUSELECT: | 
|---|
| 424 | case WM_MENUEND: | 
|---|
| 425 | case WM_NEXTMENU: | 
|---|
| 426 | case WM_SYSCOLORCHANGE: | 
|---|
| 427 | case WM_SYSVALUECHANGED: | 
|---|
| 428 | case WM_SETSELECTION: | 
|---|
| 429 | case WM_PPAINT: | 
|---|
| 430 | case WM_PSETFOCUS: | 
|---|
| 431 | case WM_PSYSCOLORCHANGE: | 
|---|
| 432 | case WM_PSIZE: | 
|---|
| 433 | case WM_PACTIVATE: | 
|---|
| 434 | case WM_PCONTROL: | 
|---|
| 435 | case WM_HELP: | 
|---|
| 436 | case WM_APPTERMINATENOTIFY: | 
|---|
| 437 | case WM_PRESPARAMCHANGED: | 
|---|
| 438 | case WM_DRAWITEM: | 
|---|
| 439 | case WM_MEASUREITEM: | 
|---|
| 440 | case WM_CONTROLPOINTER: | 
|---|
| 441 | case WM_QUERYDLGCODE: | 
|---|
| 442 | case WM_SUBSTITUTESTRING: | 
|---|
| 443 | case WM_MATCHMNEMONIC: | 
|---|
| 444 | case WM_SAVEAPPLICATION: | 
|---|
| 445 | case WM_SEMANTICEVENT: | 
|---|
| 446 | default: | 
|---|
| 447 | //dprintf(("OS2: RunDefWndProc msg %x for %x", msg, hwnd)); | 
|---|
| 448 | RestoreOS2TIB(); | 
|---|
| 449 | return WinDefWindowProc( hwnd, msg, mp1, mp2 ); | 
|---|
| 450 | } | 
|---|
| 451 | RestoreOS2TIB(); | 
|---|
| 452 | return (MRESULT)rc; | 
|---|
| 453 |  | 
|---|
| 454 | RunDefWndProc: | 
|---|
| 455 | //  dprintf(("OS2: RunDefWndProc msg %x for %x", msg, hwnd)); | 
|---|
| 456 | RestoreOS2TIB(); | 
|---|
| 457 |  | 
|---|
| 458 | return WinDefWindowProc( hwnd, msg, mp1, mp2 ); | 
|---|
| 459 | } /* End of Win32WindowProc */ | 
|---|
| 460 | //****************************************************************************** | 
|---|
| 461 | //****************************************************************************** | 
|---|