There were menu drawing regression after https://github.com/reactos/reactos/commit/
03adec81414abb53e589ecd9061042b9ca2104c1.
This PR will fix it. CORE-16244
- We don't have to draw the frame manually because of WS_EX_DLGMODALFRAME extended style.
- We don't need the margins (MENU_TOP_MARGIN and MENU_BOTTOM_MARGIN) in the client area any more because the client area doesn't contain the frame width.
- Use GetSystemMetrics(SM_CXDLGFRAME) and GetSystemMetrics(SM_CYDLGFRAME) for frame width.
/* Space between 2 columns */
#define MENU_COL_SPACE 4
/* Space between 2 columns */
#define MENU_COL_SPACE 4
-/* top and bottom margins for popup menus */
-#define MENU_TOP_MARGIN 3
-#define MENU_BOTTOM_MARGIN 2
-
#define MENU_ITEM_HBMP_SPACE (5)
#define MENU_BAR_ITEMS_SPACE (12)
#define SEPARATOR_HEIGHT (5)
#define MENU_ITEM_HBMP_SPACE (5)
#define MENU_BAR_ITEMS_SPACE (12)
#define SEPARATOR_HEIGHT (5)
NtGdiSelectFont( hdc, ghMenuFont );
start = 0;
NtGdiSelectFont( hdc, ghMenuFont );
start = 0;
orgX = maxX;
if( lpitem->fType & (MF_MENUBREAK | MF_MENUBARBREAK))
orgX += MENU_COL_SPACE;
orgX = maxX;
if( lpitem->fType & (MF_MENUBREAK | MF_MENUBARBREAK))
orgX += MENU_COL_SPACE;
- orgY = MENU_TOP_MARGIN;
maxTab = maxTabWidth = 0;
/* Parse items until column break or end of menu */
maxTab = maxTabWidth = 0;
/* Parse items until column break or end of menu */
* of the bitmaps */
if( !textandbmp) Menu->cxTextAlign = 0;
* of the bitmaps */
if( !textandbmp) Menu->cxTextAlign = 0;
- /* space for 3d border */
- Menu->cyMenu += MENU_BOTTOM_MARGIN;
- Menu->cxMenu += 2;
-
/* Adjust popup height if it exceeds maximum */
maxHeight = MENU_GetMaxPopupHeight(Menu);
/* Adjust popup height if it exceeds maximum */
maxHeight = MENU_GetMaxPopupHeight(Menu);
- Menu->iMaxTop = Menu->cyMenu - MENU_TOP_MARGIN;
+ Menu->iMaxTop = Menu->cyMenu;
if (Menu->cyMenu >= maxHeight)
{
Menu->cyMenu = maxHeight;
if (Menu->cyMenu >= maxHeight)
{
Menu->cyMenu = maxHeight;
- NtGdiRectangle( hdc, rect.left, rect.top, rect.right, rect.bottom );
+ /* FIXME: Maybe we don't have to fill the background manually */
+ FillRect(hdc, &rect, brush);
hPrevPen = NtGdiSelectPen( hdc, NtGdiGetStockObject( NULL_PEN ) );
if ( hPrevPen )
{
hPrevPen = NtGdiSelectPen( hdc, NtGdiGetStockObject( NULL_PEN ) );
if ( hPrevPen )
{
- BOOL flat_menu = FALSE;
-
- UserSystemParametersInfo (SPI_GETFLATMENU, 0, &flat_menu, 0);
- if (flat_menu)
- FrameRect(hdc, &rect, IntGetSysColorBrush(COLOR_BTNSHADOW));
- else
- DrawEdge (hdc, &rect, EDGE_RAISED, BF_RECT);
-
TRACE("hmenu %p Style %08x\n", UserHMGetHandle(menu), (menu->fFlags & MNS_STYLE_MASK));
/* draw menu items */
if (menu && menu->cItems)
TRACE("hmenu %p Style %08x\n", UserHMGetHandle(menu), (menu->fFlags & MNS_STYLE_MASK));
/* draw menu items */
if (menu && menu->cItems)
/* adjust popup menu pos so that it fits within the desktop */
/* adjust popup menu pos so that it fits within the desktop */
- width = menu->cxMenu + UserGetSystemMetrics(SM_CXBORDER);
- height = menu->cyMenu + UserGetSystemMetrics(SM_CYBORDER);
+ width = menu->cxMenu + UserGetSystemMetrics(SM_CXDLGFRAME) * 2;
+ height = menu->cyMenu + UserGetSystemMetrics(SM_CYDLGFRAME) * 2;
if (flags & TPM_LAYOUTRTL)
flags ^= TPM_RIGHTALIGN;
if (flags & TPM_LAYOUTRTL)
flags ^= TPM_RIGHTALIGN;
arrow_bitmap_height = gpsi->oembmi[OBI_DNARROW].cy;
rc.top += arrow_bitmap_height;
arrow_bitmap_height = gpsi->oembmi[OBI_DNARROW].cy;
rc.top += arrow_bitmap_height;
- rc.bottom -= arrow_bitmap_height + MENU_BOTTOM_MARGIN;
+ rc.bottom -= arrow_bitmap_height;
nMaxHeight -= UserGetSystemMetrics(SM_CYBORDER) + 2 * arrow_bitmap_height;
UserRefObjectCo(pWnd, &Ref);
nMaxHeight -= UserGetSystemMetrics(SM_CYBORDER) + 2 * arrow_bitmap_height;
UserRefObjectCo(pWnd, &Ref);
MENU_DrawScrollArrows(lppop, hdc);
//ERR("Scroll Down iTop %d iMaxTop %d nMaxHeight %d\n",lppop->iTop,lppop->iMaxTop,nMaxHeight);
}
MENU_DrawScrollArrows(lppop, hdc);
//ERR("Scroll Down iTop %d iMaxTop %d nMaxHeight %d\n",lppop->iTop,lppop->iMaxTop,nMaxHeight);
}
- else if (item->yItem - MENU_TOP_MARGIN < lppop->iTop)
+ else if (item->yItem < lppop->iTop)
- lppop->iTop = item->yItem - MENU_TOP_MARGIN;
+ lppop->iTop = item->yItem;
IntScrollWindow(pWnd, 0, nOldPos - lppop->iTop, &rc, &rc);
MENU_DrawScrollArrows(lppop, hdc);
//ERR("Scroll Up iTop %d iMaxTop %d nMaxHeight %d\n",lppop->iTop,lppop->iMaxTop,nMaxHeight);
IntScrollWindow(pWnd, 0, nOldPos - lppop->iTop, &rc, &rc);
MENU_DrawScrollArrows(lppop, hdc);
//ERR("Scroll Up iTop %d iMaxTop %d nMaxHeight %d\n",lppop->iTop,lppop->iMaxTop,nMaxHeight);
/* The first item in the popup menu has to be at the
same y position as the focused menu item */
if(Flags & TPM_LAYOUTRTL)
/* The first item in the popup menu has to be at the
same y position as the focused menu item */
if(Flags & TPM_LAYOUTRTL)
- Rect.left += UserGetSystemMetrics(SM_CXBORDER);
+ Rect.left += UserGetSystemMetrics(SM_CXDLGFRAME);
- Rect.left += rc.right /*ItemInfo.Rect.right*/ - UserGetSystemMetrics(SM_CXBORDER);
- Rect.top += rc.top - MENU_TOP_MARGIN;//3;
- Rect.right = rc.left - rc.right + UserGetSystemMetrics(SM_CXBORDER);
- Rect.bottom = rc.top - rc.bottom - MENU_TOP_MARGIN - MENU_BOTTOM_MARGIN/*2*/
- - UserGetSystemMetrics(SM_CYBORDER);
+ Rect.left += rc.right - UserGetSystemMetrics(SM_CXDLGFRAME);
+
+ Rect.top += rc.top;