From 6a36505f8aa312ee2ccf0f173bc0fc6659664418 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Mon, 22 Apr 2002 23:00:57 +0000 Subject: [PATCH] even more fixes for maximizing/placement with hidden slit/toolbar/etc --- src/Window.cc | 31 ++++++++++++++++++++----------- src/Workspace.cc | 31 ++++++++++++++++++++----------- 2 files changed, 40 insertions(+), 22 deletions(-) diff --git a/src/Window.cc b/src/Window.cc index 6d9d8859..f768f6c1 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -1564,21 +1564,23 @@ void OpenboxWindow::maximize(unsigned int button) { slit->placement() == Slit::TopRight)) || slit->placement() == Slit::TopCenter) { // exclude top - if (tbartop) - space.setH(space.h() - slit_y); - else + if (tbartop && slit_y + slit->area().h() < tbarh) { + space.setY(space.y() + tbarh); space.setH(space.h() - tbarh); - space.setY(space.y() + slit_y + slit->area().h() + - screen->getBorderWidth() * 2); - space.setH(space.h() - (slit_y + slit->area().h() + - screen->getBorderWidth() * 2)); + } else { + space.setY(space.y() + (slit_y + slit->area().h() + + screen->getBorderWidth() * 2)); + space.setH(space.h() - (slit_y + slit->area().h() + + screen->getBorderWidth() * 2)); + if (!tbartop) + space.setH(space.h() - tbarh); + } } else if ((slit->direction() == Slit::Vertical && (slit->placement() == Slit::TopRight || slit->placement() == Slit::BottomRight)) || slit->placement() == Slit::CenterRight) { // exclude right - space.setW(space.w() - (screen->size().w() - slit_x + - screen->getBorderWidth() * 2)); + space.setW(space.w() - (screen->size().w() - slit_x)); if (tbartop) space.setY(space.y() + tbarh); space.setH(space.h() - tbarh); @@ -1587,8 +1589,15 @@ void OpenboxWindow::maximize(unsigned int button) { slit->placement() == Slit::BottomRight)) || slit->placement() == Slit::BottomCenter) { // exclude bottom - space.setH(space.h() - ((screen->size().h() - slit_y) > tbarh ? - screen->size().h() - slit_y : tbarh)); + if (!tbartop && (screen->size().h() - slit_y) < tbarh) { + space.setH(space.h() - tbarh); + } else { + space.setH(space.h() - (screen->size().h() - slit_y)); + if (tbartop) { + space.setY(space.y() + tbarh); + space.setH(space.h() - tbarh); + } + } } else {// if ((slit->direction() == Slit::Vertical && // (slit->placement() == Slit::TopLeft || // slit->placement() == Slit::BottomLeft)) || diff --git a/src/Workspace.cc b/src/Workspace.cc index 45dc2bc3..27afcade 100644 --- a/src/Workspace.cc +++ b/src/Workspace.cc @@ -572,21 +572,23 @@ void Workspace::placeWindow(OpenboxWindow *win) { slit->placement() == Slit::TopRight)) || slit->placement() == Slit::TopCenter) { // exclude top - if (tbartop) - space.setH(space.h() - slit_y); - else + if (tbartop && slit_y + slit->area().h() < tbarh) { + space.setY(space.y() + tbarh); space.setH(space.h() - tbarh); - space.setY(space.y() + slit_y + slit->area().h() + - screen.getBorderWidth() * 2); - space.setH(space.h() - (slit_y + slit->area().h() + - screen.getBorderWidth() * 2)); + } else { + space.setY(space.y() + (slit_y + slit->area().h() + + screen.getBorderWidth() * 2)); + space.setH(space.h() - (slit_y + slit->area().h() + + screen.getBorderWidth() * 2)); + if (!tbartop) + space.setH(space.h() - tbarh); + } } else if ((slit->direction() == Slit::Vertical && (slit->placement() == Slit::TopRight || slit->placement() == Slit::BottomRight)) || slit->placement() == Slit::CenterRight) { // exclude right - space.setW(space.w() - (screen.size().w() - slit_x + - screen.getBorderWidth() * 2)); + space.setW(space.w() - (screen.size().w() - slit_x)); if (tbartop) space.setY(space.y() + tbarh); space.setH(space.h() - tbarh); @@ -595,8 +597,15 @@ void Workspace::placeWindow(OpenboxWindow *win) { slit->placement() == Slit::BottomRight)) || slit->placement() == Slit::BottomCenter) { // exclude bottom - space.setH(space.h() - ((screen.size().h() - slit_y) > tbarh ? - screen.size().h() - slit_y : tbarh)); + if (!tbartop && (screen.size().h() - slit_y) < tbarh) { + space.setH(space.h() - tbarh); + } else { + space.setH(space.h() - (screen.size().h() - slit_y)); + if (tbartop) { + space.setY(space.y() + tbarh); + space.setH(space.h() - tbarh); + } + } } else {// if ((slit->direction() == Slit::Vertical && // (slit->placement() == Slit::TopLeft || // slit->placement() == Slit::BottomLeft)) || -- 2.45.2