aboutsummaryrefslogtreecommitdiff
path: root/src/Window.cc
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-04-04 13:19:10 (GMT)
committerfluxgen <fluxgen>2002-04-04 13:19:10 (GMT)
commite4d3840f267f95c50299ca725b2dfb1202a09801 (patch)
tree6fbde1b292cfb64736c6558db44ddefddac8dcc5 /src/Window.cc
parent1717c112802ac6828ced2890fd8cfe99ba96cd96 (diff)
downloadfluxbox_pavel-e4d3840f267f95c50299ca725b2dfb1202a09801.zip
fluxbox_pavel-e4d3840f267f95c50299ca725b2dfb1202a09801.tar.bz2
added startMoving, stopMoving, startResizing and stopResizing and fixed bug 528101
Diffstat (limited to 'src/Window.cc')
-rw-r--r--src/Window.cc229
1 files changed, 124 insertions, 105 deletions
diff --git a/src/Window.cc b/src/Window.cc
index ba18a05..a6689cb 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.37 2002/04/04 11:28:19 fluxgen Exp $ 25// $Id: Window.cc,v 1.38 2002/04/04 13:19:10 fluxgen Exp $
26 26
27//use GNU extensions 27//use GNU extensions
28#ifndef _GNU_SOURCE 28#ifndef _GNU_SOURCE
@@ -1495,9 +1495,9 @@ void FluxboxWindow::getWMIconName(void) {
1495 1495
1496 XFree((char *) text_prop.value); 1496 XFree((char *) text_prop.value);
1497 } else 1497 } else
1498 client.icon_title = getTitle(); //assign title to icon title 1498 client.icon_title = getTitle();
1499 } else 1499 } else
1500 client.icon_title = getTitle(); //assign title to icon title 1500 client.icon_title = getTitle();
1501} 1501}
1502 1502
1503 1503
@@ -2035,6 +2035,10 @@ void FluxboxWindow::close(void) {
2035void FluxboxWindow::withdraw(void) { 2035void FluxboxWindow::withdraw(void) {
2036 visible = false; 2036 visible = false;
2037 iconic = false; 2037 iconic = false;
2038 if (isMoving())
2039 stopMoving();
2040 if (isResizing())
2041 stopResizing();
2038 2042
2039 XUnmapWindow(display, frame.window); 2043 XUnmapWindow(display, frame.window);
2040 2044
@@ -3295,46 +3299,11 @@ void FluxboxWindow::buttonReleaseEvent(XButtonEvent *re) {
3295 if (! validateClient()) 3299 if (! validateClient())
3296 return; 3300 return;
3297 3301
3298 if (moving) { 3302 if (isMoving())
3299 moving = false; 3303 stopMoving();
3300 3304 else if (isResizing())
3301 fluxbox->maskWindowEvents(0, (FluxboxWindow *) 0); 3305 stopResizing();
3302 3306 else if (re->window == frame.window) {
3303 if (! screen->doOpaqueMove()) {
3304 XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(),
3305 frame.move_x, frame.move_y, frame.resize_w,
3306 frame.resize_h);
3307
3308 configure(frame.move_x, frame.move_y, frame.width, frame.height);
3309 fluxbox->ungrab();
3310 } else
3311 configure(frame.x, frame.y, frame.width, frame.height);
3312
3313 screen->hideGeometry();
3314 XUngrabPointer(display, CurrentTime);
3315 } else if (resizing) {
3316 XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(),
3317 frame.resize_x, frame.resize_y,
3318 frame.resize_w, frame.resize_h);
3319
3320 screen->hideGeometry();
3321
3322 if (re->window == frame.left_grip)
3323 left_fixsize();
3324 else
3325 right_fixsize();
3326
3327 resizing = false;
3328 configure(frame.resize_x, frame.resize_y,
3329 frame.resize_w - screen->getBorderWidth2x(),
3330 frame.resize_h - screen->getBorderWidth2x());
3331
3332 if (tab)
3333 tab->resize();
3334
3335 fluxbox->ungrab();
3336 XUngrabPointer(display, CurrentTime);
3337 } else if (re->window == frame.window) {
3338 if (re->button == 2 && re->state == Mod1Mask) 3307 if (re->button == 2 && re->state == Mod1Mask)
3339 XUngrabPointer(display, CurrentTime); 3308 XUngrabPointer(display, CurrentTime);
3340 } else { 3309 } else {
@@ -3356,39 +3325,13 @@ void FluxboxWindow::buttonReleaseEvent(XButtonEvent *re) {
3356 3325
3357 3326
3358void FluxboxWindow::motionNotifyEvent(XMotionEvent *me) { 3327void FluxboxWindow::motionNotifyEvent(XMotionEvent *me) {
3359 Fluxbox *fluxbox = Fluxbox::instance();
3360 if ((me->state & Button1Mask) && functions.move && 3328 if ((me->state & Button1Mask) && functions.move &&
3361 (frame.title == me->window || frame.label == me->window || 3329 (frame.title == me->window || frame.label == me->window ||
3362 frame.handle == me->window || frame.window == me->window) && !resizing) { 3330 frame.handle == me->window || frame.window == me->window) && !isResizing()) {
3363 3331
3364 if (! moving) { 3332 if (! isMoving()) {
3365 XGrabPointer(display, me->window, False, Button1MotionMask | 3333 startMoving(me->window);
3366 ButtonReleaseMask, GrabModeAsync, GrabModeAsync, 3334 } else {
3367 None, fluxbox->getMoveCursor(), CurrentTime);
3368
3369 if (windowmenu && windowmenu->isVisible())
3370 windowmenu->hide();
3371
3372 moving = true;
3373
3374 fluxbox->maskWindowEvents(client.window, this);
3375
3376 if (! screen->doOpaqueMove()) {
3377 fluxbox->grab();
3378
3379 frame.move_x = frame.x;
3380 frame.move_y = frame.y;
3381 frame.resize_w = frame.width + screen->getBorderWidth2x();
3382 frame.resize_h = ((shaded) ? frame.title_h : frame.height) +
3383 screen->getBorderWidth2x();
3384
3385 screen->showPosition(frame.x, frame.y);
3386
3387 XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(),
3388 frame.move_x, frame.move_y,
3389 frame.resize_w, frame.resize_h);
3390 }
3391 } else {
3392 int dx = me->x_root - frame.grab_x, dy = me->y_root - frame.grab_y; 3335 int dx = me->x_root - frame.grab_x, dy = me->y_root - frame.grab_y;
3393 3336
3394 dx -= screen->getBorderWidth(); 3337 dx -= screen->getBorderWidth();
@@ -3429,8 +3372,7 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent *me) {
3429 3372
3430 if (! screen->doOpaqueMove()) { 3373 if (! screen->doOpaqueMove()) {
3431 XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(), 3374 XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(),
3432 frame.move_x, frame.move_y, frame.resize_w, 3375 frame.move_x, frame.move_y, frame.resize_w, frame.resize_h);
3433 frame.resize_h);
3434 3376
3435 frame.move_x = dx; 3377 frame.move_x = dx;
3436 frame.move_y = dy; 3378 frame.move_y = dy;
@@ -3441,7 +3383,7 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent *me) {
3441 } else 3383 } else
3442 configure(dx, dy, frame.width, frame.height); 3384 configure(dx, dy, frame.width, frame.height);
3443 3385
3444 screen->showPosition(dx, dy); 3386 screen->showPosition(dx, dy);
3445 } 3387 }
3446 } else if (functions.resize && 3388 } else if (functions.resize &&
3447 (((me->state & Button1Mask) && (me->window == frame.right_grip || 3389 (((me->state & Button1Mask) && (me->window == frame.right_grip ||
@@ -3449,35 +3391,8 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent *me) {
3449 me->window == frame.window)) { 3391 me->window == frame.window)) {
3450 bool left = (me->window == frame.left_grip); 3392 bool left = (me->window == frame.left_grip);
3451 3393
3452 if (! resizing) { 3394 if (! resizing) {
3453 XGrabPointer(display, me->window, false, ButtonMotionMask | 3395 startResizing(me, left);
3454 ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None,
3455 ((left) ? fluxbox->getLowerLeftAngleCursor() :
3456 fluxbox->getLowerRightAngleCursor()),
3457 CurrentTime);
3458
3459 resizing = true;
3460
3461// fluxbox->grab();
3462
3463 int gx, gy;
3464 frame.grab_x = me->x - screen->getBorderWidth();
3465 frame.grab_y = me->y - screen->getBorderWidth2x();
3466 frame.resize_x = frame.x;
3467 frame.resize_y = frame.y;
3468 frame.resize_w = frame.width + screen->getBorderWidth2x();
3469 frame.resize_h = frame.height + screen->getBorderWidth2x();
3470
3471 if (left)
3472 left_fixsize(&gx, &gy);
3473 else
3474 right_fixsize(&gx, &gy);
3475
3476 screen->showGeometry(gx, gy);
3477
3478 XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(),
3479 frame.resize_x, frame.resize_y,
3480 frame.resize_w, frame.resize_h);
3481 } else if (resizing) { 3396 } else if (resizing) {
3482 XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(), 3397 XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(),
3483 frame.resize_x, frame.resize_y, 3398 frame.resize_x, frame.resize_y,
@@ -3566,6 +3481,110 @@ bool FluxboxWindow::validateClient(void) {
3566 return true; 3481 return true;
3567} 3482}
3568 3483
3484void FluxboxWindow::startMoving(Window win) {
3485 moving = true;
3486 Fluxbox *fluxbox = Fluxbox::instance();
3487 XGrabPointer(display, win, False, Button1MotionMask |
3488 ButtonReleaseMask, GrabModeAsync, GrabModeAsync,
3489 None, fluxbox->getMoveCursor(), CurrentTime);
3490
3491 if (windowmenu && windowmenu->isVisible())
3492 windowmenu->hide();
3493
3494 fluxbox->maskWindowEvents(client.window, this);
3495
3496 if (! screen->doOpaqueMove()) {
3497 fluxbox->grab();
3498
3499 frame.move_x = frame.x;
3500 frame.move_y = frame.y;
3501 frame.resize_w = frame.width + screen->getBorderWidth2x();
3502 frame.resize_h = ((shaded) ? frame.title_h : frame.height) +
3503 screen->getBorderWidth2x();
3504
3505 screen->showPosition(frame.x, frame.y);
3506
3507 XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(),
3508 frame.move_x, frame.move_y,
3509 frame.resize_w, frame.resize_h);
3510 }
3511}
3512
3513void FluxboxWindow::stopMoving() {
3514 moving = false;
3515 Fluxbox *fluxbox = Fluxbox::instance();
3516
3517 fluxbox->maskWindowEvents(0, (FluxboxWindow *) 0);
3518
3519 if (! screen->doOpaqueMove()) {
3520 XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(),
3521 frame.move_x, frame.move_y, frame.resize_w,
3522 frame.resize_h);
3523
3524 configure(frame.move_x, frame.move_y, frame.width, frame.height);
3525 fluxbox->ungrab();
3526 } else
3527 configure(frame.x, frame.y, frame.width, frame.height);
3528
3529 screen->hideGeometry();
3530 XUngrabPointer(display, CurrentTime);
3531
3532 XSync(display, False); //make sure the redraw is made before we continue
3533}
3534
3535void FluxboxWindow::startResizing(XMotionEvent *me, bool left) {
3536 resizing = true;
3537 Fluxbox *fluxbox = Fluxbox::instance();
3538 XGrabPointer(display, me->window, false, ButtonMotionMask | ButtonReleaseMask,
3539 GrabModeAsync, GrabModeAsync, None,
3540 ((left) ? fluxbox->getLowerLeftAngleCursor() : fluxbox->getLowerRightAngleCursor()),
3541 CurrentTime);
3542
3543 int gx, gy;
3544 frame.grab_x = me->x - screen->getBorderWidth();
3545 frame.grab_y = me->y - screen->getBorderWidth2x();
3546 frame.resize_x = frame.x;
3547 frame.resize_y = frame.y;
3548 frame.resize_w = frame.width + screen->getBorderWidth2x();
3549 frame.resize_h = frame.height + screen->getBorderWidth2x();
3550
3551 if (left)
3552 left_fixsize(&gx, &gy);
3553 else
3554 right_fixsize(&gx, &gy);
3555
3556 screen->showGeometry(gx, gy);
3557
3558 XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(),
3559 frame.resize_x, frame.resize_y,
3560 frame.resize_w, frame.resize_h);
3561}
3562
3563void FluxboxWindow::stopResizing(Window win) {
3564 resizing = false;
3565
3566 XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(),
3567 frame.resize_x, frame.resize_y,
3568 frame.resize_w, frame.resize_h);
3569
3570 screen->hideGeometry();
3571
3572 if (win == frame.left_grip)
3573 left_fixsize();
3574 else
3575 right_fixsize();
3576
3577
3578 configure(frame.resize_x, frame.resize_y,
3579 frame.resize_w - screen->getBorderWidth2x(),
3580 frame.resize_h - screen->getBorderWidth2x());
3581
3582 if (tab)
3583 tab->resize();
3584
3585 Fluxbox::instance()->ungrab();
3586 XUngrabPointer(display, CurrentTime);
3587}
3569 3588
3570void FluxboxWindow::restore(void) { 3589void FluxboxWindow::restore(void) {
3571 XChangeSaveSet(display, client.window, SetModeDelete); 3590 XChangeSaveSet(display, client.window, SetModeDelete);