source: trunk/src/user32/new/pmwindow.cpp@ 741

Last change on this file since 741 was 741, checked in by sandervl, 26 years ago

Redesign; base class for all window types

File size: 20.4 KB
Line 
1/* $Id: pmwindow.cpp,v 1.26 1999-08-30 11:59:53 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
15#include <os2.h> /* PM header file */
16#include <os2wrap.h>
17#include <stdlib.h>
18#include "win32type.h"
19#include <winconst.h>
20#include <wprocess.h>
21#include <misc.h>
22#include <win32wbase.h>
23#include <win32dlg.h>
24#include "pmwindow.h"
25#include "oslibwin.h"
26#include "oslibutil.h"
27#include "oslibgdi.h"
28#include "oslibmsg.h"
29
30HMQ hmq = 0; /* Message queue handle */
31HAB hab = 0;
32
33RECTL desktopRectl = {0};
34ULONG ScreenWidth = 0;
35ULONG ScreenHeight = 0;
36
37MRESULT EXPENTRY Win32WindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
38
39//******************************************************************************
40//Initialize PM; create hab, message queue and register special Win32 window classes
41//******************************************************************************
42BOOL InitPM()
43{
44 hab = WinInitialize(0);
45 dprintf(("Winitialize returned %x", hab));
46 hmq = WinCreateMsgQueue(hab, 0);
47
48 if(!hab || !hmq)
49 {
50 UINT error;
51 //CB: only fail on real error
52 error = WinGetLastError(hab) & 0xFFFF; //error code
53 if (!hab || error != PMERR_MSG_QUEUE_ALREADY_EXISTS)
54 {
55 dprintf(("WinInitialize or WinCreateMsgQueue failed %x %x", hab, hmq));
56 dprintf((" Error = %x",error));
57 return(FALSE);
58 }
59 else
60 {
61 if(!hab) {
62 hab = WinQueryAnchorBlock(HWND_DESKTOP);
63 dprintf(("WinQueryAnchorBlock returned %x", hab));
64 }
65 if(!hmq) {
66 hmq = HMQ_CURRENT;
67 }
68 }
69 }
70 SetThreadHAB(hab);
71 dprintf(("InitPM: hmq = %x", hmq));
72 SetThreadMessageQueue(hmq);
73
74 if(!WinRegisterClass( /* Register window class */
75 hab, /* Anchor block handle */
76 (PSZ)WIN32_STDCLASS, /* Window class name */
77 (PFNWP)Win32WindowProc, /* Address of window procedure */
78 CS_SIZEREDRAW | CS_HITTEST,
79 NROF_WIN32WNDBYTES)) {
80 dprintf(("WinRegisterClass Win32BaseWindow failed"));
81 return(FALSE);
82 }
83
84 WinQueryWindowRect(HWND_DESKTOP, &desktopRectl);
85 ScreenWidth = desktopRectl.xRight;
86 ScreenHeight = desktopRectl.yTop;
87
88 dprintf(("InitPM: Desktop (%d,%d)", ScreenWidth, ScreenHeight));
89 return OSLibInitMsgQueue();
90} /* End of main */
91//******************************************************************************
92//Win32 window message handler
93//******************************************************************************
94MRESULT EXPENTRY Win32WindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
95{
96 POSTMSG_PACKET *postmsg;
97 OSLIBPOINT point, ClientPoint;
98 Win32BaseWindow *win32wnd;
99 APIRET rc;
100
101 //Restore our FS selector
102 SetWin32TIB();
103
104 win32wnd = Win32BaseWindow::GetWindowFromOS2Handle(hwnd);
105
106 if(msg != WM_CREATE && win32wnd == NULL) {
107 dprintf(("Invalid win32wnd pointer for window %x!!", hwnd));
108 goto RunDefWndProc;
109 }
110 if(msg > WIN32APP_USERMSGBASE) {
111 //win32 app user message
112 dprintf(("PMWINDOW: Message %x (%x,%x) posted to window %x", (ULONG)msg-WIN32APP_USERMSGBASE, mp1, mp2, hwnd));
113 win32wnd->SendMessageA((ULONG)msg-WIN32APP_USERMSGBASE, (ULONG)mp1, (ULONG)mp2);
114 }
115 switch( msg )
116 {
117 //OS/2 msgs
118 case WM_CREATE:
119 //Processing is done in after WinCreateWindow returns
120 dprintf(("OS2: WM_CREATE %x", hwnd));
121 RestoreOS2TIB();
122 return (MRESULT)FALSE;
123
124 case WM_QUIT:
125 dprintf(("OS2: WM_QUIT %x", hwnd));
126 if(win32wnd->MsgQuit()) {
127 goto RunDefWndProc;
128 }
129 break;
130
131 case WM_CLOSE:
132 dprintf(("OS2: WM_CLOSE %x", hwnd));
133 if(win32wnd->MsgClose()) {
134 goto RunDefWndProc;
135 }
136 break;
137
138 case WM_DESTROY:
139 dprintf(("OS2: WM_DESTROY %x", hwnd));
140 if(win32wnd->MsgDestroy()) {
141 goto RunDefWndProc;
142 }
143 break;
144
145 case WM_ENABLE:
146 dprintf(("OS2: WM_ENABLE %x", hwnd));
147 if(win32wnd->MsgEnable((ULONG)mp1)) {
148 goto RunDefWndProc;
149 }
150 break;
151
152 case WM_SHOW:
153 dprintf(("OS2: WM_SHOW %x", hwnd));
154 if(win32wnd->MsgShow((ULONG)mp1)) {
155 goto RunDefWndProc;
156 }
157 break;
158
159 case WM_ADJUSTWINDOWPOS:
160 {
161 PSWP pswp = (PSWP)mp1;
162 SWP swpOld;
163 WINDOWPOS wp;
164 ULONG parentHeight = 0;
165 HWND hParent = NULLHANDLE, hFrame = NULLHANDLE;
166
167 dprintf(("OS2: WM_ADJUSTWINDOWPOS %x %x (%d,%d) (%d,%d)", hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
168
169 if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0) break;
170
171 WinQueryWindowPos(hwnd, &swpOld);
172
173 if(pswp->fl & (SWP_MOVE | SWP_SIZE)) {
174 if (win32wnd->isChild())
175 hParent = win32wnd->getParent()->getOS2WindowHandle();
176 else
177 hFrame = win32wnd->getOS2FrameWindowHandle();
178 }
179 OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, hParent, hFrame);
180
181 wp.hwnd = win32wnd->getWindowHandle();
182 if ((pswp->fl & SWP_ZORDER) && (pswp->hwndInsertBehind > HWND_BOTTOM))
183 {
184 Win32BaseWindow *wndAfter = Win32BaseWindow::GetWindowFromOS2Handle(pswp->hwndInsertBehind);
185 if(wndAfter) wp.hwndInsertAfter = wndAfter->getWindowHandle();
186 }
187 win32wnd->MsgPosChanging((LPARAM)&wp);
188 break;
189 }
190
191 case WM_WINDOWPOSCHANGED:
192 {
193 PSWP pswp = (PSWP)mp1;
194 PSWP pswpo = pswp + 1;
195 WINDOWPOS wp;
196 ULONG parentHeight = 0;
197 HWND hParent = NULLHANDLE, hFrame = NULLHANDLE;
198 LONG yDelta = pswp->cy - pswpo->cy;
199 ULONG classStyle;
200
201 dprintf(("OS2: WM_WINDOWPOSCHANGED %x %x (%d,%d) (%d,%d)", hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
202
203 if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0) break;
204
205 if(pswp->fl & (SWP_MOVE | SWP_SIZE)) {
206 if (win32wnd->isChild())
207 hParent = win32wnd->getParent()->getOS2WindowHandle();
208 else
209 hFrame = win32wnd->getOS2FrameWindowHandle();
210 }
211 OSLibMapSWPtoWINDOWPOS(pswp, &wp, pswpo, hParent, hFrame);
212
213 win32wnd->setWindowRect(wp.x, wp.y, wp.x + wp.cx, wp.y + wp.cy);
214 win32wnd->setClientRect(pswpo->x, pswpo->y, pswpo->x + pswpo->cx, pswpo->y + pswpo->cy);
215
216 wp.hwnd = win32wnd->getWindowHandle();
217 if ((pswp->fl & SWP_ZORDER) && (pswp->hwndInsertBehind > HWND_BOTTOM))
218 {
219 Win32BaseWindow *wndAfter = Win32BaseWindow::GetWindowFromOS2Handle(pswp->hwndInsertBehind);
220 wp.hwndInsertAfter = wndAfter->getWindowHandle();
221 }
222 classStyle = win32wnd->getClass()->getStyle();
223// if (yDelta != 0)
224 if ((yDelta != 0) && ((classStyle & CS_VREDRAW_W) ||
225 ((classStyle & CS_HREDRAW_W) && (pswp->cx != pswpo->cx))))
226 {
227 HENUM henum = WinBeginEnumWindows(pswp->hwnd);
228 SWP swp[10];
229 int i = 0;
230 HWND hwnd;
231
232 dprintf(("move children"));
233 while ((hwnd = WinGetNextWindow(henum)) != NULLHANDLE)
234 {
235#if 0
236 /* Do not move MDI clients. MDI clients are a special case,
237 * even though they are bottom aligned they are always supposed
238 * to be the same size as their parent. This code is an
239 * optimization and will not work correctly if the this
240 * assumption is incorrect.
241 */
242 WinBase *pBase = (WinBase *)WinQueryDAXData( hwnd );
243 if ( pBase && pBase->typeOf() == mdiClient )
244 {
245 continue;
246 }
247#endif
248 // We don't know how many children we have so we'll move ten
249 // at a time. Not very nice, I know.
250 WinQueryWindowPos(hwnd, &(swp[i]));
251
252 // The SWP flags are all set but PM will ignore any
253 // superflous ones, so keep them as they contain useful
254 // minimise and maximise flags.
255 swp[i].y += yDelta;
256
257 if (i == 9)
258 {
259 WinSetMultWindowPos(GetThreadHAB(), swp, 10);
260 i = 0;
261 }
262 else
263 {
264 i++;
265 }
266 }
267
268 WinEndEnumWindows(henum);
269
270 // Any remaining windows?
271 if (i)
272 WinSetMultWindowPos(GetThreadHAB(), swp, i);
273 }
274 win32wnd->MsgPosChanged((LPARAM)&wp);
275
276 break;
277 }
278
279 case WM_ERASEBACKGROUND:
280 {
281 break;
282 }
283 case WM_SIZE:
284 {
285 break;
286 }
287
288 case WM_ACTIVATE:
289 {
290 HWND hwndActivate = (HWND)mp1;
291
292 dprintf(("OS2: WM_ACTIVATE %x", hwnd));
293 if(WinQueryWindowULong(hwndActivate, OFFSET_WIN32PM_MAGIC) != WIN32PM_MAGIC) {
294 //another (non-win32) application's window
295 //set to NULL (allowed according to win32 SDK) to avoid problems
296 hwndActivate = NULL;
297 }
298 if(win32wnd->MsgActivate(1, hwndActivate)) {
299 goto RunDefWndProc;
300 }
301 break;
302 }
303 case WM_FOCUSCHANGE:
304 dprintf(("OS2: WM_FOCUSCHANGE %x", hwnd));
305 goto RunDefWndProc;
306
307 case WM_SETFOCUS:
308 {
309 HWND hwndFocus = (HWND)mp1;
310
311 dprintf(("OS2: WM_SETFOCUS %x %d", hwnd, mp2));
312 if(WinQueryWindowULong(hwndFocus, OFFSET_WIN32PM_MAGIC) != WIN32PM_MAGIC) {
313 //another (non-win32) application's window
314 //set to NULL (allowed according to win32 SDK) to avoid problems
315 hwndFocus = NULL;
316 }
317 if((ULONG)mp2 == TRUE) {
318 rc = win32wnd->MsgSetFocus(hwndFocus);
319 }
320 else rc = win32wnd->MsgKillFocus(hwndFocus);
321 if(rc) {
322 goto RunDefWndProc;
323 }
324 break;
325 }
326 //**************************************************************************
327 //Mouse messages (OS/2 Window coordinates -> Win32 coordinates relative to screen
328 //**************************************************************************
329 case WM_BUTTON1DOWN:
330 dprintf(("OS2: WM_BUTTON1DOWN %x", hwnd));
331 point.x = (*(POINTS *)&mp1).x;
332 point.y = (*(POINTS *)&mp1).y;
333 ClientPoint.x = point.x;
334 ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
335 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
336 if(win32wnd->MsgButton(BUTTON_LEFTDOWN, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
337 goto RunDefWndProc;
338 }
339 break;
340
341 case WM_BUTTON1UP:
342 dprintf(("OS2: WM_BUTTON1UP %x", hwnd));
343 point.x = (*(POINTS *)&mp1).x;
344 point.y = (*(POINTS *)&mp1).y;
345 ClientPoint.x = point.x;
346 ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
347 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
348 if(win32wnd->MsgButton(BUTTON_LEFTUP, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
349 goto RunDefWndProc;
350 }
351 break;
352 case WM_BUTTON1DBLCLK:
353 point.x = (*(POINTS *)&mp1).x;
354 point.y = (*(POINTS *)&mp1).y;
355 ClientPoint.x = point.x;
356 ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
357 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
358 if(win32wnd->MsgButton(BUTTON_LEFTDBLCLICK, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
359 goto RunDefWndProc;
360 }
361 break;
362 case WM_BUTTON2DOWN:
363 point.x = (*(POINTS *)&mp1).x;
364 point.y = (*(POINTS *)&mp1).y;
365 ClientPoint.x = point.x;
366 ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
367 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
368 if(win32wnd->MsgButton(BUTTON_RIGHTDOWN, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
369 goto RunDefWndProc;
370 }
371 break;
372 case WM_BUTTON2UP:
373 point.x = (*(POINTS *)&mp1).x;
374 point.y = (*(POINTS *)&mp1).y;
375 ClientPoint.x = point.x;
376 ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
377 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
378 if(win32wnd->MsgButton(BUTTON_RIGHTUP, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
379 goto RunDefWndProc;
380 }
381 break;
382 case WM_BUTTON2DBLCLK:
383 point.x = (*(POINTS *)&mp1).x;
384 point.y = (*(POINTS *)&mp1).y;
385 ClientPoint.x = point.x;
386 ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
387 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
388 if(win32wnd->MsgButton(BUTTON_RIGHTDBLCLICK, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
389 goto RunDefWndProc;
390 }
391 break;
392 case WM_BUTTON3DOWN:
393 point.x = (*(POINTS *)&mp1).x;
394 point.y = (*(POINTS *)&mp1).y;
395 ClientPoint.x = point.x;
396 ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
397 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
398 if(win32wnd->MsgButton(BUTTON_MIDDLEDOWN, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
399 goto RunDefWndProc;
400 }
401 break;
402 case WM_BUTTON3UP:
403 point.x = (*(POINTS *)&mp1).x;
404 point.y = (*(POINTS *)&mp1).y;
405 ClientPoint.x = point.x;
406 ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
407 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
408 if(win32wnd->MsgButton(BUTTON_MIDDLEUP, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
409 goto RunDefWndProc;
410 }
411 break;
412 case WM_BUTTON3DBLCLK:
413 point.x = (*(POINTS *)&mp1).x;
414 point.y = (*(POINTS *)&mp1).y;
415 ClientPoint.x = point.x;
416 ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
417 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
418 if(win32wnd->MsgButton(BUTTON_MIDDLEDBLCLICK, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
419 goto RunDefWndProc;
420 }
421 break;
422
423 case WM_BUTTON2MOTIONSTART:
424 case WM_BUTTON2MOTIONEND:
425 case WM_BUTTON2CLICK:
426 case WM_BUTTON1MOTIONSTART:
427 case WM_BUTTON1MOTIONEND:
428 case WM_BUTTON1CLICK:
429 case WM_BUTTON3MOTIONSTART:
430 case WM_BUTTON3MOTIONEND:
431 case WM_BUTTON3CLICK:
432 goto RunDefWndProc;
433
434 case WM_MOUSEMOVE:
435 {
436 //Only send this message when the mouse isn't captured
437 if(WinQueryCapture(HWND_DESKTOP) != NULLHANDLE) {
438 goto RunDefWndProc;
439 }
440 ULONG keystate = 0;
441 if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON1))
442 keystate |= WMMOVE_LBUTTON;
443 if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON2))
444 keystate |= WMMOVE_MBUTTON;
445 if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON3))
446 keystate |= WMMOVE_RBUTTON;
447 if(WinGetKeyState(HWND_DESKTOP, VK_SHIFT))
448 keystate |= WMMOVE_SHIFT;
449 if(WinGetKeyState(HWND_DESKTOP, VK_CTRL))
450 keystate |= WMMOVE_CTRL;
451
452 //OS/2 Window coordinates -> Win32 Window coordinates
453 //TODO: What do windows apps that handle this messages return?
454 if(!win32wnd->MsgMouseMove(keystate, SHORT1FROMMP(mp1), MapOS2ToWin32Y(win32wnd, SHORT2FROMMP(mp1)))) {
455 goto RunDefWndProc;
456 }
457 break;
458 }
459
460 //**************************************************************************
461 //Slider messages
462 //**************************************************************************
463 case WM_VSCROLL:
464 case WM_HSCROLL:
465
466 case WM_CONTROL:
467
468 case WM_COMMAND:
469 if(SHORT1FROMMP(mp2) == CMDSRC_MENU) {
470 win32wnd->MsgCommand(CMD_MENU, SHORT1FROMMP(mp1), 0);
471 }
472 if(SHORT1FROMMP(mp2) == CMDSRC_ACCELERATOR) {
473 win32wnd->MsgCommand(CMD_ACCELERATOR, SHORT1FROMMP(mp1), 0);
474 }
475 //todo controls + accelerators
476 break;
477
478 case WM_SYSCOMMAND:
479 {
480 ULONG x = 0, y = 0;
481 ULONG win32sc;
482
483 if(SHORT2FROMMP(mp2) == TRUE) {//syscommand caused by mouse action
484 POINTL pointl;
485 WinQueryPointerPos(HWND_DESKTOP, &pointl);
486 x = pointl.x;
487 y = ScreenHeight - y;
488 }
489 switch(SHORT1FROMMP(mp1)) {
490 case SC_MOVE:
491 win32sc = WIN32SC_MOVE;
492 break;
493 case SC_CLOSE:
494 win32sc = WIN32SC_CLOSE;
495 break;
496 case SC_MAXIMIZE:
497 win32sc = WIN32SC_MAXIMIZE;
498 break;
499 case SC_MINIMIZE:
500 win32sc = WIN32SC_MINIMIZE;
501 break;
502 case SC_NEXTFRAME:
503 case SC_NEXTWINDOW:
504 win32sc = WIN32SC_NEXTWINDOW;
505 break;
506 case SC_RESTORE:
507 win32sc = WIN32SC_RESTORE;
508 break;
509 case SC_TASKMANAGER:
510 win32sc = WIN32SC_TASKLIST;
511 break;
512 default:
513 goto RunDefWndProc;
514 }
515 dprintf(("WM_SYSCOMMAND %x %x (%d,%d)", hwnd, win32sc, x, y));
516 if(win32wnd->MsgSysCommand(win32sc, x, y)) {
517 goto RunDefWndProc;
518 }
519 break;
520 }
521 case WM_CHAR:
522 {
523 ULONG keyflags = 0, vkey = 0;
524 ULONG fl = SHORT1FROMMP(mp1);
525
526 if(!(fl & KC_CHAR)) {
527 dprintf(("WM_CHAR: no valid character code"));
528 goto RunDefWndProc;
529 }
530 if(fl & KC_VIRTUALKEY) {
531 vkey = SHORT2FROMMP(mp2);
532 }
533 if(fl & KC_KEYUP) {
534 keyflags |= KEY_UP;
535 }
536 if(fl & KC_ALT) {
537 keyflags |= KEY_ALTDOWN;
538 }
539 if(fl & KC_PREVDOWN) {
540 keyflags |= KEY_PREVDOWN;
541 }
542 if(fl & KC_DEADKEY) {
543 keyflags |= KEY_DEADKEY;
544 }
545 if(win32wnd->MsgChar(SHORT1FROMMP(mp2), CHAR3FROMMP(mp1), CHAR4FROMMP(mp1), vkey, keyflags)) {
546 goto RunDefWndProc;
547 }
548 break;
549 }
550 case WM_INITMENU:
551 case WM_MENUSELECT:
552 case WM_MENUEND:
553 case WM_NEXTMENU:
554
555 case WM_TIMER:
556 goto RunDefWndProc;
557
558 case WM_SETWINDOWPARAMS:
559 {
560 WNDPARAMS *wndParams = (WNDPARAMS *)mp1;
561
562 dprintf(("OS2: WM_SETWINDOWPARAMS %x", hwnd));
563 if(wndParams->fsStatus & WPM_TEXT) {
564 if(win32wnd->MsgSetText(wndParams->pszText, wndParams->cchText)) {
565 goto RunDefWndProc;
566 }
567 }
568 goto RunDefWndProc;
569 }
570
571 case WM_QUERYWINDOWPARAMS:
572 {
573 PWNDPARAMS wndpars = (PWNDPARAMS)mp1;
574 ULONG textlen;
575 PSZ wintext;
576
577 if(wndpars->fsStatus & (WPM_CCHTEXT | WPM_TEXT)) {
578 if(wndpars->fsStatus & WPM_CCHTEXT)
579 wndpars->cchText = win32wnd->MsgGetTextLength();
580 if(wndpars->fsStatus & WPM_TEXT)
581 wndpars->pszText = win32wnd->MsgGetText();
582 return (MRESULT)TRUE;
583 }
584 goto RunDefWndProc;
585 }
586
587 case WM_PAINT:
588 dprintf(("OS2: WM_PAINT %x", hwnd));
589 if(win32wnd->MsgPaint(0, 0)) {
590 goto RunDefWndProc;
591 }
592 break;
593
594 case WM_HITTEST:
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;
603 break;
604
605 case WM_SYSCOLORCHANGE:
606 case WM_SYSVALUECHANGED:
607 case WM_CALCVALIDRECTS:
608 case WM_SETSELECTION:
609 case WM_PPAINT:
610 case WM_PSETFOCUS:
611 case WM_PSYSCOLORCHANGE:
612 case WM_PSIZE:
613 case WM_PACTIVATE:
614 case WM_PCONTROL:
615 case WM_HELP:
616 case WM_APPTERMINATENOTIFY:
617 case WM_PRESPARAMCHANGED:
618 case WM_DRAWITEM:
619 case WM_MEASUREITEM:
620 case WM_CONTROLPOINTER:
621 case WM_QUERYDLGCODE:
622 case WM_SUBSTITUTESTRING:
623 case WM_MATCHMNEMONIC:
624 case WM_SAVEAPPLICATION:
625 case WM_SEMANTICEVENT:
626 default:
627// dprintf(("OS2: RunDefWndProc msg %x for %x", msg, hwnd));
628 RestoreOS2TIB();
629 return WinDefWindowProc( hwnd, msg, mp1, mp2 );
630 }
631 RestoreOS2TIB();
632 return (MRESULT)FALSE;
633
634RunDefWndProc:
635// dprintf(("OS2: RunDefWndProc msg %x for %x", msg, hwnd));
636 RestoreOS2TIB();
637 return WinDefWindowProc( hwnd, msg, mp1, mp2 );
638} /* End of Win32WindowProc */
639//******************************************************************************
640//******************************************************************************
Note: See TracBrowser for help on using the repository browser.