diff options
author | markt <markt> | 2007-07-06 17:48:02 (GMT) |
---|---|---|
committer | markt <markt> | 2007-07-06 17:48:02 (GMT) |
commit | d39a5489b18ef28f21ba910c76cba8f1342bc97c (patch) | |
tree | 490f46a6cf9db5dc96f8f1e3d0452aa08d3717f8 /src/Window.cc | |
parent | ae3c30423925960fe70262d1d7e4079b73531c37 (diff) | |
download | fluxbox-d39a5489b18ef28f21ba910c76cba8f1342bc97c.zip fluxbox-d39a5489b18ef28f21ba910c76cba8f1342bc97c.tar.bz2 |
we know better than MPlayer
Diffstat (limited to 'src/Window.cc')
-rw-r--r-- | src/Window.cc | 53 |
1 files changed, 40 insertions, 13 deletions
diff --git a/src/Window.cc b/src/Window.cc index 1bfab7f..3a2801b 100644 --- a/src/Window.cc +++ b/src/Window.cc | |||
@@ -249,6 +249,7 @@ FluxboxWindow::FluxboxWindow(WinClient &client, FbWinFrameTheme &tm, | |||
249 | m_titlesig(*this), | 249 | m_titlesig(*this), |
250 | m_attentionsig(*this), | 250 | m_attentionsig(*this), |
251 | m_themelistener(*this), | 251 | m_themelistener(*this), |
252 | m_creation_time(0), | ||
252 | moving(false), resizing(false), shaded(false), | 253 | moving(false), resizing(false), shaded(false), |
253 | iconic(false), focused(false), | 254 | iconic(false), focused(false), |
254 | stuck(false), m_initialized(false), fullscreen(false), | 255 | stuck(false), m_initialized(false), fullscreen(false), |
@@ -537,6 +538,10 @@ void FluxboxWindow::init() { | |||
537 | } else | 538 | } else |
538 | deiconify(false); | 539 | deiconify(false); |
539 | 540 | ||
541 | struct timeval now; | ||
542 | gettimeofday(&now, NULL); | ||
543 | m_creation_time = now.tv_sec; | ||
544 | |||
540 | sendConfigureNotify(); | 545 | sendConfigureNotify(); |
541 | // no focus default | 546 | // no focus default |
542 | setFocusFlag(false); | 547 | setFocusFlag(false); |
@@ -2561,23 +2566,49 @@ void FluxboxWindow::configureRequestEvent(XConfigureRequestEvent &cr) { | |||
2561 | if (client == 0 || isIconic()) | 2566 | if (client == 0 || isIconic()) |
2562 | return; | 2567 | return; |
2563 | 2568 | ||
2564 | int cx = frame().x(), cy = frame().y(), ignore = 0; | 2569 | int old_x = frame().x(), old_y = frame().y(); |
2565 | unsigned int cw = frame().width(), ch = frame().height(); | 2570 | unsigned int old_w = frame().width(); |
2571 | unsigned int old_h = frame().height() - frame().titlebarHeight() | ||
2572 | + frame().handleHeight(); | ||
2573 | int cx = old_x, cy = old_y, ignore = 0; | ||
2574 | unsigned int cw = old_w, ch = old_h; | ||
2566 | 2575 | ||
2567 | // make sure the new width/height would be ok with all clients, or else they | 2576 | // make sure the new width/height would be ok with all clients, or else they |
2568 | // could try to resize the window back and forth | 2577 | // could try to resize the window back and forth |
2569 | if (client != m_client && | 2578 | if (cr.value_mask & CWWidth || cr.value_mask & CWHeight) { |
2570 | cr.value_mask & CWWidth && cr.value_mask & CWHeight) { | 2579 | int new_w = (cr.value_mask & CWWidth) ? cr.width : cw; |
2580 | int new_h = (cr.value_mask & CWHeight) ? cr.height : ch; | ||
2571 | ClientList::iterator it = clientList().begin(); | 2581 | ClientList::iterator it = clientList().begin(); |
2572 | ClientList::iterator it_end = clientList().end(); | 2582 | ClientList::iterator it_end = clientList().end(); |
2573 | for (; it != it_end; ++it) { | 2583 | for (; it != it_end; ++it) { |
2574 | if (!m_client->checkSizeHints(cr.width, cr.height)) { | 2584 | if (*it != client && !(*it)->checkSizeHints(new_w, new_h)) { |
2575 | sendConfigureNotify(); | 2585 | sendConfigureNotify(); |
2576 | return; | 2586 | return; |
2577 | } | 2587 | } |
2578 | } | 2588 | } |
2579 | } | 2589 | } |
2580 | 2590 | ||
2591 | #ifdef REMEMBER | ||
2592 | // don't let misbehaving clients (e.g. MPlayer) move/resize their windows | ||
2593 | // just after creation if the user has a saved position/size | ||
2594 | if (m_creation_time) { | ||
2595 | struct timeval now; | ||
2596 | gettimeofday(&now, NULL); | ||
2597 | |||
2598 | if (now.tv_sec > m_creation_time + 1) | ||
2599 | m_creation_time = 0; | ||
2600 | else { | ||
2601 | if (Remember::instance().isRemembered(*client, | ||
2602 | Remember::REM_DIMENSIONS)) | ||
2603 | cr.value_mask = cr.value_mask & ~(CWWidth | CWHeight); | ||
2604 | |||
2605 | if (Remember::instance().isRemembered(*client, | ||
2606 | Remember::REM_POSITION)) | ||
2607 | cr.value_mask = cr.value_mask & ~(CWX | CWY); | ||
2608 | } | ||
2609 | } | ||
2610 | #endif // REMEMBER | ||
2611 | |||
2581 | if (cr.value_mask & CWBorderWidth) | 2612 | if (cr.value_mask & CWBorderWidth) |
2582 | client->old_bw = cr.border_width; | 2613 | client->old_bw = cr.border_width; |
2583 | 2614 | ||
@@ -2597,24 +2628,20 @@ void FluxboxWindow::configureRequestEvent(XConfigureRequestEvent &cr) { | |||
2597 | frame().setActiveGravity(client->gravity(), client->old_bw); | 2628 | frame().setActiveGravity(client->gravity(), client->old_bw); |
2598 | } | 2629 | } |
2599 | 2630 | ||
2600 | if (cr.value_mask & CWWidth) { | 2631 | if (cr.value_mask & CWWidth) |
2601 | cw = cr.width; | 2632 | cw = cr.width; |
2602 | // we must set this now, or else window grows when height not specified | ||
2603 | ch -= (frame().titlebarHeight() + frame().handleHeight()); | ||
2604 | } | ||
2605 | 2633 | ||
2606 | if (cr.value_mask & CWHeight) | 2634 | if (cr.value_mask & CWHeight) |
2607 | ch = cr.height; | 2635 | ch = cr.height; |
2608 | 2636 | ||
2609 | // whether we should send ConfigureNotify to netizens | 2637 | // whether we should send ConfigureNotify to netizens |
2610 | // the request is for client window so we resize the frame to it first | 2638 | // the request is for client window so we resize the frame to it first |
2611 | // NOTE: this might not work correctly if client actually requests that size | 2639 | if (old_w != cw || old_h != ch) { |
2612 | if (frame().width() != cw || frame().height() != ch) { | 2640 | if (old_x != cx || old_y != cy) |
2613 | if (frame().x() != cx || frame().y() != cy) | ||
2614 | frame().moveResizeForClient(cx, cy, cw, ch); | 2641 | frame().moveResizeForClient(cx, cy, cw, ch); |
2615 | else | 2642 | else |
2616 | frame().resizeForClient(cw, ch); | 2643 | frame().resizeForClient(cw, ch); |
2617 | } else if (frame().x() != cx || frame().y() != cy) { | 2644 | } else if (old_x != cx || old_y != cy) { |
2618 | frame().move(cx, cy); | 2645 | frame().move(cx, cy); |
2619 | } | 2646 | } |
2620 | 2647 | ||