mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-29 16:44:13 +08:00
Update utils.py
This commit is contained in:
parent
2d26b27b0e
commit
cef3d14356
@ -427,18 +427,21 @@ def minmaxmoveobservefunc(self):
|
|||||||
def win_event_callback(
|
def win_event_callback(
|
||||||
hWinEventHook, event, hwnd, idObject, idChild, dwEventThread, dwmsEventTime
|
hWinEventHook, event, hwnd, idObject, idChild, dwEventThread, dwmsEventTime
|
||||||
):
|
):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if not gobject.baseobject.hwnd:
|
myhwnd = gobject.baseobject.hwnd
|
||||||
|
if not myhwnd:
|
||||||
return
|
return
|
||||||
|
mymyhwnd = windows.GetAncestor(myhwnd)
|
||||||
|
if myhwnd != mymyhwnd:
|
||||||
|
gobject.baseobject.hwnd = myhwnd = mymyhwnd
|
||||||
if (
|
if (
|
||||||
event == windows.EVENT_OBJECT_DESTROY
|
event == windows.EVENT_OBJECT_DESTROY
|
||||||
and idObject == windows.OBJID_WINDOW
|
and idObject == windows.OBJID_WINDOW
|
||||||
):
|
):
|
||||||
if hwnd == gobject.baseobject.hwnd:
|
if hwnd == myhwnd:
|
||||||
gobject.baseobject.hwnd = None
|
gobject.baseobject.hwnd = None
|
||||||
return
|
return
|
||||||
p_pids = windows.GetWindowThreadProcessId(gobject.baseobject.hwnd)
|
p_pids = windows.GetWindowThreadProcessId(myhwnd)
|
||||||
if not p_pids:
|
if not p_pids:
|
||||||
# 有时候谜之没有EVENT_OBJECT_DESTROY/僵尸进程
|
# 有时候谜之没有EVENT_OBJECT_DESTROY/僵尸进程
|
||||||
gobject.baseobject.hwnd = None
|
gobject.baseobject.hwnd = None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user