Better GTK+ Menu color support (#12300)

* Better GTK+ Menu color support

 * Fix 'invisible menu' issue (#12275)

 * Now updates menu text color when focus changes!

 * Better caching of colors when system theme changes

 * Removed all GTK+ deprecation warnings from menubar

* Don't highlight menu text on mouseover in GTK+

* Fix textColor declaration scope error

* Simplify FocusManager connection management a bit

* Make the linter happy

* Decouple MenuBar view recoloring from rebuilding

This way we don't need to rebuild the subview each time a recolor
is needed, e.g. when window focus changes or the system theme changes

* Don't iterate child views if we don't need to

* Move variable declaration outside of a loop

* More efficient iteration of MenuBar children

* Cleaner MenuButton bounds testing

* Fix oops

* Add a nullptr check in MenuBar::GetItemCount()

* Simplify iteration in MenuBar::RebuildChildren()

* Make the linter happy

* Fix signed-unsigned comparison

* Remove declarations of nonexistent methods

* Make SubmenuButton accessor const

* Cleaner accelerator iteration

* Windows fixes
This commit is contained in:
Charles Kerr 2018-03-17 06:37:36 +09:00 committed by GitHub
parent 31d688ad3d
commit 558ef7352d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 126 additions and 115 deletions

View file

@ -1337,7 +1337,7 @@ void NativeWindowViews::HandleKeyboardEvent(
if (event.GetType() == blink::WebInputEvent::kRawKeyDown &&
!IsAltKey(event) && IsAltModifier(event)) {
if (!menu_bar_visible_ &&
(menu_bar_->GetAcceleratorIndex(event.windows_key_code) != -1))
(menu_bar_->HasAccelerator(event.windows_key_code)))
SetMenuBarVisibility(true);
menu_bar_->ActivateAccelerator(event.windows_key_code);
return;
@ -1445,12 +1445,9 @@ void NativeWindowViews::RegisterAccelerators(AtomMenuModel* menu_model) {
// Register accelerators with focus manager.
accelerator_util::GenerateAcceleratorTable(&accelerator_table_, menu_model);
accelerator_util::AcceleratorTable::const_iterator iter;
for (iter = accelerator_table_.begin();
iter != accelerator_table_.end();
++iter) {
for (const auto& iter : accelerator_table_) {
focus_manager->RegisterAccelerator(
iter->first, ui::AcceleratorManager::kNormalPriority, this);
iter.first, ui::AcceleratorManager::kNormalPriority, this);
}
}