This commit is contained in:
恍兮惚兮 2024-11-30 04:03:13 +08:00
parent 9b5a1d872a
commit 696de614ac
4 changed files with 24 additions and 1 deletions

View File

@ -1,7 +1,7 @@
set(VERSION_MAJOR 6) set(VERSION_MAJOR 6)
set(VERSION_MINOR 8) set(VERSION_MINOR 8)
set(VERSION_PATCH 2) set(VERSION_PATCH 3)
set(VERSION_REVISION 0) set(VERSION_REVISION 0)
set(LUNA_VERSION "{${VERSION_MAJOR},${VERSION_MINOR},${VERSION_PATCH},${VERSION_REVISION}}") set(LUNA_VERSION "{${VERSION_MAJOR},${VERSION_MINOR},${VERSION_PATCH},${VERSION_REVISION}}")
add_library(VERSION_DEF ${CMAKE_CURRENT_LIST_DIR}/version_def.cpp) add_library(VERSION_DEF ${CMAKE_CURRENT_LIST_DIR}/version_def.cpp)

View File

@ -139,3 +139,19 @@ DECLARE_API UINT GetMonitorDpiScaling(HWND hwnd)
return dpiX; return dpiX;
} }
} }
DECLARE_API bool check_window_viewable(HWND hwnd)
{
RECT windowRect;
if (!GetWindowRect(hwnd, &windowRect))
return false;
HMONITOR hMonitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST);
if (!hMonitor)
return false;
MONITORINFO monitorInfo;
monitorInfo.cbSize = sizeof(MONITORINFO);
if (!GetMonitorInfo(hMonitor, &monitorInfo))
return false;
RECT _;
return IntersectRect(&_, &windowRect, &monitorInfo.rcWork);
}

View File

@ -297,6 +297,9 @@ class TranslatorWindow(resizableframeless):
if not rect: if not rect:
lastpos = None lastpos = None
continue continue
if not winsharedutils.check_window_viewable(hwnd):
lastpos = None
continue
rate = self.devicePixelRatioF() rate = self.devicePixelRatioF()
rect = QRect( rect = QRect(
int(rect[0] / rate), int(rect[0] / rate),

View File

@ -356,3 +356,7 @@ StartCaptureAsync.argtypes = (StartCaptureAsync_cb,)
StartCaptureAsync.restype = HANDLE StartCaptureAsync.restype = HANDLE
StopCaptureAsync = utilsdll.StopCaptureAsync StopCaptureAsync = utilsdll.StopCaptureAsync
StopCaptureAsync.argtypes = (HANDLE,) StopCaptureAsync.argtypes = (HANDLE,)
check_window_viewable = utilsdll.check_window_viewable
check_window_viewable.argtypes = (HWND,)
check_window_viewable.restype = c_bool