be a little smarter about size hints in tabbed windows
This commit is contained in:
parent
feac120f4a
commit
c37a91e150
4 changed files with 51 additions and 30 deletions
|
@ -1860,8 +1860,10 @@ void FbWinFrame::SizeHints::reset(const XSizeHints &sizehint) {
|
||||||
min_aspect_y = sizehint.min_aspect.y;
|
min_aspect_y = sizehint.min_aspect.y;
|
||||||
max_aspect_x = sizehint.max_aspect.x;
|
max_aspect_x = sizehint.max_aspect.x;
|
||||||
max_aspect_y = sizehint.max_aspect.y;
|
max_aspect_y = sizehint.max_aspect.y;
|
||||||
} else
|
} else {
|
||||||
min_aspect_x = min_aspect_y = max_aspect_x = max_aspect_y = 0;
|
min_aspect_x = max_aspect_y = 0;
|
||||||
|
min_aspect_y = max_aspect_x = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (sizehint.flags & PWinGravity)
|
if (sizehint.flags & PWinGravity)
|
||||||
win_gravity = sizehint.win_gravity;
|
win_gravity = sizehint.win_gravity;
|
||||||
|
|
|
@ -112,8 +112,8 @@ public:
|
||||||
SizeHints():
|
SizeHints():
|
||||||
min_width(1), max_width(0), min_height(1), max_height(0),
|
min_width(1), max_width(0), min_height(1), max_height(0),
|
||||||
width_inc(1), height_inc(1), base_width(0), base_height(0),
|
width_inc(1), height_inc(1), base_width(0), base_height(0),
|
||||||
min_aspect_x(0), max_aspect_x(0),
|
min_aspect_x(0), max_aspect_x(1),
|
||||||
min_aspect_y(0), max_aspect_y(0),
|
min_aspect_y(1), max_aspect_y(0),
|
||||||
win_gravity(0) { }
|
win_gravity(0) { }
|
||||||
|
|
||||||
void reset(const XSizeHints &sizehint);
|
void reset(const XSizeHints &sizehint);
|
||||||
|
|
|
@ -1016,7 +1016,6 @@ bool FluxboxWindow::setCurrentClient(WinClient &client, bool setinput) {
|
||||||
// frame focused doesn't necessarily mean input focused
|
// frame focused doesn't necessarily mean input focused
|
||||||
frame().setLabelButtonFocus(*button);
|
frame().setLabelButtonFocus(*button);
|
||||||
frame().setShapingClient(&client, false);
|
frame().setShapingClient(&client, false);
|
||||||
frame().setSizeHints(client.sizeHints());
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1033,10 +1032,50 @@ void FluxboxWindow::associateClientWindow() {
|
||||||
m_client->width(), m_client->height(),
|
m_client->width(), m_client->height(),
|
||||||
m_client->gravity(), m_client->old_bw);
|
m_client->gravity(), m_client->old_bw);
|
||||||
|
|
||||||
frame().setSizeHints(m_client->sizeHints());
|
updateSizeHints();
|
||||||
frame().setClientWindow(*m_client);
|
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() {
|
void FluxboxWindow::grabButtons() {
|
||||||
|
|
||||||
|
@ -1208,32 +1247,10 @@ void FluxboxWindow::moveResizeForClient(int new_x, int new_y,
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluxboxWindow::getMaxSize(unsigned int* width, unsigned int* height) const {
|
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)
|
if (width)
|
||||||
*width = w;
|
*width = m_size_hint.max_width;
|
||||||
|
|
||||||
if (height)
|
if (height)
|
||||||
*height = h;
|
*height = m_size_hint.max_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns whether the focus was "set" to this window
|
// returns whether the focus was "set" to this window
|
||||||
|
|
|
@ -491,6 +491,7 @@ private:
|
||||||
|
|
||||||
bool getState();
|
bool getState();
|
||||||
void updateMWMHintsFromClient(WinClient &client);
|
void updateMWMHintsFromClient(WinClient &client);
|
||||||
|
void updateSizeHints();
|
||||||
void associateClientWindow();
|
void associateClientWindow();
|
||||||
|
|
||||||
void setState(unsigned long stateval, bool setting_up);
|
void setState(unsigned long stateval, bool setting_up);
|
||||||
|
@ -552,6 +553,7 @@ private:
|
||||||
typedef std::map<WinClient *, IconButton *> Client2ButtonMap;
|
typedef std::map<WinClient *, IconButton *> Client2ButtonMap;
|
||||||
Client2ButtonMap m_labelbuttons;
|
Client2ButtonMap m_labelbuttons;
|
||||||
|
|
||||||
|
FbWinFrame::SizeHints m_size_hint;
|
||||||
struct _decorations {
|
struct _decorations {
|
||||||
bool titlebar, handle, border, iconify,
|
bool titlebar, handle, border, iconify,
|
||||||
maximize, close, menu, sticky, shade, tab, enabled;
|
maximize, close, menu, sticky, shade, tab, enabled;
|
||||||
|
|
Loading…
Reference in a new issue