Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

winmgrc.c File Reference

#include "precomp.h"

Go to the source code of this file.

Defines

#define CONSOLE_WINDOW_CLASS   (L"ConsoleWindowClass")
#define ALPHASTART   40
#define ONEFRAME   10
#define AW_HOR   (AW_HOR_POSITIVE | AW_HOR_NEGATIVE | AW_CENTER)
#define AW_VER   (AW_VER_POSITIVE | AW_VER_NEGATIVE | AW_CENTER)
#define MINSCROLL   10
#define MAXSCROLLTIME   200

Functions

WORD GetWindowWord (HWND hwnd, int index)
BOOL FChildVisible (HWND hwnd)
BOOL WINAPI AdjustWindowRectEx (LPRECT lpRect, DWORD dwStyle, BOOL bMenu, DWORD dwExStyle)
int WINAPI GetClassNameW (HWND hwnd, LPWSTR lpClassName, int nMaxCount)
HWND GetFocus (VOID)
HWND GetCapture (VOID)
BOOL AnyPopup (VOID)
BOOL GetInputState (VOID)
int MapWindowPoints (HWND hwndFrom, HWND hwndTo, LPPOINT lppt, UINT cpt)
HWND GetLastActivePopup (HWND hwnd)
PTHREADINFO PtiWindow (HWND hwnd)
DWORD GetWindowThreadProcessId (HWND hwnd, LPDWORD lpdwProcessId)
int GetScrollPos (HWND hwnd, int code)
BOOL GetScrollRange (HWND hwnd, int code, LPINT lpposMin, LPINT lpposMax)
BOOL GetScrollInfo (HWND hwnd, int code, LPSCROLLINFO lpsi)
HWND GetActiveWindow (VOID)
HCURSOR GetCursor (VOID)
BOOL IsMenu (HMENU hMenu)
DWORD GetAppCompatFlags (PTHREADINFO pti)
DWORD GetAppCompatFlags2 (WORD wVer)
BOOL IsWindowUnicode (IN HWND hwnd)
BOOL TestWindowProcess (PWND pwnd)
BOOL IsHungAppWindow (HWND hwnd)
PTHREADINFO PtiCurrent (VOID)
BOOL _AdjustWindowRectEx (LPRECT lprc, LONG style, BOOL fMenu, DWORD dwExStyle)
void ShowWindowNoRepaint (PWND pwnd)
BOOL AnimateBlend (PWND pwnd, HDC hdcScreen, HDC hdcImage, DWORD dwTime, BOOL fHide)
__inline int AnimInc (int x, int y, int z)
__inline int AnimDec (int x, int y, int z)
BOOL WINAPI AnimateWindow (HWND hwnd, DWORD dwTime, DWORD dwFlags)
int SmoothScrollWindowEx (HWND hwnd, int dx, int dy, CONST RECT *prcScroll, CONST RECT *prcClip, HRGN hrgnUpdate, LPRECT prcUpdate, DWORD dwFlags, DWORD dwTime)
int ScrollWindowEx (HWND hwnd, int dx, int dy, CONST RECT *prcScroll, CONST RECT *prcClip, HRGN hrgnUpdate, LPRECT prcUpdate, UINT dwFlags)


Define Documentation

#define ALPHASTART   40
 

Definition at line 677 of file winmgrc.c.

Referenced by AnimateBlend(), ShowFade(), and StartFade().

#define AW_HOR   (AW_HOR_POSITIVE | AW_HOR_NEGATIVE | AW_CENTER)
 

Definition at line 797 of file winmgrc.c.

Referenced by AnimateWindow().

#define AW_VER   (AW_VER_POSITIVE | AW_VER_NEGATIVE | AW_CENTER)
 

Definition at line 798 of file winmgrc.c.

Referenced by AnimateWindow().

#define CONSOLE_WINDOW_CLASS   (L"ConsoleWindowClass")
 

Definition at line 15 of file winmgrc.c.

#define MAXSCROLLTIME   200
 

Definition at line 1208 of file winmgrc.c.

Referenced by SmoothScrollWindowEx().

#define MINSCROLL   10
 

Definition at line 1207 of file winmgrc.c.

Referenced by SmoothScrollWindowEx().

#define ONEFRAME   10
 

Definition at line 678 of file winmgrc.c.

Referenced by AnimateBlend().


Function Documentation

BOOL _AdjustWindowRectEx LPRECT  lprc,
LONG  style,
BOOL  fMenu,
DWORD  dwExStyle
 

Definition at line 604 of file winmgrc.c.

References BOOL, GETAPPVER, GetWindowBorders(), InflateRect(), NeedsWindowEdge(), SYSMET, TRUE, and VER40.

Referenced by AdjustWindowRect(), AdjustWindowRectEx(), ChildMinMaxInfo(), InternalCreateDialog(), MDIClientWndProcWorker(), and xxxSetStaticImage().

