X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;ds=sidebyside;f=util%2Fepist%2Fscreen.cc;h=1bd7ad5da9b872db8de5f4a19b1ba5bf88db4178;hb=cc5bde6d00892cf27fcb6e4e0b4974bcecca265f;hp=0ec57decab51bd2eaf35c399082139a45065ae4a;hpb=bd05f7ec58f3e1f5839c372ad4fb007a8d8866f5;p=chaz%2Fopenbox diff --git a/util/epist/screen.cc b/util/epist/screen.cc index 0ec57dec..1bd7ad5d 100644 --- a/util/epist/screen.cc +++ b/util/epist/screen.cc @@ -279,19 +279,23 @@ void screen::handleKeypress(const XEvent &e) { return; case Action::moveWindowUp: - window->move(window->x(), window->y() - it->number()); + window->move(window->x(), window->y() - + (it->number() != 0 ? it->number(): 1)); return; case Action::moveWindowDown: - window->move(window->x(), window->y() + it->number()); + window->move(window->x(), window->y() + + (it->number() != 0 ? it->number(): 1)); return; case Action::moveWindowLeft: - window->move(window->x() - it->number(), window->y()); + window->move(window->x() - (it->number() != 0 ? it->number(): 1), + window->y()); return; case Action::moveWindowRight: - window->move(window->x() + it->number(), window->y()); + window->move(window->x() + (it->number() != 0 ? it->number(): 1), + window->y()); return; case Action::resizeWindowWidth: @@ -317,6 +321,10 @@ void screen::handleKeypress(const XEvent &e) { case Action::toggleMaximizeFull: window->toggleMaximize(XWindow::Max_Full); return; + + case Action::toggleDecorations: + window->decorate(! window->decorated()); + return; default: assert(false); // unhandled action type! @@ -588,38 +596,56 @@ void screen::changeWorkspaceVert(const int num) const { if (width > _num_desktops || width <= 0) return; + int wnum; + + // a cookie to the person that makes this pretty if (num < 0) { - int wnum = _active_desktop - width; - if (wnum >= 0) - changeWorkspace(wnum); + wnum = _active_desktop - width; + if (wnum < 0) { + wnum = _num_desktops/width * width + _active_desktop; + if (wnum >= _num_desktops) + wnum = _num_desktops - 1; + } } else { - int wnum = _active_desktop + width; - if (wnum < _num_desktops) - changeWorkspace(wnum); + wnum = _active_desktop + width; + if (wnum >= _num_desktops) { + wnum = (_active_desktop + width) % _num_desktops - 1; + if (wnum < 0) + wnum = 0; + } } + changeWorkspace(wnum); } void screen::changeWorkspaceHorz(const int num) const { assert(_managed); const Config *conf = _epist->getConfig(); int width = conf->getNumberValue(Config::workspaceColumns); - + int wnum; + if (width > _num_desktops || width <= 0) return; if (num < 0) { if (_active_desktop % width != 0) changeWorkspace(_active_desktop - 1); - else - changeWorkspace(_active_desktop + width - 1); + else { + wnum = _active_desktop + width - 1; + if (wnum >= _num_desktops) + wnum = _num_desktops - 1; + } } else { - if (_active_desktop % width != width - 1) - changeWorkspace(_active_desktop + 1); + if (_active_desktop % width != width - 1) { + wnum = _active_desktop + 1; + if (wnum >= _num_desktops) + wnum = _num_desktops / width * width; + } else - changeWorkspace(_active_desktop - width + 1); + wnum = _active_desktop - width + 1; } + changeWorkspace(wnum); } void screen::grabKey(const KeyCode keyCode, const int modifierMask) const {