diff options
author | rathnor <rathnor> | 2003-02-23 13:40:22 (GMT) |
---|---|---|
committer | rathnor <rathnor> | 2003-02-23 13:40:22 (GMT) |
commit | b3ba75792908cbc14555001d7495828206a23fdc (patch) | |
tree | c7394cff7c2d97286570f0b52c85a990423d04c3 /src/Window.cc | |
parent | 0470d0087cd7d95f906e901414de80da318a1bfa (diff) | |
download | fluxbox-b3ba75792908cbc14555001d7495828206a23fdc.zip fluxbox-b3ba75792908cbc14555001d7495828206a23fdc.tar.bz2 |
various frame size, and window resize/moving/outline bugs
Diffstat (limited to 'src/Window.cc')
-rw-r--r-- | src/Window.cc | 60 |
1 files changed, 37 insertions, 23 deletions
diff --git a/src/Window.cc b/src/Window.cc index 8871253..f0e3393 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.125 2003/02/22 21:40:35 fluxgen Exp $ | 25 | // $Id: Window.cc,v 1.126 2003/02/23 13:40:22 rathnor Exp $ |
26 | 26 | ||
27 | #include "Window.hh" | 27 | #include "Window.hh" |
28 | 28 | ||
@@ -349,6 +349,7 @@ FluxboxWindow::FluxboxWindow(Window w, BScreen *s, int screen_num, | |||
349 | } | 349 | } |
350 | 350 | ||
351 | setState(current_state); | 351 | setState(current_state); |
352 | m_frame.resizeForClient(wattrib.width, wattrib.height); | ||
352 | 353 | ||
353 | // no focus default | 354 | // no focus default |
354 | setFocusFlag(false); | 355 | setFocusFlag(false); |
@@ -497,21 +498,22 @@ void FluxboxWindow::reconfigure() { | |||
497 | void FluxboxWindow::positionWindows() { | 498 | void FluxboxWindow::positionWindows() { |
498 | 499 | ||
499 | m_frame.window().setBorderWidth(screen->getBorderWidth()); | 500 | m_frame.window().setBorderWidth(screen->getBorderWidth()); |
500 | m_frame.clientArea().setBorderWidth(screen->getFrameWidth()); | 501 | m_frame.clientArea().setBorderWidth(0); // client area bordered by other things |
501 | 502 | ||
503 | m_frame.titlebar().setBorderWidth(screen->getBorderWidth()); | ||
502 | if (decorations.titlebar) { | 504 | if (decorations.titlebar) { |
503 | m_frame.titlebar().setBorderWidth(screen->getBorderWidth()); | ||
504 | m_frame.showTitlebar(); | 505 | m_frame.showTitlebar(); |
505 | } else { | 506 | } else { |
506 | m_frame.hideTitlebar(); | 507 | m_frame.hideTitlebar(); |
507 | } | 508 | } |
509 | |||
510 | m_frame.handle().setBorderWidth(screen->getBorderWidth()); | ||
511 | m_frame.gripLeft().setBorderWidth(screen->getBorderWidth()); | ||
512 | m_frame.gripRight().setBorderWidth(screen->getBorderWidth()); | ||
508 | 513 | ||
509 | if (decorations.handle) { | 514 | if (decorations.handle) |
510 | m_frame.handle().setBorderWidth(screen->getBorderWidth()); | ||
511 | m_frame.gripLeft().setBorderWidth(screen->getBorderWidth()); | ||
512 | m_frame.gripRight().setBorderWidth(screen->getBorderWidth()); | ||
513 | m_frame.showHandle(); | 515 | m_frame.showHandle(); |
514 | } else | 516 | else |
515 | m_frame.hideHandle(); | 517 | m_frame.hideHandle(); |
516 | 518 | ||
517 | m_frame.reconfigure(); | 519 | m_frame.reconfigure(); |
@@ -2111,11 +2113,13 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) { | |||
2111 | if (! screen->doOpaqueMove()) { | 2113 | if (! screen->doOpaqueMove()) { |
2112 | XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(), | 2114 | XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(), |
2113 | last_move_x, last_move_y, | 2115 | last_move_x, last_move_y, |
2114 | m_frame.width(), m_frame.height()); | 2116 | m_frame.width() + 2*frame().window().borderWidth(), |
2117 | m_frame.height() + 2*frame().window().borderWidth()); | ||
2115 | 2118 | ||
2116 | XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(), | 2119 | XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(), |
2117 | dx, dy, | 2120 | dx, dy, |
2118 | m_frame.width(), m_frame.height()); | 2121 | m_frame.width() + 2*frame().window().borderWidth(), |
2122 | m_frame.height() + 2*frame().window().borderWidth()); | ||
2119 | last_move_x = dx; | 2123 | last_move_x = dx; |
2120 | last_move_y = dy; | 2124 | last_move_y = dy; |
2121 | } else { | 2125 | } else { |
@@ -2138,7 +2142,8 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) { | |||
2138 | // draw over old rect | 2142 | // draw over old rect |
2139 | XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(), | 2143 | XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(), |
2140 | last_resize_x, last_resize_y, | 2144 | last_resize_x, last_resize_y, |
2141 | last_resize_w - 1, last_resize_h-1); | 2145 | last_resize_w - 1 + 2 * m_frame.window().borderWidth(), |
2146 | last_resize_h - 1 + 2 * m_frame.window().borderWidth()); | ||
2142 | 2147 | ||
2143 | 2148 | ||
2144 | // move rectangle | 2149 | // move rectangle |
@@ -2165,7 +2170,8 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) { | |||
2165 | // draw resize rectangle | 2170 | // draw resize rectangle |
2166 | XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(), | 2171 | XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(), |
2167 | last_resize_x, last_resize_y, | 2172 | last_resize_x, last_resize_y, |
2168 | last_resize_w - 1, last_resize_h - 1); | 2173 | last_resize_w - 1 + 2 * m_frame.window().borderWidth(), |
2174 | last_resize_h - 1 + 2 * m_frame.window().borderWidth()); | ||
2169 | 2175 | ||
2170 | if (screen->doShowWindowPos()) | 2176 | if (screen->doShowWindowPos()) |
2171 | screen->showGeometry(gx, gy); | 2177 | screen->showGeometry(gx, gy); |
@@ -2304,7 +2310,8 @@ void FluxboxWindow::startMoving(Window win) { | |||
2304 | if (! screen->doOpaqueMove()) { | 2310 | if (! screen->doOpaqueMove()) { |
2305 | XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(), | 2311 | XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(), |
2306 | frame().x(), frame().y(), | 2312 | frame().x(), frame().y(), |
2307 | frame().width(), frame().height()); | 2313 | frame().width() + 2*frame().window().borderWidth(), |
2314 | frame().height() + 2*frame().window().borderWidth()); | ||
2308 | screen->showPosition(frame().x(), frame().y()); | 2315 | screen->showPosition(frame().x(), frame().y()); |
2309 | } | 2316 | } |
2310 | } | 2317 | } |
@@ -2319,7 +2326,8 @@ void FluxboxWindow::stopMoving() { | |||
2319 | if (! screen->doOpaqueMove()) { | 2326 | if (! screen->doOpaqueMove()) { |
2320 | XDrawRectangle(FbTk::App::instance()->display(), screen->getRootWindow(), screen->getOpGC(), | 2327 | XDrawRectangle(FbTk::App::instance()->display(), screen->getRootWindow(), screen->getOpGC(), |
2321 | last_move_x, last_move_y, | 2328 | last_move_x, last_move_y, |
2322 | frame().width(), frame().height()); | 2329 | frame().width() + 2*frame().window().borderWidth(), |
2330 | frame().height() + 2*frame().window().borderWidth()); | ||
2323 | moveResize(last_move_x, last_move_y, m_frame.width(), m_frame.height()); | 2331 | moveResize(last_move_x, last_move_y, m_frame.width(), m_frame.height()); |
2324 | } else | 2332 | } else |
2325 | moveResize(m_frame.x(), m_frame.y(), m_frame.width(), m_frame.height()); | 2333 | moveResize(m_frame.x(), m_frame.y(), m_frame.width(), m_frame.height()); |
@@ -2349,12 +2357,12 @@ void FluxboxWindow::startResizing(Window win, int x, int y, bool left) { | |||
2349 | CurrentTime); | 2357 | CurrentTime); |
2350 | 2358 | ||
2351 | int gx = 0, gy = 0; | 2359 | int gx = 0, gy = 0; |
2352 | button_grab_x = x - screen->getBorderWidth(); | 2360 | button_grab_x = x; |
2353 | button_grab_y = y - screen->getBorderWidth2x(); | 2361 | button_grab_y = y; |
2354 | last_resize_x = m_frame.x(); | 2362 | last_resize_x = m_frame.x(); |
2355 | last_resize_y = m_frame.y(); | 2363 | last_resize_y = m_frame.y(); |
2356 | last_resize_w = m_frame.width() + screen->getBorderWidth2x(); | 2364 | last_resize_w = m_frame.width(); |
2357 | last_resize_h = m_frame.height() + screen->getBorderWidth2x(); | 2365 | last_resize_h = m_frame.height(); |
2358 | 2366 | ||
2359 | if (left) | 2367 | if (left) |
2360 | left_fixsize(&gx, &gy); | 2368 | left_fixsize(&gx, &gy); |
@@ -2366,7 +2374,8 @@ void FluxboxWindow::startResizing(Window win, int x, int y, bool left) { | |||
2366 | 2374 | ||
2367 | XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(), | 2375 | XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(), |
2368 | last_resize_x, last_resize_y, | 2376 | last_resize_x, last_resize_y, |
2369 | last_resize_w - 1, last_resize_h - 1); | 2377 | last_resize_w - 1 + 2 * m_frame.window().borderWidth(), |
2378 | last_resize_h - 1 + 2 * m_frame.window().borderWidth()); | ||
2370 | } | 2379 | } |
2371 | 2380 | ||
2372 | void FluxboxWindow::stopResizing(Window win) { | 2381 | void FluxboxWindow::stopResizing(Window win) { |
@@ -2374,7 +2383,8 @@ void FluxboxWindow::stopResizing(Window win) { | |||
2374 | 2383 | ||
2375 | XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(), | 2384 | XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(), |
2376 | last_resize_x, last_resize_y, | 2385 | last_resize_x, last_resize_y, |
2377 | last_resize_w - 1, last_resize_h - 1); | 2386 | last_resize_w - 1 + 2 * m_frame.window().borderWidth(), |
2387 | last_resize_h - 1 + 2 * m_frame.window().borderWidth()); | ||
2378 | 2388 | ||
2379 | screen->hideGeometry(); | 2389 | screen->hideGeometry(); |
2380 | 2390 | ||
@@ -2385,8 +2395,8 @@ void FluxboxWindow::stopResizing(Window win) { | |||
2385 | 2395 | ||
2386 | 2396 | ||
2387 | moveResize(last_resize_x, last_resize_y, | 2397 | moveResize(last_resize_x, last_resize_y, |
2388 | last_resize_w - screen->getBorderWidth2x(), | 2398 | last_resize_w; |
2389 | last_resize_h - screen->getBorderWidth2x()); | 2399 | last_resize_h; |
2390 | 2400 | ||
2391 | XUngrabPointer(display, CurrentTime); | 2401 | XUngrabPointer(display, CurrentTime); |
2392 | } | 2402 | } |
@@ -2596,7 +2606,11 @@ void FluxboxWindow::left_fixsize(int *gx, int *gy) { | |||
2596 | int titlebar_height = (decorations.titlebar ? frame().titlebar().height() + frame().titlebar().borderWidth() : 0); | 2606 | int titlebar_height = (decorations.titlebar ? frame().titlebar().height() + frame().titlebar().borderWidth() : 0); |
2597 | int handle_height = (decorations.handle ? frame().handle().height() + frame().handle().borderWidth() : 0); | 2607 | int handle_height = (decorations.handle ? frame().handle().height() + frame().handle().borderWidth() : 0); |
2598 | int decoration_height = titlebar_height + handle_height; | 2608 | int decoration_height = titlebar_height + handle_height; |
2609 | |||
2610 | // dx is new width = current width + difference between new and old x values | ||
2599 | int dx = m_frame.width() + m_frame.x() - last_resize_x; | 2611 | int dx = m_frame.width() + m_frame.x() - last_resize_x; |
2612 | |||
2613 | // dy = new height (w/o decorations), similarly | ||
2600 | int dy = last_resize_h - client.base_height - decoration_height; | 2614 | int dy = last_resize_h - client.base_height - decoration_height; |
2601 | 2615 | ||
2602 | // check minimum size | 2616 | // check minimum size |
@@ -2617,7 +2631,7 @@ void FluxboxWindow::left_fixsize(int *gx, int *gy) { | |||
2617 | if (client.height_inc == 0) | 2631 | if (client.height_inc == 0) |
2618 | client.height_inc = 1; | 2632 | client.height_inc = 1; |
2619 | 2633 | ||
2620 | // set snaping | 2634 | // set snapping |
2621 | dx /= client.width_inc; | 2635 | dx /= client.width_inc; |
2622 | dy /= client.height_inc; | 2636 | dy /= client.height_inc; |
2623 | 2637 | ||