all repos — fluxbox @ b3ba75792908cbc14555001d7495828206a23fdc

custom fork of the fluxbox windowmanager

various frame size, and window resize/moving/outline bugs
rathnor rathnor
commit

b3ba75792908cbc14555001d7495828206a23fdc

parent

0470d0087cd7d95f906e901414de80da318a1bfa

3 files changed, 92 insertions(+), 58 deletions(-)

jump to
M ChangeLogChangeLog

@@ -1,6 +1,8 @@

(Format: Year/Month/Day) Changes for 0.1.15: *03/02/22: + * Fix frame size and window moving/resizing/outline bugs (Simon) + Window.cc FbWinFrame.cc * s/""/'' so the shell does not have to expand the contents of the string in fluxbox_generatemenu (Han) * Added portability notes in fluxbox_generatemenu (Han)
M src/FbWinFrame.ccsrc/FbWinFrame.cc

@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: FbWinFrame.cc,v 1.12 2003/02/23 00:57:55 fluxgen Exp $ +// $Id: FbWinFrame.cc,v 1.13 2003/02/23 13:40:22 rathnor Exp $ #include "FbWinFrame.hh" #include "ImageControl.hh"

@@ -170,16 +170,16 @@ reconfigure();

} void FbWinFrame::resizeForClient(unsigned int width, unsigned int height) { - // total height for frame without client - int handle_height = m_handle.height() + m_handle.borderWidth(); - int titlebar_height = m_titlebar.height() + m_titlebar.borderWidth(); - unsigned int total_height = handle_height + titlebar_height; - // resize frame height with total height + specified height - if (!m_use_titlebar) - total_height -= titlebar_height; - if (!m_use_handle) - total_height -= handle_height; - resize(width, total_height + height); + // total height for frame + unsigned int total_height = height; + + // having a titlebar = 1 extra border + titlebar height + if (m_use_titlebar) + total_height += m_titlebar.height() + m_titlebar.borderWidth(); + // having a handle = 1 extra border + handle height + if (m_use_handle) + total_height += m_handle.height() + m_handle.borderWidth(); + resize(width, total_height); } void FbWinFrame::moveResize(int x, int y, unsigned int width, unsigned int height) {

@@ -280,8 +280,10 @@

m_titlebar.hide(); m_use_titlebar = false; m_clientarea.raise(); + + // only take away one borderwidth (as the other border is still the "top" border) m_window.resize(m_window.width(), m_window.height() - m_titlebar.height() - - m_titlebar.borderWidth()*2); + m_titlebar.borderWidth()); #ifdef DEBUG cerr<<__FILE__<<": Hide Titlebar"<<endl; #endif // DEBUG

@@ -293,30 +295,43 @@ return;

m_titlebar.show(); m_use_titlebar = true; + + // only add one borderwidth (as the other border is still the "top" border) + m_window.resize(m_window.width(), m_window.height() + m_titlebar.height() + + m_titlebar.borderWidth()); + #ifdef DEBUG cerr<<__FILE__<<": Show Titlebar"<<endl; #endif // DEBUG } void FbWinFrame::hideHandle() { + if (!m_use_handle) + return; m_handle.hide(); m_grip_left.hide(); m_grip_right.hide(); m_use_handle = false; + m_window.resize(m_window.width(), m_window.height() - m_handle.height() - + m_handle.borderWidth()); + } void FbWinFrame::showHandle() { + if (m_use_handle) + return; m_handle.show(); m_grip_left.show(); m_grip_right.show(); m_use_handle = true; + m_window.resize(m_window.width(), m_window.height() + m_handle.height() + + m_handle.borderWidth()); } void FbWinFrame::hideAllDecorations() { hideHandle(); hideTitlebar(); - m_window.setBorderWidth(0); - m_window.resize(m_clientarea.width(), m_clientarea.height()); + // resize done by hide* reconfigure(); }

@@ -325,7 +340,7 @@ if (!m_use_handle)

showHandle(); if (!m_use_titlebar) showTitlebar(); - resizeForClient(m_clientarea.width(), m_clientarea.height()); + // resize shouldn't be necessary reconfigure(); }

@@ -395,6 +410,10 @@ if (m_titlebar == event.window)

redrawTitlebar(); else if (m_label == event.window) redrawTitle(); + else if (m_handle == event.window || + m_grip_left == event.window || + m_grip_right == event.window) + renderHandles(); } void FbWinFrame::handleEvent(XEvent &event) {

@@ -415,28 +434,28 @@ // align titlebar and render it

if (m_use_titlebar) reconfigureTitlebar(); - // setup client area size/pos - int next_y = m_titlebar.height() + m_titlebar.borderWidth(); - unsigned int client_height = - m_window.height() - next_y; - /*- m_titlebar.height() - m_titlebar.y() - m_handle.height();*/ + int client_top = 0; + int client_height = m_window.height(); + if (m_use_titlebar) { + // only one borderwidth as titlebar is really at -borderwidth + int titlebar_height = m_titlebar.height() + m_titlebar.borderWidth(); + client_top += titlebar_height; + client_height -= titlebar_height; + } - if (!m_use_titlebar) { - next_y = -m_titlebar.y(); - if (!m_use_handle) - client_height = m_window.height(); - else - client_height = m_window.height() - m_handle.height(); + if (m_use_handle) { + client_height -= m_handle.height() + m_handle.borderWidth(); } - m_clientarea.moveResize(0, m_titlebar.y() + next_y, + m_clientarea.moveResize(0, client_top, m_window.width(), client_height); if (m_clientwin != 0) { XMoveResizeWindow(FbTk::App::instance()->display(), m_clientwin, 0, 0, m_clientarea.width(), m_clientarea.height()); - } + } + if (!m_use_handle) // no need to do anything more return;

@@ -444,19 +463,18 @@

// align handle and grips const int grip_height = m_handle.height(); const int grip_width = 20; //TODO - - const int ypos = m_window.height() - grip_height; + + const int ypos = m_window.height() - grip_height - m_handle.borderWidth(); - m_grip_left.moveResize(0, ypos, + m_grip_left.moveResize(-m_handle.borderWidth(), ypos, grip_width, grip_height); m_handle.moveResize(grip_width, ypos, - m_window.width() - grip_width*2, grip_height); - - m_grip_right.moveResize(m_window.width() - grip_width, ypos, + m_window.width() - grip_width*2 - m_handle.borderWidth()*2, grip_height); + + m_grip_right.moveResize(m_window.width() - grip_width - m_handle.borderWidth(), ypos, grip_width, grip_height); - // render the theme renderButtons(); renderHandles();
M src/Window.ccsrc/Window.cc

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Window.cc,v 1.125 2003/02/22 21:40:35 fluxgen Exp $ +// $Id: Window.cc,v 1.126 2003/02/23 13:40:22 rathnor Exp $ #include "Window.hh"

@@ -349,6 +349,7 @@ deiconify(); //we're omnipresent and visible

} setState(current_state); + m_frame.resizeForClient(wattrib.width, wattrib.height); // no focus default setFocusFlag(false);

