summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMark Tiefenbruck <mark@fluxbox.org>2008-08-27 17:47:16 (GMT)
committerMark Tiefenbruck <mark@fluxbox.org>2008-08-27 17:47:16 (GMT)
commitcbc1075dde0276956aca1753a229097bcc7bac87 (patch)
tree1449a8cd55a242034e5f6f70a78e4df63f00dc54 /src
parent55fd49614bb1b9e37561147f18719b2ac277b64b (diff)
downloadfluxbox_lack-cbc1075dde0276956aca1753a229097bcc7bac87.zip
fluxbox_lack-cbc1075dde0276956aca1753a229097bcc7bac87.tar.bz2
move decoration handling for non-resizable windows to SizeHint class
Diffstat (limited to 'src')
-rw-r--r--src/Window.cc23
-rw-r--r--src/WindowState.cc8
-rw-r--r--src/WindowState.hh2
3 files changed, 14 insertions, 19 deletions
diff --git a/src/Window.cc b/src/Window.cc
index 25a6baf..98c10f4 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -451,11 +451,8 @@ void FluxboxWindow::init() {
451 } 451 }
452 } 452 }
453 453
454 if (m_client->maxWidth() != 0 && m_client->maxHeight() != 0 && 454 if (!m_client->sizeHints().isResizable()) {
455 m_client->maxWidth() <= m_client->minWidth() && 455 functions.resize = functions.maximize = false;
456 m_client->maxHeight() <= m_client->minHeight()) {
457 decorations.maximize = decorations.handle =
458 functions.resize = functions.maximize = false;
459 decorations.tab = false; //no tab for this window 456 decorations.tab = false; //no tab for this window
460 } 457 }
461 458
@@ -2187,27 +2184,17 @@ void FluxboxWindow::propertyNotifyEvent(WinClient &client, Atom atom) {
2187 client.maxWidth() != old_max_width || 2184 client.maxWidth() != old_max_width ||
2188 client.minHeight() != old_min_height || 2185 client.minHeight() != old_min_height ||
2189 client.maxHeight() != old_max_height) { 2186 client.maxHeight() != old_max_height) {
2190 if (client.maxWidth() != 0 && client.maxHeight() != 0 && 2187 if (!client.sizeHints().isResizable()) {
2191 client.maxWidth() <= client.minWidth() && 2188 if (functions.resize ||
2192 client.maxHeight() <= client.minHeight()) {
2193 if (decorations.maximize ||
2194 decorations.handle ||
2195 functions.resize ||
2196 functions.maximize) 2189 functions.maximize)
2197 changed = true; 2190 changed = true;
2198 decorations.maximize = false;
2199 decorations.handle = false;
2200 functions.resize=false; 2191 functions.resize=false;
2201 functions.maximize=false; 2192 functions.maximize=false;
2202 } else { 2193 } else {
2203 // TODO: is broken while handled by FbW, needs to be in WinClient 2194 // TODO: is broken while handled by FbW, needs to be in WinClient
2204 if (!client.isTransient() || screen().decorateTransient()) { 2195 if (!client.isTransient() || screen().decorateTransient()) {
2205 if (!decorations.maximize || 2196 if (!functions.maximize)
2206 !decorations.handle ||
2207 !functions.maximize)
2208 changed = true; 2197 changed = true;
2209 decorations.maximize = true;
2210 decorations.handle = true;
2211 functions.maximize = true; 2198 functions.maximize = true;
2212 } 2199 }
2213 if (!functions.resize) 2200 if (!functions.resize)
diff --git a/src/WindowState.cc b/src/WindowState.cc
index 2f8fd4e..f4df136 100644
--- a/src/WindowState.cc
+++ b/src/WindowState.cc
@@ -30,7 +30,8 @@ bool WindowState::useBorder() const {
30} 30}
31 31
32bool WindowState::useHandle() const { 32bool WindowState::useHandle() const {
33 return !fullscreen && !shaded && deco_mask & DECORM_HANDLE; 33 return !fullscreen && !shaded && deco_mask & DECORM_HANDLE &&
34 size_hints.isResizable();
34} 35}
35 36
36bool WindowState::useTabs() const { 37bool WindowState::useTabs() const {
@@ -78,6 +79,11 @@ int WindowState::getDecoMaskFromString(const std::string &str_label) {
78 return mask; 79 return mask;
79} 80}
80 81
82bool SizeHints::isResizable() const {
83 return max_width == 0 || max_height == 0 ||
84 max_width > min_width || max_height > min_height;
85}
86
81void SizeHints::reset(const XSizeHints &sizehint) { 87void SizeHints::reset(const XSizeHints &sizehint) {
82 if (sizehint.flags & PMinSize) { 88 if (sizehint.flags & PMinSize) {
83 min_width = sizehint.min_width; 89 min_width = sizehint.min_width;
diff --git a/src/WindowState.hh b/src/WindowState.hh
index fa17eb6..3bc5d24 100644
--- a/src/WindowState.hh
+++ b/src/WindowState.hh
@@ -43,6 +43,8 @@ public:
43 void displaySize(unsigned int &i, unsigned int &j, 43 void displaySize(unsigned int &i, unsigned int &j,
44 unsigned int width, unsigned int height) const; 44 unsigned int width, unsigned int height) const;
45 45
46 bool isResizable() const;
47
46 unsigned int min_width, max_width, min_height, max_height, 48 unsigned int min_width, max_width, min_height, max_height,
47 width_inc, height_inc, base_width, base_height, 49 width_inc, height_inc, base_width, base_height,
48 min_aspect_x, max_aspect_x, min_aspect_y, max_aspect_y; 50 min_aspect_x, max_aspect_x, min_aspect_y, max_aspect_y;