source: trunk/src/user32/dc.cpp@ 10545

Last change on this file since 10545 was 10545, checked in by sandervl, 21 years ago

updates

File size: 57.1 KB
Line 
1/* $Id: dc.cpp,v 1.128 2004-03-18 15:38:41 sandervl Exp $ */
2
3/*
4 * DC functions for USER32
5 *
6 * Project Odin Software License can be found in LICENSE.TXT
7 *
8 */
9
10/*****************************************************************************
11 * Includes *
12 *****************************************************************************/
13
14#include <odin.h>
15
16#define INCL_WIN
17#define INCL_GPI
18#define INCL_GREALL
19#define INCL_DEV
20#include <os2wrap.h>
21//#include <pmddi.h>
22#include <stdlib.h>
23
24#include <string.h>
25#include <win32type.h>
26#include <win32api.h>
27#include <winuser32.h>
28#include <winconst.h>
29#include <misc.h>
30#include <win32wbase.h>
31#include <math.h>
32#include <limits.h>
33#include "oslibwin.h"
34#include "oslibmsg.h"
35#include <dcdata.h>
36#include <codepage.h>
37#include <wingdi32.h>
38#include <stats.h>
39
40#define INCLUDED_BY_DC
41#include "dc.h"
42
43#define DBG_LOCALLOG DBG_dc
44#include "dbglocal.h"
45
46#ifndef DEVESC_SETPS
47 #define DEVESC_SETPS 49149L
48#endif
49
50#define FLOAT_TO_FIXED(x) ((FIXED) ((x) * 65536.0))
51#define MICRO_HPS_TO_HDC(x) ((x) & 0xFFFFFFFE)
52
53#define PMRECT_FROM_WINRECT( pmRect, winRect ) \
54{ \
55 (pmRect).xLeft = (winRect).left; \
56 (pmRect).yBottom = (winRect).bottom; \
57 (pmRect).xRight = (winRect).right; \
58 (pmRect).yTop = (winRect).top; \
59}
60
61#define WINRECT_FROM_PMRECT( winRect, pmRect ) \
62{ \
63 (winRect).left = (pmRect).xLeft; \
64 (winRect).top = (pmRect).yTop; \
65 (winRect).right = (pmRect).xRight; \
66 (winRect).bottom = (pmRect).yBottom; \
67}
68
69#define MEM_HPS_MAX 768
70
71const XFORM_W XFORMIdentity = { 1.0, 0.0, 0.0, 1.0, 0, 0 };
72const MATRIXLF matrixlfIdentity = { 0x10000, 0, 0, 0, 0x10000, 0, 0, 0, 0};
73
74BOOL setPageXForm(Win32BaseWindow *wnd, pDCData pHps);
75BOOL changePageXForm(Win32BaseWindow *wnd, pDCData pHps, PPOINTL pValue, int x, int y, PPOINTL pPrev);
76LONG clientHeight(Win32BaseWindow *wnd, HWND hwnd, pDCData pHps);
77
78#ifdef DEBUG
79#define dprintfRegion(a,b,c) if(DbgEnabledLvl2USER32[DBG_LOCALLOG] == 1) dprintfRegion1(a,b,c)
80//#define dprintfRegion(a,b,c) dprintfRegion1(a,b,c)
81
82void dprintfRegion1(HPS hps, HWND hWnd, HRGN hrgnClip)
83{
84 RGNRECT rgnRect = {0, 16, 0, RECTDIR_LFRT_TOPBOT};
85 RECTL rectRegion[16];
86 APIRET rc;
87
88 dprintf(("dprintfRegion %x %x", hWnd, hps));
89 rc = GpiQueryRegionRects(hps, hrgnClip, NULL, &rgnRect, &rectRegion[0]);
90 for(int i=0;i<rgnRect.crcReturned;i++) {
91 dprintf(("(%d,%d)(%d,%d)", rectRegion[i].xLeft, rectRegion[i].yBottom, rectRegion[i].xRight, rectRegion[i].yTop));
92 }
93}
94#else
95#define dprintfRegion(a,b,c)
96#endif
97
98//******************************************************************************
99//******************************************************************************
100void WIN32API TestWideLine (pDCData pHps)
101{
102 const LOGPEN_W *pLogPen;
103
104 pHps->isWideLine = FALSE;
105 pLogPen = pHps->penIsExtPen ?
106 &(pHps->lastPenObject->ExtPen.logpen) :
107 &(pHps->lastPenObject->Pen.logpen);
108
109 if (((pLogPen->lopnStyle & PS_STYLE_MASK_W) != PS_NULL_W) &&
110 (pLogPen->lopnWidth.x > 0))
111 {
112 POINTL aptl[2] = { 0, 0, pLogPen->lopnWidth.x, pLogPen->lopnWidth.x };
113
114 GpiConvert(pHps->hps, CVTC_WORLD, CVTC_DEVICE, 2, aptl);
115
116 ULONG dx = abs(aptl[0].x - aptl[1].x);
117 ULONG dy = abs(aptl[0].y - aptl[1].y);
118
119 pHps->isWideLine = (dx > 1) || (dy > 1);
120 }
121}
122//******************************************************************************
123//******************************************************************************
124void WIN32API Calculate1PixelDelta(pDCData pHps)
125{
126 POINTL aptl[2] = {0, 0, 1, 1};
127
128 GpiConvert(pHps->hps, CVTC_DEVICE, CVTC_WORLD, 2, aptl);
129 pHps->worldYDeltaFor1Pixel = (int)(aptl[1].y - aptl[0].y);
130 pHps->worldXDeltaFor1Pixel = (int)(aptl[1].x - aptl[0].x); // 171182
131}
132//******************************************************************************
133//******************************************************************************
134int setMapMode(Win32BaseWindow *wnd, pDCData pHps, int mode)
135{
136 int prevMode = 0;
137 ULONG flOptions;
138
139 switch (mode)
140 {
141 case MM_HIENGLISH_W : flOptions = PU_HIENGLISH; break;
142 case MM_LOENGLISH_W : flOptions = PU_LOENGLISH; break;
143 case MM_HIMETRIC_W : flOptions = PU_HIMETRIC ; break;
144 case MM_LOMETRIC_W : flOptions = PU_LOMETRIC ; break;
145 case MM_TEXT_W : flOptions = PU_PELS ; break;
146 case MM_TWIPS_W : flOptions = PU_TWIPS ; break;
147 case MM_ANISOTROPIC_W: flOptions = PU_PELS ; break;
148 case MM_ISOTROPIC_W : flOptions = PU_LOMETRIC ; break;
149 default:
150 SetLastError(ERROR_INVALID_PARAMETER_W);
151 return FALSE;
152 }
153
154 prevMode = pHps->MapMode; /* store previous mode */
155 pHps->MapMode = mode;
156
157 if (mode == MM_TEXT_W)
158 {
159 pHps->viewportXExt =
160 pHps->viewportYExt = 1.0;
161 pHps->windowExt.cx =
162 pHps->windowExt.cy = 1;
163 }
164 else if (mode != MM_ANISOTROPIC_W)
165 {
166 RECTL rectl;
167 SIZEL sizel;
168 ULONG data[3];
169
170 data[0] = flOptions;
171 data[1] = data[2] = 0;
172
173 if (DevEscape(pHps->hdc ? pHps->hdc : pHps->hps, DEVESC_SETPS, 12, (PBYTE)data, 0, 0) == DEVESC_ERROR)
174 {
175 SetLastError(ERROR_INVALID_PARAMETER_W);
176 return 0;
177 }
178
179 GpiQueryPageViewport(pHps->hps, &rectl);
180 pHps->viewportXExt = (double)rectl.xRight;
181 pHps->viewportYExt = -(double)rectl.yTop;
182
183 GreGetPageUnits(pHps->hdc? pHps->hdc : pHps->hps, &sizel);
184 pHps->windowExt.cx = sizel.cx;
185 pHps->windowExt.cy = sizel.cy;
186
187 data[0] = PU_PELS;
188 DevEscape(pHps->hdc ? pHps->hdc : pHps->hps, DEVESC_SETPS, 12, (PBYTE)data, 0, 0);
189 }
190
191 if (((prevMode != MM_ISOTROPIC_W) && (prevMode != MM_ANISOTROPIC_W)) &&
192 ((mode == MM_ISOTROPIC_W) || (mode == MM_ANISOTROPIC_W)))
193 {
194 if (pHps->lWndXExtSave && pHps->lWndYExtSave)
195 {
196 changePageXForm (wnd, pHps, (PPOINTL)&pHps->windowExt,
197 pHps->lWndXExtSave, pHps->lWndYExtSave, NULL );
198 pHps->lWndXExtSave = pHps->lWndYExtSave = 0;
199 }
200 if (pHps->lVwpXExtSave && pHps->lVwpYExtSave)
201 {
202 changePageXForm (wnd, pHps, NULL,
203 pHps->lVwpXExtSave, pHps->lVwpYExtSave, NULL );
204 pHps->lVwpXExtSave = pHps->lVwpYExtSave = 0;
205 }
206 }
207
208 setPageXForm(wnd, pHps);
209
210 return prevMode;
211}
212//******************************************************************************
213//******************************************************************************
214BOOL setPageXForm(Win32BaseWindow *wnd, pDCData pHps)
215{
216 MATRIXLF mlf;
217 BOOL rc = TRUE;
218
219 pHps->height = clientHeight(wnd, 0, pHps) - 1;
220
221 double xScale = pHps->viewportXExt / (double)pHps->windowExt.cx;
222 double yScale = pHps->viewportYExt / (double)pHps->windowExt.cy;
223
224#if 0
225 mlf.fxM11 = FLOAT_TO_FIXED(1.0);
226 mlf.fxM12 = 0;
227 mlf.lM13 = 0;
228 mlf.fxM21 = 0;
229 mlf.fxM22 = FLOAT_TO_FIXED(1.0);
230 mlf.lM23 = 0;
231 mlf.lM31 = pHps->viewportOrg.x - (LONG)(pHps->windowOrg.x * xScale);
232 mlf.lM32 = pHps->viewportOrg.y - (LONG)(pHps->windowOrg.y * yScale);
233 mlf.lM33 = 1;
234
235//testestest
236 if(wnd && wnd->getWindowWidth() && wnd->getWindowHeight())
237 {
238 RECTL recttmp, rectviewold;
239
240 rc = GpiQueryPageViewport(pHps->hps, &rectviewold);
241 if(rc == 0) {
242 dprintf(("WARNING: GpiQueryPageViewport returned FALSE!!"));
243 }
244 recttmp.xLeft = 0;
245 recttmp.xRight = ((double)GetScreenWidth() / xScale);
246 recttmp.yBottom = 0;
247 recttmp.yTop = ((double)GetScreenHeight() / yScale);
248
249 if(recttmp.yTop != rectviewold.yTop ||
250 recttmp.xRight != rectviewold.xRight)
251 {
252 if(pHps->viewportYExt > pHps->windowExt.cy) {//scaling up means we have to invert the y values
253 recttmp.yBottom = GetScreenHeight() - recttmp.yTop;
254 recttmp.yTop = GetScreenHeight();
255 }
256 dprintf(("GpiSetPageViewport %x (%d,%d)(%d,%d) %f %f", pHps->hps, recttmp.xLeft, recttmp.yBottom, recttmp.xRight, recttmp.yTop, xScale, yScale));
257 rc = GpiSetPageViewport(pHps->hps, &recttmp);
258 if(rc == 0) {
259 dprintf(("WARNING: GpiSetPageViewport returned FALSE!!"));
260 }
261 }
262 }
263//testestest
264
265#else
266 mlf.fxM11 = FLOAT_TO_FIXED(xScale);
267 mlf.fxM12 = 0;
268 mlf.lM13 = 0;
269 mlf.fxM21 = 0;
270 mlf.fxM22 = FLOAT_TO_FIXED(yScale);
271 mlf.lM23 = 0;
272 mlf.lM31 = pHps->viewportOrg.x - (LONG)(pHps->windowOrg.x * xScale);
273 mlf.lM32 = pHps->viewportOrg.y - (LONG)(pHps->windowOrg.y * yScale);
274 mlf.lM33 = 1;
275#endif
276
277 pHps->isLeftLeft = mlf.fxM11 >= 0;
278 pHps->isTopTop = mlf.fxM22 >= 0;
279
280 BOOL bEnableYInversion = FALSE;
281 if ((mlf.fxM22 > 0) ||
282 ((pHps->graphicsMode == GM_ADVANCED_W) &&
283 ((pHps->MapMode == MM_ANISOTROPIC_W) ||
284 (pHps->MapMode == MM_ISOTROPIC_W))))
285 {
286 bEnableYInversion = TRUE;
287 }
288 else
289 {
290 bEnableYInversion = FALSE;
291 mlf.lM32 = pHps->HPStoHDCInversionHeight + pHps->height - mlf.lM32;
292 mlf.fxM22 = -mlf.fxM22;
293 }
294
295 if (!pHps->isMetaPS)
296// if ((!pHps->isMetaPS) ||
297// (pHps->pMetaFileObject && pHps->pMetaFileObject->isEnhanced()))
298 rc = GpiSetDefaultViewMatrix(pHps->hps, 8, &mlf, TRANSFORM_REPLACE);
299 if(rc == 0) {
300 dprintf(("WARNING: GpiSetDefaultViewMatrix returned FALSE!!"));
301 }
302#ifdef INVERT
303 if (bEnableYInversion)
304 GpiEnableYInversion(pHps->hps, pHps->height + pHps->HPStoHDCInversionHeight);
305 else
306 GpiEnableYInversion(pHps->hps, 0);
307#else
308 pHps->yInvert = 0;
309 if(bEnableYInversion)
310 {
311 pHps->yInvert4Enable = pHps->height + pHps->HPStoHDCInversionHeight;
312 if(pHps->isPrinter)
313 {
314 pHps->yInvert = pHps->yInvert4Enable
315 * (pHps->windowExt.cy / (double)pHps->viewportYExt);
316 } else {
317 pHps->yInvert = pHps->yInvert4Enable;
318 }
319 }
320#endif
321
322 TestWideLine(pHps);
323 Calculate1PixelDelta(pHps);
324 return rc;
325}
326//******************************************************************************
327//******************************************************************************
328BOOL changePageXForm(Win32BaseWindow *wnd, pDCData pHps, PPOINTL pValue, int x, int y, PPOINTL pPrev)
329{
330 BOOL result = FALSE;
331
332 if (pValue)
333 {
334 if (pPrev)
335 *pPrev = *pValue;
336
337 if ((pValue->x == x) && (pValue->y == y)) {
338 return TRUE;
339 }
340 pValue->x = x;
341 pValue->y = y;
342 }
343 else
344 {
345 if (pPrev)
346 {
347 pPrev->x = (int)pHps->viewportXExt;
348 pPrev->y = (int)pHps->viewportYExt;
349 }
350 pHps->viewportXExt = (double)x;
351 pHps->viewportYExt = (double)y;
352 }
353
354 if (pHps->MapMode == MM_ISOTROPIC_W)
355 {
356 double xExt = fabs(pHps->viewportXExt);
357 double yExt = fabs(pHps->viewportYExt);
358 double sf = fabs((double)pHps->windowExt.cx / pHps->windowExt.cy);
359
360 if (xExt > (yExt * sf))
361 {
362 xExt = yExt * sf;
363
364 if ((double)LONG_MAX <= xExt) return (result);
365
366 if (pHps->viewportXExt < 0.0)
367 pHps->viewportXExt = -xExt;
368 else
369 pHps->viewportXExt = xExt;
370 }
371 else
372 {
373 yExt = xExt / sf;
374
375 if ((double)LONG_MAX <= yExt) return (result);
376
377 if (pHps->viewportYExt < 0.0)
378 pHps->viewportYExt = -yExt;
379 else
380 pHps->viewportYExt = yExt;
381 }
382 }
383 result = setPageXForm(wnd, pHps);
384
385 return (result);
386}
387//******************************************************************************
388//******************************************************************************
389VOID removeClientArea(Win32BaseWindow *window, pDCData pHps)
390{
391 pHps->isClient = FALSE;
392 pHps->isClientArea = FALSE;
393}
394//******************************************************************************
395//******************************************************************************
396void selectClientArea(Win32BaseWindow *window, pDCData pHps)
397{
398 pHps->isClient = TRUE;
399 pHps->isClientArea = TRUE;
400}
401//******************************************************************************
402//******************************************************************************
403void selectClientArea(Win32BaseWindow *wnd, HDC hdc)
404{
405 pDCData pHps = (pDCData)GpiQueryDCData (wnd->getOwnDC());
406
407 if (pHps != NULLHANDLE)
408 selectClientArea(wnd, pHps);
409}
410//******************************************************************************
411//******************************************************************************
412LONG clientHeight(Win32BaseWindow *wnd, HWND hwnd, pDCData pHps)
413{
414 if ((hwnd == 0) && (pHps != 0))
415 hwnd = pHps->hwnd;
416
417 if ((hwnd != 0) || (pHps == 0))
418 {
419 if(wnd) {
420 if(pHps && !pHps->isClientArea) {
421 return (wnd->getWindowHeight());
422 }
423 else return (wnd->getClientHeight());
424 }
425 else return OSLibQueryScreenHeight();
426 }
427 else if (pHps->bitmapHandle)
428 {
429 return pHps->bitmapHeight;
430 }
431 else if (pHps->isMetaPS)
432 {
433 return 0;
434 }
435 else if (pHps->isPrinter)
436 {
437 return pHps->printPageHeight;
438 }
439 else
440 {
441 return MEM_HPS_MAX;
442 }
443}
444//******************************************************************************
445//******************************************************************************
446BOOL WIN32API changePageXForm(pDCData pHps, PPOINTL pValue, int x, int y, PPOINTL pPrev)
447{
448 Win32BaseWindow *wnd;
449
450 if(pHps->isClient) {
451 wnd = Win32BaseWindow::GetWindowFromOS2Handle(pHps->hwnd);
452 }
453 else wnd = Win32BaseWindow::GetWindowFromOS2FrameHandle(pHps->hwnd);
454 BOOL ret = changePageXForm(wnd, pHps, pValue, x, y, pPrev);
455 if(wnd) RELEASE_WNDOBJ(wnd);
456 return ret;
457}
458//******************************************************************************
459//******************************************************************************
460BOOL WIN32API setPageXForm(pDCData pHps)
461{
462 Win32BaseWindow *wnd;
463
464 if(pHps->isClient) {
465 wnd = Win32BaseWindow::GetWindowFromOS2Handle(pHps->hwnd);
466 }
467 else wnd = Win32BaseWindow::GetWindowFromOS2FrameHandle(pHps->hwnd);
468 BOOL ret = setPageXForm(wnd, pHps);
469 if(wnd) RELEASE_WNDOBJ(wnd);
470 return ret;
471}
472//******************************************************************************
473//******************************************************************************
474VOID WIN32API removeClientArea(pDCData pHps)
475{
476 Win32BaseWindow *wnd;
477
478 if(pHps->isClient) {
479 wnd = Win32BaseWindow::GetWindowFromOS2Handle(pHps->hwnd);
480 }
481 else wnd = Win32BaseWindow::GetWindowFromOS2FrameHandle(pHps->hwnd);
482 if(wnd) {
483 removeClientArea(wnd, pHps);
484 RELEASE_WNDOBJ(wnd);
485 }
486}
487//******************************************************************************
488//******************************************************************************
489VOID WIN32API selectClientArea(pDCData pHps)
490{
491 Win32BaseWindow *wnd;
492
493 if(pHps->isClient) {
494 wnd = Win32BaseWindow::GetWindowFromOS2Handle(pHps->hwnd);
495 }
496 else wnd = Win32BaseWindow::GetWindowFromOS2FrameHandle(pHps->hwnd);
497 if(wnd) {
498 selectClientArea(wnd, pHps);
499 RELEASE_WNDOBJ(wnd);
500 }
501}
502//******************************************************************************
503//******************************************************************************
504VOID WIN32API checkOrigin(pDCData pHps)
505{
506 Win32BaseWindow *wnd;
507
508 if(pHps->isClient) {
509 wnd = Win32BaseWindow::GetWindowFromOS2Handle(pHps->hwnd);
510 }
511 else wnd = Win32BaseWindow::GetWindowFromOS2FrameHandle(pHps->hwnd);
512 if(wnd) {
513 if(pHps->isClient)
514 selectClientArea(wnd, pHps);
515 RELEASE_WNDOBJ(wnd);
516 }
517}
518//******************************************************************************
519//******************************************************************************
520LONG WIN32API clientHeight(HWND hwnd, pDCData pHps)
521{
522 Win32BaseWindow *wnd;
523
524 if(!pHps) {
525 wnd = Win32BaseWindow::GetWindowFromOS2Handle(hwnd);
526 }
527 else
528 if(pHps->isClient) {
529 wnd = Win32BaseWindow::GetWindowFromOS2Handle(pHps->hwnd);
530 }
531 else wnd = Win32BaseWindow::GetWindowFromOS2FrameHandle(pHps->hwnd);
532 LONG ret = clientHeight(wnd, hwnd, pHps);
533 if(wnd) RELEASE_WNDOBJ(wnd);
534 return ret;
535}
536//******************************************************************************
537//******************************************************************************
538int WIN32API setMapModeDC(pDCData pHps, int mode)
539{
540 Win32BaseWindow *wnd;
541
542 if(pHps->isClient) {
543 wnd = Win32BaseWindow::GetWindowFromOS2Handle(pHps->hwnd);
544 }
545 else wnd = Win32BaseWindow::GetWindowFromOS2FrameHandle(pHps->hwnd);
546 int ret = setMapMode(wnd, pHps, mode);
547 if(wnd) RELEASE_WNDOBJ(wnd);
548 return ret;
549}
550//******************************************************************************
551//******************************************************************************
552BOOL isYup (pDCData pHps)
553{
554 if (((pHps->windowExt.cy < 0) && (pHps->viewportYExt > 0.0)) ||
555 ((pHps->windowExt.cy > 0) && (pHps->viewportYExt < 0.0)))
556 {
557 if ((pHps->graphicsMode == GM_COMPATIBLE_W) ||
558 ((pHps->graphicsMode == GM_ADVANCED_W) && (pHps->xform.eM22 >= 0.0)))
559 return TRUE;
560 }
561 else
562 {
563 if ((pHps->graphicsMode == GM_ADVANCED_W) && (pHps->xform.eM22 < 0.0))
564 return TRUE;
565 }
566 return FALSE;
567}
568//******************************************************************************
569//******************************************************************************
570INT revertDy (Win32BaseWindow *wnd, INT dy)
571{
572 //SvL: Hack for memory.exe (doesn't get repainted properly otherwise)
573// if (wnd->isOwnDC() && wnd->getOwnDC())
574 if (wnd->isOwnDC())
575 {
576 pDCData pHps = (pDCData)GpiQueryDCData (wnd->getOwnDC());
577
578 if (pHps != NULLHANDLE)
579 if (!isYup (pHps))
580 dy = -dy;
581 }
582 else
583 {
584 dy = -dy;
585 }
586 return (dy);
587}
588//******************************************************************************
589//******************************************************************************
590HDC sendEraseBkgnd (Win32BaseWindow *wnd)
591{
592 BOOL erased;
593 HWND hwnd;
594 HDC hdc;
595 HPS hps;
596 HRGN hrgnUpdate;
597 RECTL rectl = { 1, 1, 2, 2 };
598 pDCData pHps = NULLHANDLE;
599
600 hwnd = wnd->getOS2WindowHandle();
601 hps = WinGetPS(hwnd);
602
603 hrgnUpdate = GpiCreateRegion (hps, 1, &rectl);
604 WinQueryUpdateRegion (hwnd, hrgnUpdate);
605
606 hdc = HPSToHDC (hwnd, hps, NULL, NULL);
607
608 pHps = (pDCData)GpiQueryDCData(hps);
609 GdiSetVisRgn(pHps, hrgnUpdate);
610
611 erased = wnd->MsgEraseBackGround (hdc);
612
613 //hrgnUpdate is destroyed in DeleteHDC
614 DeleteHDC (hdc);
615 WinReleasePS (hps);
616
617 return erased;
618}
619//******************************************************************************
620//******************************************************************************
621HDC WIN32API BeginPaint (HWND hWnd, PPAINTSTRUCT_W lpps)
622{
623 HWND hwnd = hWnd ? hWnd : HWND_DESKTOP;
624 pDCData pHps = NULLHANDLE;
625 HPS hPS_ownDC = NULLHANDLE, hpsPaint = 0;
626 RECTL rectl = {0, 0, 1, 1};
627 HRGN hrgnOldClip;
628 LONG lComplexity;
629 RECTL rectlClient;
630 RECTL rectlClip;
631 BOOL bIcon;
632
633 if(lpps == NULL) {
634 //BeginPaint does NOT change last error in this case
635 //(verified in NT4, SP6)
636 dprintf (("USER32: BeginPaint %x NULL PAINTSTRUCT pointer", hWnd));
637 return 0;
638 }
639 memset(lpps, 0, sizeof(*lpps));
640
641 Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
642 if(!wnd) {
643 dprintf (("USER32: BeginPaint %x %x: invalid window handle!!", hWnd, lpps));
644 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W); //(verified in NT4, SP6)
645 return (HDC)0;
646 }
647 bIcon = IsIconic(hwnd);
648
649 //check if the application previously didn't handle a WM_PAINT msg properly
650 wnd->checkForDirtyUpdateRegion();
651
652 HWND hwndClient = (bIcon) ? wnd->getOS2FrameWindowHandle() : wnd->getOS2WindowHandle();
653
654 if(hwnd != HWND_DESKTOP && !bIcon && wnd->isOwnDC())
655 {
656 hPS_ownDC = wnd->getOwnDC();
657 //SvL: Hack for memory.exe (doesn't get repainted properly otherwise)
658 if(hPS_ownDC) {
659 pHps = (pDCData)GpiQueryDCData(hPS_ownDC);
660 if (!pHps)
661 {
662 dprintf (("USER32: BeginPaint %x invalid parameter %x", hWnd, lpps));
663 RELEASE_WNDOBJ(wnd);
664 SetLastError(ERROR_INVALID_PARAMETER_W);
665 return (HDC)NULLHANDLE;
666 }
667 hpsPaint = hPS_ownDC;
668 STATS_GetDCEx(hwnd, hpsPaint, 0, 0);
669 }
670 }
671 if(!hpsPaint) {
672 hpsPaint = GetDCEx(hwnd, 0, (DCX_CACHE_W|DCX_USESTYLE_W | ((bIcon) ? DCX_WINDOW_W : 0)));
673 pHps = (pDCData)GpiQueryDCData(hpsPaint);
674 if (!pHps)
675 {
676 dprintf (("USER32: BeginPaint %x invalid parameter %x", hWnd, lpps));
677 RELEASE_WNDOBJ(wnd);
678 SetLastError(ERROR_INVALID_PARAMETER_W);
679 return (HDC)NULLHANDLE;
680 }
681 }
682
683 if(WinQueryUpdateRect(hwndClient, &rectl) == FALSE)
684 {
685 memset(&rectl, 0, sizeof(rectl));
686 dprintf (("USER32: WARNING: WinQueryUpdateRect failed (error or no update rectangle)!!"));
687
688 if(bIcon) {
689 //WinBeginPaint messes this up for icon windows; this isn't
690 //a good solution, but it does the job
691 //Use the entire frame window as clip region
692 rectl.xRight = wnd->getWindowWidth();
693 rectl.yTop = wnd->getWindowHeight();
694 }
695
696 //save old clip and visible regions (restored for CS_OWNDC windows in EndPaint)
697 dprintf(("Old visible region %x; old clip region %x", pHps->hrgnWinVis, pHps->hrgnWin32Clip));
698 wnd->SaveClipRegion(pHps->hrgnWin32Clip);
699 wnd->SaveVisRegion(pHps->hrgnWinVis);
700
701 //clear visible and clip regions
702 pHps->hrgnWin32Clip = NULLHANDLE;
703 pHps->hrgnWinVis = NULLHANDLE;
704
705 HRGN hrgnVis = GpiCreateRegion(pHps->hps, 1, &rectl);
706 GdiSetVisRgn(pHps, hrgnVis);
707
708 selectClientArea(wnd, pHps);
709
710 if(bIcon) {
711 lComplexity = RGN_RECT;
712 }
713 else lComplexity = RGN_NULL;
714 }
715 else {
716 rectlClip.yBottom = rectlClip.xLeft = 0;
717 rectlClip.yTop = rectlClip.xRight = 1;
718
719 //Query update region
720 HRGN hrgnVis = GpiCreateRegion(pHps->hps, 1, &rectlClip);
721 WinQueryUpdateRegion(hwndClient, hrgnVis);
722 WinValidateRegion(hwndClient, hrgnVis, FALSE);
723
724 dprintfRegion(pHps->hps, wnd->getWindowHandle(), hrgnVis);
725
726#ifdef DEBUG
727 //Note: GpiQueryClipBox returns logical points
728 lComplexity = GpiQueryClipBox(pHps->hps, &rectlClip);
729 dprintf(("ClipBox (%d): (%d,%d)(%d,%d)", lComplexity, rectlClip.xLeft, rectlClip.yBottom, rectlClip.xRight, rectlClip.yTop));
730#endif
731
732 //save old clip and visible regions (restored for CS_OWNDC windows in EndPaint)
733 dprintf(("Old visible region %x; old clip region %x", pHps->hrgnWinVis, pHps->hrgnWin32Clip));
734 wnd->SaveClipRegion(pHps->hrgnWin32Clip);
735 wnd->SaveVisRegion(pHps->hrgnWinVis);
736
737 //clear visible and clip regions
738 pHps->hrgnWin32Clip = NULLHANDLE;
739 pHps->hrgnWinVis = NULLHANDLE;
740
741 //set clip region
742 lComplexity = GdiSetVisRgn(pHps, hrgnVis);
743
744 if(lComplexity == NULLREGION_W) {
745 dprintf (("BeginPaint %x: EMPTY update rectangle (vis=%d/%d show=%d/%d", hWnd, WinIsWindowVisible(wnd->getOS2FrameWindowHandle()), WinIsWindowVisible(wnd->getOS2WindowHandle()), WinIsWindowShowing(wnd->getOS2FrameWindowHandle()), WinIsWindowShowing(wnd->getOS2WindowHandle())));
746 }
747 else dprintf (("BeginPaint %x: (vis=%d/%d show=%d/%d)", hWnd, WinIsWindowVisible(wnd->getOS2FrameWindowHandle()), WinIsWindowVisible(wnd->getOS2WindowHandle()), WinIsWindowShowing(wnd->getOS2FrameWindowHandle()), WinIsWindowShowing(wnd->getOS2WindowHandle())));
748
749 selectClientArea(wnd, pHps);
750
751#ifdef DEBUG
752 //Note: GpiQueryClipBox returns logical points
753 GpiQueryClipBox(pHps->hps, &rectlClip);
754 dprintf(("ClipBox (%d): (%d,%d)(%d,%d)", lComplexity, rectlClip.xLeft, rectlClip.yBottom, rectlClip.xRight, rectlClip.yTop));
755#endif
756 }
757
758 if(hPS_ownDC == 0)
759 setMapMode (wnd, pHps, MM_TEXT_W);
760 else
761 setPageXForm(wnd, pHps);
762
763 pHps->hdcType = TYPE_3;
764
765 HideCaret(hwnd);
766 WinShowTrackRect(wnd->getOS2WindowHandle(), FALSE);
767
768 if((wnd->needsEraseBkgnd() || wnd->hasPMUpdateRegionChanged()) && lComplexity != RGN_NULL) {
769 wnd->setEraseBkgnd(FALSE);
770 wnd->SetPMUpdateRegionChanged(FALSE);
771 lpps->fErase = (wnd->MsgEraseBackGround(pHps->hps) == 0);
772 }
773 else lpps->fErase = TRUE;
774
775 lpps->hdc = (HDC)pHps->hps;
776
777 if(lComplexity != RGN_NULL) {
778 long height = wnd->getClientHeight();
779 lpps->rcPaint.top = height - rectl.yTop;
780 lpps->rcPaint.left = rectl.xLeft;
781 lpps->rcPaint.bottom = height - rectl.yBottom;
782 lpps->rcPaint.right = rectl.xRight;
783 //BeginPaint must return logical points instead of device points.
784 //(not the same if e.g. app changes page viewport)
785 DPtoLP(lpps->hdc, (LPPOINT)&lpps->rcPaint, 2);
786 }
787 else {
788 lpps->rcPaint.bottom = lpps->rcPaint.top = 0;
789 lpps->rcPaint.right = lpps->rcPaint.left = 0;
790 }
791 RELEASE_WNDOBJ(wnd);
792
793 SetLastError(0);
794 dprintf(("USER32: BeginPaint %x -> hdc %x (%d,%d)(%d,%d)", hWnd, pHps->hps, lpps->rcPaint.left, lpps->rcPaint.top, lpps->rcPaint.right, lpps->rcPaint.bottom));
795 return (HDC)pHps->hps;
796}
797//******************************************************************************
798//******************************************************************************
799BOOL WIN32API EndPaint (HWND hWnd, const PAINTSTRUCT_W *pPaint)
800{
801 HWND hwnd = hWnd ? hWnd : HWND_DESKTOP;
802 pDCData pHps;
803
804 dprintf (("USER32: EndPaint(%x)", hwnd));
805
806 if (!pPaint || !pPaint->hdc )
807 return TRUE;
808
809 Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
810
811 if (!wnd) goto exit;
812
813 pHps = (pDCData)GpiQueryDCData((HPS)pPaint->hdc);
814 if (pHps && (pHps->hdcType == TYPE_3))
815 {
816 //restore previous visible and clip regions
817 if(pHps->hrgnWinVis) {
818 GreDestroyRegion(pHps->hps, pHps->hrgnWinVis);
819 pHps->hrgnWinVis = NULLHANDLE;
820 }
821 if(pHps->hrgnWin32Clip) {
822 GreDestroyRegion(pHps->hps, pHps->hrgnWin32Clip);
823 pHps->hrgnWin32Clip = NULLHANDLE;
824 }
825
826 GdiSetVisRgn(pHps, wnd->GetVisRegion());
827 GdiCombineVisRgnClipRgn(pHps, wnd->GetClipRegion(), RGN_AND_W);
828
829 wnd->SaveClipRegion(0);
830 wnd->SaveVisRegion(0);
831
832 pHps->hdcType = TYPE_1; //otherwise Open32's ReleaseDC fails
833 ReleaseDC(hwnd, pPaint->hdc);
834 }
835 else {
836 dprintf(("EndPaint: wrong hdc %x!!", pPaint->hdc));
837 }
838 wnd->setEraseBkgnd(TRUE);
839 ShowCaret(hwnd);
840 WinShowTrackRect(wnd->getOS2WindowHandle(), TRUE);
841
842exit:
843 if(wnd) RELEASE_WNDOBJ(wnd);
844 SetLastError(0);
845 return TRUE;
846}
847//******************************************************************************
848//******************************************************************************
849int WIN32API ReleaseDC (HWND hwnd, HDC hdc)
850{
851 BOOL isOwnDC = FALSE;
852 int rc;
853
854 HWND hwndDC = WindowFromDC(hdc);
855
856 //hwndDC can be zero if the window has already been destroyed
857 if(hwndDC != hwnd) {
858 dprintf(("WARNING: ReleaseDC: wrong window handle specified %x -> %x", hwnd, hwndDC));
859 hwnd = hwndDC;
860 }
861
862 if (hwnd)
863 {
864 Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle (hwnd);
865 if(wnd == NULL) {
866 dprintf(("ERROR: ReleaseDC %x %x failed", hwnd, hdc));
867 return 0;
868 }
869 isOwnDC = wnd->isOwnDC() && (wnd->getOwnDC() == hdc);
870 if(!isOwnDC)
871 {
872 pDCData pHps = (pDCData)GpiQueryDCData((HPS)hdc);
873 if(pHps && pHps->psType == MICRO_CACHED) {
874 removeClientArea(wnd, pHps);
875 if(pHps->hrgnWinVis) {
876 GreDestroyRegion(pHps->hps, pHps->hrgnWinVis);
877 pHps->hrgnWinVis = 0;
878 }
879 if(pHps->hrgnWin32Clip) {
880 GreDestroyRegion(pHps->hps, pHps->hrgnWin32Clip);
881 pHps->hrgnWin32Clip = 0;
882 }
883 }
884 else {
885 dprintf(("ERROR: ReleaseDC: pHps == NULL!!"));
886 DebugInt3();
887 }
888 }
889 else {
890 dprintf2(("ReleaseDC: CS_OWNDC, not released"));
891 }
892 if(!isOwnDC && !wnd->isDesktopWindow()) {
893 //remove from list of open DCs for this window
894 wnd->removeOpenDC(hdc);
895 }
896 RELEASE_WNDOBJ(wnd);
897 }
898
899 STATS_ReleaseDC(hwnd, hdc);
900 if(isOwnDC) {
901 rc = TRUE;
902 }
903 else {
904 UnselectGDIObjects(hdc);
905 rc = O32_ReleaseDC (0, hdc);
906 }
907
908 dprintf(("ReleaseDC %x %x", hwnd, hdc));
909 return (rc);
910}
911//******************************************************************************
912// This implementation of GetDCEx supports:
913//
914// DCX_WINDOW
915// DCX_CACHE
916// DCX_EXCLUDERGN (complex regions allowed)
917// DCX_INTERSECTRGN (complex regions allowed)
918// DCX_USESTYLE
919// DCX_CLIPSIBLINGS
920// DCX_CLIPCHILDREN
921// DCX_PARENTCLIP
922//
923// Not supported:
924//
925// DCX_NORESETATTRS_W
926// DCX_INTERSECTUPDATE_W
927// DCX_LOCKWINDOWUPDATE_W
928// DCX_VALIDATE_W
929// DCX_EXCLUDEUPDATE_W
930//
931//TODO: WM_SETREDRAW affects drawingAllowed flag!!
932//******************************************************************************
933HDC WIN32API GetDCEx (HWND hwnd, HRGN hrgn, ULONG flags)
934{
935 Win32BaseWindow *wnd = NULL;
936 HWND hWindow;
937 BOOL success;
938 pDCData pHps = NULL;
939 HPS hps = NULLHANDLE;
940 BOOL drawingAllowed = TRUE;
941 BOOL isWindowOwnDC;
942 BOOL creatingOwnDC = FALSE;
943 PS_Type psType;
944
945 if(flags & (DCX_NORESETATTRS_W | DCX_INTERSECTUPDATE_W | DCX_LOCKWINDOWUPDATE_W | DCX_VALIDATE_W | DCX_EXCLUDEUPDATE_W)) {
946 dprintf(("ERROR: GetDCEx: unsupported flags %x!!", flags));
947 DebugInt3();
948 }
949
950 if(hwnd == 0) {
951 dprintf(("error: GetDCEx window %x not found", hwnd));
952 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W);
953 return 0;
954 }
955
956 if(hwnd)
957 {
958 wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
959 if(wnd == NULL) {
960 dprintf (("ERROR: User32: GetDCEx bad window handle %X!!!!!", hwnd));
961 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W);
962 return 0;
963 }
964 if(flags & DCX_WINDOW_W) {
965 hWindow = wnd->getOS2FrameWindowHandle();
966 }
967 else hWindow = wnd->getOS2WindowHandle();
968 }
969
970 isWindowOwnDC = (((hWindow == HWND_DESKTOP) ? FALSE : (wnd->isOwnDC()))
971 && !(flags & (DCX_CACHE_W|DCX_WINDOW_W)));
972
973 if(isWindowOwnDC) //own dc always for client area
974 {
975 hps = wnd->getOwnDC();
976 if (hps)
977 {
978 pDCData pHps = (pDCData)GpiQueryDCData (hps);
979 if (!pHps)
980 goto error;
981
982 selectClientArea(wnd, pHps);
983
984 //TODO: Is this always necessary??
985 setPageXForm (wnd, pHps);
986 pHps->hdcType = TYPE_1;
987
988 //TODO: intersect/exclude clip region?
989 dprintf (("User32: GetDCEx hwnd %x (%x %x) -> wnd %x hdc %x", hwnd, hrgn, flags, wnd, hps));
990
991 RELEASE_WNDOBJ(wnd);
992
993 STATS_GetDCEx(hwnd, hps, hrgn, flags);
994
995 return (HDC)hps;
996 }
997 else creatingOwnDC = TRUE;
998 }
999
1000 if(isWindowOwnDC)
1001 {
1002 SIZEL sizel = {0,0};
1003 hps = GpiCreatePS (WinQueryAnchorBlock (hWindow),
1004 WinOpenWindowDC (hWindow),
1005 &sizel, PU_PELS | GPIT_MICRO | GPIA_ASSOC );
1006 psType = MICRO;
1007 // default cp is OS/2 one: set to windows default (ODIN.INI)
1008 GpiSetCp(hps, GetDisplayCodepage());
1009 }
1010 else
1011 {
1012 if (hWindow == HWND_DESKTOP) {
1013 hps = WinGetScreenPS (hWindow);
1014 }
1015 else {
1016 int clipstyle = 0;
1017 int clipwnd = HWND_TOP;
1018 if(flags & (DCX_USESTYLE_W))
1019 {
1020 int style = wnd->getStyle();
1021 if(style & WS_CLIPCHILDREN_W) {
1022 clipstyle |= PSF_CLIPCHILDREN;
1023 }
1024 if(style & WS_CLIPSIBLINGS_W) {
1025 clipstyle |= PSF_CLIPSIBLINGS;
1026 }
1027 if(wnd->fHasParentDC()) {
1028 clipstyle |= PSF_PARENTCLIP;
1029 }
1030 }
1031 if(flags & DCX_CLIPSIBLINGS_W) {
1032 clipstyle |= PSF_CLIPSIBLINGS;
1033 }
1034 if(flags & DCX_CLIPCHILDREN_W) {
1035 clipstyle |= PSF_CLIPCHILDREN;
1036 }
1037 if(flags & DCX_PARENTCLIP_W) {
1038 clipstyle |= PSF_PARENTCLIP;
1039 }
1040 //Always call WinGetClipPS; WinGetPS takes window & class style
1041 //into account
1042// if(clipstyle || !(flags & DCX_DEFAULTCLIP_W)) {
1043 dprintf2(("WinGetClipPS style %x", clipstyle));
1044 hps = WinGetClipPS(hWindow, clipwnd, clipstyle);
1045// }
1046// else hps = WinGetPS (hWindow);
1047
1048 // default cp is OS/2 one: set to windows default (ODIN.INI)
1049 GpiSetCp(hps, GetDisplayCodepage());
1050 }
1051 psType = MICRO_CACHED;
1052 }
1053
1054 if (!hps)
1055 goto error;
1056
1057 HPSToHDC (hWindow, hps, NULL, NULL);
1058 pHps = (pDCData)GpiQueryDCData (hps);
1059
1060 if(flags & DCX_WINDOW_W) {
1061 removeClientArea(wnd, pHps);
1062 }
1063 else selectClientArea(wnd, pHps);
1064
1065 setMapMode(wnd, pHps, MM_TEXT_W);
1066
1067 if ((flags & DCX_EXCLUDERGN_W) || (flags & DCX_INTERSECTRGN_W))
1068 {
1069 ULONG BytesNeeded;
1070 PRGNDATA RgnData;
1071 PRECT pr;
1072 int i;
1073 RECTL rectl;
1074
1075 if (!hrgn)
1076 goto error;
1077
1078 success = TRUE;
1079 if (flags & DCX_EXCLUDERGN_W)
1080 {//exclude specified region from visible region
1081 success = (GdiCombineVisRgn(pHps, hrgn, RGN_DIFF_W) != ERROR_W);
1082 }
1083 else //DCX_INTERSECTRGN_W
1084 {//intersect visible region with specified region
1085 success = (GdiCombineVisRgn(pHps, hrgn, RGN_AND_W) != ERROR_W);
1086 }
1087 if (!success)
1088 goto error;
1089 }
1090
1091 if (creatingOwnDC)
1092 wnd->setOwnDC ((HDC)hps);
1093
1094 pHps->psType = psType;
1095 pHps->hdcType = TYPE_1;
1096 //TODO: WM_SETREDRAW affects drawingAllowed flag!!
1097 GpiSetDrawControl (hps, DCTL_DISPLAY, drawingAllowed ? DCTL_ON : DCTL_OFF);
1098
1099 dprintf (("User32: GetDCEx hwnd %x (%x %x) -> hdc %x", hwnd, hrgn, flags, pHps->hps));
1100
1101 //add to list of open DCs for this window
1102 if(wnd->isDesktopWindow() == FALSE) {//not relevant for the desktop window
1103 wnd->addOpenDC((HDC)pHps->hps);
1104 }
1105
1106 RELEASE_WNDOBJ(wnd);
1107
1108 STATS_GetDCEx(hwnd, pHps->hps, hrgn, flags);
1109 return (HDC)pHps->hps;
1110
1111error:
1112 /* Something went wrong; clean up
1113 */
1114 dprintf(("ERROR: GetDCEx hwnd %x (%x %x) FAILED!", hwnd, hrgn, flags));
1115 DebugInt3();
1116 if (pHps)
1117 {
1118 if (pHps->hps)
1119 {
1120 if(pHps->psType == MICRO_CACHED)
1121 WinReleasePS(pHps->hps);
1122 else
1123 GpiDestroyPS(pHps->hps);
1124 }
1125
1126 if (pHps->hdc) DevCloseDC(pHps->hdc);
1127 if (pHps->hrgnHDC) GpiDestroyRegion(pHps->hps, pHps->hrgnHDC);
1128
1129 O32_DeleteObject (pHps->nullBitmapHandle);
1130 }
1131 if(wnd) RELEASE_WNDOBJ(wnd);
1132 SetLastError(ERROR_INVALID_PARAMETER_W);
1133 return NULL;
1134}
1135//******************************************************************************
1136//******************************************************************************
1137HDC WIN32API GetDC (HWND hwnd)
1138{
1139 if(!hwnd)
1140 return GetDCEx( GetDesktopWindow(), 0, DCX_CACHE_W | DCX_WINDOW_W );
1141
1142 return GetDCEx (hwnd, NULL, DCX_USESTYLE_W);
1143}
1144//******************************************************************************
1145//******************************************************************************
1146HDC WIN32API GetWindowDC (HWND hwnd)
1147{
1148 if (!hwnd) hwnd = GetDesktopWindow();
1149 return GetDCEx (hwnd, NULL, DCX_WINDOW_W | DCX_USESTYLE_W);
1150}
1151//******************************************************************************
1152//Helper for RedrawWindow (RDW_ALLCHILDREN_W)
1153//******************************************************************************
1154LRESULT WIN32API RedrawChildEnumProc(HWND hwnd, LPARAM lParam)
1155{
1156 RedrawWindow(hwnd, NULL, 0, lParam);
1157 return TRUE;
1158}
1159//******************************************************************************
1160// This implementation of RedrawWindow supports
1161// RDW_ERASE
1162// RDW_NOERASE
1163// RDW_INTERNALPAINT
1164// RDW_NOINTERNALPAINT
1165// RDW_INVALIDATE
1166// RDW_VALIDATE
1167// RDW_ERASENOW
1168// RDW_UPDATENOW
1169// RDW_FRAME
1170//
1171//TODO: Works ok for RDW_FRAME??
1172// SDK docs say RDW_FRAME is only valid for RDW_INVALIDATE...
1173//******************************************************************************
1174BOOL WIN32API RedrawWindow(HWND hwnd, const RECT* pRect, HRGN hrgn, DWORD redraw)
1175{
1176 Win32BaseWindow *wnd;
1177
1178 if(pRect) {
1179 dprintf(("RedrawWindow %x (%d,%d)(%d,%d) %x %x", hwnd, pRect->left, pRect->top, pRect->right, pRect->bottom, hrgn, redraw));
1180 }
1181 else dprintf(("RedrawWindow %x %x %x %x", hwnd, pRect, hrgn, redraw));
1182
1183 if(!IsWindowVisible(hwnd)) {
1184 dprintf(("WARNING: Invisible window -> ignoring RedrawWindow call"));
1185 return TRUE;
1186 }
1187
1188 if (hwnd == NULLHANDLE)
1189 {
1190 hwnd = HWND_DESKTOP;
1191 wnd = Win32BaseWindow::GetWindowFromOS2Handle(OSLIB_HWND_DESKTOP);
1192
1193 if (!wnd)
1194 {
1195 dprintf(("USER32:dc: RedrawWindow can't find desktop window %08xh\n",
1196 hwnd));
1197 SetLastError(ERROR_INVALID_PARAMETER_W);
1198 return FALSE;
1199 }
1200 }
1201 else
1202 {
1203 wnd = Win32BaseWindow::GetWindowFromHandle (hwnd);
1204
1205 if (!wnd)
1206 {
1207 dprintf(("USER32:dc: RedrawWindow can't find window %08xh\n",
1208 hwnd));
1209 SetLastError(ERROR_INVALID_PARAMETER_W);
1210 return FALSE;
1211 }
1212 if(redraw & RDW_FRAME_W) {
1213 hwnd = wnd->getOS2FrameWindowHandle();
1214 }
1215 else hwnd = wnd->getOS2WindowHandle();
1216 }
1217
1218 //check if the application previously didn't handle a WM_PAINT msg properly
1219 wnd->checkForDirtyUpdateRegion();
1220
1221 BOOL IncludeChildren = (redraw & RDW_ALLCHILDREN_W) ? TRUE : FALSE;
1222 BOOL success = TRUE;
1223 HPS hpsTemp = NULLHANDLE;
1224 HRGN hrgnTemp = NULLHANDLE;
1225 RECTL rectl;
1226
1227 if (hrgn)
1228 {
1229 ULONG BytesNeeded;
1230 PRGNDATA RgnData;
1231 PRECTL pr;
1232 int i;
1233 LONG height;
1234
1235 if(wnd) {
1236 height = (redraw & RDW_FRAME_W) ? wnd->getWindowHeight() : wnd->getClientHeight();
1237 }
1238 else height = OSLibQueryScreenHeight();
1239
1240 if (!hrgn)
1241 goto error;
1242
1243 BytesNeeded = GetRegionData (hrgn, 0, NULL);
1244 RgnData = (PRGNDATA)_alloca (BytesNeeded);
1245 if (RgnData == NULL)
1246 goto error;
1247 GetRegionData (hrgn, BytesNeeded, RgnData);
1248
1249 pr = (PRECTL)(RgnData->Buffer);
1250 for (i = RgnData->rdh.nCount; i > 0; i--, pr++) {
1251 LONG temp = pr->yTop;
1252 pr->yTop = height - pr->yBottom;
1253 pr->yBottom = height - temp;
1254 dprintf2(("RedrawWindow: region (%d,%d) (%d,%d)", pr->xLeft, pr->yBottom, pr->xRight, pr->yTop));
1255 }
1256
1257 hpsTemp = WinGetScreenPS (HWND_DESKTOP);
1258 hrgnTemp = GpiCreateRegion (hpsTemp, RgnData->rdh.nCount, (PRECTL)(RgnData->Buffer));
1259 if (!hrgnTemp) goto error;
1260 }
1261 else if (pRect)
1262 {
1263 if(wnd) {
1264 if(redraw & RDW_FRAME_W) {
1265 mapWin32ToOS2Rect(wnd->getWindowHeight(), (PRECT)pRect, (PRECTLOS2)&rectl);
1266 }
1267 else mapWin32ToOS2Rect(wnd->getClientHeight(), (PRECT)pRect, (PRECTLOS2)&rectl);
1268 }
1269 else mapWin32ToOS2Rect(OSLibQueryScreenHeight(), (PRECT)pRect, (PRECTLOS2)&rectl);
1270 }
1271
1272 if (redraw & RDW_INVALIDATE_W)
1273 {
1274 //TODO: SvL: pingpong.exe doesn't have RDW_NOERASE, but doesn't want WM_ERASEBKGND msgs
1275 if (redraw & RDW_ERASE_W) {
1276 wnd->setEraseBkgnd(TRUE);
1277 }
1278 else
1279 //Don't clear erase background flag if the window is
1280 //already (partly) invalidated
1281 if (!WinQueryUpdateRect (hwnd, NULL)) {
1282 dprintf(("RDW_INVALIDATE: no update rectangle, disable %x WM_ERASEBKGND", wnd->getWindowHandle()));
1283 wnd->setEraseBkgnd(FALSE);
1284 }
1285
1286 if (!pRect && !hrgn)
1287 success = WinInvalidateRect (hwnd, NULL, IncludeChildren);
1288 else
1289 if (hrgn) {
1290 success = WinInvalidateRegion (hwnd, hrgnTemp, IncludeChildren);
1291 if(IncludeChildren && WinQueryUpdateRect(hwnd, NULL) == FALSE) {
1292 dprintf(("WARNING: WinQueryUpdateRect %x region %x returned false even though we just invalidated part of a window!!!", hwnd, hrgnTemp));
1293 success = success = WinInvalidateRegion (hwnd, hrgnTemp, FALSE);
1294 }
1295 }
1296 else {
1297 dprintf2(("WinInvalidateRect (%d,%d)(%d,%d)", rectl.xLeft, rectl.yBottom, rectl.xRight, rectl.yTop));
1298 success = WinInvalidateRect (hwnd, &rectl, IncludeChildren);
1299//SvL: If all children are included, then WinInvalidateRect is called
1300// with fIncludeChildren=1 -> rect of hwnd isn't invalidated if child(ren)
1301// overlap(s) the specified rectangle completely (EVEN if window doesn't
1302// have WS_CLIPCHILREN!)
1303// -> example: XWing vs Tie Fighter install window
1304// WinInvalidateRect with fIncludeChildren=0 invalidates both the parent
1305// and child windows
1306//SvL: Can't always set fIncludeChildren to FALSE or else some controls in
1307// the RealPlayer setup application aren't redrawn when invalidating
1308// their parent
1309// SO: Check if IncludeChildren is set and part of the window is invalid
1310// If not -> call WinInvalidateRect with IncludeChildren=0 to force
1311// the window rectangle to be invalidated
1312//
1313 if(IncludeChildren && WinQueryUpdateRect(hwnd, NULL) == FALSE) {
1314 dprintf(("WARNING: WinQueryUpdateRect %x (%d,%d)(%d,%d) returned false even though we just invalidated part of a window!!!", hwnd, rectl.xLeft, rectl.yBottom, rectl.xRight, rectl.yTop));
1315 success = WinInvalidateRect (hwnd, &rectl, FALSE);
1316 }
1317 }
1318
1319 if (!success) goto error;
1320 }
1321 else if (redraw & RDW_VALIDATE_W)
1322 {
1323 if (redraw & RDW_NOERASE_W) {
1324 dprintf(("RDW_NOERASE: disable %x WM_ERASEBKGND", wnd->getWindowHandle()));
1325 wnd->setEraseBkgnd(FALSE);
1326 }
1327 if (WinQueryUpdateRect (hwnd, NULL))
1328 {
1329 if(!pRect && !hrgn) {
1330 success = WinValidateRect (hwnd, NULL, IncludeChildren);
1331 }
1332 else
1333 if(hrgn) {
1334 success = WinValidateRegion (hwnd, hrgnTemp, IncludeChildren);
1335 }
1336 else {
1337 success = WinValidateRect (hwnd, &rectl, IncludeChildren);
1338 }
1339 if(!success) goto error;
1340 }
1341 }
1342
1343 if(WinQueryUpdateRect(hwnd, &rectl))
1344 {
1345 dprintf2(("Update region (%d,%d)(%d,%d)", rectl.xLeft, rectl.yBottom, rectl.xRight, rectl.yTop));
1346 //TODO: Does this work if RDW_ALLCHILDREN is set??
1347 if(redraw & RDW_UPDATENOW_W)
1348 {
1349 dprintf(("RDW_UPDATENOW -> UpdateWindow"));
1350 UpdateWindow(wnd->getWindowHandle());
1351 }
1352 else
1353// if((redraw & RDW_ERASE_W) && (redraw & RDW_ERASENOW_W))
1354 if(redraw & RDW_ERASENOW_W && wnd->needsEraseBkgnd())
1355 wnd->setEraseBkgnd(sendEraseBkgnd(wnd) == 0);
1356// if(redraw & RDW_ALLCHILDREN_W) {
1357// EnumChildWindows(wnd->getWindowHandle(), RedrawChildEnumProc, redraw);
1358// }
1359 }
1360 else if((redraw & RDW_INTERNALPAINT_W) && !(redraw & RDW_INVALIDATE_W))
1361 {
1362 dprintf(("Manual redraw"));
1363 if(redraw & RDW_UPDATENOW_W) {
1364 wnd->MsgPaint(0, FALSE);
1365 }
1366 else PostMessageA(hwnd, WINWM_PAINT, 0, 0);
1367 }
1368
1369error:
1370 /* clean up */
1371 if (hrgnTemp)
1372 GpiDestroyRegion (hpsTemp, hrgnTemp);
1373
1374 if (hpsTemp)
1375 WinReleasePS (hpsTemp);
1376
1377 if (!success) {
1378 dprintf(("RedrawWindow failure!"));
1379 SetLastError(ERROR_INVALID_PARAMETER_W);
1380 }
1381 if(wnd) RELEASE_WNDOBJ(wnd);
1382 return (success);
1383}
1384//******************************************************************************
1385//******************************************************************************
1386BOOL WIN32API UpdateWindow (HWND hwnd)
1387{
1388 Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle (hwnd);
1389 RECTL rectl;
1390 BOOL rc;
1391
1392 if(!wnd) {
1393 dprintf (("ERROR: User32: UpdateWindow INVALID hwnd %x", hwnd));
1394 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W);
1395 return FALSE;
1396 }
1397
1398 //check if the application previously didn't handle a WM_PAINT msg properly
1399 wnd->checkForDirtyUpdateRegion();
1400
1401#ifdef DEBUG
1402 if(WinQueryUpdateRect(wnd->getOS2WindowHandle(), &rectl))
1403 {
1404 RECT rectUpdate;
1405 mapOS2ToWin32Rect(wnd->getClientHeight(), (PRECTLOS2)&rectl, &rectUpdate);
1406
1407 dprintf (("User32: UpdateWindow hwnd %x: update rectangle (%d,%d)(%d,%d)", hwnd, rectUpdate.left, rectUpdate.top, rectUpdate.right, rectUpdate.bottom));
1408 }
1409 else dprintf (("User32: UpdateWindow hwnd %x; EMPTY update rectangle (vis=%d/%d, show=%d/%d, vis parent=%d)", hwnd, WinIsWindowVisible(wnd->getOS2FrameWindowHandle()), WinIsWindowVisible(wnd->getOS2WindowHandle()), WinIsWindowShowing(wnd->getOS2FrameWindowHandle()), WinIsWindowShowing(wnd->getOS2WindowHandle()), IsWindowVisible(GetParent(hwnd))));
1410#endif
1411 //SvL: This doesn't work right (Wine uses RDW_NOCHILDREN_W -> doesn't work here)
1412 // Breaks vpbuddy
1413 //rc = RedrawWindow(hwnd, NULL, 0, RDW_UPDATENOW_W | RDW_ALLCHILDREN_W);
1414 // -> RDW_UPDATENOW causes WM_PAINT messages to be directy posted to window
1415 // handler; possibly bypassing queued WM_PAINT messages for parent window(s)
1416 // -> out of sync painting (i.e. parent paints over child)
1417
1418// if(!WinIsWindowShowing(wnd->getOS2FrameWindowHandle()) || !WinIsWindowShowing(wnd->getOS2WindowHandle())) {
1419// dprintf(("UpdateWindow: window not showing %d/%d", WinIsWindowShowing(wnd->getOS2FrameWindowHandle()), WinIsWindowShowing(wnd->getOS2WindowHandle()) ));
1420// RELEASE_WNDOBJ(wnd);
1421// return FALSE;
1422// }
1423 //Must use frame window here. If the frame window has a valid update region and we call
1424 //WinUpdateWindow for the client window, then no WM_PAINT messages will be sent.
1425 rc = WinUpdateWindow(wnd->getOS2FrameWindowHandle());
1426#ifdef DEBUG
1427 if(WinQueryUpdateRect(wnd->getOS2WindowHandle(), NULL))
1428 {
1429 //if parent has valid update region then WinUpdateWindow will still fail..
1430 //might be harmless and happen even in windows
1431 dprintf (("ERROR: User32: UpdateWindow didn't send WM_PAINT messages!!"));
1432 }
1433#endif
1434 RELEASE_WNDOBJ(wnd);
1435 return rc;
1436}
1437//******************************************************************************
1438//******************************************************************************
1439BOOL WIN32API ValidateRect( HWND hwnd, const RECT * lprc)
1440{
1441 if(lprc) {
1442 dprintf(("USER32: ValidateRect %x (%d,%d)(%d,%d)", hwnd, lprc->left, lprc->top, lprc->right, lprc->bottom));
1443 }
1444 else dprintf(("USER32: ValidateRect %x", hwnd));
1445
1446 return RedrawWindow( hwnd, lprc, 0, RDW_VALIDATE_W | RDW_NOCHILDREN_W | (hwnd==0 ? RDW_UPDATENOW_W : 0));
1447}
1448//******************************************************************************
1449//******************************************************************************
1450BOOL WIN32API ValidateRgn( HWND hwnd, HRGN hrgn)
1451{
1452 dprintf(("USER32: ValidateRgn %x %x", hwnd, hrgn));
1453 return RedrawWindow( hwnd, NULL, hrgn, RDW_VALIDATE_W | RDW_NOCHILDREN_W | (hwnd==0 ? RDW_UPDATENOW_W : 0));
1454}
1455//******************************************************************************
1456//******************************************************************************
1457BOOL WIN32API InvalidateRect (HWND hwnd, const RECT *pRect, BOOL erase)
1458{
1459 BOOL result;
1460
1461 if(pRect) {
1462 dprintf(("InvalidateRect %x (%d,%d)(%d,%d) erase=%d", hwnd, pRect->left, pRect->top, pRect->right, pRect->bottom, erase));
1463 }
1464 else dprintf(("InvalidateRect %x NULL erase=%d", hwnd, erase));
1465#if 1
1466 result = RedrawWindow (hwnd, pRect, NULLHANDLE,
1467 RDW_ALLCHILDREN_W | RDW_INVALIDATE_W |
1468 (erase ? RDW_ERASE_W : 0) |
1469 (hwnd == NULLHANDLE ? RDW_UPDATENOW_W : 0));
1470#else
1471 result = RedrawWindow (hwnd, pRect, NULLHANDLE,
1472 RDW_ALLCHILDREN_W | RDW_INVALIDATE_W |
1473 (erase ? RDW_ERASE_W : RDW_NOERASE_W) |
1474 (hwnd == NULLHANDLE ? RDW_UPDATENOW_W : 0));
1475#endif
1476 return (result);
1477}
1478//******************************************************************************
1479//******************************************************************************
1480BOOL WIN32API InvalidateRgn (HWND hwnd, HRGN hrgn, BOOL erase)
1481{
1482 BOOL result;
1483
1484 dprintf(("InvalidateRgn %x %x erase=%d", hwnd, hrgn, erase));
1485#if 1
1486 result = RedrawWindow (hwnd, NULL, hrgn,
1487 RDW_ALLCHILDREN_W | RDW_INVALIDATE_W |
1488 (erase ? RDW_ERASE_W : 0) |
1489 (hwnd == NULLHANDLE ? RDW_UPDATENOW_W : 0));
1490#else
1491 result = RedrawWindow (hwnd, NULL, hrgn,
1492 RDW_ALLCHILDREN_W | RDW_INVALIDATE_W |
1493 (erase ? RDW_ERASE_W : RDW_NOERASE_W) |
1494 (hwnd == NULLHANDLE ? RDW_UPDATENOW_W : 0));
1495#endif
1496 return (result);
1497}
1498//******************************************************************************
1499//TODO: Change for client rectangle!!!!!
1500//******************************************************************************
1501BOOL setPMRgnIntoWinRgn (HPS hps, HRGN hrgnPM, HRGN hrgnWin, LONG height)
1502{
1503 BOOL rc;
1504 RGNRECT rgnRect;
1505 rgnRect.ircStart = 1;
1506 rgnRect.crc = 0;
1507 rgnRect.ulDirection = RECTDIR_LFRT_TOPBOT;
1508
1509 rc = GpiQueryRegionRects (hps, hrgnPM, NULL, &rgnRect, NULL);
1510
1511 if (rc && (rgnRect.crcReturned > 0))
1512 {
1513 PRECTL Rcls = new RECTL[rgnRect.crcReturned];
1514 PRECTL pRcl = Rcls;
1515
1516 if (Rcls != NULL)
1517 {
1518 rgnRect.crc = rgnRect.crcReturned;
1519 rc = GpiQueryRegionRects (hps, hrgnPM, NULL, &rgnRect, Rcls);
1520
1521 rc = SetRectRgn(hrgnWin, pRcl->xLeft, height - pRcl->yTop,
1522 pRcl->xRight, height - pRcl->yBottom);
1523
1524 if (rgnRect.crcReturned > 1)
1525 {
1526 int i;
1527 HRGN temp;
1528 temp = CreateRectRgn (0, 0, 1, 1);
1529
1530 for (i = 1, pRcl++; rc && (i < rgnRect.crcReturned); i++, pRcl++)
1531 {
1532 rc = SetRectRgn (temp, pRcl->xLeft, height - pRcl->yTop,
1533 pRcl->xRight, height - pRcl->yBottom);
1534 rc &= CombineRgn (hrgnWin, hrgnWin, temp, RGN_OR_W);
1535 }
1536 DeleteObject (temp);
1537 }
1538 delete[] Rcls;
1539 }
1540 else
1541 {
1542 rc = FALSE;
1543 }
1544 }
1545 else
1546 {
1547 rc = SetRectRgn (hrgnWin, 0, 0, 0, 0);
1548 }
1549
1550 return (rc);
1551}
1552//******************************************************************************
1553//Using WinScrollWindow to scroll child windows is better (smoother).
1554//******************************************************************************
1555INT WIN32API ScrollWindowEx(HWND hwnd, int dx, int dy, const RECT *pScroll, const RECT *pClip,
1556 HRGN hrgnUpdate, PRECT pRectUpdate, UINT scrollFlag)
1557{
1558 Win32BaseWindow *window;
1559 APIRET rc;
1560 RECTL scrollRect;
1561 RECTL clipRect;
1562 PRECTL pScrollOS2 = NULL;
1563 PRECTL pClipOS2 = NULL;
1564 ULONG scrollFlagsOS2 = 0;
1565 int orgdy = dy;
1566 int regionType = ERROR_W;
1567
1568 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
1569 if(!window) {
1570 dprintf(("ScrollWindowEx, window %x not found", hwnd));
1571 return 0;
1572 }
1573
1574 dprintf(("ScrollWindowEx %x %d %d %x %x", hwnd, dx, dy, pScroll, pClip));
1575
1576 dy = revertDy (window, dy);
1577
1578 if (scrollFlag & SW_INVALIDATE_W) scrollFlagsOS2 |= SW_INVALIDATERGN;
1579 if (scrollFlag & SW_SCROLLCHILDREN_W) scrollFlagsOS2 |= SW_SCROLLCHILDREN;
1580
1581 if(pScroll) {
1582 mapWin32ToOS2Rect(window->getClientHeight(), (RECT *)pScroll, (PRECTLOS2)&scrollRect);
1583 pScrollOS2 = &scrollRect;
1584 }
1585
1586 if(pClip) {
1587 mapWin32ToOS2Rect(window->getClientHeight(), (RECT *)pClip, (PRECTLOS2)&clipRect);
1588 pClipOS2 = &clipRect;
1589 }
1590
1591 RECTL rectlUpdate;
1592 HRGN hrgn = NULLHANDLE;
1593 HPS hpsScreen = 0;
1594
1595 if(hrgnUpdate) {
1596 RECTL rectl = { 1, 1, 2, 2 };
1597
1598 hpsScreen = WinGetScreenPS (HWND_DESKTOP);
1599 hrgn = GpiCreateRegion(hpsScreen, 1, &rectl);
1600 }
1601
1602 if (scrollFlag & SW_SMOOTHSCROLL_W)
1603 {
1604 INT time = (scrollFlag >> 16) & 0xFFFF;
1605
1606 //CB: todo, scroll in several steps
1607 // is time in ms? time <-> iteration count?
1608 }
1609
1610 LONG lComplexity = WinScrollWindow(window->getOS2WindowHandle(), dx, dy,
1611 pScrollOS2, pClipOS2,
1612 hrgn, &rectlUpdate, scrollFlagsOS2);
1613 if (lComplexity == RGN_ERROR)
1614 {
1615 goto fail;
1616 }
1617
1618 //Notify children that they have moved (according to the SDK docs,
1619 //they only receive a WM_MOVE message)
1620 //(PM only does this for windows with CS_MOVENOTIFY class)
1621 //TODO: Verify this (no WM_WINDOWPOSCHANGING/ED?)
1622 if (scrollFlag & SW_SCROLLCHILDREN_W)
1623 {
1624 HWND hwndChild;
1625 RECT rectChild, rc;
1626
1627 dprintf(("ScrollWindowEx: Scroll child windows"));
1628 GetClientRect(hwnd, &rc);
1629 if (pScroll) IntersectRect(&rc, &rc, pScroll);
1630
1631 hwndChild = GetWindow(hwnd, GW_CHILD_W);
1632
1633 while(hwndChild)
1634 {
1635 Win32BaseWindow *child;
1636
1637 child = Win32BaseWindow::GetWindowFromHandle(hwndChild);
1638 if(!child) {
1639 dprintf(("ERROR: ScrollWindowEx, child %x not found", hwnd));
1640 goto fail;
1641 }
1642 rectChild = *child->getWindowRect();
1643 if(!pScroll || IntersectRect(&rectChild, &rectChild, &rc))
1644 {
1645 dprintf(("ScrollWindowEx: Scroll child window %x", hwndChild));
1646 child->ScrollWindow(dx, orgdy);
1647 }
1648 RELEASE_WNDOBJ(child);
1649 hwndChild = GetWindow(hwndChild, GW_HWNDNEXT_W);
1650 }
1651 dprintf(("***ScrollWindowEx: Scroll child windows DONE"));
1652 }
1653
1654 RECT winRectUpdate;
1655
1656 mapOS2ToWin32Rect(window->getClientHeight(), (PRECTLOS2)&rectlUpdate, &winRectUpdate);
1657
1658 if (pRectUpdate)
1659 *pRectUpdate = winRectUpdate;
1660
1661 if (hrgnUpdate) {
1662 rc = setPMRgnIntoWinRgn(hpsScreen, hrgn, hrgnUpdate, window->getClientHeight());
1663 GpiDestroyRegion(hpsScreen, hrgn);
1664 WinReleasePS(hpsScreen);
1665 }
1666
1667 // If the background is to be erased, then make it so
1668 if ((scrollFlag & SW_ERASE_W))
1669 {
1670 dprintf(("Set erase background flag to TRUE"));
1671 window->setEraseBkgnd(TRUE);
1672 }
1673
1674#if 0
1675 //SvL: WinScrollWindow already invalidates the area; no need to do it again
1676 //(call to invalidateRect was wrong; has to include erase flag)
1677 if ((scrollFlag & SW_INVALIDATE_W) &&
1678 ((lComplexity == RGN_RECT) || (lComplexity == RGN_COMPLEX)))
1679 {
1680 rc = RedrawWindow (hwnd, &winRectUpdate, NULLHANDLE,
1681 RDW_ALLCHILDREN_W | RDW_INVALIDATE_W |
1682 ((scrollFlag & SW_ERASE_W) ? RDW_ERASE_W : 0) |
1683 RDW_UPDATENOW_W);
1684
1685// rc = InvalidateRect (hwnd, &winRectUpdate, (scrollFlag & SW_ERASE_W) ? 1 : 0);
1686 if (rc == FALSE)
1687 {
1688 RELEASE_WNDOBJ(window);
1689 return (0);
1690 }
1691 }
1692#endif
1693
1694 switch (lComplexity)
1695 {
1696 case RGN_NULL:
1697 regionType = NULLREGION_W;
1698 break;
1699 case RGN_RECT:
1700 regionType = SIMPLEREGION_W;
1701 break;
1702 case RGN_COMPLEX:
1703 regionType = COMPLEXREGION_W;
1704 break;
1705 default:
1706 regionType = ERROR_W;
1707 break;
1708 }
1709
1710 RELEASE_WNDOBJ(window);
1711 return (regionType);
1712
1713fail:
1714 if(hrgn) GpiDestroyRegion(hpsScreen, hrgn);
1715 if(hpsScreen) WinReleasePS(hpsScreen);
1716 RELEASE_WNDOBJ(window);
1717 return ERROR_W;
1718}
1719//******************************************************************************
1720//******************************************************************************
1721BOOL WIN32API ScrollWindow(HWND hwnd, int dx, int dy, const RECT *pScroll, const RECT *pClip)
1722{
1723 dprintf(("ScrollWindow %x %d %d %x %x", hwnd, dx, dy, pScroll, pClip));
1724 return (ERROR_W != ScrollWindowEx(hwnd, dx, dy, pScroll, pClip, 0, NULL,
1725 (pScroll ? 0 : SW_SCROLLCHILDREN_W) |
1726 SW_INVALIDATE_W ));
1727}
1728//******************************************************************************
1729//******************************************************************************
1730HWND WIN32API WindowFromDC(HDC hdc)
1731{
1732 pDCData pHps = (pDCData)GpiQueryDCData( (HPS)hdc );
1733
1734 dprintf2(("USER32: WindowFromDC %x", hdc));
1735 if ( pHps )
1736 return OS2ToWin32Handle(pHps->hwnd);
1737 else
1738 return 0;
1739}
1740//******************************************************************************
1741//******************************************************************************
1742
Note: See TracBrowser for help on using the repository browser.