move decoration handling for non-resizable windows to SizeHint class

This commit is contained in:
Mark Tiefenbruck 2008-08-27 13:47:16 -04:00
parent 55fd49614b
commit cbc1075dde
3 changed files with 14 additions and 19 deletions

View file

@ -451,11 +451,8 @@ void FluxboxWindow::init() {
}
}
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 @@ void FluxboxWindow::propertyNotifyEvent(WinClient &client, Atom atom) {
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)

View file

@ -30,7 +30,8 @@ bool WindowState::useBorder() const {
}
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 {
@ -78,6 +79,11 @@ int WindowState::getDecoMaskFromString(const std::string &str_label) {
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) {
if (sizehint.flags & PMinSize) {
min_width = sizehint.min_width;

View file

@ -43,6 +43,8 @@ public:
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;