00609 { 00610 // 00611 // Here we add on the appropriate 3D borders for old and new apps. 00612 // 00613 // Rules: 00614 // (1) Do nothing for windows that have 3D border styles. 00615 // (2) If the window has a dlgframe border (has a caption or is a 00616 // a dialog), then add on the window edge style. 00617 // (3) We NEVER add on the CLIENT STYLE. New apps can create 00618 // it if they want. This is because it screws up alignment 00619 // when the app doesn't know about it. 00620 // 00621 00622 if (NeedsWindowEdge(style, dwExStyle, GETAPPVER() >= VER40)) 00623 dwExStyle |= WS_EX_WINDOWEDGE; 00624 else 00625 dwExStyle &= ~WS_EX_WINDOWEDGE; 00626 00627 // 00628 // Space for a menu bar 00629 // 00630 if (fMenu) 00631 lprc->top -= SYSMET(CYMENU); 00632 00633 // 00634 // Space for a caption bar 00635 // 00636 if ((HIWORD(style) & HIWORD(WS_CAPTION)) == HIWORD(WS_CAPTION)) { 00637 lprc->top -= (dwExStyle & WS_EX_TOOLWINDOW) ? SYSMET(CYSMCAPTION) : SYSMET(CYCAPTION); 00638 } 00639 00640 // 00641 // Space for borders (window AND client) 00642 // 00643 { 00644 int cBorders; 00645 00646 // 00647 // Window AND Client borders 00648 // 00649 00650 if (cBorders = GetWindowBorders(style, dwExStyle, TRUE, TRUE)) 00651 InflateRect(lprc, cBorders*SYSMET(CXBORDER), cBorders*SYSMET(CYBORDER)); 00652 } 00653 00654 return TRUE; 00655 }

BOOL WINAPI AdjustWindowRectEx LPRECT  lpRect,
DWORD  dwStyle,
BOOL  bMenu,
DWORD  dwExStyle
 

Definition at line 65 of file winmgrc.c.

References _AdjustWindowRectEx(), BOOL, and ConnectIfNecessary.

Referenced by InitializeSystemMetrics().

00070 { 00071 ConnectIfNecessary(); 00072 00073 return _AdjustWindowRectEx(lpRect, dwStyle, bMenu, dwExStyle); 00074 }

BOOL AnimateBlend PWND  pwnd,
HDC  hdcScreen,
HDC  hdcImage,
DWORD  dwTime,
BOOL  fHide
 

Definition at line 680 of file winmgrc.c.

References ALPHASTART, BOOL, BYTE, DWORD, FALSE, HWq, NtUserSetWindowPos(), NtUserUpdateLayeredWindow(), NULL, ONEFRAME, tagWND::rcWindow, ShowWindowNoRepaint(), and TRUE.

Referenced by AnimateWindow().

00681 { 00682 HWND hwnd = HWq(pwnd); 00683 SIZE size; 00684 POINT ptSrc = {0, 0}, ptDst; 00685 BLENDFUNCTION blend; 00686 DWORD dwElapsed; 00687 BYTE bAlpha = ALPHASTART; 00688 LARGE_INTEGER liFreq, liStart, liDiff; 00689 LARGE_INTEGER liIter; 00690 DWORD dwIter; 00691 00692 if (QueryPerformanceFrequency(&liFreq) == 0) 00693 return FALSE; 00694 00695 if (SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) | 00696 WS_EX_LAYERED) == 0) 00697 return FALSE; 00698 00699 if (fHide) { 00700 /* 00701 * Give up the time slice and sleep just a touch to allow windows 00702 * below invalidated by the SetWindowLong(WS_EX_LAYERED) call to 00703 * repaint enough for the sprite to get good background image. 00704 */ 00705 Sleep(10); 00706 } 00707 00708 ptDst.x = pwnd->rcWindow.left; 00709 ptDst.y = pwnd->rcWindow.top; 00710 size.cx = pwnd->rcWindow.right - pwnd->rcWindow.left; 00711 size.cy = pwnd->rcWindow.bottom - pwnd->rcWindow.top; 00712 00713 blend.BlendOp = AC_SRC_OVER; 00714 blend.BlendFlags = 0; 00715 blend.AlphaFormat = 0; 00716 blend.SourceConstantAlpha = fHide ? (255 - bAlpha) : bAlpha; 00717 00718 /* 00719 * Copy the initial image with the initial alpha. 00720 */ 00721 NtUserUpdateLayeredWindow(hwnd, NULL, &ptDst, &size, hdcImage, &ptSrc, 0, 00722 &blend, ULW_ALPHA); 00723 00724 if (!fHide) { 00725 ShowWindowNoRepaint(pwnd); 00726 } 00727 00728 /* 00729 * Time and start the animation cycle. 00730 */ 00731 dwElapsed = (dwTime * ALPHASTART + 255) / 255 + 10; 00732 QueryPerformanceCounter(&liStart); 00733 liStart.QuadPart = liStart.QuadPart - dwElapsed * liFreq.QuadPart / 1000; 00734 00735 while (dwElapsed < dwTime) { 00736 00737 if (fHide) { 00738 blend.SourceConstantAlpha = (BYTE)((255 * (dwTime - dwElapsed)) / dwTime); 00739 } else { 00740 blend.SourceConstantAlpha = (BYTE)((255 * dwElapsed) / dwTime); 00741 } 00742 00743 QueryPerformanceCounter(&liIter); 00744 00745 NtUserUpdateLayeredWindow(hwnd, NULL, NULL, NULL, NULL, NULL, 0, 00746 &blend, ULW_ALPHA); 00747 00748 QueryPerformanceCounter(&liDiff); 00749 00750 /* 00751 * Calculate how long in ms the previous frame took. 00752 */ 00753 liIter.QuadPart = liDiff.QuadPart - liIter.QuadPart; 00754 dwIter = (DWORD)((liIter.QuadPart * 1000) / liFreq.QuadPart); 00755 00756 if (dwIter < ONEFRAME) { 00757 Sleep(ONEFRAME - dwIter); 00758 } 00759 00760 liDiff.QuadPart -= liStart.QuadPart; 00761 dwElapsed = (DWORD)((liDiff.QuadPart * 1000) / liFreq.QuadPart); 00762 } 00763 00764 /* 00765 * Hide the window before removing the layered bit to make sure that 00766 * the bits for the window are not left on the screen. 00767 */ 00768 if (fHide) { 00769 NtUserSetWindowPos(hwnd, NULL, 0, 0, 0, 0, SWP_HIDEWINDOW | 00770 SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); 00771 } 00772 00773 SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) & 00774 ~WS_EX_LAYERED); 00775 00776 if (!fHide) { 00777 BitBlt(hdcScreen, 0, 0, size.cx, size.cy, hdcImage, 0, 0, SRCCOPY | NOMIRRORBITMAP); 00778 } 00779 00780 return TRUE; 00781 }

BOOL WINAPI AnimateWindow HWND  hwnd,
DWORD  dwTime,
DWORD  dwFlags
 

Definition at line 810 of file winmgrc.c.

References AnimateBlend(), AnimDec(), AnimInc(), AW_HOR, AW_VER, BOOL, ClearWindowState(), CMS_QANIMATION, cy, dwFlags, DWORD, EqualRect, FALSE, GetDCEx, tagWND::hrgnClip, IsWindowVisible(), NtUserCallHwndParamLock(), NtUserSetWindowPos(), NtUserShowWindow(), NULL, PtiCurrent, tagWND::rcWindow, RedrawWindow, ReleaseDC(), SendMessage(), SetWindowRgn(), SetWindowState(), ShowWindowNoRepaint(), TestWF, TRUE, UINT, ValidateHwnd, and WFCLIPCHILDREN.

Referenced by xxxCBShowListBoxWindow().

