make sure menus close only when right clicking down and up on the titlebar

This commit is contained in:
markt 2007-07-15 16:32:54 +00:00
parent 857a6d0a6a
commit 5aecf58d47
3 changed files with 10 additions and 5 deletions

View file

@ -600,7 +600,7 @@ void Menu::internal_hide(bool first) {
shown = (Menu *) 0; shown = (Menu *) 0;
} }
m_torn = m_visible = false; m_torn = m_visible = m_closing = false;
m_which_sub = -1; m_which_sub = -1;
if (first && m_parent && m_parent->isVisible() && if (first && m_parent && m_parent->isVisible() &&
@ -835,12 +835,16 @@ void Menu::handleEvent(XEvent &event) {
if (validIndex(m_which_sub) && if (validIndex(m_which_sub) &&
menuitems[m_which_sub]->submenu()->isVisible()) menuitems[m_which_sub]->submenu()->isVisible())
menuitems[m_which_sub]->submenu()->grabInputFocus(); menuitems[m_which_sub]->submenu()->grabInputFocus();
} } else if (event.type == LeaveNotify)
m_closing = false;
} }
void Menu::buttonPressEvent(XButtonEvent &be) { void Menu::buttonPressEvent(XButtonEvent &be) {
if (be.window == menu.title) if (be.window == menu.title) {
grabInputFocus(); grabInputFocus();
m_closing = (be.button == 3);
} else
m_closing = false;
if (be.window == menu.frame && menu.item_w != 0) { if (be.window == menu.frame && menu.item_w != 0) {
@ -879,7 +883,7 @@ void Menu::buttonReleaseEvent(XButtonEvent &re) {
} }
} }
if (re.button == 3) if (re.button == 3 && m_closing)
internal_hide(); internal_hide();
} else if (re.window == menu.frame) { } else if (re.window == menu.frame) {

View file

@ -220,6 +220,7 @@ private:
int m_screen_x, m_screen_y; int m_screen_x, m_screen_y;
unsigned int m_screen_width, m_screen_height; unsigned int m_screen_width, m_screen_height;
bool m_moving; ///< if we're moving/draging or not 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_visible; ///< menu visibility
bool m_torn; ///< torn from parent bool m_torn; ///< torn from parent
bool m_internal_menu; ///< whether we should destroy this menu or if it's managed somewhere else bool m_internal_menu; ///< whether we should destroy this menu or if it's managed somewhere else

View file

@ -216,7 +216,7 @@ void Gnome::updateClientList(BScreen &screen) {
} }
void Gnome::updateClientClose(WinClient &client) { void Gnome::updateClientClose(WinClient &client) {
if (client.screen().isShuttingdown()) { if (!client.screen().isShuttingdown()) {
XDeleteProperty(FbTk::App::instance()->display(), client.window(), XDeleteProperty(FbTk::App::instance()->display(), client.window(),
m_gnome_wm_win_workspace); m_gnome_wm_win_workspace);
XDeleteProperty(FbTk::App::instance()->display(), client.window(), XDeleteProperty(FbTk::App::instance()->display(), client.window(),