Release 970112
[wine.git] / windows / dce.c
blob56889ce64f7ea02eea3f845735590327c96ba9d3
1 /*
2 * USER DCE functions
4 * Copyright 1993 Alexandre Julliard
5 * 1996 Alex Korobka
8 * Note: Visible regions of CS_OWNDC/CS_CLASSDC window DCs
9 * have to be updated dynamically.
11 * Internal DCX flags:
13 * DCX_DCEBUSY - dce structure is in use
14 * DCX_KEEPCLIPRGN - do not delete clipping region in ReleaseDC
15 * DCX_WINDOWPAINT - BeginPaint specific flag
18 #include "dce.h"
19 #include "class.h"
20 #include "win.h"
21 #include "gdi.h"
22 #include "heap.h"
23 #include "sysmetrics.h"
24 #include "stddebug.h"
25 /* #define DEBUG_DC */
26 #include "debug.h"
28 #define NB_DCE 5 /* Number of DCEs created at startup */
30 static DCE *firstDCE = 0;
31 static HDC32 defaultDCstate = 0;
33 /***********************************************************************
34 * DCE_AllocDCE
36 * Allocate a new DCE.
38 DCE *DCE_AllocDCE( HWND32 hWnd, DCE_TYPE type )
40 DCE * dce;
41 if (!(dce = HeapAlloc( SystemHeap, 0, sizeof(DCE) ))) return NULL;
42 if (!(dce->hDC = CreateDC16( "DISPLAY", NULL, NULL, NULL )))
44 HeapFree( SystemHeap, 0, dce );
45 return 0;
48 /* store DCE handle in DC hook data field */
50 SetDCHook( dce->hDC, (FARPROC16)DCHook, (DWORD)dce );
52 dce->hwndCurrent = hWnd;
53 dce->hClipRgn = 0;
54 dce->next = firstDCE;
55 firstDCE = dce;
57 if( type != DCE_CACHE_DC )
59 dce->DCXflags = DCX_DCEBUSY;
60 if( hWnd )
62 WND* wnd = WIN_FindWndPtr(hWnd);
64 if( wnd->dwStyle & WS_CLIPCHILDREN ) dce->DCXflags |= DCX_CLIPCHILDREN;
65 if( wnd->dwStyle & WS_CLIPSIBLINGS ) dce->DCXflags |= DCX_CLIPSIBLINGS;
67 SetHookFlags(dce->hDC,DCHF_INVALIDATEVISRGN);
69 else dce->DCXflags = DCX_CACHE;
71 return dce;
75 /***********************************************************************
76 * DCE_FreeDCE
78 void DCE_FreeDCE( DCE *dce )
80 DCE **ppDCE = &firstDCE;
82 if (!dce) return;
83 while (*ppDCE && (*ppDCE != dce)) ppDCE = &(*ppDCE)->next;
84 if (*ppDCE == dce) *ppDCE = dce->next;
86 SetDCHook(dce->hDC, NULL, 0L);
88 DeleteDC32( dce->hDC );
89 if( dce->hClipRgn && !(dce->DCXflags & DCX_KEEPCLIPRGN) )
90 DeleteObject32(dce->hClipRgn);
91 HeapFree( SystemHeap, 0, dce );
95 /**********************************************************************
96 * WindowFromDC16 (USER32.580)
98 HWND16 WindowFromDC16( HDC16 hDC )
100 return (HWND16)WindowFromDC32( hDC );
104 /**********************************************************************
105 * WindowFromDC32 (USER32.580)
107 HWND32 WindowFromDC32( HDC32 hDC )
109 DCE *dce = firstDCE;
110 while (dce && (dce->hDC != hDC)) dce = dce->next;
111 return dce ? dce->hwndCurrent : 0;
115 /***********************************************************************
116 * DCE_InvalidateDCE
118 * It is called from SetWindowPos - we have to invalidate all busy
119 * DCE's for windows whose client rect intersects with update rectangle
121 BOOL32 DCE_InvalidateDCE(WND* wndScope, RECT16* pRectUpdate)
123 BOOL32 bRet = FALSE;
124 DCE *dce;
126 if( !wndScope ) return 0;
128 dprintf_dc(stddeb,"InvalidateDCE: scope hwnd = %04x, (%i,%i - %i,%i)\n",
129 wndScope->hwndSelf, pRectUpdate->left,pRectUpdate->top,
130 pRectUpdate->right,pRectUpdate->bottom);
131 /* walk all DCE's */
133 for (dce = firstDCE; (dce); dce = dce->next)
135 if( dce->DCXflags & DCX_DCEBUSY )
137 WND * wndCurrent, * wnd;
139 wnd = wndCurrent = WIN_FindWndPtr(dce->hwndCurrent);
141 /* desktop is not critical (DC is not owned anyway) */
143 if( wnd == WIN_GetDesktop() ) continue;
145 /* check if DCE window is within z-order scope */
147 for( ; wnd ; wnd = wnd->parent )
148 if( wnd == wndScope )
150 RECT16 wndRect = wndCurrent->rectWindow;
152 dprintf_dc(stddeb,"\tgot hwnd %04x\n", wndCurrent->hwndSelf);
154 MapWindowPoints16(wndCurrent->parent->hwndSelf, wndScope->hwndSelf,
155 (LPPOINT16)&wndRect, 2);
156 if( IntersectRect16(&wndRect,&wndRect,pRectUpdate) )
158 SetHookFlags(dce->hDC, DCHF_INVALIDATEVISRGN);
159 bRet = TRUE;
161 break;
165 return bRet;
168 /***********************************************************************
169 * DCE_Init
171 void DCE_Init()
173 int i;
174 DCE * dce;
176 for (i = 0; i < NB_DCE; i++)
178 if (!(dce = DCE_AllocDCE( 0, DCE_CACHE_DC ))) return;
179 if (!defaultDCstate) defaultDCstate = GetDCState( dce->hDC );
184 /***********************************************************************
185 * DCE_GetVisRect
187 * Calc the visible rectangle of a window, i.e. the client or
188 * window area clipped by the client area of all ancestors.
189 * Return FALSE if the visible region is empty.
191 static BOOL DCE_GetVisRect( WND *wndPtr, BOOL clientArea, RECT16 *lprect )
193 int xoffset, yoffset;
195 *lprect = clientArea ? wndPtr->rectClient : wndPtr->rectWindow;
196 xoffset = lprect->left;
197 yoffset = lprect->top;
199 if (!(wndPtr->dwStyle & WS_VISIBLE) || (wndPtr->flags & WIN_NO_REDRAW))
201 SetRectEmpty16( lprect ); /* Clip everything */
202 return FALSE;
205 while (wndPtr->parent)
207 wndPtr = wndPtr->parent;
208 if (!(wndPtr->dwStyle & WS_VISIBLE) ||
209 (wndPtr->flags & WIN_NO_REDRAW) ||
210 (wndPtr->dwStyle & WS_ICONIC))
212 SetRectEmpty16( lprect ); /* Clip everything */
213 return FALSE;
215 xoffset += wndPtr->rectClient.left;
216 yoffset += wndPtr->rectClient.top;
217 OffsetRect16( lprect, wndPtr->rectClient.left,
218 wndPtr->rectClient.top );
220 /* Warning!! we assume that IntersectRect() handles the case */
221 /* where the destination is the same as one of the sources. */
222 if (!IntersectRect16( lprect, lprect, &wndPtr->rectClient ))
223 return FALSE; /* Visible rectangle is empty */
225 OffsetRect16( lprect, -xoffset, -yoffset );
226 return TRUE;
230 /***********************************************************************
231 * DCE_ClipWindows
233 * Go through the linked list of windows from hwndStart to hwndEnd,
234 * removing from the given region the rectangle of each window offset
235 * by a given amount. The new region is returned, and the original one
236 * is destroyed. Used to implement DCX_CLIPSIBLINGS and
237 * DCX_CLIPCHILDREN styles.
239 static HRGN32 DCE_ClipWindows( WND *pWndStart, WND *pWndEnd,
240 HRGN32 hrgn, int xoffset, int yoffset )
242 HRGN32 hrgnNew;
244 if (!pWndStart) return hrgn;
245 if (!(hrgnNew = CreateRectRgn32( 0, 0, 0, 0 )))
247 DeleteObject32( hrgn );
248 return 0;
250 for (; pWndStart != pWndEnd; pWndStart = pWndStart->next)
252 if (!(pWndStart->dwStyle & WS_VISIBLE)) continue;
253 SetRectRgn( hrgnNew, pWndStart->rectWindow.left + xoffset,
254 pWndStart->rectWindow.top + yoffset,
255 pWndStart->rectWindow.right + xoffset,
256 pWndStart->rectWindow.bottom + yoffset );
257 if (!CombineRgn32( hrgn, hrgn, hrgnNew, RGN_DIFF )) break;
259 DeleteObject32( hrgnNew );
260 if (pWndStart != pWndEnd) /* something went wrong */
262 DeleteObject32( hrgn );
263 return 0;
265 return hrgn;
269 /***********************************************************************
270 * DCE_GetVisRgn
272 * Return the visible region of a window, i.e. the client or window area
273 * clipped by the client area of all ancestors, and then optionally
274 * by siblings and children.
276 HRGN32 DCE_GetVisRgn( HWND hwnd, WORD flags )
278 RECT16 rect;
279 HRGN32 hrgn;
280 int xoffset, yoffset;
281 WND *wndPtr = WIN_FindWndPtr( hwnd );
283 /* Get visible rectangle and create a region with it.
284 * do we really need to calculate vis rgns for X windows?
285 * - yes, to clip child windows but we should skip
286 * siblings in this case.
289 if (!wndPtr || !DCE_GetVisRect( wndPtr, !(flags & DCX_WINDOW), &rect ))
291 return CreateRectRgn32( 0, 0, 0, 0 ); /* Visible region is empty */
293 if (!(hrgn = CreateRectRgnIndirect16( &rect ))) return 0;
295 /* Clip all children from the visible region */
297 if (flags & DCX_CLIPCHILDREN)
299 if (flags & DCX_WINDOW)
301 xoffset = wndPtr->rectClient.left - wndPtr->rectWindow.left;
302 yoffset = wndPtr->rectClient.top - wndPtr->rectWindow.top;
304 else xoffset = yoffset = 0;
305 hrgn = DCE_ClipWindows( wndPtr->child, NULL, hrgn, xoffset, yoffset );
306 if (!hrgn) return 0;
309 /* Clip siblings placed above this window */
311 if (flags & DCX_WINDOW)
313 xoffset = -wndPtr->rectWindow.left;
314 yoffset = -wndPtr->rectWindow.top;
316 else
318 xoffset = -wndPtr->rectClient.left;
319 yoffset = -wndPtr->rectClient.top;
321 if (flags & DCX_CLIPSIBLINGS)
323 hrgn = DCE_ClipWindows( wndPtr->parent ? wndPtr->parent->child : NULL,
324 wndPtr, hrgn, xoffset, yoffset );
325 if (!hrgn) return 0;
328 /* Clip siblings of all ancestors that have the WS_CLIPSIBLINGS style */
330 while (wndPtr->dwStyle & WS_CHILD)
332 wndPtr = wndPtr->parent;
333 xoffset -= wndPtr->rectClient.left;
334 yoffset -= wndPtr->rectClient.top;
335 hrgn = DCE_ClipWindows( wndPtr->parent ? wndPtr->parent->child : NULL,
336 wndPtr, hrgn, xoffset, yoffset );
337 if (!hrgn) return 0;
339 return hrgn;
343 /***********************************************************************
344 * DCE_SetDrawable
346 * Set the drawable, origin and dimensions for the DC associated to
347 * a given window.
349 static void DCE_SetDrawable( WND *wndPtr, DC *dc, WORD flags )
351 if (!wndPtr) /* Get a DC for the whole screen */
353 dc->w.DCOrgX = 0;
354 dc->w.DCOrgY = 0;
355 dc->u.x.drawable = rootWindow;
356 XSetSubwindowMode( display, dc->u.x.gc, IncludeInferiors );
358 else
360 if (flags & DCX_WINDOW)
362 dc->w.DCOrgX = wndPtr->rectWindow.left;
363 dc->w.DCOrgY = wndPtr->rectWindow.top;
365 else
367 dc->w.DCOrgX = wndPtr->rectClient.left;
368 dc->w.DCOrgY = wndPtr->rectClient.top;
370 while (!wndPtr->window)
372 wndPtr = wndPtr->parent;
373 dc->w.DCOrgX += wndPtr->rectClient.left;
374 dc->w.DCOrgY += wndPtr->rectClient.top;
376 dc->w.DCOrgX -= wndPtr->rectWindow.left;
377 dc->w.DCOrgY -= wndPtr->rectWindow.top;
378 dc->u.x.drawable = wndPtr->window;
381 /***********************************************************************
382 * DCE_ExcludeRgn
384 * Translate given region from the wnd client to the DC coordinates
385 * and add it to the clipping region.
387 INT16 DCE_ExcludeRgn( HDC32 hDC, WND* wnd, HRGN32 hRgn )
389 INT16 ret;
390 POINT32 pt = {0, 0};
391 HRGN32 hRgnClip = GetClipRgn16( hDC );
392 DCE *dce = firstDCE;
394 while (dce && (dce->hDC != hDC)) dce = dce->next;
395 if( dce )
397 MapWindowPoints32( wnd->hwndSelf, dce->hwndCurrent, &pt, 1);
398 if( dce->DCXflags & DCX_WINDOW )
400 wnd = WIN_FindWndPtr(dce->hwndCurrent);
401 pt.x += wnd->rectClient.left - wnd->rectWindow.left;
402 pt.y += wnd->rectClient.top - wnd->rectWindow.top;
405 else return ERROR;
406 OffsetRgn32(hRgn, pt.x, pt.y);
407 if( hRgnClip ) ret = CombineRgn32( hRgnClip, hRgnClip, hRgn, RGN_DIFF );
408 else
410 hRgnClip = InquireVisRgn( hDC );
411 ret = CombineRgn32( hRgn, hRgnClip, hRgn, RGN_DIFF );
412 SelectClipRgn32( hDC, hRgn );
414 return ret;
417 /***********************************************************************
418 * GetDCEx16 (USER.359)
420 HDC16 GetDCEx16( HWND16 hwnd, HRGN16 hrgnClip, DWORD flags )
422 return (HDC16)GetDCEx32( hwnd, hrgnClip, flags );
426 /***********************************************************************
427 * GetDCEx32 (USER32.230)
429 * Unimplemented flags: DCX_LOCKWINDOWUPDATE
431 HDC32 GetDCEx32( HWND32 hwnd, HRGN32 hrgnClip, DWORD flags )
433 HRGN32 hrgnVisible;
434 HDC32 hdc = 0;
435 DCE * dce;
436 DC * dc;
437 WND * wndPtr;
438 DWORD dcx_flags = 0;
439 BOOL need_update = TRUE;
441 dprintf_dc(stddeb,"GetDCEx: hwnd %04x, hrgnClip %04x, flags %08x\n", hwnd, hrgnClip, (unsigned)flags);
443 if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0;
445 if (!(wndPtr->class->style & (CS_OWNDC | CS_CLASSDC))) flags |= DCX_CACHE;
447 if (flags & DCX_USESTYLE)
449 flags &= ~( DCX_CLIPCHILDREN | DCX_CLIPSIBLINGS | DCX_PARENTCLIP);
451 if( wndPtr->dwStyle & WS_CLIPSIBLINGS )
452 flags |= DCX_CLIPSIBLINGS;
454 if ( !(flags & DCX_WINDOW) )
456 if (wndPtr->class->style & CS_PARENTDC) flags |= DCX_PARENTCLIP;
458 if (wndPtr->dwStyle & WS_CLIPCHILDREN &&
459 !(wndPtr->dwStyle & WS_MINIMIZE) ) flags |= DCX_CLIPCHILDREN;
461 else flags |= DCX_CACHE;
464 if( flags & DCX_NOCLIPCHILDREN )
466 flags |= DCX_CACHE;
467 flags &= ~(DCX_PARENTCLIP | DCX_CLIPCHILDREN);
470 if (hwnd == GetDesktopWindow32() || !(wndPtr->dwStyle & WS_CHILD))
471 flags &= ~DCX_PARENTCLIP;
473 if (flags & DCX_WINDOW) flags = (flags & ~DCX_CLIPCHILDREN) | DCX_CACHE;
475 if( flags & DCX_PARENTCLIP )
477 flags |= DCX_CACHE;
478 if( !(flags & (DCX_CLIPSIBLINGS | DCX_CLIPCHILDREN)) )
479 if( (wndPtr->dwStyle & WS_VISIBLE) && (wndPtr->parent->dwStyle & WS_VISIBLE) )
481 flags &= ~DCX_CLIPCHILDREN;
482 if( wndPtr->parent->dwStyle & WS_CLIPSIBLINGS )
483 flags |= DCX_CLIPSIBLINGS;
487 if (flags & DCX_CACHE)
489 for (dce = firstDCE; (dce); dce = dce->next)
491 if ((dce->DCXflags & DCX_CACHE) && !(dce->DCXflags & DCX_DCEBUSY)) break;
494 else
496 dce = (wndPtr->class->style & CS_OWNDC)?wndPtr->dce:wndPtr->class->dce;
497 if( dce->hwndCurrent == hwnd )
499 dprintf_dc(stddeb,"\tskipping hVisRgn update\n");
500 need_update = FALSE;
503 if( hrgnClip && dce->hClipRgn && !(dce->DCXflags & DCX_KEEPCLIPRGN))
505 fprintf(stdnimp,"GetDCEx: hClipRgn collision!\n");
506 DeleteObject32( dce->hClipRgn );
507 need_update = TRUE;
511 dcx_flags = flags & ( DCX_CLIPSIBLINGS | DCX_CLIPCHILDREN | DCX_CACHE | DCX_WINDOW | DCX_WINDOWPAINT);
513 if (!dce) return 0;
514 dce->hwndCurrent = hwnd;
515 dce->hClipRgn = 0;
516 dce->DCXflags = dcx_flags | DCX_DCEBUSY;
517 hdc = dce->hDC;
519 if (!(dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ))) return 0;
521 DCE_SetDrawable( wndPtr, dc, flags );
522 if( need_update || dc->w.flags & DC_DIRTY )
524 dprintf_dc(stddeb,"updating hDC anyway\n");
526 if (flags & DCX_PARENTCLIP)
528 WND *parentPtr = wndPtr->parent;
529 dcx_flags = flags & ~(DCX_CLIPSIBLINGS | DCX_CLIPCHILDREN |
530 DCX_WINDOW);
531 if (parentPtr->dwStyle & WS_CLIPSIBLINGS)
532 dcx_flags |= DCX_CLIPSIBLINGS;
533 hrgnVisible = DCE_GetVisRgn( parentPtr->hwndSelf, dcx_flags );
534 if (flags & DCX_WINDOW)
535 OffsetRgn32( hrgnVisible, -wndPtr->rectWindow.left,
536 -wndPtr->rectWindow.top );
537 else OffsetRgn32( hrgnVisible, -wndPtr->rectClient.left,
538 -wndPtr->rectClient.top );
540 /* optimize away GetVisRgn for desktop if it isn't there */
542 else if ((hwnd == GetDesktopWindow32()) &&
543 (rootWindow == DefaultRootWindow(display)))
544 hrgnVisible = CreateRectRgn32( 0, 0, SYSMETRICS_CXSCREEN,
545 SYSMETRICS_CYSCREEN );
546 else hrgnVisible = DCE_GetVisRgn( hwnd, flags );
548 if( wndPtr->parent && wndPtr->window )
550 WND* wnd = wndPtr->parent->child;
551 RECT16 rect;
553 for( ; wnd != wndPtr; wnd = wnd->next )
554 if( wnd->class->style & CS_SAVEBITS &&
555 wnd->dwStyle & WS_VISIBLE &&
556 IntersectRect16(&rect, &wndPtr->rectClient, &wnd->rectClient) )
557 wnd->flags |= WIN_SAVEUNDER_OVERRIDE;
560 dc->w.flags &= ~DC_DIRTY;
561 SelectVisRgn( hdc, hrgnVisible );
563 else hrgnVisible = CreateRectRgn32( 0, 0, 0, 0 );
565 if ((flags & DCX_INTERSECTRGN) || (flags & DCX_EXCLUDERGN))
567 dce->DCXflags |= flags & (DCX_KEEPCLIPRGN | DCX_INTERSECTRGN | DCX_EXCLUDERGN);
568 dce->hClipRgn = hrgnClip;
570 dprintf_dc(stddeb, "\tsaved VisRgn, clipRgn = %04x\n", hrgnClip);
572 SaveVisRgn( hdc );
573 CombineRgn32( hrgnVisible, InquireVisRgn( hdc ), hrgnClip,
574 (flags & DCX_INTERSECTRGN) ? RGN_AND : RGN_DIFF );
575 SelectVisRgn( hdc, hrgnVisible );
577 DeleteObject32( hrgnVisible );
579 dprintf_dc(stddeb, "GetDCEx(%04x,%04x,0x%lx): returning %04x\n",
580 hwnd, hrgnClip, flags, hdc);
581 return hdc;
585 /***********************************************************************
586 * GetDC16 (USER.66)
588 HDC16 GetDC16( HWND16 hwnd )
590 return (HDC16)GetDC32( hwnd );
594 /***********************************************************************
595 * GetDC32 (USER32.229)
597 HDC32 GetDC32( HWND32 hwnd )
599 if (!hwnd)
600 return GetDCEx32( GetDesktopWindow32(), 0, DCX_CACHE | DCX_WINDOW );
601 return GetDCEx32( hwnd, 0, DCX_USESTYLE );
605 /***********************************************************************
606 * GetWindowDC16 (USER.67)
608 HDC16 GetWindowDC16( HWND16 hwnd )
610 if (!hwnd) hwnd = GetDesktopWindow16();
611 return GetDCEx16( hwnd, 0, DCX_USESTYLE | DCX_WINDOW );
615 /***********************************************************************
616 * GetWindowDC32 (USER32.)
618 HDC32 GetWindowDC32( HWND32 hwnd )
620 if (!hwnd) hwnd = GetDesktopWindow32();
621 return GetDCEx32( hwnd, 0, DCX_USESTYLE | DCX_WINDOW );
625 /***********************************************************************
626 * ReleaseDC16 (USER.68)
628 INT16 ReleaseDC16( HWND16 hwnd, HDC16 hdc )
630 return (INT32)ReleaseDC32( hwnd, hdc );
634 /***********************************************************************
635 * ReleaseDC32 (USER32.439)
637 INT32 ReleaseDC32( HWND32 hwnd, HDC32 hdc )
639 DCE * dce = firstDCE;
641 dprintf_dc(stddeb, "ReleaseDC: %04x %04x\n", hwnd, hdc );
643 while (dce && (dce->hDC != hdc)) dce = dce->next;
644 if (!dce) return 0;
645 if (!(dce->DCXflags & DCX_DCEBUSY) ) return 0;
647 /* restore previous visible region */
649 if ( dce->DCXflags & (DCX_INTERSECTRGN | DCX_EXCLUDERGN) &&
650 (dce->DCXflags & DCX_CACHE || dce->DCXflags & DCX_WINDOWPAINT) )
652 dprintf_dc(stddeb,"\tcleaning up visrgn...\n");
653 dce->DCXflags &= ~(DCX_EXCLUDERGN | DCX_INTERSECTRGN | DCX_WINDOWPAINT);
655 if( dce->DCXflags & DCX_KEEPCLIPRGN )
656 dce->DCXflags &= ~DCX_KEEPCLIPRGN;
657 else
658 if( dce->hClipRgn > 1 )
659 DeleteObject32( dce->hClipRgn );
661 dce->hClipRgn = 0;
662 RestoreVisRgn(dce->hDC);
665 if (dce->DCXflags & DCX_CACHE)
667 SetDCState( dce->hDC, defaultDCstate );
668 dce->DCXflags = DCX_CACHE;
669 dce->hwndCurrent = 0;
671 return 1;
674 /***********************************************************************
675 * DCHook (USER.362)
677 * See "Undoc. Windows" for hints (DC, SetDCHook, SetHookFlags)..
679 BOOL16 DCHook( HDC16 hDC, WORD code, DWORD data, LPARAM lParam )
681 HRGN32 hVisRgn;
682 DCE *dce = firstDCE;;
684 dprintf_dc(stddeb,"DCHook: hDC = %04x, %i\n", hDC, code);
686 while (dce && (dce->hDC != hDC)) dce = dce->next;
687 if (!dce) return 0;
689 switch( code )
691 case DCHC_INVALIDVISRGN:
693 if( dce->DCXflags & DCX_DCEBUSY )
695 SetHookFlags(hDC, DCHF_VALIDATEVISRGN);
696 hVisRgn = DCE_GetVisRgn(dce->hwndCurrent, dce->DCXflags);
698 dprintf_dc(stddeb,"\tapplying saved clipRgn\n");
700 /* clip this region with saved clipping region */
702 if ( (dce->DCXflags & DCX_INTERSECTRGN && dce->hClipRgn != 1) ||
703 ( dce->DCXflags & DCX_EXCLUDERGN && dce->hClipRgn) )
706 if( (!dce->hClipRgn && dce->DCXflags & DCX_INTERSECTRGN) ||
707 (dce->hClipRgn == 1 && dce->DCXflags & DCX_EXCLUDERGN) )
708 SetRectRgn(hVisRgn,0,0,0,0);
709 else
710 CombineRgn32(hVisRgn, hVisRgn, dce->hClipRgn,
711 (dce->DCXflags & DCX_EXCLUDERGN)? RGN_DIFF:RGN_AND);
713 SelectVisRgn(hDC, hVisRgn);
714 DeleteObject32( hVisRgn );
716 else
717 dprintf_dc(stddeb,"DCHook: DC is not in use!\n");
719 break;
721 case DCHC_DELETEDC: /* FIXME: ?? */
722 break;
724 default:
725 fprintf(stdnimp,"DCHook: unknown code\n");
727 return 0;