all repos — openbox @ ba9c665a87fbb18cd850bf5769082bbd6f9e7d7f

openbox fork - make it a bit more like ryudo

workspace warping. this needs to be optional! also motion events are retarded!
Dana Jansens danakj@orodu.net
commit

ba9c665a87fbb18cd850bf5769082bbd6f9e7d7f

parent

fc792813a24d22330b49eda8b3ef7054eadf20d3

1 files changed, 51 insertions(+), 0 deletions(-)

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

@@ -2962,6 +2962,57 @@ int dx = x_root - frame.grab_x, dy = y_root - frame.grab_y;

dx -= frame.border_w; dy -= frame.border_w; + // workspace warping + bool warp = False; + unsigned int dest = screen->getCurrentWorkspaceID(); + if (x_root <= 0) { + warp = True; + + if (dest > 0) dest--; + else dest = screen->getNumberOfWorkspaces() - 1; + + } else if (x_root >= screen->getRect().right()) { + warp = True; + + if (dest < screen->getNumberOfWorkspaces() - 1) dest++; + else dest = 0; + } + if (warp) { + endMove(); + bool focus = flags.focused; // had focus while moving? + if (! flags.stuck) + screen->reassociateWindow(this, dest, False); + screen->changeWorkspaceID(dest); + if (focus) + setInputFocus(); + + /* + If the XWarpPointer is done after the configure, we can end up + grabbing another window, so made sure you do it first. + */ + int dest_x; + if (x_root <= 0) { + dest_x = screen->getRect().right() - 1; + XWarpPointer(blackbox->getXDisplay(), None, + screen->getRootWindow(), 0, 0, 0, 0, + dest_x, y_root); + + configure(dx + (screen->getRect().width() - 1), dy, + frame.rect.width(), frame.rect.height()); + } else { + dest_x = 0; + XWarpPointer(blackbox->getXDisplay(), None, + screen->getRootWindow(), 0, 0, 0, 0, + dest_x, y_root); + + configure(dx - (screen->getRect().width() - 1), dy, + frame.rect.width(), frame.rect.height()); + } + + beginMove(dest_x, y_root); + return; + } + const int snap_distance = screen->getEdgeSnapThreshold(); if (snap_distance) {