Skip to content

Commit

Permalink
Fixed problem that caused suspended modern Win10 apps to be managed
Browse files Browse the repository at this point in the history
  • Loading branch information
nir9 authored and prabirshrestha committed May 2, 2020
1 parent b469ddf commit 12ffc87
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
*.o
*.exe
*.ilk
*.pdb

config.h

tags
*.swp
28 changes: 17 additions & 11 deletions dwm-win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ static void updatebar(void);
static void updategeom(void);
static void view(const Arg *arg);
static void zoom(const Arg *arg);
static bool iscloaked(HWND hWnd);
static bool iscloaked(HWND hwnd);

/* Shell hook stuff */

Expand Down Expand Up @@ -615,7 +615,7 @@ getclienttitle(HWND hwnd) {
}

HWND
getroot(HWND hwnd){
getroot(HWND hwnd) {
HWND parent, deskwnd = GetDesktopWindow();

while ((parent = GetWindow(hwnd, GW_OWNER)) != NULL && deskwnd != parent)
Expand All @@ -633,17 +633,18 @@ grabkeys(HWND hwnd) {
}

bool
iscloaked(HWND hWnd) {
int CloakedVal;
HRESULT hRes = DwmGetWindowAttribute(hWnd, DWMWA_CLOAKED, &CloakedVal, sizeof(CloakedVal));
if (hRes != S_OK) {
CloakedVal = 0;
}
return CloakedVal ? true : false;
iscloaked(HWND hwnd) {
int cloaked_val;
HRESULT h_res = DwmGetWindowAttribute(hwnd, DWMWA_CLOAKED, &cloaked_val, sizeof(cloaked_val));

if (h_res != S_OK)
cloaked_val = 0;

return cloaked_val ? true : false;
}

bool
ismanageable(HWND hwnd){
ismanageable(HWND hwnd) {
if (hwnd == 0)
return false;

Expand Down Expand Up @@ -690,6 +691,10 @@ ismanageable(HWND hwnd){
if (noactiviate)
return false;

/* This is to avoid managing inactive suspended windows 10 modern apps */
if (iscloaked(hwnd))
return false;

if (wcsstr(classname, L"Windows.UI.Core.CoreWindow") && (
wcsstr(title, L"Windows Shell Experience Host") ||
wcsstr(title, L"Microsoft Text Input Application") ||
Expand Down Expand Up @@ -811,9 +816,10 @@ manage(HWND hwnd) {
debug(L" isfloating: %d\n", c->isfloating);

applyrules(c);

if (!c->isfloating)
setborder(c, false);


if (c->isfloating && IsWindowVisible(hwnd)) {
debug(L" new floating window: x: %d y: %d w: %d h: %d\n", wi.rcWindow.left, wi.rcWindow.top, wi.rcWindow.right - wi.rcWindow.left, wi.rcWindow.bottom - wi.rcWindow.top);
Expand Down

0 comments on commit 12ffc87

Please sign in to comment.