X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2FWindow.cc;h=6131ec4917b21524ac73a5c1635aa40ed70a5e3e;hb=28594da6de001f1d8b6b975286032302db3a6491;hp=226ac023f4f51dbca598e63b30ab7b03f9026e07;hpb=b73ff84f6f49e846d2dbcbf294d48db10fdc314a;p=chaz%2Fopenbox diff --git a/src/Window.cc b/src/Window.cc index 226ac023..6131ec49 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -1810,7 +1810,7 @@ void BlackboxWindow::maximize(unsigned int button) { frame.changing = *it; } else -#endif +#endif // XINERAMA frame.changing = screen->availableArea(); switch(button) { @@ -2953,6 +2953,59 @@ void BlackboxWindow::doMove(int x_root, int y_root) { dx -= frame.border_w; dy -= frame.border_w; + if (screen->doWorkspaceWarping()) { + // 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) { @@ -3044,17 +3097,25 @@ void BlackboxWindow::doMove(int x_root, int y_root) { // snap to the strut (and screen boundaries for xinerama) #ifdef XINERAMA - if (screen->isXineramaActive() && blackbox->doXineramaSnapping()) + if (screen->isXineramaActive() && blackbox->doXineramaSnapping()) { + if (! screen->doFullMax()) + snaplist.insert(snaplist.begin(), + screen->allAvailableAreas().begin(), + screen->allAvailableAreas().end()); + + // always snap to the screen edges snaplist.insert(snaplist.begin(), - screen->allAvailableAreas().begin(), - screen->allAvailableAreas().end()); - else + screen->getXineramaAreas().begin(), + screen->getXineramaAreas().end()); + } else #endif // XINERAMA + { if (! screen->doFullMax()) snaplist.push_back(screen->availableArea()); - - // always snap to the screen edges - snaplist.push_back(screen->getRect()); + + // always snap to the screen edges + snaplist.push_back(screen->getRect()); + } RectList::const_iterator it, end = snaplist.end(); for (it = snaplist.begin(); it != end; ++it) {