Skip to content

Commit

Permalink
Merge pull request #2483 from asmagill/filterFixes
Browse files Browse the repository at this point in the history
hs.window.filter fixes
  • Loading branch information
cmsj authored Sep 21, 2020
2 parents 7f3e294 + 1d3d123 commit 1355d00
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions extensions/uielement/watcher.m
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ static int userdata_gc(lua_State* L) {
watcher = nil;
}
}
lua_pushnil(L) ;
lua_setmetatable(L, 1) ;
return 0;
}

Expand Down
6 changes: 3 additions & 3 deletions extensions/window/filter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1387,7 +1387,7 @@ appWindowEvent=function(win,event,_,appname,retry)
end
if apps[appname].windows[id] then return log.df('%s (%d) already registered',appname,id) end
local watcher=win:newWatcher(windowEvent,appname)
if not watcher._element.pid then
if not watcher:pid() then
log.wf('%s: %s has no watcher pid',appname,role or (win.role and win:role()))
if retry>MAX_RETRIES then log.df('%s: %s has no watcher pid',appname,win.subrole and win:subrole() or (win.role and win:role()) or 'window')
else
Expand All @@ -1412,7 +1412,7 @@ local function startAppWatcher(app,appname)
local watcher = app:newWatcher(appWindowEvent,appname)
watcher:start({uiwatcher.windowCreated,uiwatcher.focusedWindowChanged})
App.new(app,appname,watcher)
if not watcher._element.pid then
if not watcher:pid() then
log.wf('No accessibility access to app %s (no watcher pid)',(appname or '[???]'))
end
end
Expand All @@ -1428,7 +1428,7 @@ local function startAppWatcher(app,appname,retry,nologging)
if retry>1 and not pendingApps[appname] then return end --given up before anything could even happen

local watcher = app:newWatcher(appWindowEvent,appname)
if watcher._element.pid then
if watcher:pid() then
pendingApps[appname]=nil --done
watcher:start({uiwatcher.windowCreated,uiwatcher.focusedWindowChanged})
App.new(app,appname,watcher)
Expand Down

0 comments on commit 1355d00

Please sign in to comment.