aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormarkt <markt>2007-07-07 01:56:46 (GMT)
committermarkt <markt>2007-07-07 01:56:46 (GMT)
commit18cd70f74999b85ea5d35fc95fad3fdf33f1831e (patch)
tree7a149c79982a1eaa43aed5773cecfd482e426b8e /src
parentd39a5489b18ef28f21ba910c76cba8f1342bc97c (diff)
downloadfluxbox_pavel-18cd70f74999b85ea5d35fc95fad3fdf33f1831e.zip
fluxbox_pavel-18cd70f74999b85ea5d35fc95fad3fdf33f1831e.tar.bz2
save workspace names, and some fixes for menu behavior
Diffstat (limited to 'src')
-rw-r--r--src/FbTk/Menu.cc20
-rw-r--r--src/FbTk/Menu.hh2
-rw-r--r--src/Screen.cc8
-rw-r--r--src/Screen.hh2
-rw-r--r--src/Workspace.cc2
5 files changed, 25 insertions, 9 deletions
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() {
358 358
359void Menu::enterParent() { 359void Menu::enterParent() {
360 internal_hide(); 360 internal_hide();
361 // return focus to parent
362 if (parent())
363 parent()->grabInputFocus();
364} 361}
365 362
366void Menu::disableTitle() { 363void Menu::disableTitle() {
@@ -583,11 +580,11 @@ void Menu::redrawFrame(FbDrawable &drawable) {
583 580
584} 581}
585 582
586void Menu::internal_hide() { 583void Menu::internal_hide(bool first) {
587 584
588 if (validIndex(m_which_sub)) { 585 if (validIndex(m_which_sub)) {
589 MenuItem *tmp = menuitems[m_which_sub]; 586 MenuItem *tmp = menuitems[m_which_sub];
590 tmp->submenu()->internal_hide(); 587 tmp->submenu()->internal_hide(false);
591 } 588 }
592 589
593 // if we have an active index we need to redraw it 590 // if we have an active index we need to redraw it
@@ -596,12 +593,20 @@ void Menu::internal_hide() {
596 m_active_index = -1; 593 m_active_index = -1;
597 clearItem(old); // clear old area from highlight 594 clearItem(old); // clear old area from highlight
598 595
599 if (shown && shown->menu.window == menu.window) 596 if (shown && shown->menu.window == menu.window) {
600 shown = (Menu *) 0; 597 if (m_parent && m_parent->isVisible())
598 shown = m_parent;
599 else
600 shown = (Menu *) 0;
601 }
601 602
602 m_torn = m_visible = false; 603 m_torn = m_visible = false;
603 m_which_sub = -1; 604 m_which_sub = -1;
604 605
606 if (first && m_parent && m_parent->isVisible() &&
607 s_focused && !s_focused->isVisible())
608 m_parent->grabInputFocus();
609
605 menu.window.hide(); 610 menu.window.hide();
606} 611}
607 612
@@ -1031,6 +1036,7 @@ void Menu::keyPressEvent(XKeyEvent &event) {
1031 break; 1036 break;
1032 case XK_Escape: // close menu 1037 case XK_Escape: // close menu
1033 m_type_ahead.reset(); 1038 m_type_ahead.reset();
1039 m_torn = false;
1034 hide(); 1040 hide();
1035 break; 1041 break;
1036 case XK_BackSpace: 1042 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:
191 virtual void redrawTitle(FbDrawable &pm); 191 virtual void redrawTitle(FbDrawable &pm);
192 virtual void redrawFrame(FbDrawable &pm); 192 virtual void redrawFrame(FbDrawable &pm);
193 193
194 virtual void internal_hide(); 194 virtual void internal_hide(bool first = true);
195 195
196 void update(FbTk::Subject *); 196 void update(FbTk::Subject *);
197 197
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() {
1036 m_rootmenu->reconfigure(); 1036 m_rootmenu->reconfigure();
1037} 1037}
1038 1038
1039void BScreen::updateWorkspaceName(unsigned int w) {
1040 Workspace *space = getWorkspace(w);
1041 if (space) {
1042 m_workspace_names[w] = space->name();
1043 updateWorkspaceNamesAtom();
1044 Fluxbox::instance()->save_rc();
1045 }
1046}
1039 1047
1040void BScreen::removeWorkspaceNames() { 1048void BScreen::removeWorkspaceNames() {
1041 m_workspace_names.clear(); 1049 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:
347 */ 347 */
348 void leftWorkspace(int delta); 348 void leftWorkspace(int delta);
349 349
350 /// update workspace name for given workspace
351 void updateWorkspaceName(unsigned int w);
350 /// remove all workspace names 352 /// remove all workspace names
351 void removeWorkspaceNames(); 353 void removeWorkspaceNames();
352 /// update the workspace name atom 354 /// 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) {
382 m_name = tname; 382 m_name = tname;
383 } 383 }
384 384
385 screen().updateWorkspaceNamesAtom(); 385 screen().updateWorkspaceName(m_id);
386 386
387 menu().setLabel(m_name); 387 menu().setLabel(m_name);
388 menu().updateMenu(); 388 menu().updateMenu();