all repos — fluxbox @ d39a5489b18ef28f21ba910c76cba8f1342bc97c

custom fork of the fluxbox windowmanager

we know better than MPlayer
markt markt
commit

d39a5489b18ef28f21ba910c76cba8f1342bc97c

parent

ae3c30423925960fe70262d1d7e4079b73531c37

4 files changed, 55 insertions(+), 19 deletions(-)

jump to
M ChangeLogChangeLog

@@ -1,5 +1,12 @@

(Format: Year/Month/Day) Changes for 1.0.0: +*07/07/06: + * When saving window information, use the class name instead of instance name + by default (Mark) + Remember.cc + * Prevent apps (e.g. MPlayer) from moving/resizing just after creation if the + position/size is saved in the apps file (Mark) + Window.cc/hh *07/07/03: * Avoid some problems with tabbed windows and resize increments (Mark) Window.cc WinClient.cc/hh
M src/Remember.ccsrc/Remember.cc

@@ -319,15 +319,15 @@ ClientPattern *p = new ClientPattern();

Application *app = new Application(0); // by default, we match against the WMClass of a window. - string win_name = p->getProperty(ClientPattern::NAME, winclient); + string win_class = p->getProperty(ClientPattern::CLASS, winclient); // replace special chars like ( ) and [ ] with \( \) and \[ \] - win_name = FbTk::StringUtil::replaceString(win_name, "(", "\\("); - win_name = FbTk::StringUtil::replaceString(win_name, ")", "\\)"); - win_name = FbTk::StringUtil::replaceString(win_name, "[", "\\["); - win_name = FbTk::StringUtil::replaceString(win_name, "]", "\\]"); + win_class = FbTk::StringUtil::replaceString(win_class, "(", "\\("); + win_class = FbTk::StringUtil::replaceString(win_class, ")", "\\)"); + win_class = FbTk::StringUtil::replaceString(win_class, "[", "\\["); + win_class = FbTk::StringUtil::replaceString(win_class, "]", "\\]"); - p->addTerm(win_name, ClientPattern::NAME); + p->addTerm(win_class, ClientPattern::CLASS); m_clients[&winclient] = app; p->addMatch(); m_pats->push_back(make_pair(p, app));
M src/Window.ccsrc/Window.cc

@@ -249,6 +249,7 @@ m_focussig(*this),

m_titlesig(*this), m_attentionsig(*this), m_themelistener(*this), + m_creation_time(0), moving(false), resizing(false), shaded(false), iconic(false), focused(false), stuck(false), m_initialized(false), fullscreen(false),

@@ -536,6 +537,10 @@ iconic = false;

iconify(); } else deiconify(false); + + struct timeval now; + gettimeofday(&now, NULL); + m_creation_time = now.tv_sec; sendConfigureNotify(); // no focus default

@@ -2561,23 +2566,49 @@ WinClient *client = findClient(cr.window);

if (client == 0 || isIconic()) return; - int cx = frame().x(), cy = frame().y(), ignore = 0; - unsigned int cw = frame().width(), ch = frame().height(); + int old_x = frame().x(), old_y = frame().y(); + unsigned int old_w = frame().width(); + unsigned int old_h = frame().height() - frame().titlebarHeight() + + frame().handleHeight(); + int cx = old_x, cy = old_y, ignore = 0; + unsigned int cw = old_w, ch = old_h; // make sure the new width/height would be ok with all clients, or else they // could try to resize the window back and forth - if (client != m_client && - cr.value_mask & CWWidth && cr.value_mask & CWHeight) { + if (cr.value_mask & CWWidth || cr.value_mask & CWHeight) { + int new_w = (cr.value_mask & CWWidth) ? cr.width : cw; + int new_h = (cr.value_mask & CWHeight) ? cr.height : ch; ClientList::iterator it = clientList().begin(); ClientList::iterator it_end = clientList().end(); for (; it != it_end; ++it) { - if (!m_client->checkSizeHints(cr.width, cr.height)) { + if (*it != client && !(*it)->checkSizeHints(new_w, new_h)) { sendConfigureNotify(); return; } } } +#ifdef REMEMBER + // don't let misbehaving clients (e.g. MPlayer) move/resize their windows + // just after creation if the user has a saved position/size + if (m_creation_time) { + struct timeval now; + gettimeofday(&now, NULL); + + if (now.tv_sec > m_creation_time + 1) + m_creation_time = 0; + else { + if (Remember::instance().isRemembered(*client, + Remember::REM_DIMENSIONS)) + cr.value_mask = cr.value_mask & ~(CWWidth | CWHeight); + + if (Remember::instance().isRemembered(*client, + Remember::REM_POSITION)) + cr.value_mask = cr.value_mask & ~(CWX | CWY); + } + } +#endif // REMEMBER + if (cr.value_mask & CWBorderWidth) client->old_bw = cr.border_width;

@@ -2597,24 +2628,20 @@ frame().gravityTranslate(ignore, cy, client->gravity(), client->old_bw, false);

frame().setActiveGravity(client->gravity(), client->old_bw); } - if (cr.value_mask & CWWidth) { + if (cr.value_mask & CWWidth) cw = cr.width; - // we must set this now, or else window grows when height not specified - ch -= (frame().titlebarHeight() + frame().handleHeight()); - } if (cr.value_mask & CWHeight) ch = cr.height; // whether we should send ConfigureNotify to netizens // the request is for client window so we resize the frame to it first - // NOTE: this might not work correctly if client actually requests that size - if (frame().width() != cw || frame().height() != ch) { - if (frame().x() != cx || frame().y() != cy) + if (old_w != cw || old_h != ch) { + if (old_x != cx || old_y != cy) frame().moveResizeForClient(cx, cy, cw, ch); else frame().resizeForClient(cw, ch); - } else if (frame().x() != cx || frame().y() != cy) { + } else if (old_x != cx || old_y != cy) { frame().move(cx, cy); }
M src/Window.hhsrc/Window.hh

@@ -514,6 +514,8 @@ FluxboxWindow &m_win;

}; ThemeListener m_themelistener; + time_t m_creation_time; + // Window states bool moving, resizing, shaded, iconic, focused, stuck, m_initialized, fullscreen;