Merge branch 'master' of fluxbox@dev:fluxbox
This commit is contained in:
commit
769ca8f1c8
3 changed files with 11 additions and 6 deletions
|
@ -219,6 +219,8 @@ int Menu::insert(MenuItem *item, int pos) {
|
||||||
} else {
|
} else {
|
||||||
menuitems.insert(menuitems.begin() + pos, item);
|
menuitems.insert(menuitems.begin() + pos, item);
|
||||||
fixMenuItemIndices();
|
fixMenuItemIndices();
|
||||||
|
if (m_active_index >= pos)
|
||||||
|
m_active_index++;
|
||||||
}
|
}
|
||||||
m_need_update = true; // we need to redraw the menu
|
m_need_update = true; // we need to redraw the menu
|
||||||
return menuitems.size();
|
return menuitems.size();
|
||||||
|
@ -233,7 +235,7 @@ int Menu::remove(unsigned int index) {
|
||||||
if (index >= menuitems.size()) {
|
if (index >= menuitems.size()) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
cout << "Bad index (" << index << ") given to Menu::remove()"
|
cout << "Bad index (" << index << ") given to Menu::remove()"
|
||||||
<< " -- should be between 0 and " << menuitems.size()
|
<< " -- should be between 0 and " << menuitems.size()-1
|
||||||
<< " inclusive." << endl;
|
<< " inclusive." << endl;
|
||||||
#endif // DEBUG
|
#endif // DEBUG
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -271,6 +273,9 @@ int Menu::remove(unsigned int index) {
|
||||||
else if (static_cast<unsigned int>(m_which_sub) > index)
|
else if (static_cast<unsigned int>(m_which_sub) > index)
|
||||||
m_which_sub--;
|
m_which_sub--;
|
||||||
|
|
||||||
|
if (static_cast<unsigned int>(m_active_index) > index)
|
||||||
|
m_active_index--;
|
||||||
|
|
||||||
m_need_update = true; // we need to redraw the menu
|
m_need_update = true; // we need to redraw the menu
|
||||||
|
|
||||||
return menuitems.size();
|
return menuitems.size();
|
||||||
|
@ -366,7 +371,7 @@ void Menu::enableTitle() {
|
||||||
setTitleVisibility(true);
|
setTitleVisibility(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Menu::updateMenu(int active_index) {
|
void Menu::updateMenu() {
|
||||||
if (m_title_vis) {
|
if (m_title_vis) {
|
||||||
menu.item_w = theme()->titleFont().textWidth(menu.label,
|
menu.item_w = theme()->titleFont().textWidth(menu.label,
|
||||||
menu.label.size());
|
menu.label.size());
|
||||||
|
|
|
@ -109,7 +109,7 @@ public:
|
||||||
void setLabel(const FbString &labelstr);
|
void setLabel(const FbString &labelstr);
|
||||||
/// move menu to x,y
|
/// move menu to x,y
|
||||||
virtual void move(int x, int y);
|
virtual void move(int x, int y);
|
||||||
virtual void updateMenu(int active_index = -1);
|
virtual void updateMenu();
|
||||||
void setItemSelected(unsigned int index, bool val);
|
void setItemSelected(unsigned int index, bool val);
|
||||||
void setItemEnabled(unsigned int index, bool val);
|
void setItemEnabled(unsigned int index, bool val);
|
||||||
void setMinimumSublevels(int m) { menu.minsub = m; }
|
void setMinimumSublevels(int m) { menu.minsub = m; }
|
||||||
|
|
|
@ -80,7 +80,7 @@ void WorkspaceMenu::workspaceInfoChanged( BScreen& screen ) {
|
||||||
insert(mb_menu, workspace + IDX_AFTER_ICONS);
|
insert(mb_menu, workspace + IDX_AFTER_ICONS);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateMenu(-1);
|
updateMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorkspaceMenu::workspaceChanged(BScreen& screen) {
|
void WorkspaceMenu::workspaceChanged(BScreen& screen) {
|
||||||
|
@ -89,12 +89,12 @@ void WorkspaceMenu::workspaceChanged(BScreen& screen) {
|
||||||
item = find(i + IDX_AFTER_ICONS);
|
item = find(i + IDX_AFTER_ICONS);
|
||||||
if (item && item->isSelected()) {
|
if (item && item->isSelected()) {
|
||||||
setItemSelected(i + IDX_AFTER_ICONS, false);
|
setItemSelected(i + IDX_AFTER_ICONS, false);
|
||||||
updateMenu(i + IDX_AFTER_ICONS);
|
updateMenu();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setItemSelected(screen.currentWorkspace()->workspaceID() + IDX_AFTER_ICONS, true);
|
setItemSelected(screen.currentWorkspace()->workspaceID() + IDX_AFTER_ICONS, true);
|
||||||
updateMenu(screen.currentWorkspace()->workspaceID() + IDX_AFTER_ICONS);
|
updateMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorkspaceMenu::init(BScreen &screen) {
|
void WorkspaceMenu::init(BScreen &screen) {
|
||||||
|
|
Loading…
Reference in a new issue