source: trunk/src/user32/pmwindow.cpp@ 949

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

Moved new user32 here

File size: 20.5 KB
Line 
1/* $Id: pmwindow.cpp,v 1.1 1999-09-15 23:18:55 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// win32wnd->RemoveFakeOpen32();
134 if(win32wnd->MsgClose()) {
135 goto RunDefWndProc;
136 }
137 break;
138
139 case WM_DESTROY:
140 dprintf(("OS2: WM_DESTROY %x", hwnd));
141 if(win32wnd->MsgDestroy()) {
142 goto RunDefWndProc;
143 }
144 break;
145
146 case WM_ENABLE:
147 dprintf(("OS2: WM_ENABLE %x", hwnd));
148 if(win32wnd->MsgEnable((ULONG)mp1)) {
149 goto RunDefWndProc;
150 }
151 break;
152
153 case WM_SHOW:
154 dprintf(("OS2: WM_SHOW %x", hwnd));
155 if(win32wnd->MsgShow((ULONG)mp1)) {
156 goto RunDefWndProc;
157 }
158 break;
159
160 case WM_ADJUSTWINDOWPOS:
161 {
162 PSWP pswp = (PSWP)mp1;
163 SWP swpOld;
164 WINDOWPOS wp;
165 ULONG parentHeight = 0;
166 HWND hParent = NULLHANDLE, hFrame = NULLHANDLE;
167
168 dprintf(("OS2: WM_ADJUSTWINDOWPOS %x %x (%d,%d) (%d,%d)", hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
169
170 if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0) break;
171
172 WinQueryWindowPos(hwnd, &swpOld);
173
174 if(pswp->fl & (SWP_MOVE | SWP_SIZE)) {
175 if (win32wnd->isChild())
176 hParent = win32wnd->getParent()->getOS2WindowHandle();
177 else
178 hFrame = win32wnd->getOS2FrameWindowHandle();
179 }
180 OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, hParent, hFrame);
181
182 wp.hwnd = win32wnd->getWindowHandle();
183 if ((pswp->fl & SWP_ZORDER) && (pswp->hwndInsertBehind > HWND_BOTTOM))
184 {
185 Win32BaseWindow *wndAfter = Win32BaseWindow::GetWindowFromOS2Handle(pswp->hwndInsertBehind);
186 if(wndAfter) wp.hwndInsertAfter = wndAfter->getWindowHandle();
187 }
188 win32wnd->MsgPosChanging((LPARAM)&wp);
189 break;
190 }
191
192 case WM_WINDOWPOSCHANGED:
193 {
194 PSWP pswp = (PSWP)mp1;
195 PSWP pswpo = pswp + 1;
196 WINDOWPOS wp;
197 ULONG parentHeight = 0;
198 HWND hParent = NULLHANDLE, hFrame = NULLHANDLE;
199 LONG yDelta = pswp->cy - pswpo->cy;
200 ULONG classStyle;
201
202 dprintf(("OS2: WM_WINDOWPOSCHANGED %x %x (%d,%d) (%d,%d)", hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
203
204 if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0) break;
205
206 if(pswp->fl & (SWP_MOVE | SWP_SIZE)) {
207 if (win32wnd->isChild())
208 hParent = win32wnd->getParent()->getOS2WindowHandle();
209 else
210 hFrame = win32wnd->getOS2FrameWindowHandle();
211 }
212 OSLibMapSWPtoWINDOWPOS(pswp, &wp, pswpo, hParent, hFrame);
213
214 win32wnd->setWindowRect(wp.x, wp.y, wp.x + wp.cx, wp.y + wp.cy);
215 win32wnd->setClientRect(pswpo->x, pswpo->y, pswpo->x + pswpo->cx, pswpo->y + pswpo->cy);
216
217 wp.hwnd = win32wnd->getWindowHandle();
218 if ((pswp->fl & SWP_ZORDER) && (pswp->hwndInsertBehind > HWND_BOTTOM))
219 {
220 Win32BaseWindow *wndAfter = Win32BaseWindow::GetWindowFromOS2Handle(pswp->hwndInsertBehind);
221 wp.hwndInsertAfter = wndAfter->getWindowHandle();
222 }
223 classStyle = win32wnd->getClass()->getStyle();
224// if (yDelta != 0)
225 if ((yDelta != 0) && ((classStyle & CS_VREDRAW_W) ||
226 ((classStyle & CS_HREDRAW_W) && (pswp->cx != pswpo->cx))))
227 {
228 HENUM henum = WinBeginEnumWindows(pswp->hwnd);
229 SWP swp[10];
230 int i = 0;
231 HWND hwnd;
232
233 dprintf(("move children"));
234 while ((hwnd = WinGetNextWindow(henum)) != NULLHANDLE)
235 {
236#if 0
237 /* Do not move MDI clients. MDI clients are a special case,
238 * even though they are bottom aligned they are always supposed
239 * to be the same size as their parent. This code is an
240 * optimization and will not work correctly if the this
241 * assumption is incorrect.
242 */
243 WinBase *pBase = (WinBase *)WinQueryDAXData( hwnd );
244 if ( pBase && pBase->typeOf() == mdiClient )
245 {
246 continue;
247 }
248#endif
249 // We don't know how many children we have so we'll move ten
250 // at a time. Not very nice, I know.
251 WinQueryWindowPos(hwnd, &(swp[i]));
252
253 // The SWP flags are all set but PM will ignore any
254 // superflous ones, so keep them as they contain useful
255 // minimise and maximise flags.
256 swp[i].y += yDelta;
257
258 if (i == 9)
259 {
260 WinSetMultWindowPos(GetThreadHAB(), swp, 10);
261 i = 0;
262 }
263 else
264 {
265 i++;
266 }
267 }
268
269 WinEndEnumWindows(henum);
270
271 // Any remaining windows?
272 if (i)
273 WinSetMultWindowPos(GetThreadHAB(), swp, i);
274 }
275 win32wnd->MsgPosChanged((LPARAM)&wp);
276
277 break;
278 }
279
280 case WM_ERASEBACKGROUND:
281 {
282 break;
283 }
284 case WM_SIZE:
285 {
286 break;
287 }
288
289 case WM_ACTIVATE:
290 {
291 HWND hwndActivate = (HWND)mp1;
292
293 dprintf(("OS2: WM_ACTIVATE %x", hwnd));
294 if(WinQueryWindowULong(hwndActivate, OFFSET_WIN32PM_MAGIC) != WIN32PM_MAGIC) {
295 //another (non-win32) application's window
296 //set to NULL (allowed according to win32 SDK) to avoid problems
297 hwndActivate = NULL;
298 }
299 if(win32wnd->MsgActivate(1, hwndActivate)) {
300 goto RunDefWndProc;
301 }
302 break;
303 }
304 case WM_FOCUSCHANGE:
305 dprintf(("OS2: WM_FOCUSCHANGE %x", hwnd));
306 goto RunDefWndProc;
307
308 case WM_SETFOCUS:
309 {
310 HWND hwndFocus = (HWND)mp1;
311
312 dprintf(("OS2: WM_SETFOCUS %x %d", hwnd, mp2));
313 if(WinQueryWindowULong(hwndFocus, OFFSET_WIN32PM_MAGIC) != WIN32PM_MAGIC) {
314 //another (non-win32) application's window
315 //set to NULL (allowed according to win32 SDK) to avoid problems
316 hwndFocus = NULL;
317 }
318 if((ULONG)mp2 == TRUE) {
319 rc = win32wnd->MsgSetFocus(hwndFocus);
320 }
321 else rc = win32wnd->MsgKillFocus(hwndFocus);
322 if(rc) {
323 goto RunDefWndProc;
324 }
325 break;
326 }
327 //**************************************************************************
328 //Mouse messages (OS/2 Window coordinates -> Win32 coordinates relative to screen
329 //**************************************************************************
330 case WM_BUTTON1DOWN:
331 dprintf(("OS2: WM_BUTTON1DOWN %x", hwnd));
332 point.x = (*(POINTS *)&mp1).x;
333 point.y = (*(POINTS *)&mp1).y;
334 ClientPoint.x = point.x;
335 ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
336 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
337 if(win32wnd->MsgButton(BUTTON_LEFTDOWN, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
338 goto RunDefWndProc;
339 }
340 break;
341
342 case WM_BUTTON1UP:
343 dprintf(("OS2: WM_BUTTON1UP %x", hwnd));
344 point.x = (*(POINTS *)&mp1).x;
345 point.y = (*(POINTS *)&mp1).y;
346 ClientPoint.x = point.x;
347 ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
348 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
349 if(win32wnd->MsgButton(BUTTON_LEFTUP, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
350 goto RunDefWndProc;
351 }
352 break;
353 case WM_BUTTON1DBLCLK:
354 point.x = (*(POINTS *)&mp1).x;
355 point.y = (*(POINTS *)&mp1).y;
356 ClientPoint.x = point.x;
357 ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
358 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
359 if(win32wnd->MsgButton(BUTTON_LEFTDBLCLICK, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
360 goto RunDefWndProc;
361 }
362 break;
363 case WM_BUTTON2DOWN:
364 point.x = (*(POINTS *)&mp1).x;
365 point.y = (*(POINTS *)&mp1).y;
366 ClientPoint.x = point.x;
367 ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
368 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
369 if(win32wnd->MsgButton(BUTTON_RIGHTDOWN, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
370 goto RunDefWndProc;
371 }
372 break;
373 case WM_BUTTON2UP:
374 point.x = (*(POINTS *)&mp1).x;
375 point.y = (*(POINTS *)&mp1).y;
376 ClientPoint.x = point.x;
377 ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
378 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
379 if(win32wnd->MsgButton(BUTTON_RIGHTUP, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
380 goto RunDefWndProc;
381 }
382 break;
383 case WM_BUTTON2DBLCLK:
384 point.x = (*(POINTS *)&mp1).x;
385 point.y = (*(POINTS *)&mp1).y;
386 ClientPoint.x = point.x;
387 ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
388 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
389 if(win32wnd->MsgButton(BUTTON_RIGHTDBLCLICK, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
390 goto RunDefWndProc;
391 }
392 break;
393 case WM_BUTTON3DOWN:
394 point.x = (*(POINTS *)&mp1).x;
395 point.y = (*(POINTS *)&mp1).y;
396 ClientPoint.x = point.x;
397 ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
398 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
399 if(win32wnd->MsgButton(BUTTON_MIDDLEDOWN, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
400 goto RunDefWndProc;
401 }
402 break;
403 case WM_BUTTON3UP:
404 point.x = (*(POINTS *)&mp1).x;
405 point.y = (*(POINTS *)&mp1).y;
406 ClientPoint.x = point.x;
407 ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
408 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
409 if(win32wnd->MsgButton(BUTTON_MIDDLEUP, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
410 goto RunDefWndProc;
411 }
412 break;
413 case WM_BUTTON3DBLCLK:
414 point.x = (*(POINTS *)&mp1).x;
415 point.y = (*(POINTS *)&mp1).y;
416 ClientPoint.x = point.x;
417 ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
418 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
419 if(win32wnd->MsgButton(BUTTON_MIDDLEDBLCLICK, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
420 goto RunDefWndProc;
421 }
422 break;
423
424 case WM_BUTTON2MOTIONSTART:
425 case WM_BUTTON2MOTIONEND:
426 case WM_BUTTON2CLICK:
427 case WM_BUTTON1MOTIONSTART:
428 case WM_BUTTON1MOTIONEND:
429 case WM_BUTTON1CLICK:
430 case WM_BUTTON3MOTIONSTART:
431 case WM_BUTTON3MOTIONEND:
432 case WM_BUTTON3CLICK:
433 goto RunDefWndProc;
434
435 case WM_MOUSEMOVE:
436 {
437 //Only send this message when the mouse isn't captured
438 if(WinQueryCapture(HWND_DESKTOP) != NULLHANDLE) {
439 goto RunDefWndProc;
440 }
441 ULONG keystate = 0;
442 if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON1))
443 keystate |= WMMOVE_LBUTTON;
444 if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON2))
445 keystate |= WMMOVE_MBUTTON;
446 if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON3))
447 keystate |= WMMOVE_RBUTTON;
448 if(WinGetKeyState(HWND_DESKTOP, VK_SHIFT))
449 keystate |= WMMOVE_SHIFT;
450 if(WinGetKeyState(HWND_DESKTOP, VK_CTRL))
451 keystate |= WMMOVE_CTRL;
452
453 //OS/2 Window coordinates -> Win32 Window coordinates
454 //TODO: What do windows apps that handle this messages return?
455 if(!win32wnd->MsgMouseMove(keystate, SHORT1FROMMP(mp1), MapOS2ToWin32Y(win32wnd, SHORT2FROMMP(mp1)))) {
456 goto RunDefWndProc;
457 }
458 break;
459 }
460
461 //**************************************************************************
462 //Slider messages
463 //**************************************************************************
464 case WM_VSCROLL:
465 case WM_HSCROLL:
466
467 case WM_CONTROL:
468
469 case WM_COMMAND:
470 if(SHORT1FROMMP(mp2) == CMDSRC_MENU) {
471 win32wnd->MsgCommand(CMD_MENU, SHORT1FROMMP(mp1), 0);
472 }
473 if(SHORT1FROMMP(mp2) == CMDSRC_ACCELERATOR) {
474 win32wnd->MsgCommand(CMD_ACCELERATOR, SHORT1FROMMP(mp1), 0);
475 }
476 //todo controls + accelerators
477 break;
478
479 case WM_SYSCOMMAND:
480 {
481 ULONG x = 0, y = 0;
482 ULONG win32sc;
483
484 if(SHORT2FROMMP(mp2) == TRUE) {//syscommand caused by mouse action
485 POINTL pointl;
486 WinQueryPointerPos(HWND_DESKTOP, &pointl);
487 x = pointl.x;
488 y = ScreenHeight - y;
489 }
490 switch(SHORT1FROMMP(mp1)) {
491 case SC_MOVE:
492 win32sc = WIN32SC_MOVE;
493 break;
494 case SC_CLOSE:
495 win32sc = WIN32SC_CLOSE;
496 break;
497 case SC_MAXIMIZE:
498 win32sc = WIN32SC_MAXIMIZE;
499 break;
500 case SC_MINIMIZE:
501 win32sc = WIN32SC_MINIMIZE;
502 break;
503 case SC_NEXTFRAME:
504 case SC_NEXTWINDOW:
505 win32sc = WIN32SC_NEXTWINDOW;
506 break;
507 case SC_RESTORE:
508 win32sc = WIN32SC_RESTORE;
509 break;
510 case SC_TASKMANAGER:
511 win32sc = WIN32SC_TASKLIST;
512 break;
513 default:
514 goto RunDefWndProc;
515 }
516 dprintf(("WM_SYSCOMMAND %x %x (%d,%d)", hwnd, win32sc, x, y));
517 if(win32wnd->MsgSysCommand(win32sc, x, y)) {
518 goto RunDefWndProc;
519 }
520 break;
521 }
522 case WM_CHAR:
523 {
524 ULONG keyflags = 0, vkey = 0;
525 ULONG fl = SHORT1FROMMP(mp1);
526
527 if(!(fl & KC_CHAR)) {
528// dprintf(("WM_CHAR: no valid character code"));
529 goto RunDefWndProc;
530 }
531 if(fl & KC_VIRTUALKEY) {
532 vkey = SHORT2FROMMP(mp2);
533 }
534 if(fl & KC_KEYUP) {
535 keyflags |= KEY_UP;
536 }
537 if(fl & KC_ALT) {
538 keyflags |= KEY_ALTDOWN;
539 }
540 if(fl & KC_PREVDOWN) {
541 keyflags |= KEY_PREVDOWN;
542 }
543 if(fl & KC_DEADKEY) {
544 keyflags |= KEY_DEADKEY;
545 }
546 if(win32wnd->MsgChar(SHORT1FROMMP(mp2), CHAR3FROMMP(mp1), CHAR4FROMMP(mp1), vkey, keyflags)) {
547 goto RunDefWndProc;
548 }
549 break;
550 }
551 case WM_INITMENU:
552 case WM_MENUSELECT:
553 case WM_MENUEND:
554 case WM_NEXTMENU:
555
556 case WM_TIMER:
557 goto RunDefWndProc;
558
559 case WM_SETWINDOWPARAMS:
560 {
561 WNDPARAMS *wndParams = (WNDPARAMS *)mp1;
562
563 dprintf(("OS2: WM_SETWINDOWPARAMS %x", hwnd));
564 if(wndParams->fsStatus & WPM_TEXT) {
565 if(win32wnd->MsgSetText(wndParams->pszText, wndParams->cchText)) {
566 goto RunDefWndProc;
567 }
568 }
569 goto RunDefWndProc;
570 }
571
572 case WM_QUERYWINDOWPARAMS:
573 {
574 PWNDPARAMS wndpars = (PWNDPARAMS)mp1;
575 ULONG textlen;
576 PSZ wintext;
577
578 if(wndpars->fsStatus & (WPM_CCHTEXT | WPM_TEXT)) {
579 if(wndpars->fsStatus & WPM_CCHTEXT)
580 wndpars->cchText = win32wnd->MsgGetTextLength();
581 if(wndpars->fsStatus & WPM_TEXT)
582 wndpars->pszText = win32wnd->MsgGetText();
583 return (MRESULT)TRUE;
584 }
585 goto RunDefWndProc;
586 }
587
588 case WM_PAINT:
589 dprintf(("OS2: WM_PAINT %x", hwnd));
590 if(win32wnd->MsgPaint(0, 0)) {
591 goto RunDefWndProc;
592 }
593 break;
594
595 case WM_HITTEST:
596 // Only send this message if the window is enabled
597 if (WinIsWindowEnabled(hwnd))
598 {
599 if(win32wnd->MsgHitTest((*(POINTS *)&mp1).x, MapOS2ToWin32Y(OSLIB_HWND_DESKTOP, hwnd, (*(POINTS *)&mp1).y))) {
600 goto RunDefWndProc;
601 }
602 }
603 else goto RunDefWndProc;
604 break;
605
606 case WM_SYSCOLORCHANGE:
607 case WM_SYSVALUECHANGED:
608 case WM_CALCVALIDRECTS:
609 case WM_SETSELECTION:
610 case WM_PPAINT:
611 case WM_PSETFOCUS:
612 case WM_PSYSCOLORCHANGE:
613 case WM_PSIZE:
614 case WM_PACTIVATE:
615 case WM_PCONTROL:
616 case WM_HELP:
617 case WM_APPTERMINATENOTIFY:
618 case WM_PRESPARAMCHANGED:
619 case WM_DRAWITEM:
620 case WM_MEASUREITEM:
621 case WM_CONTROLPOINTER:
622 case WM_QUERYDLGCODE:
623 case WM_SUBSTITUTESTRING:
624 case WM_MATCHMNEMONIC:
625 case WM_SAVEAPPLICATION:
626 case WM_SEMANTICEVENT:
627 default:
628// dprintf(("OS2: RunDefWndProc msg %x for %x", msg, hwnd));
629 RestoreOS2TIB();
630 return WinDefWindowProc( hwnd, msg, mp1, mp2 );
631 }
632 RestoreOS2TIB();
633 return (MRESULT)FALSE;
634
635RunDefWndProc:
636// dprintf(("OS2: RunDefWndProc msg %x for %x", msg, hwnd));
637 RestoreOS2TIB();
638 return WinDefWindowProc( hwnd, msg, mp1, mp2 );
639} /* End of Win32WindowProc */
640//******************************************************************************
641//******************************************************************************
Note: See TracBrowser for help on using the repository browser.