@@ -497,21 +498,22 @@

void FluxboxWindow::positionWindows() { m_frame.window().setBorderWidth(screen->getBorderWidth()); - m_frame.clientArea().setBorderWidth(screen->getFrameWidth()); + m_frame.clientArea().setBorderWidth(0); // client area bordered by other things + m_frame.titlebar().setBorderWidth(screen->getBorderWidth()); if (decorations.titlebar) { - m_frame.titlebar().setBorderWidth(screen->getBorderWidth()); m_frame.showTitlebar(); } else { m_frame.hideTitlebar(); } + + m_frame.handle().setBorderWidth(screen->getBorderWidth()); + m_frame.gripLeft().setBorderWidth(screen->getBorderWidth()); + m_frame.gripRight().setBorderWidth(screen->getBorderWidth()); - if (decorations.handle) { - m_frame.handle().setBorderWidth(screen->getBorderWidth()); - m_frame.gripLeft().setBorderWidth(screen->getBorderWidth()); - m_frame.gripRight().setBorderWidth(screen->getBorderWidth()); + if (decorations.handle) m_frame.showHandle(); - } else + else m_frame.hideHandle(); m_frame.reconfigure();

@@ -2111,11 +2113,13 @@

if (! screen->doOpaqueMove()) { XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(), last_move_x, last_move_y, - m_frame.width(), m_frame.height()); + m_frame.width() + 2*frame().window().borderWidth(), + m_frame.height() + 2*frame().window().borderWidth()); XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(), dx, dy, - m_frame.width(), m_frame.height()); + m_frame.width() + 2*frame().window().borderWidth(), + m_frame.height() + 2*frame().window().borderWidth()); last_move_x = dx; last_move_y = dy; } else {

@@ -2138,7 +2142,8 @@ } else if (resizing) {

// draw over old rect XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(), last_resize_x, last_resize_y, - last_resize_w - 1, last_resize_h-1); + last_resize_w - 1 + 2 * m_frame.window().borderWidth(), + last_resize_h - 1 + 2 * m_frame.window().borderWidth()); // move rectangle

@@ -2165,7 +2170,8 @@

// draw resize rectangle XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(), last_resize_x, last_resize_y, - last_resize_w - 1, last_resize_h - 1); + last_resize_w - 1 + 2 * m_frame.window().borderWidth(), + last_resize_h - 1 + 2 * m_frame.window().borderWidth()); if (screen->doShowWindowPos()) screen->showGeometry(gx, gy);

@@ -2304,7 +2310,8 @@ last_move_y = frame().y();

if (! screen->doOpaqueMove()) { XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(), frame().x(), frame().y(), - frame().width(), frame().height()); + frame().width() + 2*frame().window().borderWidth(), + frame().height() + 2*frame().window().borderWidth()); screen->showPosition(frame().x(), frame().y()); } }

