From 299e098f5f6fc6d33684b3d4e80185c8a7899664 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Mon, 1 Aug 2016 10:26:48 +0200 Subject: handle oversized windows Clients can still be stupid (feh constrains itself to the root window ...) or lazy (llpp uses the last size - if that was in pivot mode ...) and create windows which exceed the workspace dimensions, resulting in both opposing edges being off-screen (for all tested placements) This applies partial maximization instead and resizes the (restored) window to soem sane size (size constraints applied) CCBUG: 688 CCBUG: 984 --- src/Window.cc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/Window.cc b/src/Window.cc index 3ad5088..f1bf1e9 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -506,6 +506,25 @@ void FluxboxWindow::init() { fluxbox.attachSignals(*this); + if (!m_state.fullscreen) { + unsigned int new_width = 0, new_height = 0; + if (m_client->width() >= screen().width()) { + m_state.maximized |= WindowState::MAX_HORZ; + new_width = 2 * screen().width() / 3; + } + if (m_client->height() >= screen().height()) { + m_state.maximized |= WindowState::MAX_VERT; + new_height = 2 * screen().height() / 3; + } + if (new_width || new_height) { + const int maximized = m_state.maximized; + m_state.maximized = WindowState::MAX_NONE; + resize(new_width ? new_width : width(), new_height ? new_height : height()); + m_placed = false; + m_state.maximized = maximized; + } + } + // this window is managed, we are now allowed to modify actual state m_initialized = true; -- cgit v0.11.2