Skip to content

Commit

Permalink
Add DoNotManage winoption for issues #653 and ice-wm/icewm#136.
Browse files Browse the repository at this point in the history
  • Loading branch information
gijsbers committed Sep 20, 2023
1 parent 23f4fb3 commit 210fff6
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 2 deletions.
1 change: 1 addition & 0 deletions man/icewm-winoptions.pod
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ the application:
appTakesFocus: {1|0} let application take focus.
doNotCover: {1|0} limits workspace if sticky.
doNotFocus: {1|0} do not focus.
doNotManage: {1|0} do not manage.
forcedClose: {1|0} no close confirmation dialog.
fullKeys: {1|0} don't install icewm key bindings.
ignoreNoFocusHint: {1|0} focus even when no-input is set.
Expand Down
1 change: 1 addition & 0 deletions man/icewmhint.pod
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ advanced features are as follows:
appTakesFocus let application take focus.
doNotCover limits workspace if sticky.
doNotFocus do not focus.
doNotManage do not manage.
forcedClose no close dialog.
fullKeys provided more keys.
ignoreNoFocusHint focus even no-input.
Expand Down
1 change: 1 addition & 0 deletions src/wmframe.h
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ class YFrameWindow:
foNoIgnoreTaskBar = (1 << 20),
foClose = (1 << 22),
foIgnoreOverrideRedirect = (1 << 23),
foDoNotManage = (1 << 24),
};

unsigned frameFunctions() const { return fFrameFunctions; }
Expand Down
26 changes: 24 additions & 2 deletions src/wmmgr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1736,6 +1736,27 @@ void YWindowManager::placeWindow(YFrameWindow *frame,
frame->setNormalGeometryOuter(posX, posY, posWidth, posHeight);
}

bool YWindowManager::isManageable(Window win, bool mapClient) {
bool manage = true;
if (WindowOptions::anyOption(YFrameWindow::foDoNotManage)) {
ClassHint hint;
if (hint.get(win) &&
nonempty(hint.res_name) && hint.res_name[0] != '/')
{
WindowOption wo(hint.res_name);
if (hintOptions)
hintOptions->mergeWindowOption(wo, hint.res_name, false);
if (defOptions)
defOptions->mergeWindowOption(wo, hint.res_name, false);
if (wo.hasOption(YFrameWindow::foDoNotManage))
manage = false;
if (manage == false && mapClient)
XMapWindow(xapp->display(), win);
}
}
return manage;
}

bool YWindowManager::ignoreOverride(Window win, const XWindowAttributes& attr,
int* layer) {
bool ignoring = false;
Expand Down Expand Up @@ -1788,8 +1809,9 @@ YFrameClient* YWindowManager::allocateClient(Window win, bool mapClient) {
XWindowAttributes attributes;
int layer = WinLayerInvalid;
if (XGetWindowAttributes(xapp->display(), win, &attributes) &&
(attributes.override_redirect == false ||
ignoreOverride(win, attributes, &layer)) &&
(attributes.override_redirect
? ignoreOverride(win, attributes, &layer)
: isManageable(win, mapClient)) &&
(mapClient || attributes.map_state > IsUnmapped))
{
client = new YFrameClient(nullptr, nullptr, win,
Expand Down
1 change: 1 addition & 0 deletions src/wmmgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ class YWindowManager:
};

bool ignoreOverride(Window win, const XWindowAttributes& attr, int* layer);
bool isManageable(Window win, bool mapClient);
bool tabbingClient(YFrameClient* client);
YFrameClient* allocateClient(Window win, bool mapClient);
YFrameWindow* allocateFrame(YFrameClient* client);
Expand Down
1 change: 1 addition & 0 deletions src/wmoption.cc
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ void WindowOptions::setWinOption(mstring n_class_instance,
{ "dTitleBar", YFrameWindow::fdTitleBar },
{ "doNotCover", YFrameWindow::foDoNotCover },
{ "doNotFocus", YFrameWindow::foDoNotFocus },
{ "doNotManage", YFrameWindow::foDoNotManage },
{ "fClose", YFrameWindow::ffClose },
{ "fHide", YFrameWindow::ffHide },
{ "fMaximize", YFrameWindow::ffMaximize },
Expand Down

0 comments on commit 210fff6

Please sign in to comment.