#14401: BMenu::DrawBackground contains unused code
------------------------------------+------------------------------
Reporter: ahwayakchih | Owner: nobody
Type: bug | Status: new
Priority: low | Milestone: Unscheduled
Component: Kits/Interface Kit | Version: R1/Development
Keywords: BMenu, be_control_look | Blocked By:
Blocking: | Has a Patch: 0
Platform: All |
------------------------------------+------------------------------
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).
--
Ticket URL: <https://dev.haiku-os.org/ticket/14401>
Haiku <https://dev.haiku-os.org>
The Haiku operating system.