00811 { 00812 PTHREADINFO ptiCurrent = PtiCurrent(); 00813 HDC hdc = NULL, hdcMem = NULL; 00814 HRGN hrgnUpdate = NULL, hrgnOld = NULL, hrgnWin; 00815 HBITMAP hbmMem = NULL, hbmOld; 00816 BOOL fHide = dwFlags & AW_HIDE, fRet = FALSE, fSlide = dwFlags & AW_SLIDE; 00817 BOOL fRemoveClipChildren = FALSE; 00818 int x, y, nx, ny, cx, cy, ix, iy, ixLast, iyLast, xLast, yLast, xWin, yWin; 00819 int xReal, yReal, xMem, yMem; 00820 DWORD dwStart, dwElapsed; 00821 RECT rcOld, rcNew, rcWin; 00822 PWND pwnd = ValidateHwnd(hwnd); 00823 UINT uBounds; 00824 RECT rcBounds; 00825 #ifdef USE_MIRRORING 00826 DWORD dwOldlayout = GDI_ERROR; 00827 #endif 00828 00829 if (pwnd == NULL) 00830 return FALSE; 00831 00832 /* 00833 * Nothing to do or the flags didn't validate. Send the jerk to hell. 00834 */ 00835 if ((dwFlags & ~AW_VALID) != 0 || (dwFlags & (AW_HOR_POSITIVE | 00836 AW_HOR_NEGATIVE | AW_CENTER | AW_VER_POSITIVE | 00837 AW_VER_NEGATIVE | AW_BLEND)) == 0) 00838 return FALSE; 00839 00840 if (!(dwFlags & AW_BLEND)) { 00841 if (pwnd->hrgnClip != NULL) { 00842 return FALSE; 00843 } 00844 } 00845 00846 /* 00847 * If already hidden and tring to hide, just bail out of here. 00848 * (or already shown and trying to show...) 00849 */ 00850 if (!IsWindowVisible(hwnd)) { 00851 if (fHide) { 00852 return FALSE; 00853 } 00854 } else { 00855 if (!fHide) { 00856 return FALSE; 00857 } 00858 } 00859 00860 00861 if ((hdc = GetDCEx(hwnd, NULL, DCX_WINDOW | DCX_USESTYLE | 00862 DCX_CACHE)) == NULL) { 00863 return FALSE; 00864 } 00865 00866 if (TestWF(pwnd, WFCLIPCHILDREN)) { 00867 fRemoveClipChildren = TRUE; 00868 ClearWindowState(pwnd, WFCLIPCHILDREN); 00869 } 00870 00871 /* 00872 * Precreate regions used for calculating paint updates. 00873 */ 00874 if (fHide) { 00875 if ((hrgnUpdate = CreateRectRgn(0, 0, 0, 0)) == NULL) { 00876 goto Cleanup; 00877 } 00878 if ((hrgnOld = CreateRectRgn(0, 0, 0, 0)) == NULL) { 00879 goto Cleanup; 00880 } 00881 } 00882 00883 rcWin = pwnd->rcWindow; 00884 cx = rcWin.right - rcWin.left; 00885 cy = rcWin.bottom - rcWin.top; 00886 00887 /* 00888 * Set up the offscreen dc. 00889 */ 00890 if ((hbmMem = CreateCompatibleBitmap(hdc, cx, cy | CCB_NOVIDEOMEMORY)) == NULL) { 00891 goto Cleanup; 00892 } 00893 if ((hdcMem = CreateCompatibleDC(hdc)) == NULL) { 00894 goto Cleanup; 00895 } 00896 #ifdef USE_MIRRORING 00897 /* 00898 * Turn off Mirroring. 00899 */ 00900 dwOldlayout = SetLayout(hdcMem, 0); 00901 #endif 00902 hbmOld = SelectBitmap(hdcMem, hbmMem); 00903 00904 if (!(dwFlags & AW_BLEND)) { 00905 /* 00906 * Set window region to nothing, so that if the window draws during 00907 * callbacks in WM_PRINT, it doesn't happen on screen. 00908 */ 00909 if ((hrgnWin = CreateRectRgn(0, 0, 0, 0)) != NULL) { 00910 SetWindowRgn(hwnd, hrgnWin, FALSE); 00911 } 00912 00913 if (!fHide) { 00914 ShowWindowNoRepaint(pwnd); 00915 } 00916 } 00917 00918 SetBoundsRect(hdcMem, NULL, DCB_RESET | DCB_ENABLE); 00919 00920 /* 00921 * Get the actual image. The windows participating here must implement 00922 * WM_PRINTCLIENT or they will look ugly. 00923 */ 00924 SendMessage(hwnd, WM_PRINT, (WPARAM)hdcMem, PRF_CLIENT | PRF_NONCLIENT | 00925 PRF_CHILDREN | PRF_ERASEBKGND); 00926 00927 /* 00928 * If the window changes size during callbacks, like RAID does with combo 00929 * boxes by resizing them on WM_CTLCOLOR from WM_ERASEBKGND, send WM_PRINT 00930 * again to get the correctly sized image. 00931 */ 00932 if (!EqualRect(&rcWin, &pwnd->rcWindow)) { 00933 rcWin = pwnd->rcWindow; 00934 cx = rcWin.right - rcWin.left; 00935 cy = rcWin.bottom - rcWin.top; 00936 00937 SelectObject(hdcMem, hbmOld); 00938 DeleteObject(hbmMem); 00939 00940 if ((hbmMem = CreateCompatibleBitmap(hdc, cx, cy)) == NULL) { 00941 goto Cleanup; 00942 } 00943 00944 SelectObject(hdcMem, hbmMem); 00945 SendMessage(hwnd, WM_PRINT, (WPARAM)hdcMem, PRF_CLIENT | 00946 PRF_NONCLIENT | PRF_CHILDREN | PRF_ERASEBKGND); 00947 } 00948 00949 /* 00950 * Check to see if the app painted in our DC. If not, do not animate the window 00951 * SetBoundsRect() was called prior to SendMessage(WM_PRINT) for the hdcMem 00952 * and in xxxLBPaint() (to fix bug#83743) 00953 */ 00954 uBounds = GetBoundsRect(hdcMem, &rcBounds, 0); 00955 if ((uBounds & DCB_RESET) && (!(uBounds & DCB_ACCUMULATE))) { 00956 if (fHide) { 00957 NtUserShowWindow(hwnd, SW_HIDE); 00958 } else { 00959 RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | 00960 RDW_ALLCHILDREN); 00961 } 00962 goto Cleanup; 00963 } 00964 00965 if (dwTime == 0) { 00966 dwTime = CMS_QANIMATION; 00967 } 00968 if (dwFlags & AW_BLEND) { 00969 fRet = AnimateBlend(pwnd, hdc, hdcMem, dwTime, fHide); 00970 goto ShowActivate; 00971 } 00972 00973 xWin = rcWin.left; 00974 yWin = rcWin.top; 00975 00976 ix = iy = xLast = yLast = 0; 00977 ixLast = cx; 00978 iyLast = cy; 00979 00980 /* 00981 * Calculate initial coordinates and multiples. x, y are the starting points 00982 * for xReal, yReal calcs, nx, and ny are the directional multiples. 00983 */ 00984 if (dwFlags & AW_CENTER) { 00985 x = cx / 2; 00986 nx = -1; 00987 fSlide = FALSE; 00988 } else if (dwFlags & AW_HOR_POSITIVE) { 00989 x = fHide ? cx : 0; 00990 nx = fHide ? -1 : 0; 00991 } else if (dwFlags & AW_HOR_NEGATIVE) { 00992 x = fHide ? 0 : cx; 00993 nx = fHide ? 0 : -1; 00994 } else { 00995 x = 0; 00996 nx = 0; 00997 ix = cx; 00998 } 00999 01000 if (dwFlags & AW_CENTER) { 01001 y = cy / 2; 01002 ny = -1; 01003 } else if (dwFlags & AW_VER_POSITIVE) { 01004 y = fHide ? cy : 0; 01005 ny = fHide ? -1 : 0; 01006 } else if (dwFlags & AW_VER_NEGATIVE) { 01007 y = fHide ? 0 : cy; 01008 ny = fHide ? 0 : -1; 01009 } else { 01010 y = 0; 01011 ny = 0; 01012 iy = cy; 01013 } 01014 01015 dwStart = GetTickCount(); 01016 01017 while (TRUE) { 01018 01019 dwElapsed = GetTickCount() - dwStart; 01020 01021 if (dwFlags & AW_HOR) { 01022 if (fHide) { 01023 ix = AnimDec(cx, dwElapsed, dwTime); 01024 } else { 01025 ix = AnimInc(cx, dwElapsed, dwTime); 01026 } 01027 } 01028 01029 if (dwFlags & AW_VER) { 01030 if (fHide) { 01031 iy = AnimDec(cy, dwElapsed, dwTime); 01032 } else { 01033 iy = AnimInc(cy, dwElapsed, dwTime); 01034 } 01035 } 01036 01037 /* 01038 * Terminate when we are out of time or we're hiding and either 01039 * dimenion has reached zero (i.e. the window is not visible) or 01040 * we're showing and the window is completely visible. 01041 */ 01042 if (dwElapsed > dwTime || 01043 (fHide && (ix == 0 || iy == 0)) || 01044 (!fHide && (ix == cx && iy == cy))) { 01045 break; 01046 } else if (ixLast == ix && iyLast == iy) { 01047 Sleep(1); 01048 } else { 01049 if (dwFlags & AW_CENTER) { 01050 xReal = x + nx * (ix / 2); 01051 yReal = y + ny * (iy / 2); 01052 } else { 01053 xReal = x + nx * ix; 01054 yReal = y + ny * iy; 01055 } 01056 01057 /* 01058 * Calculate new window area and set as the window rgn. 01059 */ 01060 rcNew.left = xReal; 01061 rcNew.top = yReal; 01062 rcNew.right = rcNew.left + ix; 01063 rcNew.bottom = rcNew.top + iy; 01064 01065 /* 01066 * Change the window region accordingly to the new rect to make 01067 * sure that everything underneath paints properly. If a region 01068 * was selected in before, it will be destroyed in SetWindowRgn. 01069 */ 01070 if ((hrgnWin = CreateRectRgnIndirect(&rcNew)) != NULL) { 01071 SetWindowRgn(hwnd, hrgnWin, FALSE); 01072 } 01073 01074 if (fHide) { 01075 /* 01076 * Calculate the smallest possible update region. 01077 */ 01078 rcOld.left = xLast; 01079 rcOld.top = yLast; 01080 rcOld.right = rcOld.left + ixLast; 01081 rcOld.bottom = rcOld.top + iyLast; 01082 01083 SetRectRgn(hrgnOld, rcOld.left, rcOld.top, rcOld.right, rcOld.bottom); 01084 SetRectRgn(hrgnUpdate, rcNew.left, rcNew.top, rcNew.right, rcNew.bottom); 01085 CombineRgn(hrgnUpdate, hrgnOld, hrgnUpdate, RGN_DIFF); 01086 01087 OffsetRgn(hrgnUpdate, xWin, yWin); 01088 RedrawWindow(NULL, NULL, hrgnUpdate, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | 01089 RDW_ALLCHILDREN); 01090 NtUserCallHwndParamLock(hwnd, (ULONG_PTR)hrgnUpdate, SFI_XXXUPDATEWINDOWS); 01091 } 01092 01093 xMem = xReal; 01094 yMem = yReal; 01095 01096 if (fSlide) { 01097 if (dwFlags & AW_HOR_POSITIVE) { 01098 xMem = fHide ? 0: cx - ix; 01099 } else if (dwFlags & AW_HOR_NEGATIVE) { 01100 xMem = fHide ? cx - ix : 0; 01101 } 01102 if (dwFlags & AW_VER_POSITIVE) { 01103 yMem = fHide ? 0 : cy - iy; 01104 } else if (dwFlags & AW_VER_NEGATIVE) { 01105 yMem = fHide ? cy - iy : 0; 01106 } 01107 } 01108 01109 BitBlt(hdc, xReal, yReal, ix, iy, hdcMem, xMem, yMem, SRCCOPY | NOMIRRORBITMAP); 01110 01111 xLast = xReal; 01112 yLast = yReal; 01113 ixLast = ix; 01114 iyLast = iy; 01115 } 01116 } 01117 01118 fRet = TRUE; 01119 01120 /* 01121 * One last update to make sure that everything is repainted properly. 01122 */ 01123 if (fHide) { 01124 if (fRemoveClipChildren) { 01125 SetWindowState(pwnd, WFCLIPCHILDREN); 01126 fRemoveClipChildren = FALSE; 01127 } 01128 NtUserSetWindowPos(hwnd, NULL, 0, 0, 0, 0, SWP_NOMOVE | 01129 SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER | 01130 SWP_NOREDRAW | SWP_HIDEWINDOW | 01131 (dwFlags & AW_ACTIVATE ? 0 : SWP_NOACTIVATE)); 01132 01133 /* 01134 * This way we won't get a flash, which we would if we allowed to draw 01135 * in the call above. 01136 */ 01137 if (ixLast != 0 && iyLast != 0) { 01138 rcWin.left = xLast + xWin; 01139 rcWin.top = yLast + yWin; 01140 rcWin.right = rcWin.left + ixLast; 01141 rcWin.bottom = rcWin.top + iyLast; 01142 SetRectRgn(hrgnUpdate, rcWin.left, rcWin.top, rcWin.right, rcWin.bottom); 01143 RedrawWindow(NULL, NULL, hrgnUpdate, RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_ERASE | 01144 RDW_FRAME); 01145 NtUserCallHwndParamLock(hwnd, (ULONG_PTR)hrgnUpdate, SFI_XXXUPDATEWINDOWS); 01146 } 01147 } else { 01148 if (ixLast != cx || iyLast != cy) { 01149 if ((hrgnWin = CreateRectRgn(0, 0, cx, cy)) != NULL) { 01150 SetWindowRgn(hwnd, hrgnWin, FALSE); 01151 } 01152 BitBlt(hdc, 0, 0, cx, cy, hdcMem, 0, 0, SRCCOPY | NOMIRRORBITMAP); 01153 } 01154 if (fRemoveClipChildren) { 01155 SetWindowState(pwnd, WFCLIPCHILDREN); 01156 fRemoveClipChildren = FALSE; 01157 } 01158 01159 ShowActivate: 01160 if (dwFlags & AW_ACTIVATE) { 01161 NtUserSetWindowPos(hwnd, NULL, 0, 0, 0, 0, SWP_NOMOVE | 01162 SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER); 01163 } 01164 } 01165 01166 Cleanup: 01167 if (fRemoveClipChildren) { 01168 SetWindowState(pwnd, WFCLIPCHILDREN); 01169 } 01170 if (hdcMem != NULL) { 01171 #ifdef USE_MIRRORING 01172 /* 01173 * Restore old layout value. 01174 */ 01175 if (dwOldlayout != GDI_ERROR) 01176 SetLayout(hdcMem, dwOldlayout); 01177 #endif 01178 DeleteDC(hdcMem); 01179 } 01180 if (hbmMem != NULL) { 01181 DeleteObject(hbmMem); 01182 } 01183 if (hdc != NULL) { 01184 ReleaseDC(hwnd, hdc); 01185 } 01186 if (fHide) { 01187 if (hrgnUpdate != NULL) { 01188 DeleteObject(hrgnUpdate); 01189 } 01190 if (hrgnOld != NULL) { 01191 DeleteObject(hrgnOld); 01192 } 01193 } 01194 if (!(dwFlags & AW_BLEND)) { 01195 SetWindowRgn(hwnd, NULL, FALSE); 01196 } 01197 return fRet; 01198 }

__inline int AnimDec int  x,
int  y,
int  z
 

Definition at line 805 of file winmgrc.c.

References AnimInc().

Referenced by AnimateWindow().

00806 { 00807 return x - AnimInc(x, y, z); 00808 }

__inline int AnimInc int  x,
int  y,
int  z
 

Definition at line 800 of file winmgrc.c.

References MultDiv.

Referenced by AnimateWindow(), and AnimDec().

00801 { 00802 return MultDiv(x, y, z); 00803 }

BOOL AnyPopup VOID   ) 
 

