diff options
Diffstat (limited to 'src/Window.cc')
-rw-r--r-- | src/Window.cc | 119 |
1 files changed, 82 insertions, 37 deletions
diff --git a/src/Window.cc b/src/Window.cc index 3648333..3104847 100644 --- a/src/Window.cc +++ b/src/Window.cc | |||
@@ -22,7 +22,7 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: Window.cc,v 1.72 2002/08/30 13:08:35 fluxgen Exp $ | 25 | // $Id: Window.cc,v 1.73 2002/08/30 14:06:40 fluxgen Exp $ |
26 | 26 | ||
27 | #include "Window.hh" | 27 | #include "Window.hh" |
28 | 28 | ||
@@ -3258,6 +3258,35 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent *me) { | |||
3258 | else if (dby > 0 && dby < screen->getEdgeSnapThreshold()) | 3258 | else if (dby > 0 && dby < screen->getEdgeSnapThreshold()) |
3259 | dy = dbby - frame.snap_h; | 3259 | dy = dbby - frame.snap_h; |
3260 | } | 3260 | } |
3261 | // Warp to next or previous workspace? | ||
3262 | if (screen->isWorkspaceWarping()) { | ||
3263 | int cur_id = screen->getCurrentWorkspaceID(); | ||
3264 | int new_id = cur_id; | ||
3265 | const int warpPad = screen->getEdgeSnapThreshold(); | ||
3266 | if (me->x_root >= int(screen->getWidth()) - warpPad - 1 && | ||
3267 | frame.x < int(me->x_root - frame.grab_x - screen->getBorderWidth())) { | ||
3268 | //warp right | ||
3269 | new_id = (cur_id + 1) % screen->getCount(); | ||
3270 | dx = -me->x_root; | ||
3271 | } else if (me->x_root <= warpPad && | ||
3272 | frame.x > int(me->x_root - frame.grab_x - screen->getBorderWidth())) { | ||
3273 | //warp left | ||
3274 | new_id = (cur_id - 1 + screen->getCount()) % screen->getCount(); | ||
3275 | dx = screen->getWidth() - me->x_root; | ||
3276 | } | ||
3277 | if (new_id != cur_id) { | ||
3278 | XWarpPointer(display, None, None, 0, 0, 0, 0, dx, 0); | ||
3279 | |||
3280 | screen->changeWorkspaceID(new_id); | ||
3281 | |||
3282 | if (!screen->doOpaqueMove()) { | ||
3283 | dx += frame.move_x; // for rectangle in correct position | ||
3284 | } else { | ||
3285 | dx += frame.x; // for window in correct position | ||
3286 | } | ||
3287 | } | ||
3288 | } | ||
3289 | |||
3261 | 3290 | ||
3262 | if (! screen->doOpaqueMove()) { | 3291 | if (! screen->doOpaqueMove()) { |
3263 | XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(), | 3292 | XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(), |
@@ -3270,47 +3299,12 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent *me) { | |||
3270 | frame.move_x, frame.move_y, frame.resize_w, | 3299 | frame.move_x, frame.move_y, frame.resize_w, |
3271 | frame.resize_h); | 3300 | frame.resize_h); |
3272 | } else { | 3301 | } else { |
3273 | // Warp to next or previous workspace? | ||
3274 | if (screen->isWorkspaceWarping()) { | ||
3275 | int cur_id = screen->getCurrentWorkspaceID(); | ||
3276 | int new_id = cur_id; | ||
3277 | const int warpPad = screen->getEdgeSnapThreshold(); | ||
3278 | if (me->x_root >= int(screen->getWidth()) - warpPad - 1 && | ||
3279 | frame.x < int(me->x_root - frame.grab_x - screen->getBorderWidth())) { | ||
3280 | //warp right | ||
3281 | new_id = (cur_id + 1) % screen->getCount(); | ||
3282 | dx = -me->x_root; | ||
3283 | } else if (me->x_root <= warpPad && | ||
3284 | frame.x > int(me->x_root - frame.grab_x - screen->getBorderWidth())) { | ||
3285 | //warp left | ||
3286 | new_id = (cur_id - 1 + screen->getCount()) % screen->getCount(); | ||
3287 | dx = screen->getWidth() - me->x_root; | ||
3288 | } | ||
3289 | if (new_id != cur_id) { | ||
3290 | frame.x += dx; | ||
3291 | XWarpPointer(display, None, None, 0, 0, 0, 0, dx, 0); | ||
3292 | screen->reassociateWindow(this, new_id, true); | ||
3293 | |||
3294 | //if the window has a tab and is in a group | ||
3295 | //reassociate those windows too | ||
3296 | if (hasTab() && (getTab()->next() || getTab()->prev())) { | ||
3297 | Tab *tab_it = getTab()->first(); | ||
3298 | for (; tab_it; tab_it = tab_it->next()) { | ||
3299 | screen->reassociateWindow(tab_it->getWindow(), new_id, true); | ||
3300 | } | ||
3301 | } | ||
3302 | screen->changeWorkspaceID(new_id); | ||
3303 | setInputFocus(); | ||
3304 | screen->raiseFocus(); | ||
3305 | } | ||
3306 | } | ||
3307 | |||
3308 | configure(dx, dy, frame.width, frame.height); | 3302 | configure(dx, dy, frame.width, frame.height); |
3309 | } | 3303 | } |
3310 | 3304 | ||
3311 | if (screen->doShowWindowPos()) | 3305 | if (screen->doShowWindowPos()) |
3312 | screen->showPosition(dx, dy); | 3306 | screen->showPosition(dx, dy); |
3313 | } | 3307 | } // end if moving |
3314 | } else if (functions.resize && | 3308 | } else if (functions.resize && |
3315 | (((me->state & Button1Mask) && (me->window == frame.right_grip || | 3309 | (((me->state & Button1Mask) && (me->window == frame.right_grip || |
3316 | me->window == frame.left_grip)) || | 3310 | me->window == frame.left_grip)) || |
@@ -3484,6 +3478,7 @@ void FluxboxWindow::startMoving(Window win) { | |||
3484 | 3478 | ||
3485 | frame.move_x = frame.x; | 3479 | frame.move_x = frame.x; |
3486 | frame.move_y = frame.y; | 3480 | frame.move_y = frame.y; |
3481 | frame.move_ws = screen->getCurrentWorkspaceID(); | ||
3487 | frame.resize_w = frame.width + screen->getBorderWidth2x(); | 3482 | frame.resize_w = frame.width + screen->getBorderWidth2x(); |
3488 | frame.resize_h = ((shaded) ? frame.title_h : frame.height) + | 3483 | frame.resize_h = ((shaded) ? frame.title_h : frame.height) + |
3489 | screen->getBorderWidth2x(); | 3484 | screen->getBorderWidth2x(); |
@@ -3519,6 +3514,56 @@ void FluxboxWindow::stopMoving() { | |||
3519 | XSync(display, False); //make sure the redraw is made before we continue | 3514 | XSync(display, False); //make sure the redraw is made before we continue |
3520 | } | 3515 | } |
3521 | 3516 | ||
3517 | void FluxboxWindow::pauseMoving() { | ||
3518 | screen->hideGeometry(); // otherwise our window gets raised above it | ||
3519 | if (screen->doOpaqueMove()) { | ||
3520 | return; | ||
3521 | } | ||
3522 | |||
3523 | // remove old rectangle | ||
3524 | XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(), | ||
3525 | frame.move_x, frame.move_y, frame.resize_w, frame.resize_h); | ||
3526 | |||
3527 | Fluxbox::instance()->ungrab(); | ||
3528 | if (workspace_number != frame.move_ws) { | ||
3529 | // get it out of view | ||
3530 | frame.save_x = frame.x; | ||
3531 | frame.save_y = frame.y; | ||
3532 | frame.x = screen->getWidth()/2; | ||
3533 | frame.y = screen->getHeight()+screen->getTabHeight()+10; // +10 to be safe | ||
3534 | configure(frame.x, frame.y, frame.width, frame.height); | ||
3535 | } | ||
3536 | } | ||
3537 | |||
3538 | |||
3539 | void FluxboxWindow::resumeMoving() { | ||
3540 | if (screen->doOpaqueMove()) { | ||
3541 | setInputFocus(); | ||
3542 | screen->raiseFocus(); | ||
3543 | if (screen->doShowWindowPos()) | ||
3544 | screen->showPosition(frame.x, frame.y); | ||
3545 | return; | ||
3546 | } | ||
3547 | |||
3548 | if (workspace_number != frame.move_ws) { | ||
3549 | frame.x = frame.save_x; | ||
3550 | frame.y = frame.save_y; | ||
3551 | } else { | ||
3552 | // back on home workspace, display window | ||
3553 | configure(frame.x, frame.y, frame.width, frame.height); | ||
3554 | } | ||
3555 | Fluxbox::instance()->grab(); | ||
3556 | setInputFocus(); | ||
3557 | screen->raiseFocus(); | ||
3558 | if (screen->doShowWindowPos()) | ||
3559 | screen->showPosition(frame.move_x, frame.move_y); | ||
3560 | XSync(display,false); | ||
3561 | XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(), | ||
3562 | frame.move_x, frame.move_y, frame.resize_w, | ||
3563 | frame.resize_h); | ||
3564 | } | ||
3565 | |||
3566 | |||
3522 | void FluxboxWindow::startResizing(XMotionEvent *me, bool left) { | 3567 | void FluxboxWindow::startResizing(XMotionEvent *me, bool left) { |
3523 | resizing = true; | 3568 | resizing = true; |
3524 | Fluxbox *fluxbox = Fluxbox::instance(); | 3569 | Fluxbox *fluxbox = Fluxbox::instance(); |