1 | /* $Id: pmframe.cpp,v 1.43 2000-02-20 18:28:32 cbratschi Exp $ */
|
---|
2 | /*
|
---|
3 | * Win32 Frame Managment Code for OS/2
|
---|
4 | *
|
---|
5 | * Copyright 1999 by Christoph Bratschi (cbratschi@datacomm.ch)
|
---|
6 | *
|
---|
7 | *
|
---|
8 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
9 | *
|
---|
10 | */
|
---|
11 |
|
---|
12 | #define INCL_WIN
|
---|
13 | #define INCL_GPI
|
---|
14 |
|
---|
15 | #include <os2wrap.h>
|
---|
16 | #include <stdlib.h>
|
---|
17 | #include <string.h>
|
---|
18 | #include "win32type.h"
|
---|
19 | #include <misc.h>
|
---|
20 | #include <win32wbase.h>
|
---|
21 | #include "wprocess.h"
|
---|
22 | #include "pmframe.h"
|
---|
23 | #include "oslibutil.h"
|
---|
24 | #include "oslibwin.h"
|
---|
25 | #include "caret.h"
|
---|
26 | #include "oslibmsg.h"
|
---|
27 |
|
---|
28 | #define DBG_LOCALLOG DBG_pmframe
|
---|
29 | #include "dbglocal.h"
|
---|
30 |
|
---|
31 | #define PMFRAMELOG
|
---|
32 |
|
---|
33 | //******************************************************************************
|
---|
34 | //******************************************************************************
|
---|
35 | VOID FrameTrackFrame(Win32BaseWindow *win32wnd,DWORD flags)
|
---|
36 | {
|
---|
37 | WinSendMsg(win32wnd->getOS2FrameWindowHandle(),WM_TRACKFRAME,(MPARAM)flags,(MPARAM)0);
|
---|
38 | }
|
---|
39 | //******************************************************************************
|
---|
40 | //******************************************************************************
|
---|
41 | VOID FrameUpdateChildPositions(HWND hwnd)
|
---|
42 | {
|
---|
43 | HENUM henum;
|
---|
44 | HWND hchild;
|
---|
45 | RECTL rectl;
|
---|
46 |
|
---|
47 | henum = WinBeginEnumWindows(hwnd);
|
---|
48 | while ((hchild = WinGetNextWindow(henum)) != NULLHANDLE)
|
---|
49 | {
|
---|
50 | Win32BaseWindow *child = Win32BaseWindow::GetWindowFromOS2FrameHandle(hchild);
|
---|
51 |
|
---|
52 | if (child)
|
---|
53 | {
|
---|
54 | WinQueryWindowRect(child->getOS2FrameWindowHandle(),&rectl);
|
---|
55 | mapOS2ToWin32Rect(child->getOS2FrameWindowHandle(),OSLIB_HWND_DESKTOP,(PRECTLOS2)&rectl,child->getWindowRect());
|
---|
56 | FrameUpdateChildPositions(child->getOS2WindowHandle());
|
---|
57 | }
|
---|
58 | }
|
---|
59 | WinEndEnumWindows(henum);
|
---|
60 | }
|
---|
61 | //******************************************************************************
|
---|
62 | //Win32 frame message handler
|
---|
63 | //******************************************************************************
|
---|
64 | MRESULT EXPENTRY Win32FrameProc(HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2)
|
---|
65 | {
|
---|
66 | Win32BaseWindow *win32wnd;
|
---|
67 | PFNWP OldFrameProc;
|
---|
68 | MRESULT rc;
|
---|
69 | THDB *thdb;
|
---|
70 | MSG *pWinMsg,winMsg;
|
---|
71 |
|
---|
72 | SetWin32TIB();
|
---|
73 |
|
---|
74 | thdb = GetThreadTHDB();
|
---|
75 | win32wnd = Win32BaseWindow::GetWindowFromOS2FrameHandle(hwnd);
|
---|
76 |
|
---|
77 | if (!thdb || (win32wnd == NULL) || !win32wnd->getOldFrameProc())
|
---|
78 | {
|
---|
79 | dprintf(("Invalid win32wnd pointer for frame %x!!", hwnd));
|
---|
80 | goto RunDefWndProc;
|
---|
81 | }
|
---|
82 |
|
---|
83 | if((thdb->msgstate & 1) == 0)
|
---|
84 | {//message that was sent directly to our window proc handler; translate it here
|
---|
85 | QMSG qmsg;
|
---|
86 |
|
---|
87 | qmsg.msg = msg;
|
---|
88 | qmsg.hwnd = hwnd;
|
---|
89 | qmsg.mp1 = mp1;
|
---|
90 | qmsg.mp2 = mp2;
|
---|
91 | qmsg.time = WinQueryMsgTime(thdb->hab);
|
---|
92 | WinQueryMsgPos(thdb->hab, &qmsg.ptl);
|
---|
93 | qmsg.reserved = 0;
|
---|
94 |
|
---|
95 | if(OS2ToWinMsgTranslate((PVOID)thdb, &qmsg, &winMsg, FALSE, MSG_REMOVE) == FALSE)
|
---|
96 | {//message was not translated
|
---|
97 | memset(&winMsg, 0, sizeof(MSG));
|
---|
98 | }
|
---|
99 | pWinMsg = &winMsg;
|
---|
100 | }
|
---|
101 | else {
|
---|
102 | pWinMsg = &thdb->msg;
|
---|
103 | thdb->msgstate++;
|
---|
104 | }
|
---|
105 |
|
---|
106 | OldFrameProc = (PFNWP)win32wnd->getOldFrameProc();
|
---|
107 |
|
---|
108 | switch(msg)
|
---|
109 | {
|
---|
110 | case WM_FORMATFRAME:
|
---|
111 | break;
|
---|
112 |
|
---|
113 | case WM_MINMAXFRAME:
|
---|
114 | {
|
---|
115 | PSWP swp = (PSWP)mp1;
|
---|
116 |
|
---|
117 | if (!win32wnd->IsWindowCreated()) goto RunDefFrameProc;
|
---|
118 | dprintf(("PMFRAME: WM_MINMAXFRAME %x",hwnd));
|
---|
119 | if ((swp->fl & SWP_MAXIMIZE) == SWP_MAXIMIZE)
|
---|
120 | {
|
---|
121 | win32wnd->setStyle((win32wnd->getStyle() & ~WS_MINIMIZE_W) | WS_MAXIMIZE_W);
|
---|
122 |
|
---|
123 | RECT rect;
|
---|
124 |
|
---|
125 | rect.left = rect.top = rect.right = rect.bottom = 0;
|
---|
126 | win32wnd->AdjustMaximizedRect(&rect);
|
---|
127 | swp->x += rect.left;
|
---|
128 | swp->cx += rect.right-rect.left;
|
---|
129 | swp->y -= rect.bottom;
|
---|
130 | swp->cy += rect.bottom-rect.top;
|
---|
131 | }
|
---|
132 | else if ((swp->fl & SWP_MINIMIZE) == SWP_MINIMIZE)
|
---|
133 | {
|
---|
134 | win32wnd->setStyle((win32wnd->getStyle() & ~WS_MAXIMIZE_W) | WS_MINIMIZE_W);
|
---|
135 | }
|
---|
136 | else if ((swp->fl & SWP_RESTORE) == SWP_RESTORE)
|
---|
137 | {
|
---|
138 | win32wnd->setStyle(win32wnd->getStyle() & ~(WS_MINIMIZE_W | WS_MAXIMIZE_W));
|
---|
139 | }
|
---|
140 | goto RunDefFrameProc;
|
---|
141 | }
|
---|
142 |
|
---|
143 | case WM_QUERYTRACKINFO:
|
---|
144 | {
|
---|
145 | PTRACKINFO trackInfo = (PTRACKINFO)mp2;
|
---|
146 |
|
---|
147 | RestoreOS2TIB();
|
---|
148 | OldFrameProc(hwnd,msg,mp1,mp2);
|
---|
149 | SetWin32TIB();
|
---|
150 | trackInfo->cxBorder = 0;
|
---|
151 | trackInfo->cyBorder = 0;
|
---|
152 | win32wnd->AdjustTrackInfo((PPOINT)&trackInfo->ptlMinTrackSize,(PPOINT)&trackInfo->ptlMaxTrackSize);
|
---|
153 | RestoreOS2TIB();
|
---|
154 | return (MRESULT)TRUE;
|
---|
155 | }
|
---|
156 |
|
---|
157 | case WM_QUERYBORDERSIZE:
|
---|
158 | {
|
---|
159 | PWPOINT size = (PWPOINT)mp1;
|
---|
160 |
|
---|
161 | size->x = 0;
|
---|
162 | size->y = 0;
|
---|
163 | RestoreOS2TIB();
|
---|
164 | return (MRESULT)TRUE;
|
---|
165 | }
|
---|
166 |
|
---|
167 | case WM_BUTTON1DOWN:
|
---|
168 | case WM_BUTTON1UP:
|
---|
169 | case WM_BUTTON1DBLCLK:
|
---|
170 | case WM_BUTTON2DOWN:
|
---|
171 | case WM_BUTTON2UP:
|
---|
172 | case WM_BUTTON2DBLCLK:
|
---|
173 | case WM_BUTTON3DOWN:
|
---|
174 | case WM_BUTTON3UP:
|
---|
175 | case WM_BUTTON3DBLCLK:
|
---|
176 | {
|
---|
177 | if (win32wnd->IsWindowCreated())
|
---|
178 | {
|
---|
179 | win32wnd->MsgButton(pWinMsg);
|
---|
180 | RestoreOS2TIB();
|
---|
181 | }
|
---|
182 | return (MRESULT)TRUE;
|
---|
183 | }
|
---|
184 |
|
---|
185 | case WM_BUTTON2MOTIONSTART:
|
---|
186 | case WM_BUTTON2MOTIONEND:
|
---|
187 | case WM_BUTTON2CLICK:
|
---|
188 | case WM_BUTTON1MOTIONSTART:
|
---|
189 | case WM_BUTTON1MOTIONEND:
|
---|
190 | case WM_BUTTON1CLICK:
|
---|
191 | case WM_BUTTON3MOTIONSTART:
|
---|
192 | case WM_BUTTON3MOTIONEND:
|
---|
193 | case WM_BUTTON3CLICK:
|
---|
194 | RestoreOS2TIB();
|
---|
195 | return (MRESULT)TRUE;
|
---|
196 |
|
---|
197 | case WM_MOUSEMOVE:
|
---|
198 | {
|
---|
199 | //OS/2 Window coordinates -> Win32 Window coordinates
|
---|
200 | if (win32wnd->IsWindowCreated())
|
---|
201 | win32wnd->MsgMouseMove(pWinMsg);
|
---|
202 | RestoreOS2TIB();
|
---|
203 | return (MRESULT)TRUE;
|
---|
204 | }
|
---|
205 |
|
---|
206 | case WM_PAINT:
|
---|
207 | {
|
---|
208 | dprintf(("PMFRAME: WM_PAINT"));
|
---|
209 | if (win32wnd->getStyle() & WS_MINIMIZE_W)
|
---|
210 | goto RunDefFrameProc;
|
---|
211 | if (win32wnd->IsWindowCreated())
|
---|
212 | win32wnd->MsgNCPaint();
|
---|
213 | goto RunDefWndProc;
|
---|
214 | }
|
---|
215 |
|
---|
216 | case WM_SIZE:
|
---|
217 | dprintf(("PMFRAME: WM_SIZE"));
|
---|
218 | goto RunDefFrameProc;
|
---|
219 |
|
---|
220 | case WM_ADJUSTWINDOWPOS:
|
---|
221 | {
|
---|
222 | PSWP pswp = (PSWP)mp1;
|
---|
223 | SWP swpOld;
|
---|
224 | WINDOWPOS wp,wpOld;
|
---|
225 | HWND hParent = NULLHANDLE, hwndAfter;
|
---|
226 |
|
---|
227 | dprintf(("PMFRAME: WM_ADJUSTWINDOWPOS %x %x %x (%d,%d) (%d,%d)", win32wnd->getWindowHandle(), pswp->hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
|
---|
228 |
|
---|
229 | //CB: show dialog in front of owner
|
---|
230 | if (win32wnd->IsModalDialogOwner())
|
---|
231 | {
|
---|
232 | pswp->fl |= SWP_ZORDER;
|
---|
233 | pswp->hwndInsertBehind = win32wnd->getOS2HwndModalDialog();
|
---|
234 | if (pswp->fl & SWP_ACTIVATE)
|
---|
235 | {
|
---|
236 | pswp->fl &= ~SWP_ACTIVATE;
|
---|
237 | WinSetWindowPos(win32wnd->getOS2HwndModalDialog(),0,0,0,0,0,SWP_ACTIVATE);
|
---|
238 | }
|
---|
239 | }
|
---|
240 |
|
---|
241 | if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0)
|
---|
242 | goto RunDefFrameProc;
|
---|
243 |
|
---|
244 | if(!win32wnd->CanReceiveSizeMsgs())
|
---|
245 | break;
|
---|
246 |
|
---|
247 | WinQueryWindowPos(hwnd, &swpOld);
|
---|
248 | if(pswp->fl & (SWP_MOVE | SWP_SIZE)) {
|
---|
249 | if (win32wnd->isChild()) {
|
---|
250 | if(win32wnd->getParent()) {
|
---|
251 | hParent = win32wnd->getParent()->getOS2WindowHandle();
|
---|
252 | }
|
---|
253 | else goto RunDefFrameProc;
|
---|
254 | }
|
---|
255 | }
|
---|
256 | hwndAfter = pswp->hwndInsertBehind;
|
---|
257 | OSLibMapSWPtoWINDOWPOSFrame(pswp, &wp, &swpOld, hParent, hwnd);
|
---|
258 |
|
---|
259 | wp.hwnd = win32wnd->getWindowHandle();
|
---|
260 | if ((pswp->fl & SWP_ZORDER) && (pswp->hwndInsertBehind > HWND_BOTTOM))
|
---|
261 | {
|
---|
262 | Win32BaseWindow *wndAfter = Win32BaseWindow::GetWindowFromOS2Handle(pswp->hwndInsertBehind);
|
---|
263 | if(wndAfter) wp.hwndInsertAfter = wndAfter->getWindowHandle();
|
---|
264 | }
|
---|
265 |
|
---|
266 | wpOld = wp;
|
---|
267 | win32wnd->MsgPosChanging((LPARAM)&wp);
|
---|
268 |
|
---|
269 | if ((wp.hwndInsertAfter != wpOld.hwndInsertAfter) ||
|
---|
270 | (wp.x != wpOld.x) || (wp.y != wpOld.y) || (wp.cx != wpOld.cx) || (wp.cy != wpOld.cy) || (wp.flags != wpOld.flags))
|
---|
271 | {
|
---|
272 | dprintf(("PMFRAME: WM_ADJUSTWINDOWPOS, app changed windowpos struct"));
|
---|
273 | dprintf(("%x (%d,%d), (%d,%d)", pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
|
---|
274 |
|
---|
275 | OSLibMapWINDOWPOStoSWPFrame(&wp, pswp, &swpOld, hParent, hwnd);
|
---|
276 | dprintf(("%x (%d,%d), (%d,%d)", pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
|
---|
277 | pswp->fl |= SWP_NOADJUST;
|
---|
278 | pswp->hwndInsertBehind = hwndAfter;
|
---|
279 | pswp->hwnd = hwnd;
|
---|
280 |
|
---|
281 | RestoreOS2TIB();
|
---|
282 | return (MRESULT)0xf;
|
---|
283 | }
|
---|
284 | RestoreOS2TIB();
|
---|
285 | return (MRESULT)0;
|
---|
286 | }
|
---|
287 |
|
---|
288 | case WM_WINDOWPOSCHANGED:
|
---|
289 | {
|
---|
290 | PSWP pswp = (PSWP)mp1,pswpOld = pswp+1;
|
---|
291 | SWP swpOld = *(pswp + 1);
|
---|
292 | WINDOWPOS wp;
|
---|
293 | HWND hParent = NULLHANDLE;
|
---|
294 | RECTL rect;
|
---|
295 | SWP swpClient = {0};
|
---|
296 |
|
---|
297 | dprintf(("PMFRAME: WM_WINDOWPOSCHANGED (%x) %x %x (%d,%d) (%d,%d)", mp2, win32wnd->getWindowHandle(), pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
|
---|
298 |
|
---|
299 | if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0)
|
---|
300 | {
|
---|
301 | goto RunDefFrameProc;
|
---|
302 | }
|
---|
303 |
|
---|
304 | if(pswp->fl & (SWP_MOVE | SWP_SIZE)) {
|
---|
305 | if (win32wnd->isChild()) {
|
---|
306 | if(win32wnd->getParent()) {
|
---|
307 | hParent = win32wnd->getParent()->getOS2WindowHandle();
|
---|
308 | }
|
---|
309 | else goto PosChangedEnd; //parent has just been destroyed
|
---|
310 | }
|
---|
311 | }
|
---|
312 |
|
---|
313 | OSLibMapSWPtoWINDOWPOSFrame(pswp, &wp, &swpOld, hParent, hwnd);
|
---|
314 |
|
---|
315 | if(pswp->fl & SWP_ACTIVATE)
|
---|
316 | {
|
---|
317 | WinSendMsg(hwnd, WM_ACTIVATE, (MPARAM)TRUE, (MPARAM)hwnd);
|
---|
318 | }
|
---|
319 |
|
---|
320 | if((pswp->fl & (SWP_MOVE | SWP_SIZE)) && !(win32wnd->getStyle() & WS_MINIMIZE_W))
|
---|
321 | {
|
---|
322 | //Note: Also updates the new window rectangle
|
---|
323 | win32wnd->MsgFormatFrame(&wp);
|
---|
324 |
|
---|
325 | //CB: todo: use result for WM_CALCVALIDRECTS
|
---|
326 | mapWin32ToOS2Rect(win32wnd->getOS2FrameWindowHandle(), win32wnd->getClientRectPtr(), (PRECTLOS2)&rect);
|
---|
327 |
|
---|
328 | swpClient.hwnd = win32wnd->getOS2WindowHandle();
|
---|
329 | swpClient.hwndInsertBehind = 0;
|
---|
330 | swpClient.x = rect.xLeft;
|
---|
331 | swpClient.y = rect.yBottom;
|
---|
332 | swpClient.cx = rect.xRight-rect.xLeft;
|
---|
333 | swpClient.cy = rect.yTop-rect.yBottom;
|
---|
334 | //TODO: Get rid of SWP_SHOW; needed for winhlp32 button bar for now
|
---|
335 | swpClient.fl = (pswp->fl & ~SWP_ZORDER) | SWP_MOVE | SWP_SHOW;
|
---|
336 | WinSetMultWindowPos(thdb->hab, &swpClient, 1);
|
---|
337 |
|
---|
338 | //update child positions: rectWindow is in window coordinates
|
---|
339 | if(pswp->fl & (SWP_MOVE | SWP_SIZE)) {
|
---|
340 | FrameUpdateChildPositions(win32wnd->getOS2WindowHandle());
|
---|
341 | }
|
---|
342 |
|
---|
343 | if(win32wnd->CanReceiveSizeMsgs())
|
---|
344 | win32wnd->MsgPosChanged((LPARAM)&wp);
|
---|
345 |
|
---|
346 | if ((pswp->fl & SWP_SIZE) && ((pswp->cx != pswpOld->cx) || (pswp->cy != pswpOld->cy)))
|
---|
347 | {
|
---|
348 | //redraw the frame (to prevent unnecessary client updates)
|
---|
349 | BOOL redrawAll = FALSE;
|
---|
350 |
|
---|
351 | if (win32wnd->getWindowClass())
|
---|
352 | {
|
---|
353 | DWORD dwStyle = win32wnd->getWindowClass()->getClassLongA(GCL_STYLE_W);
|
---|
354 |
|
---|
355 | if ((dwStyle & CS_HREDRAW_W) && (pswp->cx != pswpOld->cx))
|
---|
356 | redrawAll = TRUE;
|
---|
357 | else if ((dwStyle & CS_VREDRAW_W) && (pswp->cy != pswpOld->cy))
|
---|
358 | redrawAll = TRUE;
|
---|
359 | } else redrawAll = TRUE;
|
---|
360 |
|
---|
361 | if (redrawAll)
|
---|
362 | {
|
---|
363 | //CB: redraw all children for now
|
---|
364 | // -> problems with update region if we don't do it
|
---|
365 | // todo: rewrite whole handling
|
---|
366 | WinInvalidateRect(hwnd,NULL,TRUE);
|
---|
367 | }
|
---|
368 | else
|
---|
369 | {
|
---|
370 | HPS hps = WinGetPS(hwnd);
|
---|
371 | RECTL frame,client,arcl[4];
|
---|
372 |
|
---|
373 | WinQueryWindowRect(hwnd,&frame);
|
---|
374 | //top
|
---|
375 | arcl[0].xLeft = 0;
|
---|
376 | arcl[0].xRight = frame.xRight;
|
---|
377 | arcl[0].yBottom = rect.yTop;
|
---|
378 | arcl[0].yTop = frame.yTop;
|
---|
379 | //right
|
---|
380 | arcl[1].xLeft = rect.xRight;
|
---|
381 | arcl[1].xRight = frame.xRight;
|
---|
382 | arcl[1].yBottom = 0;
|
---|
383 | arcl[1].yTop = frame.yTop;
|
---|
384 | //left
|
---|
385 | arcl[2].xLeft = 0;
|
---|
386 | arcl[2].xRight = rect.xLeft;
|
---|
387 | arcl[2].yBottom = 0;
|
---|
388 | arcl[2].yTop = frame.yTop;
|
---|
389 | //bottom
|
---|
390 | arcl[3].xLeft = 0;
|
---|
391 | arcl[3].xRight = frame.xRight;
|
---|
392 | arcl[3].yBottom = 0;
|
---|
393 | arcl[3].yTop = rect.yBottom;
|
---|
394 |
|
---|
395 | HRGN hrgn = GpiCreateRegion(hps,4,(PRECTL)&arcl);
|
---|
396 |
|
---|
397 | WinInvalidateRegion(hwnd,hrgn,FALSE);
|
---|
398 | GpiDestroyRegion(hps,hrgn);
|
---|
399 | WinReleasePS(hps);
|
---|
400 | }
|
---|
401 | }
|
---|
402 | }
|
---|
403 | else
|
---|
404 | {
|
---|
405 | //update child positions: rectWindow is in window coordinates
|
---|
406 | if(pswp->fl & (SWP_MOVE | SWP_SIZE)) {
|
---|
407 | FrameUpdateChildPositions(win32wnd->getOS2WindowHandle());
|
---|
408 | }
|
---|
409 |
|
---|
410 | if(win32wnd->CanReceiveSizeMsgs())
|
---|
411 | win32wnd->MsgPosChanged((LPARAM)&wp);
|
---|
412 | }
|
---|
413 |
|
---|
414 | PosChangedEnd:
|
---|
415 | RestoreOS2TIB();
|
---|
416 | return (MRESULT)FALSE;
|
---|
417 | }
|
---|
418 |
|
---|
419 | case WM_ERASEBACKGROUND:
|
---|
420 | break;
|
---|
421 |
|
---|
422 | case WM_CALCVALIDRECTS:
|
---|
423 | {
|
---|
424 | //don't redraw here or PM redraw the whole frame (done in WM_WINDOWPOSCHANGED)
|
---|
425 | dprintf(("PMFRAME: WM_CALCVALIDRECTS"));
|
---|
426 | RestoreOS2TIB();
|
---|
427 | return (MRESULT)(CVR_ALIGNLEFT | CVR_ALIGNTOP);
|
---|
428 | }
|
---|
429 |
|
---|
430 | case WM_ACTIVATE:
|
---|
431 | {
|
---|
432 | HWND hwndTitle;
|
---|
433 | USHORT flags = WinQueryWindowUShort(hwnd,QWS_FLAGS);
|
---|
434 |
|
---|
435 | dprintf(("PMFRAME: WM_ACTIVATE %x %x", hwnd, mp2));
|
---|
436 | if (win32wnd->IsWindowCreated())
|
---|
437 | {
|
---|
438 | WinSendMsg(WinWindowFromID(hwnd,FID_CLIENT),WM_ACTIVATE,mp1,mp2);
|
---|
439 | WinSetWindowUShort(hwnd,QWS_FLAGS,mp1 ? (flags | FF_ACTIVE):(flags & ~FF_ACTIVE));
|
---|
440 |
|
---|
441 | //CB: show owner behind the dialog
|
---|
442 | if (win32wnd->IsModalDialog())
|
---|
443 | {
|
---|
444 | Win32BaseWindow *topOwner = win32wnd->getOwner()->GetTopParent();
|
---|
445 |
|
---|
446 | if (topOwner) WinSetWindowPos(topOwner->getOS2FrameWindowHandle(),hwnd,0,0,0,0,SWP_ZORDER);
|
---|
447 | }
|
---|
448 | }
|
---|
449 | else
|
---|
450 | {
|
---|
451 | WinSetWindowUShort(hwnd,QWS_FLAGS,mp1 ? (flags | FF_ACTIVE):(flags & ~FF_ACTIVE));
|
---|
452 | }
|
---|
453 | if(win32wnd->IsWindowCreated())
|
---|
454 | win32wnd->DispatchMsgA(pWinMsg);
|
---|
455 |
|
---|
456 | RestoreOS2TIB();
|
---|
457 | return 0;
|
---|
458 | }
|
---|
459 |
|
---|
460 | case WM_DESTROY:
|
---|
461 | dprintf(("PMFRAME: WM_DESTROY %x",hwnd));
|
---|
462 | WinSubclassWindow(hwnd,OldFrameProc);
|
---|
463 | win32wnd->setOldFrameProc(NULL);
|
---|
464 | goto RunDefFrameProc;
|
---|
465 |
|
---|
466 | default:
|
---|
467 | RestoreOS2TIB();
|
---|
468 | return OldFrameProc(hwnd,msg,mp1,mp2);
|
---|
469 | }
|
---|
470 |
|
---|
471 | RestoreOS2TIB();
|
---|
472 | return (MRESULT)FALSE;
|
---|
473 |
|
---|
474 | RunDefFrameProc:
|
---|
475 | RestoreOS2TIB();
|
---|
476 | return OldFrameProc(hwnd,msg,mp1,mp2);
|
---|
477 |
|
---|
478 | RunDefWndProc:
|
---|
479 | RestoreOS2TIB();
|
---|
480 | return WinDefWindowProc(hwnd,msg,mp1,mp2);
|
---|
481 | }
|
---|
482 | //******************************************************************************
|
---|
483 | //******************************************************************************
|
---|
484 | PVOID FrameSubclassFrameWindow(Win32BaseWindow *win32wnd)
|
---|
485 | {
|
---|
486 | return WinSubclassWindow(win32wnd->getOS2FrameWindowHandle(),PFNWP(Win32FrameProc));
|
---|
487 | }
|
---|
488 | //******************************************************************************
|
---|
489 | //******************************************************************************
|
---|
490 | VOID FrameUpdateClient(Win32BaseWindow *win32wnd)
|
---|
491 | {
|
---|
492 | RECT rectOld, rectNew;
|
---|
493 | RECTL rect;
|
---|
494 | SWP swpClient = {0};
|
---|
495 |
|
---|
496 | rectOld = *win32wnd->getClientRectPtr();
|
---|
497 | win32wnd->MsgFormatFrame(NULL);
|
---|
498 | rectNew = *win32wnd->getClientRectPtr();
|
---|
499 | if(WinEqualRect(0, (PRECTL)&rectOld, (PRECTL)&rectNew) == 1) {
|
---|
500 | WinInvalidateRect(win32wnd->getOS2FrameWindowHandle(), NULL, FALSE);
|
---|
501 | return;
|
---|
502 | }
|
---|
503 | //CB: todo: use result for WM_CALCVALIDRECTS
|
---|
504 | mapWin32ToOS2Rect(win32wnd->getOS2FrameWindowHandle(), win32wnd->getClientRectPtr(), (PRECTLOS2)&rect);
|
---|
505 |
|
---|
506 |
|
---|
507 | swpClient.hwnd = win32wnd->getOS2WindowHandle();
|
---|
508 | swpClient.hwndInsertBehind = 0;
|
---|
509 | swpClient.x = rect.xLeft;
|
---|
510 | swpClient.y = rect.yBottom;
|
---|
511 | swpClient.cx = rect.xRight-rect.xLeft;
|
---|
512 | swpClient.cy = rect.yTop-rect.yBottom;
|
---|
513 | swpClient.fl = SWP_MOVE | SWP_SIZE;
|
---|
514 | WinSetMultWindowPos(GetThreadHAB(), &swpClient, 1);
|
---|
515 | }
|
---|
516 | //******************************************************************************
|
---|
517 | //******************************************************************************
|
---|