Definition at line 116 of file winmgrc.c.

References _GetDesktopWindow(), BOOL, FALSE, NULL, REBASEPWND, tagWND::spwndOwner, TestWF, TRUE, and WFVISIBLE.

00117 { 00118 PWND pwnd = _GetDesktopWindow(); 00119 00120 for (pwnd = REBASEPWND(pwnd, spwndChild); pwnd; pwnd = REBASEPWND(pwnd, spwndNext)) { 00121 00122 if ((pwnd->spwndOwner != NULL) && TestWF(pwnd, WFVISIBLE)) 00123 return TRUE; 00124 } 00125 00126 return FALSE; 00127 }

BOOL FChildVisible HWND  hwnd  ) 
 

Definition at line 52 of file winmgrc.c.

References _FChildVisible(), BOOL, NULL, and ValidateHwnd.

Referenced by SLUndo().

00054 { 00055 PWND pwnd; 00056 00057 pwnd = ValidateHwnd(hwnd); 00058 00059 if (pwnd == NULL) 00060 return 0; 00061 00062 return (_FChildVisible(pwnd)); 00063 }

HWND GetActiveWindow VOID   ) 
 

Definition at line 449 of file winmgrc.c.

References NtUserGetThreadState().

Referenced by EndDialog(), and InternalDialogBox().

