aboutsummaryrefslogtreecommitdiff
path: root/src/CurrentWindowCmd.cc
diff options
context:
space:
mode:
authormathias <mathias>2004-11-22 18:46:59 (GMT)
committermathias <mathias>2004-11-22 18:46:59 (GMT)
commit5525d29b9b1d517035fa440f759fa33cb8432c03 (patch)
treeb31bb7862a17c1afbb9e15068d81377566d2f33e /src/CurrentWindowCmd.cc
parent57da3c545ffb78f01b4286f725e55105a56f94f8 (diff)
downloadfluxbox_pavel-5525d29b9b1d517035fa440f759fa33cb8432c03.zip
fluxbox_pavel-5525d29b9b1d517035fa440f759fa33cb8432c03.tar.bz2
ensure sane values for ResizeCmd
Diffstat (limited to 'src/CurrentWindowCmd.cc')
-rw-r--r--src/CurrentWindowCmd.cc23
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
88ResizeCmd::ResizeCmd(const int step_size_x, const int step_size_y) : 88ResizeCmd::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
91template<typename T>
92T max(const T& a, const T& b) {
93 return a >= b ? a : b;
94}
95
91void ResizeCmd::real_execute() { 96void 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
99MoveToCmd::MoveToCmd(const int step_size_x, const int step_size_y) : 107MoveToCmd::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
109void ResizeToCmd::real_execute() { 117void 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}