all repos — fluxbox @ c37a91e1504fa73da233cc59fe67ead56dbd3083

custom fork of the fluxbox windowmanager

be a little smarter about size hints in tabbed windows
Mark Tiefenbruck mark@fluxbox.org
commit

c37a91e1504fa73da233cc59fe67ead56dbd3083

parent

feac120f4a433d4fee947ff9cc23e170d6af95c0

4 files changed, 51 insertions(+), 30 deletions(-)

jump to
M src/FbWinFrame.ccsrc/FbWinFrame.cc

@@ -1860,8 +1860,10 @@ min_aspect_x = sizehint.min_aspect.x;

min_aspect_y = sizehint.min_aspect.y; max_aspect_x = sizehint.max_aspect.x; max_aspect_y = sizehint.max_aspect.y; - } else - min_aspect_x = min_aspect_y = max_aspect_x = max_aspect_y = 0; + } else { + min_aspect_x = max_aspect_y = 0; + min_aspect_y = max_aspect_x = 1; + } if (sizehint.flags & PWinGravity) win_gravity = sizehint.win_gravity;
M src/FbWinFrame.hhsrc/FbWinFrame.hh

@@ -112,8 +112,8 @@ public:

SizeHints(): min_width(1), max_width(0), min_height(1), max_height(0), width_inc(1), height_inc(1), base_width(0), base_height(0), - min_aspect_x(0), max_aspect_x(0), - min_aspect_y(0), max_aspect_y(0), + min_aspect_x(0), max_aspect_x(1), + min_aspect_y(1), max_aspect_y(0), win_gravity(0) { } void reset(const XSizeHints &sizehint);
M src/Window.ccsrc/Window.cc

@@ -1016,7 +1016,6 @@ #endif // DEBUG

// frame focused doesn't necessarily mean input focused frame().setLabelButtonFocus(*button); frame().setShapingClient(&client, false); - frame().setSizeHints(client.sizeHints()); return ret; }

@@ -1033,10 +1032,50 @@ frame().moveResizeForClient(m_client->x(), m_client->y(),

m_client->width(), m_client->height(), m_client->gravity(), m_client->old_bw); - frame().setSizeHints(m_client->sizeHints()); + updateSizeHints(); frame().setClientWindow(*m_client); } +void FluxboxWindow::updateSizeHints() { + m_size_hint = m_client->sizeHints(); + + ClientList::const_iterator it = clientList().begin(); + ClientList::const_iterator it_end = clientList().end(); + for (; it != it_end; ++it) { + if ((*it) == m_client) + continue; + + const FbWinFrame::SizeHints &hint = (*it)->sizeHints(); + if (m_size_hint.min_width < hint.min_width) + m_size_hint.min_width = hint.min_width; + if (m_size_hint.max_width > hint.max_width) + m_size_hint.max_width = hint.max_width; + if (m_size_hint.min_height < hint.min_height) + m_size_hint.min_height = hint.min_height; + if (m_size_hint.max_height > hint.max_height) + m_size_hint.max_height = hint.max_height; + // lcm could end up a bit silly, and the situation is bad no matter what + if (m_size_hint.width_inc < hint.width_inc) + m_size_hint.width_inc = hint.width_inc; + if (m_size_hint.height_inc < hint.height_inc) + m_size_hint.height_inc = hint.height_inc; + if (m_size_hint.base_width < hint.base_width) + m_size_hint.base_width = hint.base_width; + if (m_size_hint.base_height < hint.base_height) + m_size_hint.base_height = hint.base_height; + if (m_size_hint.min_aspect_x * hint.min_aspect_y > + m_size_hint.min_aspect_y * hint.min_aspect_x) { + m_size_hint.min_aspect_x = hint.min_aspect_x; + m_size_hint.min_aspect_y = hint.min_aspect_y; + } + if (m_size_hint.max_aspect_x * hint.max_aspect_y > + m_size_hint.max_aspect_y * hint.max_aspect_x) { + m_size_hint.max_aspect_x = hint.max_aspect_x; + m_size_hint.max_aspect_y = hint.max_aspect_y; + } + } + frame().setSizeHints(m_size_hint); +} void FluxboxWindow::grabButtons() {

@@ -1208,32 +1247,10 @@

} void FluxboxWindow::getMaxSize(unsigned int* width, unsigned int* height) const { - - if (!width || !height) - return; - - ClientList::const_iterator it = clientList().begin(); - ClientList::const_iterator it_end = clientList().end(); - - unsigned int w; - unsigned int h; - - w = h = 0; // unlimited - - for (; it != it_end; ++it) { - // special case for max height/width == 0 - // 0 indicates unlimited size, so we skip them - if (!h || ((*it)->maxHeight() && h > (*it)->maxHeight())) - h = (*it)->maxHeight(); - if (!w || ((*it)->maxWidth() && w > (*it)->maxWidth())) - w = (*it)->maxWidth(); - } - if (width) - *width = w; - + *width = m_size_hint.max_width; if (height) - *height = h; + *height = m_size_hint.max_height; } // returns whether the focus was "set" to this window
M src/Window.hhsrc/Window.hh

@@ -491,6 +491,7 @@ void attachTo(int x, int y, bool interrupted = false);

bool getState(); void updateMWMHintsFromClient(WinClient &client); + void updateSizeHints(); void associateClientWindow(); void setState(unsigned long stateval, bool setting_up);

@@ -552,6 +553,7 @@ WinClient *m_client; ///< current client

typedef std::map<WinClient *, IconButton *> Client2ButtonMap; Client2ButtonMap m_labelbuttons; + FbWinFrame::SizeHints m_size_hint; struct _decorations { bool titlebar, handle, border, iconify, maximize, close, menu, sticky, shade, tab, enabled;