From 438222e9db8c75c99a79e745c3e5b615bd487783 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Fri, 30 Aug 2024 00:52:12 +0800 Subject: [PATCH] fix --- LunaTranslator/LunaTranslator/myutils/hwnd.py | 5 ++++- LunaTranslator/LunaTranslator/myutils/utils.py | 3 --- LunaTranslator/LunaTranslator/scalemethod/base.py | 2 ++ plugins/CMakeLists.txt | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/LunaTranslator/LunaTranslator/myutils/hwnd.py b/LunaTranslator/LunaTranslator/myutils/hwnd.py index f480c649..a19b110f 100644 --- a/LunaTranslator/LunaTranslator/myutils/hwnd.py +++ b/LunaTranslator/LunaTranslator/myutils/hwnd.py @@ -18,6 +18,8 @@ def grabwindow(app="PNG", callback_origin=None): hwndx = gobject.baseobject.hwnd if not hwndx: hwndx = windows.GetForegroundWindow() + else: + hwndx = windows.GetAncestor(hwndx) gamepath = getpidexe(windows.GetWindowThreadProcessId(hwndx)) exename = os.path.basename(gamepath).replace( "." + os.path.basename(gamepath).split(".")[-1], "" @@ -65,7 +67,8 @@ def grabwindow(app="PNG", callback_origin=None): hwnd = gobject.baseobject.hwnd if not hwnd: hwnd = windows.GetForegroundWindow() - + else: + hwnd = windows.GetAncestor(hwnd) _ = windows.GetClientRect(hwnd) p = screenshot(0, 0, _[2], _[3], hwnd).toImage() if not p.allGray(): diff --git a/LunaTranslator/LunaTranslator/myutils/utils.py b/LunaTranslator/LunaTranslator/myutils/utils.py index b2953efe..3250a9d9 100644 --- a/LunaTranslator/LunaTranslator/myutils/utils.py +++ b/LunaTranslator/LunaTranslator/myutils/utils.py @@ -431,9 +431,6 @@ def minmaxmoveobservefunc(self): myhwnd = gobject.baseobject.hwnd if not myhwnd: return - mymyhwnd = windows.GetAncestor(myhwnd) - if myhwnd != mymyhwnd: - gobject.baseobject.hwnd = myhwnd = mymyhwnd if ( event == windows.EVENT_OBJECT_DESTROY and idObject == windows.OBJID_WINDOW diff --git a/LunaTranslator/LunaTranslator/scalemethod/base.py b/LunaTranslator/LunaTranslator/scalemethod/base.py index b6d30289..eae10e66 100644 --- a/LunaTranslator/LunaTranslator/scalemethod/base.py +++ b/LunaTranslator/LunaTranslator/scalemethod/base.py @@ -1,4 +1,5 @@ from myutils.wrapper import threader +import windows class scalebase: @@ -20,6 +21,7 @@ class scalebase: self.callstatuschange_(hwnd) def callstatuschange_(self, hwnd): + hwnd = windows.GetAncestor(hwnd) self.hwnd = hwnd if self.changestatus(hwnd, self.full): self.setuistatus(self.full) diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 7362e141..99b3f7a5 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -29,7 +29,7 @@ include(generate_product_version) set(VERSION_MAJOR 5) set(VERSION_MINOR 31) -set(VERSION_PATCH 4) +set(VERSION_PATCH 5) add_library(pch pch.cpp) target_precompile_headers(pch PUBLIC pch.h)