Skip to content

Commit

Permalink
When DockApps has "dock" and LimitByDockLayer=1 then update the deskt…
Browse files Browse the repository at this point in the history
…op work area so that maximized windows leave the DockApps container visible for issue #779.
  • Loading branch information
gijsbers committed Jul 6, 2024
1 parent cdbdbab commit 3e63422
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 3 deletions.
5 changes: 3 additions & 2 deletions man/icewm-preferences.pod
Original file line number Diff line number Diff line change
Expand Up @@ -684,8 +684,9 @@ Clock Date format for tooltip (strftime format string).

=item B<DockApps>="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<XRRPrimaryScreenName>=""

Expand Down
13 changes: 12 additions & 1 deletion src/wmdock.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions src/wmdock.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 14 additions & 0 deletions src/wmmgr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down

0 comments on commit 3e63422

Please sign in to comment.