all repos — openbox @ 256bcbed81015bafe8f89340e5cab9114c91b930

openbox fork - make it a bit more like ryudo

changing the number of workspaces in the rc does something without restarting now!
Dana Jansens danakj@orodu.net
commit

256bcbed81015bafe8f89340e5cab9114c91b930

parent

f586e55a8cd3d740a1b7b3a0801bad27030926f9

3 files changed, 27 insertions(+), 17 deletions(-)

jump to
M src/Screen.ccsrc/Screen.cc

@@ -686,6 +686,23 @@ resource.ignore_maximized = true;

} +void BScreen::changeWorkspaceCount(unsigned int new_count) { + assert(new_count > 0); + + if (new_count < workspacesList.size()) { + // shrink + for (unsigned int i = workspacesList.size(); i > new_count; --i) + removeLastWorkspace(); + // removeLast already sets the current workspace to the + // last available one. + } else if (new_count > workspacesList.size()) { + // grow + for(unsigned int i = workspacesList.size(); i < new_count; ++i) + addWorkspace(); + } +} + + void BScreen::reconfigure(void) { // don't reconfigure while saving the initial rc file, it's a waste and it // breaks somethings (workspace names)

@@ -695,6 +712,10 @@ load_rc();

toolbar->load_rc(); slit->load_rc(); LoadStyle(); + + // we need to do this explicitly, because just loading this value from the rc + // does nothing + changeWorkspaceCount(resource.workspaces); XGCValues gcv; gcv.foreground = WhitePixel(blackbox->getXDisplay(),
M src/Screen.hhsrc/Screen.hh

@@ -267,6 +267,8 @@ { return resource.row_direction; }

inline int getColPlacementDirection(void) const { return resource.col_direction; } + void changeWorkspaceCount(unsigned int new_count); + inline void setRootColormapInstalled(bool r) { root_colormap_installed = r; } void saveSloppyFocus(bool s); void saveAutoRaise(bool a);
M src/blackbox.ccsrc/blackbox.cc

@@ -755,7 +755,8 @@ win->withdraw();

else win->show(); screen->reassociateWindow(win, wksp, True); - } else if (wksp == 0xfffffffe) { // XXX: BUG, BUT DOING THIS SO KDE WORKS FOR NOW!! + } else if (wksp == 0xfffffffe || // XXX: BUG, BUT DOING THIS SO KDE WORKS FOR NOW!! + wksp == 0xffffffff) { if (win->isIconic()) win->deiconify(False, True); if (! win->isStuck()) win->stick(); if (! win->isVisible()) win->show();

@@ -781,22 +782,8 @@ xatom->getAtom(XAtom::net_number_of_desktops)) {

// NET_NUMBER_OF_DESKTOPS BScreen *screen = searchScreen(e->xclient.window); - if (e->xclient.data.l[0] > 0) { - if ((unsigned) e->xclient.data.l[0] < screen->getWorkspaceCount()) { - // shrink - for (int i = screen->getWorkspaceCount(); - i > e->xclient.data.l[0]; --i) - screen->removeLastWorkspace(); - // removeLast already sets the current workspace to the - // last available one. - } else if ((unsigned) e->xclient.data.l[0] > - screen->getWorkspaceCount()) { - // grow - for(int i = screen->getWorkspaceCount(); - i < e->xclient.data.l[0]; ++i) - screen->addWorkspace(); - } - } + if (e->xclient.data.l[0] > 0) + screen->changeWorkspaceCount((unsigned) e->xclient.data.l[0]); } else if (e->xclient.message_type == xatom->getAtom(XAtom::net_close_window)) { // NET_CLOSE_WINDOW