all repos — fluxbox @ 5525d29b9b1d517035fa440f759fa33cb8432c03

custom fork of the fluxbox windowmanager

ensure sane values for ResizeCmd
mathias mathias
commit

5525d29b9b1d517035fa440f759fa33cb8432c03

parent

57da3c545ffb78f01b4286f725e55105a56f94f8

1 files changed, 16 insertions(+), 7 deletions(-)

jump to
M src/CurrentWindowCmd.ccsrc/CurrentWindowCmd.cc

@@ -86,14 +86,22 @@ fbwindow().y() + m_step_size_y);

} ResizeCmd::ResizeCmd(const int step_size_x, const int step_size_y) : - m_step_size_x(step_size_x), m_step_size_y(step_size_y) { } + m_step_size_x(step_size_x), m_step_size_y(step_size_y) { } +template<typename T> +T max(const T& a, const T& b) { + return a >= b ? a : b; +} + void ResizeCmd::real_execute() { - fbwindow().resize( - fbwindow().width() + - m_step_size_x * fbwindow().winClient().width_inc, - fbwindow().height() + - m_step_size_y * fbwindow().winClient().height_inc); + + int w = max<int>(static_cast<int>(fbwindow().width() + + m_step_size_x * fbwindow().winClient().width_inc), + fbwindow().frame().titlebarHeight() * 2 + 10); + int h = max<int>(static_cast<int>(fbwindow().height() + + m_step_size_y * fbwindow().winClient().height_inc), + fbwindow().frame().titlebarHeight() + 10); + fbwindow().resize(w, h); } 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) :

m_step_size_x(step_size_x), m_step_size_y(step_size_y) { } void ResizeToCmd::real_execute() { - fbwindow().resize(m_step_size_x, m_step_size_y); + if (m_step_size_x > 0 && m_step_size_y > 0) + fbwindow().resize(m_step_size_x, m_step_size_y); }