2 * Window painting functions
4 * Copyright 1993, 1994, 1995, 2001, 2004 Alexandre Julliard
5 * Copyright 1999 Alex Korobka
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include "wine/port.h"
33 #include "wine/server.h"
35 #include "user_private.h"
36 #include "wine/debug.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(win);
41 /***********************************************************************
44 static void dump_rdw_flags(UINT flags)
47 if (flags & RDW_INVALIDATE) TRACE(" RDW_INVALIDATE");
48 if (flags & RDW_INTERNALPAINT) TRACE(" RDW_INTERNALPAINT");
49 if (flags & RDW_ERASE) TRACE(" RDW_ERASE");
50 if (flags & RDW_VALIDATE) TRACE(" RDW_VALIDATE");
51 if (flags & RDW_NOINTERNALPAINT) TRACE(" RDW_NOINTERNALPAINT");
52 if (flags & RDW_NOERASE) TRACE(" RDW_NOERASE");
53 if (flags & RDW_NOCHILDREN) TRACE(" RDW_NOCHILDREN");
54 if (flags & RDW_ALLCHILDREN) TRACE(" RDW_ALLCHILDREN");
55 if (flags & RDW_UPDATENOW) TRACE(" RDW_UPDATENOW");
56 if (flags & RDW_ERASENOW) TRACE(" RDW_ERASENOW");
57 if (flags & RDW_FRAME) TRACE(" RDW_FRAME");
58 if (flags & RDW_NOFRAME) TRACE(" RDW_NOFRAME");
65 RDW_NOINTERNALPAINT | \
74 if (flags & ~RDW_FLAGS) TRACE(" %04x", flags & ~RDW_FLAGS);
80 /***********************************************************************
83 * Return update region (in screen coordinates) for a window.
85 static HRGN get_update_region( HWND hwnd, UINT *flags, HWND *child )
94 if (!(data = HeapAlloc( GetProcessHeap(), 0, sizeof(*data) + size - 1 )))
96 SetLastError( ERROR_OUTOFMEMORY );
100 SERVER_START_REQ( get_update_region )
104 wine_server_set_reply( req, data->Buffer, size );
105 if (!(status = wine_server_call( req )))
107 size_t reply_size = wine_server_reply_size( reply );
108 data->rdh.dwSize = sizeof(data->rdh);
109 data->rdh.iType = RDH_RECTANGLES;
110 data->rdh.nCount = reply_size / sizeof(RECT);
111 data->rdh.nRgnSize = reply_size;
112 hrgn = ExtCreateRegion( NULL, size, data );
113 if (child) *child = reply->child;
114 *flags = reply->flags;
116 else size = reply->total_size;
119 HeapFree( GetProcessHeap(), 0, data );
120 } while (status == STATUS_BUFFER_OVERFLOW);
122 if (status) SetLastError( RtlNtStatusToDosError(status) );
127 /***********************************************************************
130 * Get only the update flags, not the update region.
132 static BOOL get_update_flags( HWND hwnd, HWND *child, UINT *flags )
136 SERVER_START_REQ( get_update_region )
139 req->flags = *flags | UPDATE_NOREGION;
140 if ((ret = !wine_server_call_err( req )))
142 if (child) *child = reply->child;
143 *flags = reply->flags;
151 /***********************************************************************
152 * redraw_window_rects
154 * Redraw part of a window.
156 static BOOL redraw_window_rects( HWND hwnd, UINT flags, const RECT *rects, UINT count )
160 SERVER_START_REQ( redraw_window )
164 wine_server_add_data( req, rects, count * sizeof(RECT) );
165 ret = !wine_server_call_err( req );
172 /***********************************************************************
175 * Send a WM_NCPAINT message if needed, and return the resulting update region (in screen coords).
176 * Helper for erase_now and BeginPaint.
178 static HRGN send_ncpaint( HWND hwnd, HWND *child, UINT *flags )
180 HRGN whole_rgn = get_update_region( hwnd, flags, child );
183 if (child) hwnd = *child;
190 /* check if update rgn overlaps with nonclient area */
191 type = GetRgnBox( whole_rgn, &update );
192 GetClientRect( hwnd, &client );
193 MapWindowPoints( hwnd, 0, (POINT *)&client, 2 );
195 if ((*flags & UPDATE_NONCLIENT) ||
196 update.left < client.left || update.top < client.top ||
197 update.right > client.right || update.bottom > client.bottom)
199 client_rgn = CreateRectRgnIndirect( &client );
200 CombineRgn( client_rgn, client_rgn, whole_rgn, RGN_AND );
202 /* check if update rgn contains complete nonclient area */
203 if (type == SIMPLEREGION)
206 GetWindowRect( hwnd, &window );
207 if (EqualRect( &window, &update ))
209 DeleteObject( whole_rgn );
216 client_rgn = whole_rgn;
220 if (whole_rgn) /* NOTE: WM_NCPAINT allows wParam to be 1 */
222 if (*flags & UPDATE_NONCLIENT) SendMessageW( hwnd, WM_NCPAINT, (WPARAM)whole_rgn, 0 );
223 if (whole_rgn > (HRGN)1) DeleteObject( whole_rgn );
230 /***********************************************************************
233 * Send a WM_ERASEBKGND message if needed, and optionally return the DC for painting.
234 * If a DC is requested, the region is selected into it.
235 * Helper for erase_now and BeginPaint.
237 static BOOL send_erase( HWND hwnd, UINT flags, HRGN client_rgn,
238 RECT *clip_rect, HDC *hdc_ret )
240 BOOL need_erase = FALSE;
244 if (!clip_rect) clip_rect = &dummy;
245 if (hdc_ret || (flags & UPDATE_ERASE))
247 UINT dcx_flags = DCX_INTERSECTRGN | DCX_USESTYLE;
248 if (IsIconic(hwnd)) dcx_flags |= DCX_WINDOW;
250 if ((hdc = GetDCEx( hwnd, client_rgn, dcx_flags )))
252 INT type = GetClipBox( hdc, clip_rect );
254 if (flags & UPDATE_ERASE)
256 /* don't erase if the clip box is empty */
257 if (type != NULLREGION)
258 need_erase = !SendMessageW( hwnd, WM_ERASEBKGND, (WPARAM)hdc, 0 );
262 if (need_erase && hwnd != GetDesktopWindow()) /* FIXME: mark it as needing erase again */
263 RedrawWindow( hwnd, clip_rect, 0, RDW_INVALIDATE | RDW_ERASE | RDW_NOCHILDREN );
264 ReleaseDC( hwnd, hdc );
268 if (hdc_ret) *hdc_ret = hdc;
274 /***********************************************************************
277 * Implementation of RDW_ERASENOW behavior.
279 static void erase_now( HWND hwnd, UINT rdw_flags )
284 /* loop while we find a child to repaint */
287 UINT flags = UPDATE_NONCLIENT | UPDATE_ERASE;
289 if (rdw_flags & RDW_NOCHILDREN) flags |= UPDATE_NOCHILDREN;
290 else if (rdw_flags & RDW_ALLCHILDREN) flags |= UPDATE_ALLCHILDREN;
292 if (!(hrgn = send_ncpaint( hwnd, &child, &flags ))) break;
293 send_erase( child, flags, hrgn, NULL, NULL );
294 DeleteObject( hrgn );
296 if (!flags) break; /* nothing more to do */
297 if (rdw_flags & RDW_NOCHILDREN) break;
302 /***********************************************************************
305 * Implementation of RDW_UPDATENOW behavior.
307 * FIXME: Windows uses WM_SYNCPAINT to cut down the number of intertask
308 * SendMessage() calls. This is a comment inside DefWindowProc() source
311 * This message avoids lots of inter-app message traffic
312 * by switching to the other task and continuing the
316 * LOWORD(lParam) = hrgnClip
317 * HIWORD(lParam) = hwndSkip (not used; always NULL)
320 static void update_now( HWND hwnd, UINT rdw_flags )
322 HWND prev = 0, child;
324 /* process pending expose events before painting */
325 MsgWaitForMultipleObjects( 0, NULL, FALSE, 0, QS_PAINT );
327 /* desktop window never gets WM_PAINT, only WM_ERASEBKGND */
328 if (hwnd == GetDesktopWindow()) erase_now( hwnd, rdw_flags | RDW_NOCHILDREN );
330 /* loop while we find a child to repaint */
333 UINT flags = UPDATE_PAINT | UPDATE_INTERNALPAINT;
335 if (rdw_flags & RDW_NOCHILDREN) flags |= UPDATE_NOCHILDREN;
336 else if (rdw_flags & RDW_ALLCHILDREN) flags |= UPDATE_ALLCHILDREN;
338 if (!get_update_flags( hwnd, &child, &flags )) break;
339 if (!flags) break; /* nothing more to do */
341 if (child == prev) /* same window again, didn't get repainted properly */
343 UINT erase_flags = UPDATE_NONCLIENT | UPDATE_ERASE | UPDATE_NOCHILDREN;
346 TRACE( "%p not repainted properly, erasing\n", child );
347 if ((hrgn = send_ncpaint( child, NULL, &erase_flags )))
349 send_erase( child, erase_flags, hrgn, NULL, NULL );
350 DeleteObject( hrgn );
357 SendMessageW( child, WM_PAINT, 0, 0 );
359 if (rdw_flags & RDW_NOCHILDREN) break;
364 /*************************************************************************
367 * Helper for ScrollWindowEx.
369 static HWND fix_caret(HWND hWnd, LPRECT lprc, UINT flags)
373 if (!GetGUIThreadInfo( GetCurrentThreadId(), &info )) return 0;
374 if (!info.hwndCaret) return 0;
375 if (info.hwndCaret == hWnd ||
376 ((flags & SW_SCROLLCHILDREN) && IsChild(hWnd, info.hwndCaret)))
379 pt.x = info.rcCaret.left;
380 pt.y = info.rcCaret.top;
381 MapWindowPoints( info.hwndCaret, hWnd, (LPPOINT)&info.rcCaret, 2 );
382 if( IntersectRect(lprc, lprc, &info.rcCaret) )
387 return info.hwndCaret;
394 /***********************************************************************
395 * BeginPaint (USER32.@)
397 HDC WINAPI BeginPaint( HWND hwnd, PAINTSTRUCT *lps )
401 UINT flags = UPDATE_NONCLIENT | UPDATE_ERASE | UPDATE_PAINT | UPDATE_INTERNALPAINT | UPDATE_NOCHILDREN;
405 if (!(full_handle = WIN_IsCurrentThread( hwnd )))
408 FIXME( "window %p belongs to other thread\n", hwnd );
415 if (!(hrgn = send_ncpaint( hwnd, NULL, &flags ))) return 0;
417 lps->fErase = send_erase( hwnd, flags, hrgn, &lps->rcPaint, &lps->hdc );
418 if (!lps->hdc) DeleteObject( hrgn );
420 TRACE("hdc = %p box = (%ld,%ld - %ld,%ld), fErase = %d\n",
421 lps->hdc, lps->rcPaint.left, lps->rcPaint.top, lps->rcPaint.right, lps->rcPaint.bottom,
428 /***********************************************************************
429 * EndPaint (USER32.@)
431 BOOL WINAPI EndPaint( HWND hwnd, const PAINTSTRUCT *lps )
433 if (!lps) return FALSE;
434 if (USER_Driver.pReleaseDC) USER_Driver.pReleaseDC( hwnd, lps->hdc, TRUE );
440 /***********************************************************************
443 HDC WINAPI GetDCEx( HWND hwnd, HRGN hrgnClip, DWORD flags )
445 if (!hwnd) hwnd = GetDesktopWindow();
446 else hwnd = WIN_GetFullHandle( hwnd );
448 if (USER_Driver.pGetDCEx) return USER_Driver.pGetDCEx( hwnd, hrgnClip, flags );
453 /***********************************************************************
456 * Get a device context.
459 * Success: Handle to the device context
462 HDC WINAPI GetDC( HWND hwnd )
464 if (!hwnd) return GetDCEx( 0, 0, DCX_CACHE | DCX_WINDOW );
465 return GetDCEx( hwnd, 0, DCX_USESTYLE );
469 /***********************************************************************
470 * GetWindowDC (USER32.@)
472 HDC WINAPI GetWindowDC( HWND hwnd )
474 return GetDCEx( hwnd, 0, DCX_USESTYLE | DCX_WINDOW );
478 /***********************************************************************
479 * ReleaseDC (USER32.@)
481 * Release a device context.
484 * Success: Non-zero. Resources used by hdc are released.
487 INT WINAPI ReleaseDC( HWND hwnd, HDC hdc )
489 if (USER_Driver.pReleaseDC) return USER_Driver.pReleaseDC( hwnd, hdc, FALSE );
494 /**********************************************************************
495 * WindowFromDC (USER32.@)
497 HWND WINAPI WindowFromDC( HDC hDC )
499 if (USER_Driver.pWindowFromDC) return USER_Driver.pWindowFromDC( hDC );
504 /***********************************************************************
505 * LockWindowUpdate (USER32.@)
507 BOOL WINAPI LockWindowUpdate( HWND hwnd )
509 static HWND lockedWnd;
511 /* This function is fully implemented by the following patch:
513 * http://www.winehq.org/hypermail/wine-patches/2004/01/0142.html
515 * but in order to work properly, it needs the ability to invalidate
516 * DCEs in other processes when the lock window is changed, which
517 * isn't possible yet.
521 FIXME("(%p), partial stub!\n",hwnd);
528 /* Unlock lockedWnd */
529 /* FIXME: Do something */
533 /* Attempted to lock a second window */
534 /* Return FALSE and do nothing */
545 /***********************************************************************
546 * RedrawWindow (USER32.@)
548 BOOL WINAPI RedrawWindow( HWND hwnd, const RECT *rect, HRGN hrgn, UINT flags )
552 if (!hwnd) hwnd = GetDesktopWindow();
559 GetRgnBox( hrgn, &r );
560 TRACE( "%p region %p box %s ", hwnd, hrgn, wine_dbgstr_rect(&r) );
563 TRACE( "%p rect %s ", hwnd, wine_dbgstr_rect(rect) );
565 TRACE( "%p whole window ", hwnd );
567 dump_rdw_flags(flags);
572 ret = redraw_window_rects( hwnd, flags, rect, 1 );
576 ret = redraw_window_rects( hwnd, flags, NULL, 0 );
578 else /* need to build a list of the region rectangles */
581 RGNDATA *data = NULL;
582 static const RECT empty;
584 if (!(size = GetRegionData( hrgn, 0, NULL ))) return FALSE;
585 if (!(data = HeapAlloc( GetProcessHeap(), 0, size ))) return FALSE;
586 GetRegionData( hrgn, size, data );
587 if (!data->rdh.nCount) /* empty region -> use a single all-zero rectangle */
588 ret = redraw_window_rects( hwnd, flags, &empty, 1 );
590 ret = redraw_window_rects( hwnd, flags, (const RECT *)data->Buffer, data->rdh.nCount );
591 HeapFree( GetProcessHeap(), 0, data );
594 if (flags & RDW_UPDATENOW) update_now( hwnd, flags );
595 else if (flags & RDW_ERASENOW) erase_now( hwnd, flags );
601 /***********************************************************************
602 * UpdateWindow (USER32.@)
604 BOOL WINAPI UpdateWindow( HWND hwnd )
606 return RedrawWindow( hwnd, NULL, 0, RDW_UPDATENOW | RDW_ALLCHILDREN );
610 /***********************************************************************
611 * InvalidateRgn (USER32.@)
613 BOOL WINAPI InvalidateRgn( HWND hwnd, HRGN hrgn, BOOL erase )
615 return RedrawWindow(hwnd, NULL, hrgn, RDW_INVALIDATE | (erase ? RDW_ERASE : 0) );
619 /***********************************************************************
620 * InvalidateRect (USER32.@)
622 BOOL WINAPI InvalidateRect( HWND hwnd, const RECT *rect, BOOL erase )
624 return RedrawWindow( hwnd, rect, 0, RDW_INVALIDATE | (erase ? RDW_ERASE : 0) );
628 /***********************************************************************
629 * ValidateRgn (USER32.@)
631 BOOL WINAPI ValidateRgn( HWND hwnd, HRGN hrgn )
633 return RedrawWindow( hwnd, NULL, hrgn, RDW_VALIDATE );
637 /***********************************************************************
638 * ValidateRect (USER32.@)
640 BOOL WINAPI ValidateRect( HWND hwnd, const RECT *rect )
642 return RedrawWindow( hwnd, rect, 0, RDW_VALIDATE );
646 /***********************************************************************
647 * GetUpdateRgn (USER32.@)
649 INT WINAPI GetUpdateRgn( HWND hwnd, HRGN hrgn, BOOL erase )
652 UINT flags = UPDATE_NOCHILDREN;
655 if (erase) flags |= UPDATE_NONCLIENT | UPDATE_ERASE;
657 if ((update_rgn = send_ncpaint( hwnd, NULL, &flags )))
660 send_erase( hwnd, flags, update_rgn, NULL, NULL );
661 /* map region to client coordinates */
662 offset.x = offset.y = 0;
663 ScreenToClient( hwnd, &offset );
664 OffsetRgn( update_rgn, offset.x, offset.y );
665 retval = CombineRgn( hrgn, update_rgn, 0, RGN_COPY );
666 DeleteObject( update_rgn );
672 /***********************************************************************
673 * GetUpdateRect (USER32.@)
675 BOOL WINAPI GetUpdateRect( HWND hwnd, LPRECT rect, BOOL erase )
678 UINT flags = UPDATE_NOCHILDREN;
681 if (erase) flags |= UPDATE_NONCLIENT | UPDATE_ERASE;
683 if (!(update_rgn = send_ncpaint( hwnd, NULL, &flags ))) return FALSE;
687 if (GetRgnBox( update_rgn, rect ) != NULLREGION)
688 MapWindowPoints( 0, hwnd, (LPPOINT)rect, 2 );
691 send_erase( hwnd, flags, update_rgn, NULL, &hdc );
694 if (rect) DPtoLP( hdc, (LPPOINT)rect, 2 );
695 ReleaseDC( hwnd, hdc );
697 else DeleteObject( update_rgn );
699 /* check if we still have an update region */
700 flags = UPDATE_PAINT | UPDATE_NOCHILDREN;
701 return (get_update_flags( hwnd, NULL, &flags ) && (flags & UPDATE_PAINT));
705 /***********************************************************************
706 * ExcludeUpdateRgn (USER32.@)
708 INT WINAPI ExcludeUpdateRgn( HDC hdc, HWND hwnd )
710 HRGN update_rgn = CreateRectRgn( 0, 0, 0, 0 );
711 INT ret = GetUpdateRgn( hwnd, update_rgn, FALSE );
717 GetDCOrgEx( hdc, &pt );
718 MapWindowPoints( 0, hwnd, &pt, 1 );
719 OffsetRgn( update_rgn, -pt.x, -pt.y );
720 ret = ExtSelectClipRgn( hdc, update_rgn, RGN_DIFF );
721 DeleteObject( update_rgn );
727 /*************************************************************************
728 * ScrollWindowEx (USER32.@)
730 * Note: contrary to what the doc says, pixels that are scrolled from the
731 * outside of clipRect to the inside are NOT painted.
734 INT WINAPI ScrollWindowEx( HWND hwnd, INT dx, INT dy,
735 const RECT *rect, const RECT *clipRect,
736 HRGN hrgnUpdate, LPRECT rcUpdate,
739 INT retVal = NULLREGION;
741 BOOL bUpdate = (rcUpdate || hrgnUpdate || flags & (SW_INVALIDATE | SW_ERASE));
748 HWND hwndCaret = NULL;
750 TRACE( "%p, %d,%d hrgnUpdate=%p rcUpdate = %p %s %04x\n",
751 hwnd, dx, dy, hrgnUpdate, rcUpdate, wine_dbgstr_rect(rect), flags );
752 TRACE( "clipRect = %s\n", wine_dbgstr_rect(clipRect));
753 if( flags & ~( SW_SCROLLCHILDREN | SW_INVALIDATE | SW_ERASE))
754 FIXME("some flags (%04x) are unhandled\n", flags);
756 rdw_flags = (flags & SW_ERASE) && (flags & SW_INVALIDATE) ?
757 RDW_INVALIDATE | RDW_ERASE : RDW_INVALIDATE ;
759 if (!WIN_IsWindowDrawable( hwnd, TRUE )) return ERROR;
760 hwnd = WIN_GetFullHandle( hwnd );
762 GetClientRect(hwnd, &rc);
763 if (rect) IntersectRect(&rc, &rc, rect);
765 if (clipRect) IntersectRect(&cliprc,&rc,clipRect);
768 if( hrgnUpdate ) bOwnRgn = FALSE;
769 else if( bUpdate ) hrgnUpdate = CreateRectRgn( 0, 0, 0, 0 );
771 if( !IsRectEmpty(&cliprc) && (dx || dy)) {
772 DWORD dcxflags = DCX_CACHE;
773 DWORD style = GetWindowLongW( hwnd, GWL_STYLE );
775 hwndCaret = fix_caret(hwnd, &caretrc, flags);
777 if( style & WS_CLIPSIBLINGS) dcxflags |= DCX_CLIPSIBLINGS;
778 if( GetClassLongW( hwnd, GCL_STYLE ) & CS_PARENTDC)
779 dcxflags |= DCX_PARENTCLIP;
780 if( !(flags & SW_SCROLLCHILDREN) && (style & WS_CLIPCHILDREN))
781 dcxflags |= DCX_CLIPCHILDREN;
782 hDC = GetDCEx( hwnd, 0, dcxflags);
785 ScrollDC( hDC, dx, dy, &rc, &cliprc, hrgnUpdate, rcUpdate );
787 ReleaseDC( hwnd, hDC );
790 RedrawWindow( hwnd, NULL, hrgnUpdate, rdw_flags);
793 /* If the windows has an update region, this must be
794 * scrolled as well. Keep a copy in hrgnWinupd
795 * to be added to hrngUpdate at the end. */
796 hrgnTemp = CreateRectRgn( 0, 0, 0, 0 );
797 retVal = GetUpdateRgn( hwnd, hrgnTemp, FALSE );
798 if (retVal != NULLREGION)
800 HRGN hrgnClip = CreateRectRgnIndirect(&cliprc);
802 hrgnWinupd = CreateRectRgn( 0, 0, 0, 0);
803 CombineRgn( hrgnWinupd, hrgnTemp, 0, RGN_COPY);
805 OffsetRgn( hrgnTemp, dx, dy );
806 CombineRgn( hrgnTemp, hrgnTemp, hrgnClip, RGN_AND );
808 CombineRgn( hrgnWinupd, hrgnWinupd, hrgnTemp, RGN_OR );
809 RedrawWindow( hwnd, NULL, hrgnTemp, rdw_flags);
810 DeleteObject( hrgnClip );
812 DeleteObject( hrgnTemp );
814 /* nothing was scrolled */
816 SetRectRgn( hrgnUpdate, 0, 0, 0, 0 );
817 SetRectEmpty( rcUpdate);
820 if( flags & SW_SCROLLCHILDREN )
822 HWND *list = WIN_ListChildren( hwnd );
827 for (i = 0; list[i]; i++)
829 GetWindowRect( list[i], &r );
830 MapWindowPoints( 0, hwnd, (POINT *)&r, 2 );
831 if (!rect || IntersectRect(&dummy, &r, rect))
832 SetWindowPos( list[i], 0, r.left + dx, r.top + dy, 0, 0,
833 SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE |
834 SWP_NOREDRAW | SWP_DEFERERASE );
836 HeapFree( GetProcessHeap(), 0, list );
840 if( flags & (SW_INVALIDATE | SW_ERASE) )
841 RedrawWindow( hwnd, NULL, hrgnUpdate, rdw_flags |
842 ((flags & SW_SCROLLCHILDREN) ? RDW_ALLCHILDREN : 0 ) );
845 CombineRgn( hrgnUpdate, hrgnUpdate, hrgnWinupd, RGN_OR);
846 DeleteObject( hrgnWinupd);
850 SetCaretPos( caretrc.left + dx, caretrc.top + dy );
851 ShowCaret(hwndCaret);
854 if( bOwnRgn && hrgnUpdate ) DeleteObject( hrgnUpdate );
860 /*************************************************************************
861 * ScrollWindow (USER32.@)
864 BOOL WINAPI ScrollWindow( HWND hwnd, INT dx, INT dy,
865 const RECT *rect, const RECT *clipRect )
867 return (ERROR != ScrollWindowEx( hwnd, dx, dy, rect, clipRect, 0, NULL,
868 (rect ? 0 : SW_SCROLLCHILDREN) |
869 SW_INVALIDATE | SW_ERASE ));
873 /*************************************************************************
874 * ScrollDC (USER32.@)
876 * dx, dy, lprcScroll and lprcClip are all in logical coordinates (msdn is
877 * wrong) hrgnUpdate is returned in device coordinates with rcUpdate in
878 * logical coordinates.
880 BOOL WINAPI ScrollDC( HDC hdc, INT dx, INT dy, const RECT *lprcScroll,
881 const RECT *lprcClip, HRGN hrgnUpdate, LPRECT lprcUpdate )
884 if (USER_Driver.pScrollDC)
885 return USER_Driver.pScrollDC( hdc, dx, dy, lprcScroll, lprcClip, hrgnUpdate, lprcUpdate );