aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormarkt <markt>2007-12-13 18:42:05 (GMT)
committermarkt <markt>2007-12-13 18:42:05 (GMT)
commitb001ea9f1feb32a878b95a0b78c3fb0240f6df68 (patch)
treeb9440acc1d1b44302f21eefb1fbda30096a50499 /src
parent8b7464046cea5e521ac46811591b0fce0c45aca1 (diff)
downloadfluxbox_paul-b001ea9f1feb32a878b95a0b78c3fb0240f6df68.zip
fluxbox_paul-b001ea9f1feb32a878b95a0b78c3fb0240f6df68.tar.bz2
close menus when they lose focus, instead of on [exec] commands
Diffstat (limited to 'src')
-rw-r--r--src/FbTk/Menu.cc2
-rw-r--r--src/MenuCreator.cc14
2 files changed, 4 insertions, 12 deletions
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc
index 4c41161..88240f1 100644
--- a/src/FbTk/Menu.cc
+++ b/src/FbTk/Menu.cc
@@ -815,6 +815,8 @@ void Menu::handleEvent(XEvent &event) {
815 if (event.type == FocusOut) { 815 if (event.type == FocusOut) {
816 if (s_focused == this) 816 if (s_focused == this)
817 s_focused = 0; 817 s_focused = 0;
818 if (shown == this && !m_torn)
819 hide();
818 // I don't know why, but I get a FocusIn event when closing the menu with 820 // I don't know why, but I get a FocusIn event when closing the menu with
819 // the mouse over it -- probably an xorg bug, but it's easy to address here 821 // the mouse over it -- probably an xorg bug, but it's easy to address here
820 } else if (event.type == FocusIn && m_visible) { 822 } else if (event.type == FocusIn && m_visible) {
diff --git a/src/MenuCreator.cc b/src/MenuCreator.cc
index b98287b..0597d6c 100644
--- a/src/MenuCreator.cc
+++ b/src/MenuCreator.cc
@@ -256,21 +256,11 @@ static void translateMenuItem(Parser &parse, ParseItem &pitem, FbTk::StringConve
256 // execute and hide menu 256 // execute and hide menu
257 using namespace FbTk; 257 using namespace FbTk;
258 RefCount<Command> exec_cmd(FbTk::CommandRegistry::instance().parseLine("exec " + str_cmd)); 258 RefCount<Command> exec_cmd(FbTk::CommandRegistry::instance().parseLine("exec " + str_cmd));
259 RefCount<Command> hide_menu(FbTk::CommandRegistry::instance().parseLine("hidemenus")); 259 menu.insert(str_label, exec_cmd);
260 MacroCommand *exec_and_hide = new FbTk::MacroCommand();
261 exec_and_hide->add(hide_menu);
262 exec_and_hide->add(exec_cmd);
263 RefCount<Command> exec_and_hide_cmd(exec_and_hide);
264 menu.insert(str_label, exec_and_hide_cmd);
265 } else if (str_key == "macrocmd") { 260 } else if (str_key == "macrocmd") {
266 using namespace FbTk; 261 using namespace FbTk;
267 RefCount<Command> macro_cmd(FbTk::CommandRegistry::instance().parseLine("macrocmd " + str_cmd)); 262 RefCount<Command> macro_cmd(FbTk::CommandRegistry::instance().parseLine("macrocmd " + str_cmd));
268 RefCount<Command> hide_menu(FbTk::CommandRegistry::instance().parseLine("hidemenus")); 263 menu.insert(str_label, macro_cmd);
269 MacroCommand *exec_and_hide = new FbTk::MacroCommand();
270 exec_and_hide->add(hide_menu);
271 exec_and_hide->add(macro_cmd);
272 RefCount<Command> exec_and_hide_cmd(exec_and_hide);
273 menu.insert(str_label, exec_and_hide_cmd);
274 } else if (str_key == "style") { // style 264 } else if (str_key == "style") { // style
275 menu.insert(new StyleMenuItem(str_label, str_cmd)); 265 menu.insert(new StyleMenuItem(str_label, str_cmd));
276 } else if (str_key == "config") { 266 } else if (str_key == "config") {