Skip to content

Commit

Permalink
perf: 直接调用窗口过程而不是发送消息
Browse files Browse the repository at this point in the history
  • Loading branch information
Blinue committed Feb 2, 2025
1 parent a6f86d0 commit 2db1444
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/Magpie/AutoStartHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,9 @@ static bool CreateAutoStartTask(bool runElevated, const wchar_t* arguments) noex
principal->put_LogonType(TASK_LOGON_INTERACTIVE_TOKEN);

if (runElevated) {
hr = principal->put_RunLevel(_TASK_RUNLEVEL::TASK_RUNLEVEL_HIGHEST);
hr = principal->put_RunLevel(TASK_RUNLEVEL_HIGHEST);
} else {
hr = principal->put_RunLevel(_TASK_RUNLEVEL::TASK_RUNLEVEL_LUA);
hr = principal->put_RunLevel(TASK_RUNLEVEL_LUA);
}

if (FAILED(hr)) {
Expand Down
10 changes: 5 additions & 5 deletions src/Magpie/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -456,9 +456,9 @@ LRESULT MainWindow::_TitleBarMessageHandler(UINT msg, WPARAM wParam, LPARAM lPar
{
POINT cursorPos{ GET_X_LPARAM(lParam),GET_Y_LPARAM(lParam) };
ClientToScreen(_hwndTitleBar.get(), &cursorPos);
wParam = SendMessage(_hwndTitleBar.get(), WM_NCHITTEST, 0, MAKELPARAM(cursorPos.x, cursorPos.y));
wParam = _TitleBarMessageHandler(WM_NCHITTEST, 0, MAKELPARAM(cursorPos.x, cursorPos.y));
[[fallthrough]];
}
[[fallthrough]];
case WM_NCMOUSEMOVE:
{
CaptionButtonsControl& captionButtons = Content()->TitleBar().CaptionButtons();
Expand Down Expand Up @@ -513,7 +513,7 @@ LRESULT MainWindow::_TitleBarMessageHandler(UINT msg, WPARAM wParam, LPARAM lPar
Content()->TitleBar().CaptionButtons().LeaveButtons();
} else {
// 然后检查鼠标在标题栏上的位置
LRESULT hit = SendMessage(_hwndTitleBar.get(), WM_NCHITTEST, 0, MAKELPARAM(cursorPos.x, cursorPos.y));
LRESULT hit = _TitleBarMessageHandler(WM_NCHITTEST, 0, MAKELPARAM(cursorPos.x, cursorPos.y));
if (hit != HTMINBUTTON && hit != HTMAXBUTTON && hit != HTCLOSE) {
Content()->TitleBar().CaptionButtons().LeaveButtons();
}
Expand Down Expand Up @@ -553,9 +553,9 @@ LRESULT MainWindow::_TitleBarMessageHandler(UINT msg, WPARAM wParam, LPARAM lPar

POINT cursorPos{ GET_X_LPARAM(lParam),GET_Y_LPARAM(lParam) };
ClientToScreen(_hwndTitleBar.get(), &cursorPos);
wParam = SendMessage(_hwndTitleBar.get(), WM_NCHITTEST, 0, MAKELPARAM(cursorPos.x, cursorPos.y));
wParam = _TitleBarMessageHandler(WM_NCHITTEST, 0, MAKELPARAM(cursorPos.x, cursorPos.y));
[[fallthrough]];
}
[[fallthrough]];
case WM_NCLBUTTONUP:
{
// 处理鼠标在标题栏上释放。如果在标题栏按钮上,则通知 CaptionButtons,否则将消息传递给主窗口
Expand Down

0 comments on commit 2db1444

Please sign in to comment.