diff --git a/dlls/user32/button.c b/dlls/user32/button.c index 13fc746ba8f..5ed9c926945 100644 --- a/dlls/user32/button.c +++ b/dlls/user32/button.c @@ -690,11 +690,8 @@ static UINT BUTTON_CalcLabelRect(HWND hwnd, HDC hdc, RECT *rc) static BOOL CALLBACK BUTTON_DrawTextCallback(HDC hdc, LPARAM lp, WPARAM wp, int cx, int cy) { RECT rc; - rc.left = 0; - rc.top = 0; - rc.right = cx; - rc.bottom = cy; + SetRect(&rc, 0, 0, cx, cy); DrawTextW(hdc, (LPCWSTR)lp, -1, &rc, (UINT)wp); return TRUE; } diff --git a/dlls/user32/cursoricon.c b/dlls/user32/cursoricon.c index 4f931958f22..2b923073ec0 100644 --- a/dlls/user32/cursoricon.c +++ b/dlls/user32/cursoricon.c @@ -2289,10 +2289,7 @@ BOOL WINAPI DrawIconEx( HDC hdc, INT x0, INT y0, HICON hIcon, if (DoOffscreen) { RECT r; - r.left = 0; - r.top = 0; - r.right = cxWidth; - r.bottom = cxWidth; + SetRect(&r, 0, 0, cxWidth, cxWidth); if (!(hdc_dest = CreateCompatibleDC(hdc))) goto failed; if (!(hB_off = CreateCompatibleBitmap(hdc, cxWidth, cyWidth))) diff --git a/dlls/user32/dialog.c b/dlls/user32/dialog.c index 9cb4b8d90dc..0663693654e 100644 --- a/dlls/user32/dialog.c +++ b/dlls/user32/dialog.c @@ -517,9 +517,7 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate, /* Create dialog main window */ - rect.left = rect.top = 0; - rect.right = MulDiv(template.cx, xBaseUnit, 4); - rect.bottom = MulDiv(template.cy, yBaseUnit, 8); + SetRect(&rect, 0, 0, MulDiv(template.cx, xBaseUnit, 4), MulDiv(template.cy, yBaseUnit, 8)); if (template.style & DS_CONTROL) template.style &= ~(WS_CAPTION|WS_SYSMENU); diff --git a/dlls/user32/mdi.c b/dlls/user32/mdi.c index c23a670a15d..76999a8acdd 100644 --- a/dlls/user32/mdi.c +++ b/dlls/user32/mdi.c @@ -1244,10 +1244,7 @@ LRESULT MDIClientWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPARAM { RECT rect; - rect.left = 0; - rect.top = 0; - rect.right = LOWORD(lParam); - rect.bottom = HIWORD(lParam); + SetRect(&rect, 0, 0, LOWORD(lParam), HIWORD(lParam)); AdjustWindowRectEx(&rect, GetWindowLongA(ci->hwndActiveChild, GWL_STYLE), 0, GetWindowLongA(ci->hwndActiveChild, GWL_EXSTYLE) ); MoveWindow(ci->hwndActiveChild, rect.left, rect.top, diff --git a/dlls/user32/menu.c b/dlls/user32/menu.c index 52d09ced516..45ce7f54a47 100644 --- a/dlls/user32/menu.c +++ b/dlls/user32/menu.c @@ -1343,10 +1343,7 @@ MENU_DrawScrollArrows(const POPUPMENU *lppop, HDC hdc) hOrigBitmap = SelectObject(hdcMem, get_up_arrow_bitmap()); else hOrigBitmap = SelectObject(hdcMem, get_up_arrow_inactive_bitmap()); - rect.left = 0; - rect.top = 0; - rect.right = lppop->Width; - rect.bottom = arrow_bitmap_height; + SetRect(&rect, 0, 0, lppop->Width, arrow_bitmap_height); FillRect(hdc, &rect, GetSysColorBrush(COLOR_MENU)); BitBlt(hdc, (lppop->Width - arrow_bitmap_width) / 2, 0, arrow_bitmap_width, arrow_bitmap_height, hdcMem, 0, 0, SRCCOPY); diff --git a/dlls/user32/uitools.c b/dlls/user32/uitools.c index fa2e826a3dc..c3cd755ab9a 100644 --- a/dlls/user32/uitools.c +++ b/dlls/user32/uitools.c @@ -796,10 +796,7 @@ static BOOL UITOOLS95_DFC_ButtonRadio(HDC dc, LPRECT r, UINT uFlags) /* Define bounding box */ i = 14*SmallDiam/16; - myr.left = xc - i+i/2; - myr.right = xc + i/2; - myr.top = yc - i+i/2; - myr.bottom = yc + i/2; + SetRect(&myr, xc - i + i / 2, yc - i + i / 2, xc + i / 2, yc + i / 2); if((uFlags & 0xff) == DFCS_BUTTONRADIOMASK) { @@ -840,10 +837,7 @@ static BOOL UITOOLS95_DFC_ButtonRadio(HDC dc, LPRECT r, UINT uFlags) } i = 10*SmallDiam/16; - myr.left = xc - i+i/2; - myr.right = xc + i/2; - myr.top = yc - i+i/2; - myr.bottom = yc + i/2; + SetRect(&myr, xc - i + i / 2, yc - i + i / 2, xc + i / 2, yc + i / 2); i= !(uFlags & (DFCS_INACTIVE|DFCS_PUSHED)) ? COLOR_WINDOW : COLOR_BTNFACE; hpsave = SelectObject(dc, SYSCOLOR_GetPen(i)); hbsave = SelectObject(dc, GetSysColorBrush(i)); @@ -856,10 +850,7 @@ static BOOL UITOOLS95_DFC_ButtonRadio(HDC dc, LPRECT r, UINT uFlags) { i = 6*SmallDiam/16; i = i < 1 ? 1 : i; - myr.left = xc - i+i/2; - myr.right = xc + i/2; - myr.top = yc - i+i/2; - myr.bottom = yc + i/2; + SetRect(&myr, xc - i + i / 2, yc - i + i / 2, xc + i / 2, yc + i / 2); i = uFlags & DFCS_INACTIVE ? COLOR_BTNSHADOW : COLOR_WINDOWTEXT; hbsave = SelectObject(dc, GetSysColorBrush(i)); @@ -1189,10 +1180,7 @@ static BOOL UITOOLS95_DrawFrameMenu(HDC dc, LPRECT r, UINT uFlags) yc = myr.top + SmallDiam - SmallDiam/2; i = 234*SmallDiam/750; i = i < 1 ? 1 : i; - myr.left = xc - i+i/2; - myr.right = xc + i/2; - myr.top = yc - i+i/2; - myr.bottom = yc + i/2; + SetRect(&myr, xc - i + i / 2, yc - i + i / 2, xc + i / 2, yc + i / 2); Pie(dc, myr.left, myr.top, myr.right, myr.bottom, xe, ye, xe, ye); break; @@ -1648,10 +1636,7 @@ static BOOL UITOOLS_DrawState(HDC hdc, HBRUSH hbr, DRAWSTATEPROC func, LPARAM lp if(!cy) cy = s.cy; } - rc.left = x; - rc.top = y; - rc.right = x + cx; - rc.bottom = y + cy; + SetRect(&rc, x, y, x + cx, y + cy); if(flags & DSS_RIGHT) /* This one is not documented in the win32.hlp file */ dtflags |= DT_RIGHT; @@ -1679,9 +1664,7 @@ static BOOL UITOOLS_DrawState(HDC hdc, HBRUSH hbr, DRAWSTATEPROC func, LPARAM lp if(!memdc) goto cleanup; hbmsave = SelectObject(memdc, hbm); if(!hbmsave) goto cleanup; - rc.left = rc.top = 0; - rc.right = cx; - rc.bottom = cy; + SetRect(&rc, 0, 0, cx, cy); if(!FillRect(memdc, &rc, GetStockObject(WHITE_BRUSH))) goto cleanup; SetBkColor(memdc, RGB(255, 255, 255)); SetTextColor(memdc, RGB(0, 0, 0)); diff --git a/dlls/user32/win.c b/dlls/user32/win.c index 9051f7a344b..f69297ca09a 100644 --- a/dlls/user32/win.c +++ b/dlls/user32/win.c @@ -3567,11 +3567,7 @@ BOOL WINAPI DragDetect( HWND hWnd, POINT pt ) WORD wDragWidth = GetSystemMetrics(SM_CXDRAG); WORD wDragHeight= GetSystemMetrics(SM_CYDRAG); - rect.left = pt.x - wDragWidth; - rect.right = pt.x + wDragWidth; - - rect.top = pt.y - wDragHeight; - rect.bottom = pt.y + wDragHeight; + SetRect(&rect, pt.x - wDragWidth, pt.y - wDragHeight, pt.x + wDragWidth, pt.y + wDragHeight); SetCapture(hWnd);