00450 { 00451 return (HWND)NtUserGetThreadState(UserThreadStateActiveWindow); 00452 }

DWORD GetAppCompatFlags PTHREADINFO  pti  ) 
 

Definition at line 494 of file winmgrc.c.

00496 { 00497 UNREFERENCED_PARAMETER(pti); 00498 00499 ConnectIfNecessary(); 00500 00501 return GetClientInfo()->dwCompatFlags; 00502 }

DWORD GetAppCompatFlags2 WORD  wVer  ) 
 

Definition at line 514 of file winmgrc.c.

00516 { 00517 ConnectIfNecessary(); 00518 /* 00519 * Newer apps should behave, so they get no hacks 00520 */ 00521 if (wVer < GETAPPVER()) { 00522 return 0; 00523 } 00524 return GetClientInfo()->dwCompatFlags2; 00525 }

HWND GetCapture VOID   ) 
 

Definition at line 96 of file winmgrc.c.

References gpsi, NtUserGetThreadState(), and NULL.

Referenced by ConsoleWindowProc(), DialogBox2(), EnterReaderMode(), and SKT1ButtonUp().

00097 { 00098 /* 00099 * If no captures are currently taking place, just return NULL. 00100 */ 00101 if (gpsi->cCaptures == 0) { 00102 return NULL; 00103 } 00104 return (HWND)NtUserGetThreadState(UserThreadStateCaptureWindow); 00105 }

int WINAPI GetClassNameW HWND  hwnd,
LPWSTR  lpClassName,
int  nMaxCount
 

Definition at line 77 of file winmgrc.c.

References FALSE, NtUserGetClassName(), and USHORT.

00081 { 00082 UNICODE_STRING strClassName; 00083 00084 strClassName.MaximumLength = (USHORT)(nMaxCount * sizeof(WCHAR)); 00085 strClassName.Buffer = lpClassName; 00086 return NtUserGetClassName(hwnd, FALSE, &strClassName); 00087 }

HCURSOR GetCursor VOID   ) 
 

Definition at line 461 of file winmgrc.c.

References NtUserGetThreadState().

00462 { 00463 return (HCURSOR)NtUserGetThreadState(UserThreadStateCursor); 00464 }

HWND GetFocus VOID   ) 
 

Definition at line 90 of file winmgrc.c.

References NtUserGetThreadState().

Referenced by ColorSpaceControl(), CreateCRDControl(), CreateINTENTControl(), CreateProfCRDControl(), DefDlgProcWorker(), EndDialog(), CDeviceProfileManagement::FillList(), ImmEnableIME(), ImmIMPSetIMEW(), ImmPenAuxInput(), IsDialogMessageW(), SendIMEMessageAll(), TransSetConversionWindow(), TransSetOpenJ(), CProfileAssociationPage::UpdateDeviceListBox(), WinHelpA(), xxxRestoreDlgFocus(), and xxxSaveDlgFocus().

00091 { 00092 return (HWND)NtUserGetThreadState(UserThreadStateFocusWindow); 00093 }

BOOL GetInputState VOID   ) 
 

Definition at line 137 of file winmgrc.c.

References BOOL, FALSE, tagCLIENTTHREADINFO::fsChangeBits, GetClientInfo, NtUserGetThreadState(), and NULL.

Referenced by msProfGetInputState().

00138 { 00139 PCLIENTTHREADINFO pcti = GetClientInfo()->pClientThreadInfo; 00140 00141 if ((pcti == NULL) || (pcti->fsChangeBits & (QS_MOUSEBUTTON | QS_KEY))) 00142 return (BOOL)NtUserGetThreadState(UserThreadStateInputState); 00143 00144 return FALSE; 00145 }

HWND GetLastActivePopup HWND  hwnd  ) 
 

Definition at line 196 of file winmgrc.c.

References _GetLastActivePopup(), HW, NULL, and ValidateHwnd.

Referenced by ConsoleWindowProc().

00198 { 00199 PWND pwnd = ValidateHwnd(hwnd); 00200 00201 if (pwnd == NULL) 00202 return NULL; 00203 00204 pwnd = _GetLastActivePopup(pwnd); 00205 00206 return HW(pwnd); 00207 }

BOOL GetScrollInfo HWND  hwnd,
int  code,
LPSCROLLINFO  lpsi
 

Definition at line 383 of file winmgrc.c.

References BOOL, FALSE, tagSBINFO::Horz, NtUserSBGetParms(), NULL, tagWND::pSBInfo, REBASEALWAYS, SendMessageWorker(), TRUE, ValidateHwnd, and tagSBINFO::Vert.

Referenced by MLScroll(), ScrollMDIChildren(), and xxxLBoxCtlScroll().

00387 { 00388 PWND pwnd; 00389 PSBINFO pSBInfo; 00390 PSBDATA pSBData; 00391 00392 if (lpsi->cbSize != sizeof(SCROLLINFO)) { 00393 00394 if (lpsi->cbSize != sizeof(SCROLLINFO) - 4) { 00395 RIPMSG0(RIP_WARNING, "SCROLLINFO: Invalid cbSize"); 00396 return FALSE; 00397 00398 } else { 00399 RIPMSG0(RIP_WARNING, "SCROLLINFO: Invalid cbSize"); 00400 } 00401 } 00402 00403 if (lpsi->fMask & ~SIF_MASK) { 00404 RIPMSG0(RIP_WARNING, "SCROLLINFO: Invalid fMask"); 00405 return FALSE; 00406 } 00407 00408 if ((pwnd = ValidateHwnd(hwnd)) == NULL) 00409 return FALSE; 00410 00411 switch (code) { 00412 case SB_CTL: 00413 SendMessageWorker(pwnd, SBM_GETSCROLLINFO, 0, (LPARAM)lpsi, FALSE); 00414 return TRUE; 00415 00416 case SB_HORZ: 00417 case SB_VERT: 00418 if (pwnd->pSBInfo == NULL) { 00419 RIPERR0(ERROR_NO_SCROLLBARS, RIP_VERBOSE, ""); 00420 return FALSE; 00421 } 00422 00423 /* 00424 * Rebase rgwScroll so probing will work 00425 */ 00426 pSBInfo = (PSBINFO)REBASEALWAYS(pwnd, pSBInfo); 00427 00428 pSBData = (code == SB_VERT) ? &pSBInfo->Vert : &pSBInfo->Horz; 00429 00430 return(NtUserSBGetParms(hwnd, code, pSBData, lpsi)); 00431 00432 default: 00433 /* 00434 * Win3.1 validation layer code. 00435 */ 00436 RIPERR0(ERROR_INVALID_PARAMETER, RIP_VERBOSE, ""); 00437 return FALSE; 00438 } 00439 }

int GetScrollPos HWND  hwnd,
int  code
 

Definition at line 293 of file winmgrc.c.

References FALSE, tagSBINFO::Horz, NULL, tagSBDATA::pos, tagWND::pSBInfo, REBASEALWAYS, SendMessageWorker(), ValidateHwnd, and tagSBINFO::Vert.

