Some minor optimizations

svn path=/trunk/; revision=30489
This commit is contained in:
Thomas Bluemel 2007-11-15 23:57:50 +00:00
parent ef944678e3
commit 99767a3b59
3 changed files with 34 additions and 23 deletions

View file

@ -40,7 +40,7 @@ BOOL UserDrawSysMenuButton( HWND hWnd, HDC hDC, LPRECT, BOOL down );
void
UserGetFrameSize(ULONG Style, ULONG ExStyle, SIZE *Size);
void
UserGetInsideRectNC(HWND hWnd, RECT *rect);
UserGetInsideRectNC(PWINDOW Wnd, RECT *rect);
DWORD
SCROLL_HitTest( HWND hwnd, INT nBar, POINT pt, BOOL bDragging );

View file

@ -148,18 +148,17 @@ SetSysColors(
}
void
UserGetInsideRectNC(HWND hWnd, RECT *rect)
UserGetInsideRectNC(PWINDOW Wnd, RECT *rect)
{
RECT WindowRect;
ULONG Style;
ULONG ExStyle;
Style = GetWindowLongW(hWnd, GWL_STYLE);
ExStyle = GetWindowLongW(hWnd, GWL_EXSTYLE);
GetWindowRect(hWnd, &WindowRect);
Style = Wnd->Style;
ExStyle = Wnd->ExStyle;
rect->top = rect->left = 0;
rect->right = WindowRect.right - WindowRect.left;
rect->bottom = WindowRect.bottom - WindowRect.top;
rect->right = Wnd->WindowRect.right - Wnd->WindowRect.left;
rect->bottom = Wnd->WindowRect.bottom - Wnd->WindowRect.top;
if (Style & WS_ICONIC)
{
@ -296,21 +295,21 @@ DefWndHandleSetCursor(HWND hWnd, WPARAM wParam, LPARAM lParam, ULONG Style)
}
static LONG
DefWndStartSizeMove(HWND hWnd, WPARAM wParam, POINT *capturePoint)
DefWndStartSizeMove(HWND hWnd, PWINDOW Wnd, WPARAM wParam, POINT *capturePoint)
{
LONG hittest = 0;
POINT pt;
MSG msg;
RECT rectWindow;
ULONG Style = GetWindowLongW(hWnd, GWL_STYLE);
ULONG Style = Wnd->Style;
GetWindowRect(hWnd, &rectWindow);
rectWindow = Wnd->WindowRect;
if ((wParam & 0xfff0) == SC_MOVE)
{
/* Move pointer at the center of the caption */
RECT rect;
UserGetInsideRectNC(hWnd, &rect);
UserGetInsideRectNC(Wnd, &rect);
if (Style & WS_SYSMENU)
rect.left += GetSystemMetrics(SM_CXSIZE) + 1;
if (Style & WS_MINIMIZEBOX)
@ -436,14 +435,22 @@ DefWndDoSizeMove(HWND hwnd, WORD wParam)
HCURSOR hDragCursor = 0, hOldCursor = 0;
POINT minTrack, maxTrack;
POINT capturePoint, pt;
ULONG Style = GetWindowLongW(hwnd, GWL_STYLE);
ULONG ExStyle = GetWindowLongW(hwnd, GWL_EXSTYLE);
ULONG Style, ExStyle;
BOOL thickframe;
BOOL iconic = Style & WS_MINIMIZE;
BOOL iconic;
BOOL moved = FALSE;
DWORD dwPoint = GetMessagePos();
BOOL DragFullWindows = FALSE;
HWND hWndParent = NULL;
PWINDOW Wnd;
Wnd = ValidateHwnd(hwnd);
if (!Wnd)
return;
Style = Wnd->Style;
ExStyle = Wnd->ExStyle;
iconic = (Style & WS_MINIMIZE) != 0;
SystemParametersInfoA(SPI_GETDRAGFULLWINDOWS, 0, &DragFullWindows, 0);
@ -451,7 +458,7 @@ DefWndDoSizeMove(HWND hwnd, WORD wParam)
pt.y = GET_Y_LPARAM(dwPoint);
capturePoint = pt;
if (IsZoomed(hwnd) || !IsWindowVisible(hwnd))
if ((Style & WS_MAXIMIZE) || !IsWindowVisible(hwnd))
{
return;
}
@ -461,7 +468,7 @@ DefWndDoSizeMove(HWND hwnd, WORD wParam)
{
if (!hittest)
{
hittest = DefWndStartSizeMove(hwnd, wParam, &capturePoint);
hittest = DefWndStartSizeMove(hwnd, Wnd, wParam, &capturePoint);
}
if (!hittest)
{
@ -481,7 +488,7 @@ DefWndDoSizeMove(HWND hwnd, WORD wParam)
else
{
SetCapture(hwnd);
hittest = DefWndStartSizeMove(hwnd, wParam, &capturePoint);
hittest = DefWndStartSizeMove(hwnd, Wnd, wParam, &capturePoint);
if (!hittest)
{
ReleaseCapture();
@ -493,7 +500,7 @@ DefWndDoSizeMove(HWND hwnd, WORD wParam)
/* Get min/max info */
WinPosGetMinMaxInfo(hwnd, NULL, NULL, &minTrack, &maxTrack);
GetWindowRect(hwnd, &sizingRect);
sizingRect = Wnd->WindowRect;
if (Style & WS_CHILD)
{
hWndParent = GetParent(hwnd);

View file

@ -514,20 +514,24 @@ got_bitmap:
* Draw a single menu item.
*/
static void FASTCALL
MenuDrawMenuItem(HWND Wnd, PROSMENUINFO MenuInfo, HWND WndOwner, HDC Dc,
MenuDrawMenuItem(HWND hWnd, PROSMENUINFO MenuInfo, HWND WndOwner, HDC Dc,
PROSMENUITEMINFO Item, UINT Height, BOOL MenuBar, UINT Action)
{
RECT Rect;
PWCHAR Text;
BOOL flat_menu = FALSE;
int bkgnd;
PWINDOW Wnd = ValidateHwnd(hWnd);
if (!Wnd)
return;
if (0 != (Item->fType & MF_SYSMENU))
{
if (! IsIconic(Wnd))
if ( (Wnd->Style & WS_MINIMIZE))
{
UserGetInsideRectNC(Wnd, &Rect);
UserDrawSysMenuButton(Wnd, Dc, &Rect,
UserDrawSysMenuButton(hWnd, Dc, &Rect,
Item->fState & (MF_HILITE | MF_MOUSESELECT));
}
return;
@ -608,7 +612,7 @@ MenuDrawMenuItem(HWND Wnd, PROSMENUINFO MenuInfo, HWND WndOwner, HDC Dc,
dis.hDC = Dc;
dis.rcItem = Rect;
TRACE("Ownerdraw: owner=%p itemID=%d, itemState=%d, itemAction=%d, "
"hwndItem=%p, hdc=%p, rcItem={%ld,%ld,%ld,%ld}\n", Wnd,
"hwndItem=%p, hdc=%p, rcItem={%ld,%ld,%ld,%ld}\n", hWnd,
dis.itemID, dis.itemState, dis.itemAction, dis.hwndItem,
dis.hDC, dis.rcItem.left, dis.rcItem.top, dis.rcItem.right,
dis.rcItem.bottom);