@@ -2319,7 +2326,8 @@

if (! screen->doOpaqueMove()) { XDrawRectangle(FbTk::App::instance()->display(), screen->getRootWindow(), screen->getOpGC(), last_move_x, last_move_y, - frame().width(), frame().height()); + frame().width() + 2*frame().window().borderWidth(), + frame().height() + 2*frame().window().borderWidth()); moveResize(last_move_x, last_move_y, m_frame.width(), m_frame.height()); } else moveResize(m_frame.x(), m_frame.y(), m_frame.width(), m_frame.height());

@@ -2349,12 +2357,12 @@ (left ? fluxbox->getLowerLeftAngleCursor() : fluxbox->getLowerRightAngleCursor()),

CurrentTime); int gx = 0, gy = 0; - button_grab_x = x - screen->getBorderWidth(); - button_grab_y = y - screen->getBorderWidth2x(); + button_grab_x = x; + button_grab_y = y; last_resize_x = m_frame.x(); last_resize_y = m_frame.y(); - last_resize_w = m_frame.width() + screen->getBorderWidth2x(); - last_resize_h = m_frame.height() + screen->getBorderWidth2x(); + last_resize_w = m_frame.width(); + last_resize_h = m_frame.height(); if (left) left_fixsize(&gx, &gy);

@@ -2366,7 +2374,8 @@ screen->showGeometry(gx, gy);

XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(), last_resize_x, last_resize_y, - last_resize_w - 1, last_resize_h - 1); + last_resize_w - 1 + 2 * m_frame.window().borderWidth(), + last_resize_h - 1 + 2 * m_frame.window().borderWidth()); } void FluxboxWindow::stopResizing(Window win) {

@@ -2374,7 +2383,8 @@ resizing = false;

XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(), last_resize_x, last_resize_y, - last_resize_w - 1, last_resize_h - 1); + last_resize_w - 1 + 2 * m_frame.window().borderWidth(), + last_resize_h - 1 + 2 * m_frame.window().borderWidth()); screen->hideGeometry();

@@ -2385,8 +2395,8 @@ right_fixsize();

moveResize(last_resize_x, last_resize_y, - last_resize_w - screen->getBorderWidth2x(), - last_resize_h - screen->getBorderWidth2x()); + last_resize_w; + last_resize_h; XUngrabPointer(display, CurrentTime); }

@@ -2596,7 +2606,11 @@ void FluxboxWindow::left_fixsize(int *gx, int *gy) {

int titlebar_height = (decorations.titlebar ? frame().titlebar().height() + frame().titlebar().borderWidth() : 0); int handle_height = (decorations.handle ? frame().handle().height() + frame().handle().borderWidth() : 0); int decoration_height = titlebar_height + handle_height; + + // dx is new width = current width + difference between new and old x values int dx = m_frame.width() + m_frame.x() - last_resize_x; + + // dy = new height (w/o decorations), similarly int dy = last_resize_h - client.base_height - decoration_height; // check minimum size

@@ -2617,7 +2631,7 @@ client.width_inc = 1;

if (client.height_inc == 0) client.height_inc = 1; - // set snaping + // set snapping dx /= client.width_inc; dy /= client.height_inc;