From 3e634220bf75aba842476cc2532f4b5e42afa8b7 Mon Sep 17 00:00:00 2001 From: Bert Gijsbers Date: Sat, 6 Jul 2024 20:16:01 +0200 Subject: [PATCH] When DockApps has "dock" and LimitByDockLayer=1 then update the desktop work area so that maximized windows leave the DockApps container visible for issue #779. --- man/icewm-preferences.pod | 5 +++-- src/wmdock.cc | 13 ++++++++++++- src/wmdock.h | 3 +++ src/wmmgr.cc | 14 ++++++++++++++ 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/man/icewm-preferences.pod b/man/icewm-preferences.pod index c28055e5a..92341c921 100644 --- a/man/icewm-preferences.pod +++ b/man/icewm-preferences.pod @@ -684,8 +684,9 @@ Clock Date format for tooltip (strftime format string). =item B="right high desktop" -Support DockApps (right, left, center, down, high, above, below, -desktop, or empty to disable). Control with Ctrl+Mouse. +Support DockApps (right, left, center, down, high, above, dock, ontop, +normal, below, desktop, or empty to disable). Control with Ctrl+Mouse. +The first five control positioning, while the next six set the layer. =item B="" diff --git a/src/wmdock.cc b/src/wmdock.cc index e473dd2f2..1eb1517bc 100644 --- a/src/wmdock.cc +++ b/src/wmdock.cc @@ -86,6 +86,7 @@ bool DockApp::setup() { XChangeProperty(xapp->display(), handle(), XA_WM_CLASS, XA_STRING, 8, PropModeReplace, wmClassName, sizeof(wmClassName)); setNetWindowType(_XA_NET_WM_WINDOW_TYPE_DOCK); + setProperty(_XA_WIN_LAYER, XA_CARDINAL, layered); if (intern == None) { intern = xapp->atom(propertyName); } @@ -203,6 +204,13 @@ bool DockApp::dock(YFrameClient* client) { client->setDocked(true); direction = +1; retime(); + if (layered == WinLayerInvalid) + setup(); + if (layered == WinLayerDock) { + extern bool limitByDockLayer; + if (limitByDockLayer) + manager->requestWorkAreaUpdate(); + } } else { XRemoveFromSaveSet(xapp->display(), icon); @@ -264,12 +272,15 @@ bool DockApp::handleTimer(YTimer* t) { void DockApp::adapt() { if (docks.nonempty()) { + int sx, sy; + unsigned sw, sh; + desktop->getScreenGeometry(&sx, &sy, &sw, &sh); int mx, my, Mx, My; manager->getWorkArea(&mx, &my, &Mx, &My); int rows = min(docks.getCount(), (My - my) / 64); int cols = (docks.getCount() + (rows - 1)) / rows; rows = (docks.getCount() + (cols - 1)) / cols; - int xpos = isRight ? Mx - cols * 64 : 0; + int xpos = isRight ? sx + int(sw) - cols * 64 : sx; int ypos = (center == -1) ? 0 : (center == +1) ? (My - rows * 64) : my + (My - my - rows * 64) / 2; diff --git a/src/wmdock.h b/src/wmdock.h index b5c9dde66..1da55328c 100644 --- a/src/wmdock.h +++ b/src/wmdock.h @@ -21,12 +21,15 @@ class DockApp: using YWindow::handle; using YWindow::created; using YWindow::visible; + using YWindow::width; + using YWindow::getScreen; operator bool() const { return docks.nonempty(); } bool dock(YFrameClient* client); bool undock(YFrameClient* client); void adapt(); int layer() const { return layered; } + bool rightside() const { return isRight; } private: void handleButton(const XButtonEvent& button) override; diff --git a/src/wmmgr.cc b/src/wmmgr.cc index ceacc96a2..9872bb560 100644 --- a/src/wmmgr.cc +++ b/src/wmmgr.cc @@ -2496,6 +2496,20 @@ bool YWindowManager::updateWorkAreaInner() { } debugWorkArea("before"); + if (limitByDockLayer && fDockApp && fDockApp->layer() == WinLayerDock) { + if (fDockApp->visible()) { + int s = fDockApp->getScreen(); + int x = xiInfo[s].x_org; + int y = xiInfo[s].y_org; + int w = x + xiInfo[s].width; + int h = y + xiInfo[s].height; + if (fDockApp->rightside()) + w -= fDockApp->width(); + else + x += fDockApp->width(); + updateArea(WinWorkspaceInvalid, s, x, y, w, h); + } + } for (YFrameWindow *w = topLayer(); w; w = w->nextLayer()) { if (w->isUnmapped()) {