diff options
-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 | } |