void GuiToolbar::update(int context)
{
if (visibility_ & Toolbars::AUTO) {
- bool const was_visible = isVisible();
setVisible(visibility_ & context & Toolbars::ALLOWAUTO);
- if (isVisible() && !was_visible && commandBuffer())
+ if (isVisible() && commandBuffer() && (context & Toolbars::MINIBUFFER_FOCUS))
commandBuffer()->setFocus();
}
GuiView::GuiView(int id)
: d(*new GuiViewPrivate(this)), id_(id), closing_(false), busy_(0),
- command_execute_(false)
+ command_execute_(false), minibuffer_focus_(false)
{
// GuiToolbars *must* be initialised before the menu bar.
normalSizedIcons(); // at least on Mac the default is 32 otherwise, which is huge
context |= Toolbars::IPA;
if (command_execute_)
context |= Toolbars::MINIBUFFER;
+ if (minibuffer_focus_) {
+ context |= Toolbars::MINIBUFFER_FOCUS;
+ minibuffer_focus_ = false;
+ }
for (ToolbarMap::iterator it = d.toolbars_.begin(); it != end; ++it)
it->second->update(context);
case LFUN_COMMAND_EXECUTE: {
command_execute_ = true;
+ minibuffer_focus_ = true;
break;
}
case LFUN_DROP_LAYOUTS_CHOICE:
/// Request to open the command toolbar if it is "auto"
bool command_execute_;
+ /// Request to give focus to minibuffer
+ bool minibuffer_focus_;
};
TABLE = 256, //< show when in table
REVIEW = 512, //< show when change tracking is enabled
MATHMACROTEMPLATE = 1024, //< show in math macro template
- SAMEROW = 2048, //place to the current row, no new line
+ SAMEROW = 2048, //< place to the current row, no new line
IPA = 4096, //< show when in IPA inset
MINIBUFFER = 8192, //< show when command-execute has been invoked
+ MINIBUFFER_FOCUS = 16384, //< set focus to minibuffer
ALLOWAUTO = MATH | TABLE | REVIEW | MATHMACROTEMPLATE | IPA | MINIBUFFER
};