move decoration handling for non-resizable windows to SizeHint class
Mark Tiefenbruck mark@fluxbox.org
3 files changed,
14 insertions(+),
19 deletions(-)
M
src/Window.cc
→
src/Window.cc
@@ -451,11 +451,8 @@ decorations.handle = false;
} } - if (m_client->maxWidth() != 0 && m_client->maxHeight() != 0 && - m_client->maxWidth() <= m_client->minWidth() && - m_client->maxHeight() <= m_client->minHeight()) { - decorations.maximize = decorations.handle = - functions.resize = functions.maximize = false; + if (!m_client->sizeHints().isResizable()) { + functions.resize = functions.maximize = false; decorations.tab = false; //no tab for this window }@@ -2187,27 +2184,17 @@ if (client.minWidth() != old_min_width ||
client.maxWidth() != old_max_width || client.minHeight() != old_min_height || client.maxHeight() != old_max_height) { - if (client.maxWidth() != 0 && client.maxHeight() != 0 && - client.maxWidth() <= client.minWidth() && - client.maxHeight() <= client.minHeight()) { - if (decorations.maximize || - decorations.handle || - functions.resize || + if (!client.sizeHints().isResizable()) { + if (functions.resize || functions.maximize) changed = true; - decorations.maximize = false; - decorations.handle = false; functions.resize=false; functions.maximize=false; } else { // TODO: is broken while handled by FbW, needs to be in WinClient if (!client.isTransient() || screen().decorateTransient()) { - if (!decorations.maximize || - !decorations.handle || - !functions.maximize) + if (!functions.maximize) changed = true; - decorations.maximize = true; - decorations.handle = true; functions.maximize = true; } if (!functions.resize)
M
src/WindowState.cc
→
src/WindowState.cc
@@ -30,7 +30,8 @@ return !fullscreen && maximized != MAX_FULL && deco_mask & DECORM_BORDER;
} bool WindowState::useHandle() const { - return !fullscreen && !shaded && deco_mask & DECORM_HANDLE; + return !fullscreen && !shaded && deco_mask & DECORM_HANDLE && + size_hints.isResizable(); } bool WindowState::useTabs() const {@@ -76,6 +77,11 @@ if ((str_label.size() > 1 && str_label[0] == '0' && str_label[1] == 'x') ||
(str_label.size() > 0 && isdigit(str_label[0]))) mask = strtol(str_label.c_str(), NULL, 0); return mask; +} + +bool SizeHints::isResizable() const { + return max_width == 0 || max_height == 0 || + max_width > min_width || max_height > min_height; } void SizeHints::reset(const XSizeHints &sizehint) {
M
src/WindowState.hh
→
src/WindowState.hh
@@ -43,6 +43,8 @@ bool valid(unsigned int width, unsigned int height) const;
void displaySize(unsigned int &i, unsigned int &j, unsigned int width, unsigned int height) const; + bool isResizable() const; + unsigned int min_width, max_width, min_height, max_height, width_inc, height_inc, base_width, base_height, min_aspect_x, max_aspect_x, min_aspect_y, max_aspect_y;