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

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

Edgar Buerkle's fixes for GetDesktopWindow, icons + WM_TIMER support

File size: 20.6 KB
Line 
1/* $Id: pmwindow.cpp,v 1.3 1999-09-21 08:24:04 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 if(win32wnd->MsgEraseBackGround(0)) {
283 goto RunDefWndProc;
284 }
285 break;
286 }
287 case WM_SIZE:
288 {
289 break;
290 }
291
292 case WM_ACTIVATE:
293 {
294 HWND hwndActivate = (HWND)mp1;
295
296 dprintf(("OS2: WM_ACTIVATE %x", hwnd));
297 if(WinQueryWindowULong(hwndActivate, 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 hwndActivate = NULL;
301 }
302 if(win32wnd->MsgActivate(1, hwndActivate)) {
303 goto RunDefWndProc;
304 }
305 break;
306 }
307 case WM_FOCUSCHANGE:
308 dprintf(("OS2: WM_FOCUSCHANGE %x", hwnd));
309 goto RunDefWndProc;
310
311 case WM_SETFOCUS:
312 {
313 HWND hwndFocus = (HWND)mp1;
314
315 dprintf(("OS2: WM_SETFOCUS %x %d", hwnd, mp2));
316 if(WinQueryWindowULong(hwndFocus, OFFSET_WIN32PM_MAGIC) != WIN32PM_MAGIC) {
317 //another (non-win32) application's window
318 //set to NULL (allowed according to win32 SDK) to avoid problems
319 hwndFocus = NULL;
320 }
321 if((ULONG)mp2 == TRUE) {
322 rc = win32wnd->MsgSetFocus(hwndFocus);
323 }
324 else rc = win32wnd->MsgKillFocus(hwndFocus);
325 if(rc) {
326 goto RunDefWndProc;
327 }
328 break;
329 }
330 //**************************************************************************
331 //Mouse messages (OS/2 Window coordinates -> Win32 coordinates relative to screen
332 //**************************************************************************
333 case WM_BUTTON1DOWN:
334 dprintf(("OS2: WM_BUTTON1DOWN %x", hwnd));
335 point.x = (*(POINTS *)&mp1).x;
336 point.y = (*(POINTS *)&mp1).y;
337 ClientPoint.x = point.x;
338 ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
339 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
340 if(win32wnd->MsgButton(BUTTON_LEFTDOWN, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
341 goto RunDefWndProc;
342 }
343 break;
344
345 case WM_BUTTON1UP:
346 dprintf(("OS2: WM_BUTTON1UP %x", hwnd));
347 point.x = (*(POINTS *)&mp1).x;
348 point.y = (*(POINTS *)&mp1).y;
349 ClientPoint.x = point.x;
350 ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
351 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
352 if(win32wnd->MsgButton(BUTTON_LEFTUP, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
353 goto RunDefWndProc;
354 }
355 break;
356 case WM_BUTTON1DBLCLK:
357 point.x = (*(POINTS *)&mp1).x;
358 point.y = (*(POINTS *)&mp1).y;
359 ClientPoint.x = point.x;
360 ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
361 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
362 if(win32wnd->MsgButton(BUTTON_LEFTDBLCLICK, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
363 goto RunDefWndProc;
364 }
365 break;
366 case WM_BUTTON2DOWN:
367 point.x = (*(POINTS *)&mp1).x;
368 point.y = (*(POINTS *)&mp1).y;
369 ClientPoint.x = point.x;
370 ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
371 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
372 if(win32wnd->MsgButton(BUTTON_RIGHTDOWN, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
373 goto RunDefWndProc;
374 }
375 break;
376 case WM_BUTTON2UP:
377 point.x = (*(POINTS *)&mp1).x;
378 point.y = (*(POINTS *)&mp1).y;
379 ClientPoint.x = point.x;
380 ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
381 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
382 if(win32wnd->MsgButton(BUTTON_RIGHTUP, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
383 goto RunDefWndProc;
384 }
385 break;
386 case WM_BUTTON2DBLCLK:
387 point.x = (*(POINTS *)&mp1).x;
388 point.y = (*(POINTS *)&mp1).y;
389 ClientPoint.x = point.x;
390 ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
391 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
392 if(win32wnd->MsgButton(BUTTON_RIGHTDBLCLICK, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
393 goto RunDefWndProc;
394 }
395 break;
396 case WM_BUTTON3DOWN:
397 point.x = (*(POINTS *)&mp1).x;
398 point.y = (*(POINTS *)&mp1).y;
399 ClientPoint.x = point.x;
400 ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
401 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
402 if(win32wnd->MsgButton(BUTTON_MIDDLEDOWN, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
403 goto RunDefWndProc;
404 }
405 break;
406 case WM_BUTTON3UP:
407 point.x = (*(POINTS *)&mp1).x;
408 point.y = (*(POINTS *)&mp1).y;
409 ClientPoint.x = point.x;
410 ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
411 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
412 if(win32wnd->MsgButton(BUTTON_MIDDLEUP, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
413 goto RunDefWndProc;
414 }
415 break;
416 case WM_BUTTON3DBLCLK:
417 point.x = (*(POINTS *)&mp1).x;
418 point.y = (*(POINTS *)&mp1).y;
419 ClientPoint.x = point.x;
420 ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
421 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
422 if(win32wnd->MsgButton(BUTTON_MIDDLEDBLCLICK, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
423 goto RunDefWndProc;
424 }
425 break;
426
427 case WM_BUTTON2MOTIONSTART:
428 case WM_BUTTON2MOTIONEND:
429 case WM_BUTTON2CLICK:
430 case WM_BUTTON1MOTIONSTART:
431 case WM_BUTTON1MOTIONEND:
432 case WM_BUTTON1CLICK:
433 case WM_BUTTON3MOTIONSTART:
434 case WM_BUTTON3MOTIONEND:
435 case WM_BUTTON3CLICK:
436 goto RunDefWndProc;
437
438 case WM_MOUSEMOVE:
439 {
440 //Only send this message when the mouse isn't captured
441 if(WinQueryCapture(HWND_DESKTOP) != NULLHANDLE) {
442 goto RunDefWndProc;
443 }
444 ULONG keystate = 0;
445 if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON1))
446 keystate |= WMMOVE_LBUTTON;
447 if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON2))
448 keystate |= WMMOVE_MBUTTON;
449 if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON3))
450 keystate |= WMMOVE_RBUTTON;
451 if(WinGetKeyState(HWND_DESKTOP, VK_SHIFT))
452 keystate |= WMMOVE_SHIFT;
453 if(WinGetKeyState(HWND_DESKTOP, VK_CTRL))
454 keystate |= WMMOVE_CTRL;
455
456 //OS/2 Window coordinates -> Win32 Window coordinates
457 //TODO: What do windows apps that handle this messages return?
458 if(!win32wnd->MsgMouseMove(keystate, SHORT1FROMMP(mp1), MapOS2ToWin32Y(win32wnd, SHORT2FROMMP(mp1)))) {
459 goto RunDefWndProc;
460 }
461 break;
462 }
463
464 //**************************************************************************
465 //Slider messages
466 //**************************************************************************
467 case WM_VSCROLL:
468 case WM_HSCROLL:
469
470 case WM_CONTROL:
471
472 case WM_COMMAND:
473 if(SHORT1FROMMP(mp2) == CMDSRC_MENU) {
474 win32wnd->MsgCommand(CMD_MENU, SHORT1FROMMP(mp1), 0);
475 }
476 if(SHORT1FROMMP(mp2) == CMDSRC_ACCELERATOR) {
477 win32wnd->MsgCommand(CMD_ACCELERATOR, SHORT1FROMMP(mp1), 0);
478 }
479 //todo controls + accelerators
480 break;
481
482 case WM_SYSCOMMAND:
483 {
484 ULONG x = 0, y = 0;
485 ULONG win32sc;
486
487 if(SHORT2FROMMP(mp2) == TRUE) {//syscommand caused by mouse action
488 POINTL pointl;
489 WinQueryPointerPos(HWND_DESKTOP, &pointl);
490 x = pointl.x;
491 y = ScreenHeight - y;
492 }
493 switch(SHORT1FROMMP(mp1)) {
494 case SC_MOVE:
495 win32sc = WIN32SC_MOVE;
496 break;
497 case SC_CLOSE:
498 win32sc = WIN32SC_CLOSE;
499 break;
500 case SC_MAXIMIZE:
501 win32sc = WIN32SC_MAXIMIZE;
502 break;
503 case SC_MINIMIZE:
504 win32sc = WIN32SC_MINIMIZE;
505 break;
506 case SC_NEXTFRAME:
507 case SC_NEXTWINDOW:
508 win32sc = WIN32SC_NEXTWINDOW;
509 break;
510 case SC_RESTORE:
511 win32sc = WIN32SC_RESTORE;
512 break;
513 case SC_TASKMANAGER:
514 win32sc = WIN32SC_TASKLIST;
515 break;
516 default:
517 goto RunDefWndProc;
518 }
519 dprintf(("WM_SYSCOMMAND %x %x (%d,%d)", hwnd, win32sc, x, y));
520 if(win32wnd->MsgSysCommand(win32sc, x, y)) {
521 goto RunDefWndProc;
522 }
523 break;
524 }
525 case WM_CHAR:
526 {
527 ULONG keyflags = 0, vkey = 0;
528 ULONG fl = SHORT1FROMMP(mp1);
529
530 if(!(fl & KC_CHAR)) {
531// dprintf(("WM_CHAR: no valid character code"));
532 goto RunDefWndProc;
533 }
534 if(fl & KC_VIRTUALKEY) {
535 vkey = SHORT2FROMMP(mp2);
536 }
537 if(fl & KC_KEYUP) {
538 keyflags |= KEY_UP;
539 }
540 if(fl & KC_ALT) {
541 keyflags |= KEY_ALTDOWN;
542 }
543 if(fl & KC_PREVDOWN) {
544 keyflags |= KEY_PREVDOWN;
545 }
546 if(fl & KC_DEADKEY) {
547 keyflags |= KEY_DEADKEY;
548 }
549 if(win32wnd->MsgChar(SHORT1FROMMP(mp2), CHAR3FROMMP(mp1), CHAR4FROMMP(mp1), vkey, keyflags)) {
550 goto RunDefWndProc;
551 }
552 break;
553 }
554 case WM_INITMENU:
555 case WM_MENUSELECT:
556 case WM_MENUEND:
557 case WM_NEXTMENU:
558
559 case WM_TIMER:
560 win32wnd->MsgTimer((ULONG)mp1);
561 goto RunDefWndProc;
562
563 case WM_SETWINDOWPARAMS:
564 {
565 WNDPARAMS *wndParams = (WNDPARAMS *)mp1;
566
567 dprintf(("OS2: WM_SETWINDOWPARAMS %x", hwnd));
568 if(wndParams->fsStatus & WPM_TEXT) {
569 if(win32wnd->MsgSetText(wndParams->pszText, wndParams->cchText)) {
570 goto RunDefWndProc;
571 }
572 }
573 goto RunDefWndProc;
574 }
575
576 case WM_QUERYWINDOWPARAMS:
577 {
578 PWNDPARAMS wndpars = (PWNDPARAMS)mp1;
579 ULONG textlen;
580 PSZ wintext;
581
582 if(wndpars->fsStatus & (WPM_CCHTEXT | WPM_TEXT)) {
583 if(wndpars->fsStatus & WPM_CCHTEXT)
584 wndpars->cchText = win32wnd->MsgGetTextLength();
585 if(wndpars->fsStatus & WPM_TEXT)
586 wndpars->pszText = win32wnd->MsgGetText();
587 return (MRESULT)TRUE;
588 }
589 goto RunDefWndProc;
590 }
591
592 case WM_PAINT:
593 dprintf(("OS2: WM_PAINT %x", hwnd));
594 if(win32wnd->MsgPaint(0, 0)) {
595 goto RunDefWndProc;
596 }
597 break;
598
599 case WM_HITTEST:
600 // Only send this message if the window is enabled
601 if (WinIsWindowEnabled(hwnd))
602 {
603 if(win32wnd->MsgHitTest((*(POINTS *)&mp1).x, MapOS2ToWin32Y(OSLIB_HWND_DESKTOP, hwnd, (*(POINTS *)&mp1).y))) {
604 goto RunDefWndProc;
605 }
606 }
607 else goto RunDefWndProc;
608 break;
609
610 case WM_SYSCOLORCHANGE:
611 case WM_SYSVALUECHANGED:
612 case WM_CALCVALIDRECTS:
613 case WM_SETSELECTION:
614 case WM_PPAINT:
615 case WM_PSETFOCUS:
616 case WM_PSYSCOLORCHANGE:
617 case WM_PSIZE:
618 case WM_PACTIVATE:
619 case WM_PCONTROL:
620 case WM_HELP:
621 case WM_APPTERMINATENOTIFY:
622 case WM_PRESPARAMCHANGED:
623 case WM_DRAWITEM:
624 case WM_MEASUREITEM:
625 case WM_CONTROLPOINTER:
626 case WM_QUERYDLGCODE:
627 case WM_SUBSTITUTESTRING:
628 case WM_MATCHMNEMONIC:
629 case WM_SAVEAPPLICATION:
630 case WM_SEMANTICEVENT:
631 default:
632// dprintf(("OS2: RunDefWndProc msg %x for %x", msg, hwnd));
633 RestoreOS2TIB();
634 return WinDefWindowProc( hwnd, msg, mp1, mp2 );
635 }
636 RestoreOS2TIB();
637 return (MRESULT)FALSE;
638
639RunDefWndProc:
640// dprintf(("OS2: RunDefWndProc msg %x for %x", msg, hwnd));
641 RestoreOS2TIB();
642 return WinDefWindowProc( hwnd, msg, mp1, mp2 );
643} /* End of Win32WindowProc */
644//******************************************************************************
645//******************************************************************************
Note: See TracBrowser for help on using the repository browser.