From 18cd70f74999b85ea5d35fc95fad3fdf33f1831e Mon Sep 17 00:00:00 2001 From: markt Date: Sat, 7 Jul 2007 01:56:46 +0000 Subject: save workspace names, and some fixes for menu behavior --- ChangeLog | 7 +++++++ src/FbTk/Menu.cc | 20 +++++++++++++------- src/FbTk/Menu.hh | 2 +- src/Screen.cc | 8 ++++++++ src/Screen.hh | 2 ++ src/Workspace.cc | 2 +- 6 files changed, 32 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index ecee742..3f4d5ac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ (Format: Year/Month/Day) Changes for 1.0.0: +*07/07/07: + * Right clicking on a submenu didn't revert focus to its parent (Mark) + FbTk/Menu.cc/hh + * Pressing escape in a torn menu didn't work (Mark) + FbTk/Menu.cc + * Save workspace names when changing through menu, bug #1748967 (Mark) + Workspace.cc Screen.cc/hh *07/07/06: * When saving window information, use the class name instead of instance name by default (Mark) diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc index cf735d6..491ad76 100644 --- a/src/FbTk/Menu.cc +++ b/src/FbTk/Menu.cc @@ -358,9 +358,6 @@ void Menu::enterSubmenu() { void Menu::enterParent() { internal_hide(); - // return focus to parent - if (parent()) - parent()->grabInputFocus(); } void Menu::disableTitle() { @@ -583,11 +580,11 @@ void Menu::redrawFrame(FbDrawable &drawable) { } -void Menu::internal_hide() { +void Menu::internal_hide(bool first) { if (validIndex(m_which_sub)) { MenuItem *tmp = menuitems[m_which_sub]; - tmp->submenu()->internal_hide(); + tmp->submenu()->internal_hide(false); } // if we have an active index we need to redraw it @@ -596,12 +593,20 @@ void Menu::internal_hide() { m_active_index = -1; clearItem(old); // clear old area from highlight - if (shown && shown->menu.window == menu.window) - shown = (Menu *) 0; + if (shown && shown->menu.window == menu.window) { + if (m_parent && m_parent->isVisible()) + shown = m_parent; + else + shown = (Menu *) 0; + } m_torn = m_visible = false; m_which_sub = -1; + if (first && m_parent && m_parent->isVisible() && + s_focused && !s_focused->isVisible()) + m_parent->grabInputFocus(); + menu.window.hide(); } @@ -1031,6 +1036,7 @@ void Menu::keyPressEvent(XKeyEvent &event) { break; case XK_Escape: // close menu m_type_ahead.reset(); + m_torn = false; hide(); break; case XK_BackSpace: diff --git a/src/FbTk/Menu.hh b/src/FbTk/Menu.hh index e6c249d..576c9f3 100644 --- a/src/FbTk/Menu.hh +++ b/src/FbTk/Menu.hh @@ -191,7 +191,7 @@ protected: virtual void redrawTitle(FbDrawable &pm); virtual void redrawFrame(FbDrawable &pm); - virtual void internal_hide(); + virtual void internal_hide(bool first = true); void update(FbTk::Subject *); diff --git a/src/Screen.cc b/src/Screen.cc index dfa986e..a37b594 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -1036,6 +1036,14 @@ void BScreen::rereadMenu() { m_rootmenu->reconfigure(); } +void BScreen::updateWorkspaceName(unsigned int w) { + Workspace *space = getWorkspace(w); + if (space) { + m_workspace_names[w] = space->name(); + updateWorkspaceNamesAtom(); + Fluxbox::instance()->save_rc(); + } +} void BScreen::removeWorkspaceNames() { m_workspace_names.clear(); diff --git a/src/Screen.hh b/src/Screen.hh index 77a5169..8ab3fc5 100644 --- a/src/Screen.hh +++ b/src/Screen.hh @@ -347,6 +347,8 @@ public: */ void leftWorkspace(int delta); + /// update workspace name for given workspace + void updateWorkspaceName(unsigned int w); /// remove all workspace names void removeWorkspaceNames(); /// update the workspace name atom diff --git a/src/Workspace.cc b/src/Workspace.cc index 888c20a..35fcf54 100644 --- a/src/Workspace.cc +++ b/src/Workspace.cc @@ -382,7 +382,7 @@ void Workspace::setName(const string &name) { m_name = tname; } - screen().updateWorkspaceNamesAtom(); + screen().updateWorkspaceName(m_id); menu().setLabel(m_name); menu().updateMenu(); -- cgit v0.11.2