close menus when they lose focus, instead of on [exec] commands
This commit is contained in:
parent
8b7464046c
commit
b001ea9f1f
3 changed files with 6 additions and 12 deletions
|
@ -1,6 +1,8 @@
|
|||
(Format: Year/Month/Day)
|
||||
Changes for 1.0.1:
|
||||
*07/12/13:
|
||||
* Close menus only when they lose focus (Mark)
|
||||
MenuCreator.cc FbTk/Menu.cc
|
||||
* Moved command parsing code all over the place -- expect any patches that
|
||||
add new commands to be broken (Mark, Simon)
|
||||
Added FbTk/CommandRegistry.cc/hh
|
||||
|
|
|
@ -815,6 +815,8 @@ void Menu::handleEvent(XEvent &event) {
|
|||
if (event.type == FocusOut) {
|
||||
if (s_focused == this)
|
||||
s_focused = 0;
|
||||
if (shown == this && !m_torn)
|
||||
hide();
|
||||
// I don't know why, but I get a FocusIn event when closing the menu with
|
||||
// the mouse over it -- probably an xorg bug, but it's easy to address here
|
||||
} else if (event.type == FocusIn && m_visible) {
|
||||
|
|
|
@ -256,21 +256,11 @@ static void translateMenuItem(Parser &parse, ParseItem &pitem, FbTk::StringConve
|
|||
// execute and hide menu
|
||||
using namespace FbTk;
|
||||
RefCount<Command> exec_cmd(FbTk::CommandRegistry::instance().parseLine("exec " + str_cmd));
|
||||
RefCount<Command> hide_menu(FbTk::CommandRegistry::instance().parseLine("hidemenus"));
|
||||
MacroCommand *exec_and_hide = new FbTk::MacroCommand();
|
||||
exec_and_hide->add(hide_menu);
|
||||
exec_and_hide->add(exec_cmd);
|
||||
RefCount<Command> exec_and_hide_cmd(exec_and_hide);
|
||||
menu.insert(str_label, exec_and_hide_cmd);
|
||||
menu.insert(str_label, exec_cmd);
|
||||
} else if (str_key == "macrocmd") {
|
||||
using namespace FbTk;
|
||||
RefCount<Command> macro_cmd(FbTk::CommandRegistry::instance().parseLine("macrocmd " + str_cmd));
|
||||
RefCount<Command> hide_menu(FbTk::CommandRegistry::instance().parseLine("hidemenus"));
|
||||
MacroCommand *exec_and_hide = new FbTk::MacroCommand();
|
||||
exec_and_hide->add(hide_menu);
|
||||
exec_and_hide->add(macro_cmd);
|
||||
RefCount<Command> exec_and_hide_cmd(exec_and_hide);
|
||||
menu.insert(str_label, exec_and_hide_cmd);
|
||||
menu.insert(str_label, macro_cmd);
|
||||
} else if (str_key == "style") { // style
|
||||
menu.insert(new StyleMenuItem(str_label, str_cmd));
|
||||
} else if (str_key == "config") {
|
||||
|
|
Loading…
Reference in a new issue