X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=util%2Fepist%2Fscreen.cc;h=a7098a77d6706f2dd186f6269b0e3c5f491cd918;hb=572acce581f4b8799db661ed7ab0007de0393a09;hp=de5c29c277d34b4a58d7c72ea51e16cf51710fca;hpb=a991c575800a12afbc19de8bd75b87420934105a;p=chaz%2Fopenbox diff --git a/util/epist/screen.cc b/util/epist/screen.cc index de5c29c2..a7098a77 100644 --- a/util/epist/screen.cc +++ b/util/epist/screen.cc @@ -20,6 +20,17 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. +/* A few comments about stacked cycling: + * When stacked cycling is turned on, the focused window is always at the top + * (front) of the list (_clients), EXCEPT for when we are in cycling mode. + * (_cycling is true) If we were to add the focused window to the top of the + * stack while we were cycling, we would end in a deadlock between 2 windows. + * When the modifiers are released, the window that has focus (but it's not + * at the top of the stack, since we are cycling) is placed at the top of the + * stack and raised. + * Hooray and Bummy. - Marius + */ + #ifdef HAVE_CONFIG_H # include "../../config.h" #endif // HAVE_CONFIG_H @@ -64,7 +75,7 @@ screen::screen(epist *epist, int number) _info = _epist->getScreenInfo(_number); _root = _info->getRootWindow(); - _config->getBoolValue(Config::stackedCycling, _stacked_cycling); + _config->getValue(Config::stackedCycling, _stacked_cycling); // find a window manager supporting NETWM, waiting for it to load if we must int count = 20; // try for 20 seconds @@ -369,11 +380,7 @@ void screen::handleKeypress(const XEvent &e) { } -void screen::handleKeyrelease(const XEvent &e) { - // we're not interested in non-modifiers - if (!isModifier(e.xkey.keycode)) - return; - +void screen::handleKeyrelease(const XEvent &) { // the only keyrelease event we care about (for now) is when we do stacked // cycling and the modifier is released if (_stacked_cycling && _cycling && nothingIsPressed()) { @@ -526,7 +533,17 @@ void screen::updateActiveWindow() { break; } } + _active = it; + + /* if we're not cycling and a window gets focus, add it to the top of the + * cycle stack. + */ + if (_stacked_cycling && !_cycling) { + _clients.remove(*_active); + _clients.push_front(*_active); + } + if (it != end) _last_active = it; @@ -621,7 +638,7 @@ void screen::cycleWindow(unsigned int state, const bool forward, } // if the window is on another desktop, we can't use XSetInputFocus, since - // it doesn't imply a woskpace change. + // it doesn't imply a workspace change. if (t->desktop() == _active_desktop) t->focus(false); // focus, but don't raise else @@ -672,7 +689,7 @@ void screen::changeWorkspaceVert(const int num) const { int active_desktop = (signed)_active_desktop; int wnum = 0; - _config->getNumberValue(Config::workspaceColumns, width); + _config->getValue(Config::workspaceColumns, width); if (width > num_desktops || width <= 0) return; @@ -704,7 +721,7 @@ void screen::changeWorkspaceHorz(const int num) const { int active_desktop = (signed)_active_desktop; int wnum = 0; - _config->getNumberValue(Config::workspaceColumns, width); + _config->getValue(Config::workspaceColumns, width); if (width > num_desktops || width <= 0) return; @@ -798,21 +815,6 @@ void screen::ungrabModifiers() const { } -bool screen::isModifier(const KeyCode kc) const { - KeySym ks = XKeycodeToKeysym(_epist->getXDisplay(), kc, 0); - - if (ks == XK_Shift_L || ks == XK_Shift_R || - ks == XK_Control_L || ks == XK_Control_R || - ks == XK_Meta_L || ks == XK_Meta_R || - ks == XK_Alt_L || ks == XK_Alt_R || - ks == XK_Super_L || ks == XK_Super_R || - ks == XK_Hyper_L || ks == XK_Hyper_R) - return true; - else - return false; -} - - bool screen::nothingIsPressed(void) const { char keys[32];