00296 { 00297 PWND pwnd; 00298 00299 if ((pwnd = ValidateHwnd(hwnd)) == NULL) 00300 return 0; 00301 00302 switch (code) { 00303 case SB_CTL: 00304 return (int)SendMessageWorker(pwnd, SBM_GETPOS, 0, 0, FALSE); 00305 00306 case SB_HORZ: 00307 case SB_VERT: 00308 if (pwnd->pSBInfo != NULL) { 00309 PSBINFO pSBInfo = (PSBINFO)(REBASEALWAYS(pwnd, pSBInfo)); 00310 return (code == SB_VERT) ? pSBInfo->Vert.pos : pSBInfo->Horz.pos; 00311 } else { 00312 RIPERR0(ERROR_NO_SCROLLBARS, RIP_VERBOSE, ""); 00313 } 00314 break; 00315 00316 default: 00317 /* 00318 * Win3.1 validation layer code. 00319 */ 00320 RIPERR0(ERROR_INVALID_PARAMETER, RIP_VERBOSE, ""); 00321 } 00322 00323 return 0; 00324 }

BOOL GetScrollRange HWND  hwnd,
int  code,
LPINT  lpposMin,
LPINT  lpposMax
 

Definition at line 335 of file winmgrc.c.

References BOOL, FALSE, tagSBINFO::Horz, NULL, tagSBDATA::posMax, tagSBDATA::posMin, REBASE, SendMessageWorker(), TRUE, ValidateHwnd, and tagSBINFO::Vert.

00340 { 00341 PSBINFO pSBInfo; 00342 PWND pwnd; 00343 00344 if ((pwnd = ValidateHwnd(hwnd)) == NULL) 00345 return FALSE; 00346 00347 switch (code) { 00348 case SB_CTL: 00349 SendMessageWorker(pwnd, SBM_GETRANGE, (WPARAM)lpposMin, (LPARAM)lpposMax, FALSE); 00350 return TRUE; 00351 00352 case SB_VERT: 00353 case SB_HORZ: 00354 if (pSBInfo = REBASE(pwnd, pSBInfo)) { 00355 PSBDATA pSBData; 00356 pSBData = (code == SB_VERT) ? &pSBInfo->Vert : &pSBInfo->Horz; 00357 *lpposMin = pSBData->posMin; 00358 *lpposMax = pSBData->posMax; 00359 } else { 00360 RIPERR0(ERROR_NO_SCROLLBARS, RIP_VERBOSE, ""); 00361 *lpposMin = 0; 00362 *lpposMax = 0; 00363 } 00364 00365 return TRUE; 00366 00367 default: 00368 /* 00369 * Win3.1 validation layer code. 00370 */ 00371 RIPERR0(ERROR_INVALID_PARAMETER, RIP_VERBOSE, ""); 00372 return FALSE; 00373 } 00374 }

DWORD GetWindowThreadProcessId HWND  hwnd,
LPDWORD  lpdwProcessId
 

Definition at line 251 of file winmgrc.c.

References DWORD, NtUserQueryWindow(), NULL, PtiCurrent, and PtiWindow().

Referenced by _EndTask(), GetDialogMonitor(), ImmCallImeConsoleIME(), ImmSimulateHotKey(), ImmTranslateMessage(), IsForegroundThread(), SendWinHelpMessage(), and SetCommonStateFlags().

00254 { 00255 PTHREADINFO ptiWindow; 00256 DWORD dwThreadId; 00257 00258 if ((ptiWindow = PtiWindow(hwnd)) == NULL) 00259 return 0; 00260 00261 /* 00262 * For non-system threads get the info from the thread info structure 00263 */ 00264 if (ptiWindow == PtiCurrent()) { 00265 00266 if (lpdwProcessId != NULL) 00267 *lpdwProcessId = HandleToUlong(NtCurrentTeb()->ClientId.UniqueProcess); 00268 dwThreadId = HandleToUlong(NtCurrentTeb()->ClientId.UniqueThread); 00269 00270 } else { 00271 00272 /* 00273 * Make this better later on. 00274 */ 00275 if (lpdwProcessId != NULL) 00276 *lpdwProcessId = HandleToUlong(NtUserQueryWindow(hwnd, WindowProcess)); 00277 dwThreadId = HandleToUlong(NtUserQueryWindow(hwnd, WindowThread)); 00278 } 00279 00280 return dwThreadId; 00281 }

WORD GetWindowWord HWND  hwnd,
int  index
 

Definition at line 28 of file winmgrc.c.

References _GetWindowLong, _GetWindowWord(), FALSE, NULL, TestWF, ValidateHwnd, and WFDIALOGWINDOW.

00031 { 00032 PWND pwnd; 00033 00034 pwnd = ValidateHwnd(hwnd); 00035 00036 if (pwnd == NULL) 00037 return 0; 00038 00039 /* 00040 * If it's a dialog window the window data is on the server side 00041 * We just call the "long" routine instead of have two thunks. 00042 * We know there is enough data if its DWLP_USER so we won't fault. 00043 */ 00044 if (TestWF(pwnd, WFDIALOGWINDOW) && (index == DWLP_USER)) { 00045 return (WORD)_GetWindowLong(pwnd, index, FALSE); 00046 } 00047 00048 return _GetWindowWord(pwnd, index); 00049 }

BOOL IsHungAppWindow HWND  hwnd  ) 
 

Definition at line 571 of file winmgrc.c.

References BOOL, NtUserQueryWindow(), and NULL.

00573 { 00574 return (NtUserQueryWindow(hwnd, WindowIsHung) != NULL); 00575 }

BOOL IsMenu HMENU  hMenu  ) 
 

Definition at line 475 of file winmgrc.c.

References BOOL, FALSE, HMValidateHandle(), TRUE, and TYPE_MENU.

Referenced by MDIClientWndProcWorker().

00477 { 00478 if (HMValidateHandle(hMenu, TYPE_MENU)) 00479 return TRUE; 00480 00481 return FALSE; 00482 }

BOOL IsWindowUnicode IN HWND  hwnd  ) 
 

Definition at line 533 of file winmgrc.c.

References BOOL, FALSE, NULL, TestWF, ValidateHwnd, and WFANSIPROC.

Referenced by JTransCompositionA(), JTransCompositionW(), SetCommonStateFlags(), WINNLSTranslateMessageJ(), and WINNLSTranslateMessageK().

00535 { 00536 PWND pwnd; 00537 00538 00539 if ((pwnd = ValidateHwnd(hwnd)) == NULL) 00540 return FALSE; 00541 00542 return !TestWF(pwnd, WFANSIPROC); 00543 }

int MapWindowPoints HWND  hwndFrom,
HWND  hwndTo,
LPPOINT  lppt,
UINT  cpt
 

Definition at line 155 of file winmgrc.c.

References _MapWindowPoints(), NULL, and ValidateHwnd.

Referenced by CResizeControlGeneric::DeterminLocation(), ECImmSetCompositionWindow(), ScrollIfNecessary(), SetEndTaskDlgStatus(), and TransSetConversionWindow().

00160 { 00161 PWND pwndFrom; 00162 PWND pwndTo; 00163 00164 if (hwndFrom != NULL) { 00165 00166 if ((pwndFrom = ValidateHwnd(hwndFrom)) == NULL) 00167 return 0; 00168 00169 } else { 00170 00171 pwndFrom = NULL; 00172 } 00173 00174 if (hwndTo != NULL) { 00175 00176 00177 if ((pwndTo = ValidateHwnd(hwndTo)) == NULL) 00178 return 0; 00179 00180 } else { 00181 00182 pwndTo = NULL; 00183 } 00184 00185 return _MapWindowPoints(pwndFrom, pwndTo, lppt, cpt); 00186 }

PTHREADINFO PtiCurrent VOID   ) 
 

Definition at line 588 of file winmgrc.c.

References ConnectIfNecessary.

00589 { 00590 ConnectIfNecessary(); 00591 return (PTHREADINFO)NtCurrentTebShared()->Win32ThreadInfo; 00592 }

PTHREADINFO PtiWindow HWND  hwnd  ) 
 

