aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Window.cc119
-rw-r--r--src/Window.hh8
2 files changed, 87 insertions, 40 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
3517void 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
3539void 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
3522void FluxboxWindow::startResizing(XMotionEvent *me, bool left) { 3567void FluxboxWindow::startResizing(XMotionEvent *me, bool left) {
3523 resizing = true; 3568 resizing = true;
3524 Fluxbox *fluxbox = Fluxbox::instance(); 3569 Fluxbox *fluxbox = Fluxbox::instance();
diff --git a/src/Window.hh b/src/Window.hh
index 76b7a14..6090d71 100644
--- a/src/Window.hh
+++ b/src/Window.hh
@@ -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.hh,v 1.28 2002/08/16 10:44:17 fluxgen Exp $ 25// $Id: Window.hh,v 1.29 2002/08/30 14:06:40 fluxgen Exp $
26 26
27#ifndef WINDOW_HH 27#ifndef WINDOW_HH
28#define WINDOW_HH 28#define WINDOW_HH
@@ -202,6 +202,8 @@ public:
202 void changeBlackboxHints(BaseDisplay::BlackboxHints *bh); 202 void changeBlackboxHints(BaseDisplay::BlackboxHints *bh);
203 void restoreAttributes(); 203 void restoreAttributes();
204 void showMenu(int mx, int my); 204 void showMenu(int mx, int my);
205 void pauseMoving();
206 void resumeMoving();
205 207
206 void buttonPressEvent(XButtonEvent *be); 208 void buttonPressEvent(XButtonEvent *be);
207 void buttonReleaseEvent(XButtonEvent *be); 209 void buttonReleaseEvent(XButtonEvent *be);
@@ -324,10 +326,10 @@ private:
324 right_grip, left_grip; 326 right_grip, left_grip;
325 327
326 int x, y, resize_x, resize_y, move_x, move_y, grab_x, grab_y, 328 int x, y, resize_x, resize_y, move_x, move_y, grab_x, grab_y,
327 y_border, y_handle; 329 y_border, y_handle, save_x, save_y;
328 unsigned int width, height, title_h, label_w, label_h, handle_h, 330 unsigned int width, height, title_h, label_w, label_h, handle_h,
329 button_w, button_h, grip_w, grip_h, mwm_border_w, border_h, 331 button_w, button_h, grip_w, grip_h, mwm_border_w, border_h,
330 bevel_w, resize_w, resize_h, snap_w, snap_h; 332 bevel_w, resize_w, resize_h, snap_w, snap_h, move_ws;
331 } frame; 333 } frame;
332 334
333 enum { F_NOINPUT = 0, F_PASSIVE, F_LOCALLYACTIVE, F_GLOBALLYACTIVE }; 335 enum { F_NOINPUT = 0, F_PASSIVE, F_LOCALLYACTIVE, F_GLOBALLYACTIVE };