From 42afb461691ab184263606d93809d0a11e5b8600 Mon Sep 17 00:00:00 2001 From: mathias Date: Tue, 4 Oct 2005 07:19:56 +0000 Subject: avoid drawing the resize outline when not really resizing, caused flickering. --- ChangeLog | 3 +++ src/Window.cc | 48 ++++++++++++++++++++++++++++++------------------ 2 files changed, 33 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 043dd59..cd3687f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ (Format: Year/Month/Day) Changes for 0.9.15: +*05/10/04: + * Avoid drawing the resize outline if not really resizing (Mathias) + Window.cc *05/09/25: * added nls for "-screen" argument (Thanks php-coder) nls/*/Translation.m, nls/fluxbox-nls.hh diff --git a/src/Window.cc b/src/Window.cc index 35794ef..2190c5c 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -2824,14 +2824,14 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) { m_resize_corner = (me.y < cy) ? RIGHTTOP : RIGHTBOTTOM; startResizing(me.window, me.x, me.y); - } else if (resizing) { - // draw over old rect - parent().drawRectangle(screen().rootTheme().opGC(), - m_last_resize_x, m_last_resize_y, - m_last_resize_w - 1 + 2 * frame().window().borderWidth(), - m_last_resize_h - 1 + 2 * frame().window().borderWidth()); - + } else if (resizing) { + + int old_resize_x = m_last_resize_x; + int old_resize_y = m_last_resize_y; + int old_resize_w = m_last_resize_w; + int old_resize_h = m_last_resize_h; + // move rectangle int gx = 0, gy = 0; @@ -2854,13 +2854,25 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) { fixsize(&gx, &gy); - // draw resize rectangle - parent().drawRectangle(screen().rootTheme().opGC(), - m_last_resize_x, m_last_resize_y, - m_last_resize_w - 1 + 2 * frame().window().borderWidth(), - m_last_resize_h - 1 + 2 * frame().window().borderWidth()); + if (old_resize_x != m_last_resize_x || + old_resize_y != m_last_resize_y || + old_resize_w != m_last_resize_w || + old_resize_h != m_last_resize_h ) { - screen().showGeometry(gx, gy); + // draw over old rect + parent().drawRectangle(screen().rootTheme().opGC(), + old_resize_x, old_resize_y, + old_resize_w - 1 + 2 * frame().window().borderWidth(), + old_resize_h - 1 + 2 * frame().window().borderWidth()); + + // draw resize rectangle + parent().drawRectangle(screen().rootTheme().opGC(), + m_last_resize_x, m_last_resize_y, + m_last_resize_w - 1 + 2 * frame().window().borderWidth(), + m_last_resize_h - 1 + 2 * frame().window().borderWidth()); + + screen().showGeometry(gx, gy); + } } } else if (functions.tabable && (me.state & Button2Mask) && inside_titlebar && (client != 0 || m_attaching_tab != 0)) { @@ -3355,6 +3367,7 @@ void FluxboxWindow::doSnapping(int &orig_left, int &orig_top) { void FluxboxWindow::startResizing(Window win, int x, int y) { + if (s_num_grabs > 0 || isShaded() || isIconic() ) return; @@ -3379,18 +3392,17 @@ void FluxboxWindow::startResizing(Window win, int x, int y) { fixsize(&gx, &gy); - screen().showGeometry(gx, gy); parent().drawRectangle(screen().rootTheme().opGC(), - m_last_resize_x, m_last_resize_y, - m_last_resize_w - 1 + 2 * frame().window().borderWidth(), - m_last_resize_h - 1 + 2 * frame().window().borderWidth()); + m_last_resize_x, m_last_resize_y, + m_last_resize_w - 1 + 2 * frame().window().borderWidth(), + m_last_resize_h - 1 + 2 * frame().window().borderWidth()); } void FluxboxWindow::stopResizing(bool interrupted) { resizing = false; - + parent().drawRectangle(screen().rootTheme().opGC(), m_last_resize_x, m_last_resize_y, m_last_resize_w - 1 + 2 * frame().window().borderWidth(), -- cgit v0.11.2