Reimplement window.menuBarVisibility
preference
#10643
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What it does
Fixes #10571 by ensuring that the same logic is used for the main menu when
window.menuBarVisibility
iscompact
as when it is not.The heart of this PR is a move to use the same menu widget for the (browser-style) main menu regardless of the value of the
window.menuBarVisibility
preference, rather than using a context menu incompact
mode. That ensures that we get the same behavior as we do with the normal menu bar, and that any fixes apply equally to both. In particular, it ensures that (1) commands invoked from the main menu do not receive ananchor
argument and (2) the logic for preserving the focus context to use when a command is run is consistent between the menu bar and compact menu.While working on that, I noticed several other features of the menu implementation that could be improved:
window.menuBarVisibility
preference handling was scattered across a number of different classes. This PR moves (almost) all references to the preference into theMainMenuContribution
classes.MainMenuFactory
andMainMenuContribution
classes. This PR moves all event handling into theMainMenuContribution
classes, with the factories only responsible for creating the widget.How to test
#10571
window.menuBarVisibility
preference to'compact'
(non-OSX only)General
window.menuBarVisibility
states.window.titleBarStyle
andwindow.menuBarVisibility
states and transitions.Review checklist
Reminder for reviewers