make sure menus close only when right clicking down and up on the titlebar
markt markt
3 files changed,
10 insertions(+),
5 deletions(-)
M
src/FbTk/Menu.cc
→
src/FbTk/Menu.cc
@@ -600,7 +600,7 @@ else
shown = (Menu *) 0; } - m_torn = m_visible = false; + m_torn = m_visible = m_closing = false; m_which_sub = -1; if (first && m_parent && m_parent->isVisible() &&@@ -835,12 +835,16 @@ // if there's a submenu open, focus it instead
if (validIndex(m_which_sub) && menuitems[m_which_sub]->submenu()->isVisible()) menuitems[m_which_sub]->submenu()->grabInputFocus(); - } + } else if (event.type == LeaveNotify) + m_closing = false; } void Menu::buttonPressEvent(XButtonEvent &be) { - if (be.window == menu.title) + if (be.window == menu.title) { grabInputFocus(); + m_closing = (be.button == 3); + } else + m_closing = false; if (be.window == menu.frame && menu.item_w != 0) {@@ -879,7 +883,7 @@ clearWindow();
} } - if (re.button == 3) + if (re.button == 3 && m_closing) internal_hide(); } else if (re.window == menu.frame) {
M
src/FbTk/Menu.hh
→
src/FbTk/Menu.hh
@@ -220,6 +220,7 @@
int m_screen_x, m_screen_y; unsigned int m_screen_width, m_screen_height; bool m_moving; ///< if we're moving/draging or not + bool m_closing; ///< if we're right clicking on the menu title bool m_visible; ///< menu visibility bool m_torn; ///< torn from parent bool m_internal_menu; ///< whether we should destroy this menu or if it's managed somewhere else
M
src/Gnome.cc
→
src/Gnome.cc
@@ -216,7 +216,7 @@ delete[] wl;
} void Gnome::updateClientClose(WinClient &client) { - if (client.screen().isShuttingdown()) { + if (!client.screen().isShuttingdown()) { XDeleteProperty(FbTk::App::instance()->display(), client.window(), m_gnome_wm_win_workspace); XDeleteProperty(FbTk::App::instance()->display(), client.window(),