mirror of
https://github.com/Blinue/Magpie.git
synced 2026-06-24 02:04:10 +00:00
refactor: FrameSource 初始化完成后再计算源窗口边框
因为 FrameSource 初始化过程中可能改变源窗口位置
This commit is contained in:
parent
cac22293fc
commit
3404e510eb
9 changed files with 86 additions and 72 deletions
|
|
@ -37,16 +37,21 @@ bool GraphicsCaptureFrameSource::Initialize() {
|
|||
return false;
|
||||
}
|
||||
|
||||
const RECT& srcClient = App::GetInstance().GetSrcClientRect();
|
||||
|
||||
RECT srcClientRect;
|
||||
if (!Utils::GetClientScreenRect(App::GetInstance().GetHwndSrcClient(), srcClientRect)) {
|
||||
SPDLOG_LOGGER_ERROR(logger, "GetClientScreenRect 失败");
|
||||
return false;
|
||||
}
|
||||
|
||||
// 在源窗口存在 DPI 缩放时有时会有一像素的偏移(取决于窗口在屏幕上的位置)
|
||||
// 可能是 DwmGetWindowAttribute 的 bug
|
||||
_frameInWnd = {
|
||||
UINT(srcClient.left - srcRect.left),
|
||||
UINT(srcClient.top - srcRect.top),
|
||||
UINT(srcClientRect.left - srcRect.left),
|
||||
UINT(srcClientRect.top - srcRect.top),
|
||||
0,
|
||||
UINT(srcClient.right - srcRect.left),
|
||||
UINT(srcClient.bottom - srcRect.top),
|
||||
UINT(srcClientRect.right - srcRect.left),
|
||||
UINT(srcClientRect.bottom - srcRect.top),
|
||||
1
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue