1 #pragma once 2 3 typedef struct _CVR // Tag Ussw 4 { 5 WINDOWPOS pos; 6 LONG xClientNew; 7 LONG yClientNew; 8 LONG cxClientNew; 9 LONG cyClientNew; 10 RECT rcBlt; 11 LONG dxBlt; 12 LONG dyBlt; 13 UINT fsRE; 14 HRGN hrgnVisOld; 15 PTHREADINFO pti; 16 HRGN hrgnClip; 17 HRGN hrgnInterMonitor; 18 } CVR, *PCVR; 19 20 typedef struct _SMWP 21 { 22 HEAD head; 23 UINT bShellNotify:1; 24 UINT bHandle:1; 25 INT ccvr; 26 INT ccvrAlloc; 27 PCVR acvr; 28 } SMWP, *PSMWP; 29 30 FORCEINLINE BOOL IntPtInWindow(PWND pwnd, INT x, INT y) 31 { 32 if(!RECTL_bPointInRect(&pwnd->rcWindow, x, y)) 33 { 34 return FALSE; 35 } 36 37 if(!pwnd->hrgnClip || pwnd->style & WS_MINIMIZE) 38 { 39 return TRUE; 40 } 41 42 return NtGdiPtInRegion(pwnd->hrgnClip, 43 x - pwnd->rcWindow.left, 44 y - pwnd->rcWindow.top); 45 } 46 47 FORCEINLINE BOOL 48 IntEqualRect(RECTL *lprc1, RECTL *lprc2) 49 { 50 if (lprc1 == NULL || lprc2 == NULL) 51 return FALSE; 52 53 return (lprc1->left == lprc2->left) && (lprc1->top == lprc2->top) && 54 (lprc1->right == lprc2->right) && (lprc1->bottom == lprc2->bottom); 55 } 56 57 BOOL FASTCALL ActivateOtherWindowMin(PWND); 58 UINT FASTCALL co_WinPosArrangeIconicWindows(PWND parent); 59 BOOL FASTCALL IntGetClientOrigin(PWND Window, LPPOINT Point); 60 LRESULT FASTCALL co_WinPosGetNonClientSize(PWND Window, RECTL* WindowRect, RECTL* ClientRect); 61 UINT FASTCALL co_WinPosGetMinMaxInfo(PWND Window, POINT* MaxSize, POINT* MaxPos, POINT* MinTrack, POINT* MaxTrack); 62 UINT FASTCALL co_WinPosMinMaximize(PWND WindowObject, UINT ShowFlag, RECTL* NewPos); 63 BOOLEAN FASTCALL co_WinPosSetWindowPos(PWND Wnd, HWND WndInsertAfter, INT x, INT y, INT cx, INT cy, UINT flags); 64 BOOLEAN FASTCALL co_WinPosShowWindow(PWND Window, INT Cmd); 65 void FASTCALL co_WinPosSendSizeMove(PWND Window); 66 PWND APIENTRY co_WinPosWindowFromPoint(IN PWND ScopeWin, IN POINT *WinPoint, IN OUT USHORT* HitTest, IN BOOL Ignore); 67 VOID FASTCALL co_WinPosActivateOtherWindow(PWND); 68 PWND FASTCALL IntRealChildWindowFromPoint(PWND,LONG,LONG); 69 BOOL FASTCALL IntScreenToClient(PWND,LPPOINT); 70 BOOL FASTCALL IntClientToScreen(PWND,LPPOINT); 71 BOOL FASTCALL IntGetWindowRect(PWND,RECTL*); 72 BOOL UserHasWindowEdge(DWORD,DWORD); 73 VOID UserGetWindowBorders(DWORD,DWORD,SIZE*,BOOL); 74 75 UINT FASTCALL IntGetWindowSnapEdge(PWND Wnd); 76 VOID FASTCALL co_IntCalculateSnapPosition(PWND Wnd, UINT Edge, OUT RECT *Pos); 77 VOID FASTCALL co_IntSnapWindow(PWND Wnd, UINT Edge); 78 VOID FASTCALL IntSetSnapEdge(PWND Wnd, UINT Edge); 79 VOID FASTCALL IntSetSnapInfo(PWND Wnd, UINT Edge, IN const RECT *Pos OPTIONAL); 80 81 FORCEINLINE VOID 82 co_IntUnsnapWindow(PWND Wnd) 83 { 84 co_IntSnapWindow(Wnd, HTNOWHERE); 85 } 86 87 FORCEINLINE BOOLEAN 88 IntIsWindowSnapped(PWND Wnd) 89 { 90 return (Wnd->ExStyle2 & (WS_EX2_VERTICALLYMAXIMIZEDLEFT | WS_EX2_VERTICALLYMAXIMIZEDRIGHT)) != 0; 91 } 92 93 FORCEINLINE BOOLEAN 94 IntIsSnapAllowedForWindow(PWND Wnd) 95 { 96 /* We want to forbid snapping operations on the TaskBar and on child windows. 97 * We use a heuristic for detecting the TaskBar by its typical Style & ExStyle. */ 98 const UINT style = Wnd->style; 99 const UINT tbws = WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN; 100 const UINT tbes = WS_EX_TOOLWINDOW; 101 BOOLEAN istb = (style & tbws) == tbws && (Wnd->ExStyle & (tbes | WS_EX_APPWINDOW)) == tbes; 102 BOOLEAN thickframe = (style & WS_THICKFRAME) && (style & (WS_DLGFRAME | WS_BORDER)) != WS_DLGFRAME; 103 return thickframe && !(style & WS_CHILD) && !istb; 104 } 105