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 | |
parent | ae3c30423925960fe70262d1d7e4079b73531c37 (diff) | |
download | fluxbox_pavel-d39a5489b18ef28f21ba910c76cba8f1342bc97c.zip fluxbox_pavel-d39a5489b18ef28f21ba910c76cba8f1342bc97c.tar.bz2 |
we know better than MPlayer
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | src/Remember.cc | 12 | ||||
-rw-r--r-- | src/Window.cc | 53 | ||||
-rw-r--r-- | src/Window.hh | 2 |
4 files changed, 55 insertions, 19 deletions
@@ -1,5 +1,12 @@ | |||
1 | (Format: Year/Month/Day) | 1 | (Format: Year/Month/Day) |
2 | Changes for 1.0.0: | 2 | Changes for 1.0.0: |
3 | *07/07/06: | ||
4 | * When saving window information, use the class name instead of instance name | ||
5 | by default (Mark) | ||
6 | Remember.cc | ||
7 | * Prevent apps (e.g. MPlayer) from moving/resizing just after creation if the | ||
8 | position/size is saved in the apps file (Mark) | ||
9 | Window.cc/hh | ||
3 | *07/07/03: | 10 | *07/07/03: |
4 | * Avoid some problems with tabbed windows and resize increments (Mark) | 11 | * Avoid some problems with tabbed windows and resize increments (Mark) |
5 | Window.cc WinClient.cc/hh | 12 | Window.cc WinClient.cc/hh |
diff --git a/src/Remember.cc b/src/Remember.cc index 30a3e14..aec9921 100644 --- a/src/Remember.cc +++ b/src/Remember.cc | |||
@@ -319,15 +319,15 @@ Application * Remember::add(WinClient &winclient) { | |||
319 | Application *app = new Application(0); | 319 | Application *app = new Application(0); |
320 | 320 | ||
321 | // by default, we match against the WMClass of a window. | 321 | // by default, we match against the WMClass of a window. |
322 | string win_name = p->getProperty(ClientPattern::NAME, winclient); | 322 | string win_class = p->getProperty(ClientPattern::CLASS, winclient); |
323 | 323 | ||
324 | // replace special chars like ( ) and [ ] with \( \) and \[ \] | 324 | // replace special chars like ( ) and [ ] with \( \) and \[ \] |
325 | win_name = FbTk::StringUtil::replaceString(win_name, "(", "\\("); | 325 | win_class = FbTk::StringUtil::replaceString(win_class, "(", "\\("); |
326 | win_name = FbTk::StringUtil::replaceString(win_name, ")", "\\)"); | 326 | win_class = FbTk::StringUtil::replaceString(win_class, ")", "\\)"); |
327 | win_name = FbTk::StringUtil::replaceString(win_name, "[", "\\["); | 327 | win_class = FbTk::StringUtil::replaceString(win_class, "[", "\\["); |
328 | win_name = FbTk::StringUtil::replaceString(win_name, "]", "\\]"); | 328 | win_class = FbTk::StringUtil::replaceString(win_class, "]", "\\]"); |
329 | 329 | ||
330 | p->addTerm(win_name, ClientPattern::NAME); | 330 | p->addTerm(win_class, ClientPattern::CLASS); |
331 | m_clients[&winclient] = app; | 331 | m_clients[&winclient] = app; |
332 | p->addMatch(); | 332 | p->addMatch(); |
333 | m_pats->push_back(make_pair(p, app)); | 333 | m_pats->push_back(make_pair(p, app)); |
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 | ||
diff --git a/src/Window.hh b/src/Window.hh index d9e4a7c..340df7b 100644 --- a/src/Window.hh +++ b/src/Window.hh | |||
@@ -514,6 +514,8 @@ private: | |||
514 | }; | 514 | }; |
515 | ThemeListener m_themelistener; | 515 | ThemeListener m_themelistener; |
516 | 516 | ||
517 | time_t m_creation_time; | ||
518 | |||
517 | // Window states | 519 | // Window states |
518 | bool moving, resizing, shaded, iconic, | 520 | bool moving, resizing, shaded, iconic, |
519 | focused, stuck, m_initialized, fullscreen; | 521 | focused, stuck, m_initialized, fullscreen; |