Author: weiden Date: Fri Nov 16 02:57:50 2007 New Revision: 30489
URL: http://svn.reactos.org/svn/reactos?rev=30489&view=rev Log: Some minor optimizations
Modified: trunk/reactos/dll/win32/user32/include/window.h trunk/reactos/dll/win32/user32/windows/defwnd.c trunk/reactos/dll/win32/user32/windows/menu.c
Modified: trunk/reactos/dll/win32/user32/include/window.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/include/wi... ============================================================================== --- trunk/reactos/dll/win32/user32/include/window.h (original) +++ trunk/reactos/dll/win32/user32/include/window.h Fri Nov 16 02:57:50 2007 @@ -40,7 +40,7 @@ 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 );
Modified: trunk/reactos/dll/win32/user32/windows/defwnd.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/de... ============================================================================== --- trunk/reactos/dll/win32/user32/windows/defwnd.c (original) +++ trunk/reactos/dll/win32/user32/windows/defwnd.c Fri Nov 16 02:57:50 2007 @@ -148,18 +148,17 @@ }
void -UserGetInsideRectNC(HWND hWnd, RECT *rect) -{ - RECT WindowRect; +UserGetInsideRectNC(PWINDOW Wnd, RECT *rect) +{ 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 @@ }
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); - - GetWindowRect(hWnd, &rectWindow); + ULONG Style = Wnd->Style; + + 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 @@ 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 @@ pt.y = GET_Y_LPARAM(dwPoint); capturePoint = pt;
- if (IsZoomed(hwnd) || !IsWindowVisible(hwnd)) + if ((Style & WS_MAXIMIZE) || !IsWindowVisible(hwnd)) { return; } @@ -461,7 +468,7 @@ { if (!hittest) { - hittest = DefWndStartSizeMove(hwnd, wParam, &capturePoint); + hittest = DefWndStartSizeMove(hwnd, Wnd, wParam, &capturePoint); } if (!hittest) { @@ -481,7 +488,7 @@ else { SetCapture(hwnd); - hittest = DefWndStartSizeMove(hwnd, wParam, &capturePoint); + hittest = DefWndStartSizeMove(hwnd, Wnd, wParam, &capturePoint); if (!hittest) { ReleaseCapture(); @@ -493,7 +500,7 @@ /* Get min/max info */
WinPosGetMinMaxInfo(hwnd, NULL, NULL, &minTrack, &maxTrack); - GetWindowRect(hwnd, &sizingRect); + sizingRect = Wnd->WindowRect; if (Style & WS_CHILD) { hWndParent = GetParent(hwnd);
Modified: trunk/reactos/dll/win32/user32/windows/menu.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/me... ============================================================================== --- trunk/reactos/dll/win32/user32/windows/menu.c (original) +++ trunk/reactos/dll/win32/user32/windows/menu.c Fri Nov 16 02:57:50 2007 @@ -514,20 +514,24 @@ * 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 @@ 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);