aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormarkt <markt>2007-07-07 01:59:38 (GMT)
committermarkt <markt>2007-07-07 01:59:38 (GMT)
commit0a316695e88299dfbcfa88c1f07786581e1cfb0f (patch)
tree2d15dbe6e744a25dc33d2589c4dfe09838887b15 /src
parent27b8fe8270c5b7edcddc42134459500b00d47d4b (diff)
downloadfluxbox-0a316695e88299dfbcfa88c1f07786581e1cfb0f.zip
fluxbox-0a316695e88299dfbcfa88c1f07786581e1cfb0f.tar.bz2
save workspace names, and some fixes for menu behavior
Diffstat (limited to 'src')
-rw-r--r--src/FbTk/Menu.cc28
-rw-r--r--src/FbTk/Menu.hh3
-rw-r--r--src/Screen.cc8
-rw-r--r--src/Screen.hh2
-rw-r--r--src/Workspace.cc2
5 files changed, 27 insertions, 16 deletions
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc
index cf735d6..8f795ac 100644
--- a/src/FbTk/Menu.cc
+++ b/src/FbTk/Menu.cc
@@ -356,13 +356,6 @@ void Menu::enterSubmenu() {
356 submenu->cycleItems(false); 356 submenu->cycleItems(false);
357} 357}
358 358
359void Menu::enterParent() {
360 internal_hide();
361 // return focus to parent
362 if (parent())
363 parent()->grabInputFocus();
364}
365
366void Menu::disableTitle() { 359void Menu::disableTitle() {
367 setTitleVisibility(false); 360 setTitleVisibility(false);
368} 361}
@@ -583,11 +576,11 @@ void Menu::redrawFrame(FbDrawable &drawable) {
583 576
584} 577}
585 578
586void Menu::internal_hide() { 579void Menu::internal_hide(bool first) {
587 580
588 if (validIndex(m_which_sub)) { 581 if (validIndex(m_which_sub)) {
589 MenuItem *tmp = menuitems[m_which_sub]; 582 MenuItem *tmp = menuitems[m_which_sub];
590 tmp->submenu()->internal_hide(); 583 tmp->submenu()->internal_hide(false);
591 } 584 }
592 585
593 // if we have an active index we need to redraw it 586 // if we have an active index we need to redraw it
@@ -596,12 +589,20 @@ void Menu::internal_hide() {
596 m_active_index = -1; 589 m_active_index = -1;
597 clearItem(old); // clear old area from highlight 590 clearItem(old); // clear old area from highlight
598 591
599 if (shown && shown->menu.window == menu.window) 592 if (shown && shown->menu.window == menu.window) {
600 shown = (Menu *) 0; 593 if (m_parent && m_parent->isVisible())
594 shown = m_parent;
595 else
596 shown = (Menu *) 0;
597 }
601 598
602 m_torn = m_visible = false; 599 m_torn = m_visible = false;
603 m_which_sub = -1; 600 m_which_sub = -1;
604 601
602 if (first && m_parent && m_parent->isVisible() &&
603 s_focused && !s_focused->isVisible())
604 m_parent->grabInputFocus();
605
605 menu.window.hide(); 606 menu.window.hide();
606} 607}
607 608
@@ -1023,7 +1024,7 @@ void Menu::keyPressEvent(XKeyEvent &event) {
1023 break; 1024 break;
1024 case XK_Left: // enter parent if we have one 1025 case XK_Left: // enter parent if we have one
1025 resetTypeAhead(); 1026 resetTypeAhead();
1026 enterParent(); 1027 internal_hide();
1027 break; 1028 break;
1028 case XK_Right: // enter submenu if we have one 1029 case XK_Right: // enter submenu if we have one
1029 resetTypeAhead(); 1030 resetTypeAhead();
@@ -1031,11 +1032,12 @@ void Menu::keyPressEvent(XKeyEvent &event) {
1031 break; 1032 break;
1032 case XK_Escape: // close menu 1033 case XK_Escape: // close menu
1033 m_type_ahead.reset(); 1034 m_type_ahead.reset();
1035 m_torn = false;
1034 hide(); 1036 hide();
1035 break; 1037 break;
1036 case XK_BackSpace: 1038 case XK_BackSpace:
1037 if (m_type_ahead.stringSize() == 0) { 1039 if (m_type_ahead.stringSize() == 0) {
1038 enterParent(); 1040 internal_hide();
1039 break; 1041 break;
1040 } 1042 }
1041 1043
diff --git a/src/FbTk/Menu.hh b/src/FbTk/Menu.hh
index 20562de..8d112ca 100644
--- a/src/FbTk/Menu.hh
+++ b/src/FbTk/Menu.hh
@@ -92,7 +92,6 @@ public:
92 /// cycle through menuitems 92 /// cycle through menuitems
93 void cycleItems(bool reverse); 93 void cycleItems(bool reverse);
94 void enterSubmenu(); 94 void enterSubmenu();
95 void enterParent();
96 95
97 void disableTitle(); 96 void disableTitle();
98 void enableTitle(); 97 void enableTitle();
@@ -192,7 +191,7 @@ protected:
192 virtual void redrawTitle(FbDrawable &pm); 191 virtual void redrawTitle(FbDrawable &pm);
193 virtual void redrawFrame(FbDrawable &pm); 192 virtual void redrawFrame(FbDrawable &pm);
194 193
195 virtual void internal_hide(); 194 virtual void internal_hide(bool first = true);
196 195
197 virtual void update(FbTk::Subject *); 196 virtual void update(FbTk::Subject *);
198 197
diff --git a/src/Screen.cc b/src/Screen.cc
index 4d3944c..9a7d433 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -1106,6 +1106,14 @@ void BScreen::rereadMenu() {
1106 m_rootmenu->reconfigure(); 1106 m_rootmenu->reconfigure();
1107} 1107}
1108 1108
1109void BScreen::updateWorkspaceName(unsigned int w) {
1110 Workspace *space = getWorkspace(w);
1111 if (space) {
1112 m_workspace_names[w] = space->name();
1113 updateWorkspaceNamesAtom();
1114 Fluxbox::instance()->save_rc();
1115 }
1116}
1109 1117
1110void BScreen::removeWorkspaceNames() { 1118void BScreen::removeWorkspaceNames() {
1111 m_workspace_names.clear(); 1119 m_workspace_names.clear();
diff --git a/src/Screen.hh b/src/Screen.hh
index 9e5b7a8..91dcf15 100644
--- a/src/Screen.hh
+++ b/src/Screen.hh
@@ -355,6 +355,8 @@ public:
355 */ 355 */
356 void leftWorkspace(int delta); 356 void leftWorkspace(int delta);
357 357
358 /// update workspace name for given workspace
359 void updateWorkspaceName(unsigned int w);
358 /// remove all workspace names 360 /// remove all workspace names
359 void removeWorkspaceNames(); 361 void removeWorkspaceNames();
360 /// update the workspace name atom 362 /// update the workspace name atom
diff --git a/src/Workspace.cc b/src/Workspace.cc
index a52a211..2933ab5 100644
--- a/src/Workspace.cc
+++ b/src/Workspace.cc
@@ -182,7 +182,7 @@ void Workspace::setName(const string &name) {
182 m_name = tname; 182 m_name = tname;
183 } 183 }
184 184
185 screen().updateWorkspaceNamesAtom(); 185 screen().updateWorkspaceName(m_id);
186 186
187 menu().setLabel(m_name); 187 menu().setLabel(m_name);
188 menu().updateMenu(); 188 menu().updateMenu();