diff options
author | mathias <mathias> | 2004-11-22 18:46:59 (GMT) |
---|---|---|
committer | mathias <mathias> | 2004-11-22 18:46:59 (GMT) |
commit | 5525d29b9b1d517035fa440f759fa33cb8432c03 (patch) | |
tree | b31bb7862a17c1afbb9e15068d81377566d2f33e /src | |
parent | 57da3c545ffb78f01b4286f725e55105a56f94f8 (diff) | |
download | fluxbox_paul-5525d29b9b1d517035fa440f759fa33cb8432c03.zip fluxbox_paul-5525d29b9b1d517035fa440f759fa33cb8432c03.tar.bz2 |
ensure sane values for ResizeCmd
Diffstat (limited to 'src')
-rw-r--r-- | src/CurrentWindowCmd.cc | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/CurrentWindowCmd.cc b/src/CurrentWindowCmd.cc index 3e11812..94fc85b 100644 --- a/src/CurrentWindowCmd.cc +++ b/src/CurrentWindowCmd.cc | |||
@@ -86,14 +86,22 @@ void MoveCmd::real_execute() { | |||
86 | } | 86 | } |
87 | 87 | ||
88 | ResizeCmd::ResizeCmd(const int step_size_x, const int step_size_y) : | 88 | ResizeCmd::ResizeCmd(const int step_size_x, const int step_size_y) : |
89 | m_step_size_x(step_size_x), m_step_size_y(step_size_y) { } | 89 | m_step_size_x(step_size_x), m_step_size_y(step_size_y) { } |
90 | 90 | ||
91 | template<typename T> | ||
92 | T max(const T& a, const T& b) { | ||
93 | return a >= b ? a : b; | ||
94 | } | ||
95 | |||
91 | void ResizeCmd::real_execute() { | 96 | void ResizeCmd::real_execute() { |
92 | fbwindow().resize( | 97 | |
93 | fbwindow().width() + | 98 | int w = max<int>(static_cast<int>(fbwindow().width() + |
94 | m_step_size_x * fbwindow().winClient().width_inc, | 99 | m_step_size_x * fbwindow().winClient().width_inc), |
95 | fbwindow().height() + | 100 | fbwindow().frame().titlebarHeight() * 2 + 10); |
96 | m_step_size_y * fbwindow().winClient().height_inc); | 101 | int h = max<int>(static_cast<int>(fbwindow().height() + |
102 | m_step_size_y * fbwindow().winClient().height_inc), | ||
103 | fbwindow().frame().titlebarHeight() + 10); | ||
104 | fbwindow().resize(w, h); | ||
97 | } | 105 | } |
98 | 106 | ||
99 | MoveToCmd::MoveToCmd(const int step_size_x, const int step_size_y) : | 107 | MoveToCmd::MoveToCmd(const int step_size_x, const int step_size_y) : |
@@ -107,5 +115,6 @@ ResizeToCmd::ResizeToCmd(const int step_size_x, const int step_size_y) : | |||
107 | m_step_size_x(step_size_x), m_step_size_y(step_size_y) { } | 115 | m_step_size_x(step_size_x), m_step_size_y(step_size_y) { } |
108 | 116 | ||
109 | void ResizeToCmd::real_execute() { | 117 | void ResizeToCmd::real_execute() { |
110 | fbwindow().resize(m_step_size_x, m_step_size_y); | 118 | if (m_step_size_x > 0 && m_step_size_y > 0) |
119 | fbwindow().resize(m_step_size_x, m_step_size_y); | ||
111 | } | 120 | } |