diff options
Diffstat (limited to 'src/Window.cc')
-rw-r--r-- | src/Window.cc | 79 |
1 files changed, 47 insertions, 32 deletions
diff --git a/src/Window.cc b/src/Window.cc index 6714d0a..1f2d184 100644 --- a/src/Window.cc +++ b/src/Window.cc | |||
@@ -449,6 +449,12 @@ void FluxboxWindow::init() { | |||
449 | m_tabActivationTimer.setCommand(activate_tab_cmd); | 449 | m_tabActivationTimer.setCommand(activate_tab_cmd); |
450 | m_tabActivationTimer.fireOnce(true); | 450 | m_tabActivationTimer.fireOnce(true); |
451 | 451 | ||
452 | m_resizeTimer.setTimeout(screen().opaqueResizeDelay() * FbTk::FbTime::IN_MILLISECONDS); | ||
453 | FbTk::RefCount<FbTk::Command<void> > resize_cmd(new FbTk::SimpleCommand<FluxboxWindow>(*this, | ||
454 | &FluxboxWindow::updateResize)); | ||
455 | m_resizeTimer.setCommand(resize_cmd); | ||
456 | m_resizeTimer.fireOnce(true); | ||
457 | |||
452 | m_reposLabels_timer.setTimeout(IconButton::updateLaziness()); | 458 | m_reposLabels_timer.setTimeout(IconButton::updateLaziness()); |
453 | m_reposLabels_timer.fireOnce(true); | 459 | m_reposLabels_timer.fireOnce(true); |
454 | FbTk::RefCount<FbTk::Command<void> > elrs(new FbTk::SimpleCommand<FluxboxWindow>(*this, &FluxboxWindow::emitLabelReposSig)); | 460 | FbTk::RefCount<FbTk::Command<void> > elrs(new FbTk::SimpleCommand<FluxboxWindow>(*this, &FluxboxWindow::emitLabelReposSig)); |
@@ -2663,36 +2669,36 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) { | |||
2663 | int old_resize_w = m_last_resize_w; | 2669 | int old_resize_w = m_last_resize_w; |
2664 | int old_resize_h = m_last_resize_h; | 2670 | int old_resize_h = m_last_resize_h; |
2665 | 2671 | ||
2666 | int dx = me.x - m_button_grab_x; | 2672 | int dx = me.x_root - m_button_grab_x; |
2667 | int dy = me.y - m_button_grab_y; | 2673 | int dy = me.y_root - m_button_grab_y; |
2668 | 2674 | ||
2669 | if (m_resize_corner == LEFTTOP || m_resize_corner == LEFTBOTTOM || | 2675 | if (m_resize_corner == LEFTTOP || m_resize_corner == LEFTBOTTOM || |
2670 | m_resize_corner == LEFT) { | 2676 | m_resize_corner == LEFT) { |
2671 | m_last_resize_w = frame().width() - dx; | 2677 | m_last_resize_w = resize_base_w - dx; |
2672 | m_last_resize_x = frame().x() + dx; | 2678 | m_last_resize_x = resize_base_x + dx; |
2673 | } | 2679 | } |
2674 | if (m_resize_corner == LEFTTOP || m_resize_corner == RIGHTTOP || | 2680 | if (m_resize_corner == LEFTTOP || m_resize_corner == RIGHTTOP || |
2675 | m_resize_corner == TOP) { | 2681 | m_resize_corner == TOP) { |
2676 | m_last_resize_h = frame().height() - dy; | 2682 | m_last_resize_h = resize_base_h - dy; |
2677 | m_last_resize_y = frame().y() + dy; | 2683 | m_last_resize_y = resize_base_y + dy; |
2678 | } | 2684 | } |
2679 | if (m_resize_corner == LEFTBOTTOM || m_resize_corner == BOTTOM || | 2685 | if (m_resize_corner == LEFTBOTTOM || m_resize_corner == BOTTOM || |
2680 | m_resize_corner == RIGHTBOTTOM) | 2686 | m_resize_corner == RIGHTBOTTOM) |
2681 | m_last_resize_h = frame().height() + dy; | 2687 | m_last_resize_h = resize_base_h + dy; |
2682 | if (m_resize_corner == RIGHTBOTTOM || m_resize_corner == RIGHTTOP || | 2688 | if (m_resize_corner == RIGHTBOTTOM || m_resize_corner == RIGHTTOP || |
2683 | m_resize_corner == RIGHT) | 2689 | m_resize_corner == RIGHT) |
2684 | m_last_resize_w = frame().width() + dx; | 2690 | m_last_resize_w = resize_base_w + dx; |
2685 | if (m_resize_corner == CENTER) { | 2691 | if (m_resize_corner == CENTER) { |
2686 | // dx or dy must be at least 2 | 2692 | // dx or dy must be at least 2 |
2687 | if (abs(dx) >= 2 || abs(dy) >= 2) { | 2693 | if (abs(dx) >= 2 || abs(dy) >= 2) { |
2688 | // take max and make it even | 2694 | // take max and make it even |
2689 | int diff = 2 * (max(dx, dy) / 2); | 2695 | int diff = 2 * (max(dx, dy) / 2); |
2690 | 2696 | ||
2691 | m_last_resize_h = frame().height() + diff; | 2697 | m_last_resize_h = resize_base_h + diff; |
2692 | 2698 | ||
2693 | m_last_resize_w = frame().width() + diff; | 2699 | m_last_resize_w = resize_base_w + diff; |
2694 | m_last_resize_x = frame().x() - diff/2; | 2700 | m_last_resize_x = resize_base_x - diff/2; |
2695 | m_last_resize_y = frame().y() - diff/2; | 2701 | m_last_resize_y = resize_base_y - diff/2; |
2696 | } | 2702 | } |
2697 | } | 2703 | } |
2698 | 2704 | ||
@@ -2780,18 +2786,23 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) { | |||
2780 | } | 2786 | } |
2781 | } | 2787 | } |
2782 | 2788 | ||
2783 | // draw over old rect | 2789 | if (m_last_resize_w != old_resize_w || m_last_resize_h != old_resize_h) { |
2784 | parent().drawRectangle(screen().rootTheme()->opGC(), | 2790 | if (screen().doOpaqueResize()) { |
2785 | old_resize_x, old_resize_y, | 2791 | m_resizeTimer.start(); |
2786 | old_resize_w - 1 + 2 * frame().window().borderWidth(), | 2792 | } else { |
2787 | old_resize_h - 1 + 2 * frame().window().borderWidth()); | 2793 | // draw over old rect |
2788 | 2794 | parent().drawRectangle(screen().rootTheme()->opGC(), | |
2789 | // draw resize rectangle | 2795 | old_resize_x, old_resize_y, |
2790 | parent().drawRectangle(screen().rootTheme()->opGC(), | 2796 | old_resize_w - 1 + 2 * frame().window().borderWidth(), |
2791 | m_last_resize_x, m_last_resize_y, | 2797 | old_resize_h - 1 + 2 * frame().window().borderWidth()); |
2792 | m_last_resize_w - 1 + 2 * frame().window().borderWidth(), | 2798 | |
2793 | m_last_resize_h - 1 + 2 * frame().window().borderWidth()); | 2799 | // draw resize rectangle |
2794 | 2800 | parent().drawRectangle(screen().rootTheme()->opGC(), | |
2801 | m_last_resize_x, m_last_resize_y, | ||
2802 | m_last_resize_w - 1 + 2 * frame().window().borderWidth(), | ||
2803 | m_last_resize_h - 1 + 2 * frame().window().borderWidth()); | ||
2804 | } | ||
2805 | } | ||
2795 | } | 2806 | } |
2796 | } | 2807 | } |
2797 | } | 2808 | } |
@@ -3320,29 +3331,33 @@ void FluxboxWindow::startResizing(int x, int y, ReferenceCorner dir) { | |||
3320 | false, ButtonMotionMask | ButtonReleaseMask, | 3331 | false, ButtonMotionMask | ButtonReleaseMask, |
3321 | GrabModeAsync, GrabModeAsync, None, cursor, CurrentTime); | 3332 | GrabModeAsync, GrabModeAsync, None, cursor, CurrentTime); |
3322 | 3333 | ||
3323 | m_button_grab_x = x; | 3334 | m_button_grab_x = x + frame().x(); |
3324 | m_button_grab_y = y; | 3335 | m_button_grab_y = y + frame().y(); |
3325 | m_last_resize_x = frame().x(); | 3336 | resize_base_x = m_last_resize_x = frame().x(); |
3326 | m_last_resize_y = frame().y(); | 3337 | resize_base_y = m_last_resize_y = frame().y(); |
3327 | m_last_resize_w = frame().width(); | 3338 | resize_base_w = m_last_resize_w = frame().width(); |
3328 | m_last_resize_h = frame().height(); | 3339 | resize_base_h = m_last_resize_h = frame().height(); |
3329 | 3340 | ||
3330 | fixSize(); | 3341 | fixSize(); |
3331 | frame().displaySize(m_last_resize_w, m_last_resize_h); | 3342 | frame().displaySize(m_last_resize_w, m_last_resize_h); |
3332 | 3343 | ||
3333 | parent().drawRectangle(screen().rootTheme()->opGC(), | 3344 | if (!screen().doOpaqueResize()) { |
3345 | parent().drawRectangle(screen().rootTheme()->opGC(), | ||
3334 | m_last_resize_x, m_last_resize_y, | 3346 | m_last_resize_x, m_last_resize_y, |
3335 | m_last_resize_w - 1 + 2 * frame().window().borderWidth(), | 3347 | m_last_resize_w - 1 + 2 * frame().window().borderWidth(), |
3336 | m_last_resize_h - 1 + 2 * frame().window().borderWidth()); | 3348 | m_last_resize_h - 1 + 2 * frame().window().borderWidth()); |
3349 | } | ||
3337 | } | 3350 | } |
3338 | 3351 | ||
3339 | void FluxboxWindow::stopResizing(bool interrupted) { | 3352 | void FluxboxWindow::stopResizing(bool interrupted) { |
3340 | resizing = false; | 3353 | resizing = false; |
3341 | 3354 | ||
3342 | parent().drawRectangle(screen().rootTheme()->opGC(), | 3355 | if (!screen().doOpaqueResize()) { |
3356 | parent().drawRectangle(screen().rootTheme()->opGC(), | ||
3343 | m_last_resize_x, m_last_resize_y, | 3357 | m_last_resize_x, m_last_resize_y, |
3344 | m_last_resize_w - 1 + 2 * frame().window().borderWidth(), | 3358 | m_last_resize_w - 1 + 2 * frame().window().borderWidth(), |
3345 | m_last_resize_h - 1 + 2 * frame().window().borderWidth()); | 3359 | m_last_resize_h - 1 + 2 * frame().window().borderWidth()); |
3360 | } | ||
3346 | 3361 | ||
3347 | screen().hideGeometry(); | 3362 | screen().hideGeometry(); |
3348 | 3363 | ||