From a2f809f8f254e96739de6015e7475a3ae4cc2a62 Mon Sep 17 00:00:00 2001 From: Mathias Gumz Date: Thu, 6 May 2010 20:07:56 +0200 Subject: added little helper function to disable the maximization state of a window while keeping its current position / size --- src/Window.cc | 18 +++++++++++++----- src/Window.hh | 4 ++++ 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/Window.cc b/src/Window.cc index f64db65..9df48a2 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -1509,6 +1509,18 @@ void FluxboxWindow::setMaximizedState(int type) { stateSig().notify(); } +void FluxboxWindow::disableMaximization() { + + m_state.maximized = WindowState::MAX_NONE; + // TODO: could be optional, if the window gets back to original size / + // position after maximization is disabled + m_state.saveGeometry(frame().x(), frame().y(), + frame().width(), frame().height()); + frame().applyState(); + stateSig().notify(); +} + + /** * Maximize window horizontal */ @@ -3079,12 +3091,8 @@ void FluxboxWindow::startResizing(int x, int y, ReferenceCorner dir) { m_resize_corner = dir; resizing = true; - m_state.maximized = WindowState::MAX_NONE; - m_state.saveGeometry(frame().x(), frame().y(), - frame().width(), frame().height()); - frame().applyState(); - stateSig().notify(); + disableMaximization(); const Cursor& cursor = (m_resize_corner == LEFTTOP) ? frame().theme()->upperLeftAngleCursor() : (m_resize_corner == RIGHTTOP) ? frame().theme()->upperRightAngleCursor() : diff --git a/src/Window.hh b/src/Window.hh index a097ac6..5554ad3 100644 --- a/src/Window.hh +++ b/src/Window.hh @@ -224,6 +224,10 @@ public: void maximizeVertical(); /// maximizes the window fully void maximizeFull(); + + /// disables maximization, without restoring the old size + void disableMaximization(); + /// toggles shade void shade(); /// shades window -- cgit v0.11.2