Definition at line 217 of file winmgrc.c.

References tagSHAREDINFO::aheList, _HANDLEENTRY::bFlags, _HANDLEENTRY::bType, tagSERVERINFO::cHandleEntries, DWORD, gpsi, gSharedInfo, HANDLEF_DESTROY, HMIndexFromHandle, HMUNIQBITS, HMUniqFromHandle, NULL, _HANDLEENTRY::pOwner, TYPE_WINDOW, and _HANDLEENTRY::wUniq.

Referenced by GetWindowThreadProcessId().

00219 { 00220 PHE phe; 00221 DWORD dw; 00222 WORD uniq; 00223 00224 dw = HMIndexFromHandle(hwnd); 00225 if (dw < gpsi->cHandleEntries) { 00226 phe = &gSharedInfo.aheList[dw]; 00227 if ((phe->bType == TYPE_WINDOW) && !(phe->bFlags & HANDLEF_DESTROY)) { 00228 uniq = HMUniqFromHandle(hwnd); 00229 if ( uniq == phe->wUniq 00230 #if !defined(_WIN64) && !defined(BUILD_WOW6432) 00231 || uniq == 0 00232 || uniq == HMUNIQBITS 00233 #endif 00234 ) { 00235 return phe->pOwner; 00236 } 00237 } 00238 } 00239 UserSetLastError(ERROR_INVALID_WINDOW_HANDLE); 00240 return NULL; 00241 }

int ScrollWindowEx HWND  hwnd,
int  dx,
int  dy,
CONST RECT *  prcScroll,
CONST RECT *  prcClip,
HRGN  hrgnUpdate,
LPRECT  prcUpdate,
UINT  dwFlags
 

Definition at line 1473 of file winmgrc.c.

References dwFlags, NtUserScrollWindowEx(), and SmoothScrollWindowEx().

Referenced by MLScroll(), xxxLBoxCtlHScroll(), and xxxNewITopEx().

01476 { 01477 if (dwFlags & SW_SMOOTHSCROLL) { 01478 return SmoothScrollWindowEx(hwnd, dx, dy, prcScroll, prcClip, 01479 hrgnUpdate, prcUpdate, LOWORD(dwFlags), HIWORD(dwFlags)); 01480 } else { 01481 return NtUserScrollWindowEx(hwnd, dx, dy, prcScroll, prcClip, 01482 hrgnUpdate, prcUpdate, dwFlags); 01483 } 01484 }

void ShowWindowNoRepaint PWND  pwnd  ) 
 

Definition at line 661 of file winmgrc.c.

References HWq, NtUserSetWindowPos(), NULL, and REBASE.

Referenced by AnimateBlend(), and AnimateWindow().

00662 { 00663 HWND hwnd = HWq(pwnd); 00664 PCLS pcls = REBASE(pwnd, pcls); 00665 NtUserSetWindowPos(hwnd, NULL, 0, 0, 0, 0, SWP_NOMOVE | 00666 SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER | 00667 SWP_NOREDRAW | SWP_SHOWWINDOW | SWP_NOACTIVATE | 00668 ((pcls->style & CS_SAVEBITS) ? SWP_CREATESPB : 0)); 00669 }

int SmoothScrollWindowEx HWND  hwnd,
int  dx,
int  dy,
CONST RECT *  prcScroll,
CONST RECT *  prcClip,
HRGN  hrgnUpdate,
LPRECT  prcUpdate,
DWORD  dwFlags,
DWORD  dwTime
 

Definition at line 1210 of file winmgrc.c.

References tagCLS::atomClassName, BOOL, DispatchMessage(), dwFlags, DWORD, EqualRect, FALSE, gatomReaderMode, GetDCEx, tagWND::hrgnUpdate, max, MAXSCROLLTIME, MINSCROLL, msg, MsgWaitForMultipleObjects(), NtUserScrollWindowEx(), NULL, PeekMessage(), tagWND::rcClient, REBASEALWAYS, RedrawWindow, ReleaseDC(), SendMessage(), SetRectEmpty, TRUE, UINT, UnionRect(), and ValidateHwnd.

Referenced by ScrollWindowEx().

01213 { 01214 RECT rc, rcT, rcUpdate; 01215 int dxStep, dyStep, dxDone, dyDone, xSrc, ySrc, xDst, yDst, dxBlt, dyBlt; 01216 int nRet = ERROR, nClip; 01217 BOOL fNegX = FALSE, fNegY = FALSE; 01218 HDC hdc, hdcMem = NULL; 01219 HBITMAP hbmMem = NULL, hbmOld; 01220 DWORD dwSleep; 01221 BOOL fCalcSubscroll = FALSE; 01222 PWND pwnd = ValidateHwnd(hwnd); 01223 HRGN hrgnScroll = NULL, hrgnErase = NULL; 01224 MSG msg; 01225 UINT uBounds; 01226 RECT rcBounds; 01227 01228 if (pwnd == NULL) 01229 return ERROR; 01230 /* 01231 * Keep track of the signs so we don't have to mess with abs all the time. 01232 */ 01233 if (dx < 0) { 01234 fNegX = TRUE; 01235 dx = -dx; 01236 } 01237 01238 if (dy < 0) { 01239 fNegY = TRUE; 01240 dy = -dy; 01241 } 01242 01243 /* 01244 * Set up the client rectangle. 01245 */ 01246 if (prcScroll != NULL) { 01247 rc = *prcScroll; 01248 } else { 01249 rc.left = rc.top = 0; 01250 rc.right = pwnd->rcClient.right - pwnd->rcClient.left; 01251 rc.bottom = pwnd->rcClient.bottom - pwnd->rcClient.top; 01252 } 01253 01254 /* 01255 * If they want to scroll less than we can let them, or more than 01256 * one page, or need repainting send them to the API. 01257 */ 01258 if (pwnd->hrgnUpdate != NULL || (dx == 0 && dy == 0) || 01259 (dx != 0 && dx > rc.right) || 01260 (dy != 0 && dy > rc.bottom)) { 01261 return NtUserScrollWindowEx(hwnd, fNegX ? -dx : dx, fNegY ? -dy : dy, 01262 prcScroll, prcClip, hrgnUpdate, prcUpdate, 01263 dwFlags | SW_ERASE | SW_INVALIDATE); 01264 } 01265 01266 if ((hdc = GetDCEx(hwnd, NULL, DCX_USESTYLE | DCX_CACHE)) == NULL) { 01267 return ERROR; 01268 } 01269 01270 /* 01271 * Part of the window may be obscured, which means that more may be 01272 * invisible and may need to be bltted. Take that into account by 01273 * gettting the clip box. 01274 */ 01275 nClip = GetClipBox(hdc, &rcT); 01276 if (nClip == ERROR || nClip == NULLREGION) { 01277 goto Cleanup; 01278 } 01279 01280 /* 01281 * Set up the offscreen dc and send WM_PRINT to get the image. 01282 */ 01283 if ((hbmMem = CreateCompatibleBitmap(hdc, rc.right, rc.bottom)) == NULL) { 01284 goto Cleanup; 01285 } 01286 if ((hdcMem = CreateCompatibleDC(hdc)) == NULL) { 01287 goto Cleanup; 01288 } 01289 hbmOld = SelectBitmap(hdcMem, hbmMem); 01290 01291 SetBoundsRect(hdcMem, NULL, DCB_RESET | DCB_ENABLE); 01292 01293 SendMessage(hwnd, WM_PRINT, (WPARAM)hdcMem, PRF_CLIENT | 01294 PRF_ERASEBKGND | ((dwFlags & SW_SCROLLCHILDREN) ? PRF_CHILDREN : 0)); 01295 01296 /* 01297 * If the client rect changes during the callback, send WM_PRINT 01298 * again to get the correctly sized image. 01299 */ 01300 if (prcScroll == NULL) { 01301 rcT.left = rcT.top = 0; 01302 rcT.right = pwnd->rcClient.right - pwnd->rcClient.left; 01303 rcT.bottom = pwnd->rcClient.bottom - pwnd->rcClient.top; 01304 01305 if (!EqualRect(&rc, &rcT)) { 01306 rc = rcT; 01307 01308 SelectObject(hdcMem, hbmOld); 01309 DeleteObject(hbmMem); 01310 01311 if ((hbmMem = CreateCompatibleBitmap(hdc, rc.right, rc.bottom)) == NULL) { 01312 goto Cleanup; 01313 } 01314 01315 SelectObject(hdcMem, hbmMem); 01316 SendMessage(hwnd, WM_PRINT, (WPARAM)hdcMem, PRF_CLIENT | 01317 PRF_ERASEBKGND | ((dwFlags & SW_SCROLLCHILDREN) ? PRF_CHILDREN : 0)); 01318 } 01319 } 01320 01321 /* 01322 * Check to see if the app painted in our DC. 01323 */ 01324 uBounds = GetBoundsRect(hdcMem, &rcBounds, 0); 01325 if ((uBounds & DCB_RESET) && (!(uBounds & DCB_ACCUMULATE))) { 01326 goto Cleanup; 01327 } 01328 01329 if ((hrgnScroll = CreateRectRgn(0, 0, 0, 0)) == NULL) { 01330 goto Cleanup; 01331 } 01332 if ((hrgnErase = CreateRectRgn(0, 0, 0, 0)) == NULL) { 01333 goto Cleanup; 01334 } 01335 SetRectEmpty(&rcUpdate); 01336 01337 /* 01338 * Start off with MINSCROLL and adjust it based on available time after 01339 * the first iteration. We should consider adding a NOTIMELIMIT flag. 01340 */ 01341 xDst = xSrc = 0; 01342 yDst = ySrc = 0; 01343 01344 dxBlt = rc.right; 01345 dyBlt = rc.bottom; 01346 01347 if (dx == 0) { 01348 dxDone = rc.right; 01349 dxStep = 0; 01350 } else { 01351 dxDone = 0; 01352 dxStep = max(dx / MINSCROLL, 1); 01353 } 01354 01355 if (dy == 0) { 01356 dyDone = rc.bottom; 01357 dyStep = 0; 01358 } else { 01359 dyDone = 0; 01360 dyStep = max(dy / MINSCROLL, 1); 01361 } 01362 01363 if (dwTime == 0) { 01364 dwTime = MAXSCROLLTIME; 01365 } 01366 dwSleep = dwTime / MINSCROLL; 01367 01368 do { 01369 01370 /* 01371 * When the dc is scrolled, the part that's revealed cannot be 01372 * updated properly. We set up the variables to blt just the part that 01373 * was just uncovered. 01374 */ 01375 if (dx != 0) { 01376 if (dxDone + dxStep > dx) { 01377 dxStep = dx - dxDone; 01378 } 01379 dxDone += dxStep; 01380 01381 xDst = dx - dxDone; 01382 dxBlt = rc.right - xDst; 01383 if (!fNegX) { 01384 xSrc = xDst; 01385 xDst = 0; 01386 } 01387 } 01388 01389 if (dy != 0) { 01390 if (dyDone + dyStep > dy) { 01391 dyStep = dy - dyDone; 01392 } 01393 dyDone += dyStep; 01394 01395 yDst = dy - dyDone; 01396 dyBlt = rc.bottom - yDst; 01397 if (!fNegY) { 01398 ySrc = yDst; 01399 yDst = 0; 01400 } 01401 } 01402 01403 /* 01404 * This is a hack for ReaderMode to be smoothly continuous. We'll make an 01405 * attempt for the scrolling to take as close to dwTime 01406 * as possible. We'll also dispatch MOUSEMOVEs to the ReaderMode window, so it 01407 * can update mouse cursor. 01408 */ 01409 if (MsgWaitForMultipleObjects(0, NULL, FALSE, dwSleep, QS_MOUSEMOVE) == WAIT_OBJECT_0) { 01410 if (PeekMessage(&msg, NULL, WM_MOUSEMOVE, WM_MOUSEMOVE, MAKELONG(PM_NOREMOVE, QS_INPUT))) { 01411 PWND pwndPeek = ValidateHwnd(msg.hwnd); 01412 if (pwndPeek != NULL) { 01413 PCLS pcls = (PCLS)REBASEALWAYS(pwndPeek, pcls); 01414 if (pcls->atomClassName == gatomReaderMode) { 01415 if (PeekMessage(&msg, msg.hwnd, WM_MOUSEMOVE, WM_MOUSEMOVE, MAKELONG(PM_REMOVE, QS_INPUT))) { 01416 DispatchMessage(&msg); 01417 } 01418 } 01419 } 01420 } 01421 } 01422 01423 if ((nRet = NtUserScrollWindowEx(hwnd, fNegX ? -dxStep : dxStep, 01424 fNegY ? -dyStep : dyStep, prcScroll, prcClip, 01425 hrgnScroll, &rcT, dwFlags)) == ERROR) 01426 goto Cleanup; 01427 01428 UnionRect(&rcUpdate, &rcUpdate, &rcT); 01429 01430 /* 01431 * Blt the uncovered part. 01432 */ 01433 BitBlt(hdc, xDst, yDst, dxBlt, dyBlt, hdcMem, xSrc, ySrc, SRCCOPY | NOMIRRORBITMAP); 01434 01435 SetRectRgn(hrgnErase, xDst, yDst, xDst + dxBlt, yDst + dyBlt); 01436 CombineRgn(hrgnErase, hrgnScroll, hrgnErase, RGN_DIFF); 01437 RedrawWindow(hwnd, NULL, hrgnErase, RDW_ERASE | RDW_INVALIDATE | RDW_ERASENOW); 01438 01439 } while (dxDone < dx || dyDone < dy); 01440 01441 if (prcUpdate != NULL) { 01442 *prcUpdate = rcUpdate; 01443 } 01444 if (hrgnUpdate != NULL) { 01445 SetRectRgn(hrgnUpdate, rcUpdate.left, rcUpdate.top, 01446 rcUpdate.right, rcUpdate.bottom); 01447 } 01448 01449 Cleanup: 01450 if (hdcMem != NULL) { 01451 DeleteDC(hdcMem); 01452 } 01453 if (hbmMem != NULL) { 01454 DeleteObject(hbmMem); 01455 } 01456 if (hdc != NULL) { 01457 ReleaseDC(hwnd, hdc); 01458 } 01459 if (hrgnErase != NULL) { 01460 DeleteObject(hrgnErase); 01461 } 01462 if (hrgnScroll != NULL) { 01463 DeleteObject(hrgnScroll); 01464 } 01465 return nRet; 01466 }

BOOL TestWindowProcess PWND  pwnd  ) 
 

Definition at line 551 of file winmgrc.c.

00553 { 00554 /* 00555 * If the threads are the same, don't bother going to the kernel 00556 * to get the window's process id. 00557 */ 00558 if (GETPTI(pwnd) == PtiCurrent()) { 00559 return TRUE; 00560 } 00561 00562 return (GetWindowProcess(HW(pwnd)) == GETPROCESSID()); 00563 }


Generated on Sat May 15 19:46:09 2004 for test by doxygen 1.3.7