Opened 6 years ago

Last modified 11 months ago

#14401 new bug

BMenu::DrawBackground contains unused code

Reported by: ahwayakchih Owned by: nobody
Priority: low Milestone: Unscheduled
Component: Kits/Interface Kit/BMenu Version: R1/Development
Keywords: BMenu, be_control_look Cc:
Blocked By: Blocking:
Platform: All

Description

I'm new to the BControlLooks stuff, so i'm sorry if i'm mistaken, but it looks like BMenu::DrawBackground prepares flags that it never uses.

At https://github.com/haiku/haiku/blob/b2e0398cd4e9df66122a5b03ea6d880b1893db58/src/kits/interface/Menu.cpp#L1424-L1429 there is:

	uint32 flags = 0;
	if (!IsEnabled())
		flags |= BControlLook::B_DISABLED;

	if (IsFocus())
		flags |= BControlLook::B_FOCUSED;

and then at https://github.com/haiku/haiku/blob/b2e0398cd4e9df66122a5b03ea6d880b1893db58/src/kits/interface/Menu.cpp#L1444 there is:

be_control_look->DrawMenuBackground(this, rect, updateRect, base, 0,
		borders);

flags is not used at all.

I noticed that because in my old code, i was drawing menu item background by calling FillRect with HighColor set to B_MENU_BACKGROUND_COLOR and on Haiku it kept showing up a tiny bit darker than the menu that does not use custom draw logic. So i looked into the BMenu sources to check how it draws background by default :). Looks like be_control_look changes something, even though in system theme i have menu color set to default (216,216,216).

Change History (1)

comment:1 by pulkomandy, 11 months ago

Component: Kits/Interface KitKits/Interface Kit/BMenu
Note: See TracTickets for help on using tickets.